Atomic charges don't add up to total charge

User b98d0d9f19

24-05-2016 16:13:52

Hi,


I am using MarvinBeans version 16.5.16.0 in Eclipse. I am attempting to extract atomic charges from a molecule (a particular major microspecies, to be precise), and as a consistency check I add up all atomic charges to see if they add up to the total charge of the microspecies. Strangely, this works for only about 90% of the molecules. Do you know why this would be the case?


The core of the code I'm using is:


    ChargePlugin chargePlugin = new ChargePlugin();


    MajorMicrospeciesPlugin mmsPlugin = new MajorMicrospeciesPlugin();


    mmsPlugin.setpH(7.4); // major microspecies generation at pH = 7.4


    MolImporter importer = new MolImporter("all_smiles.txt");


    Molecule mol;


    int molOn=0;


    while ((mol = importer.read()) != null) {


         molOn++;


        mmsPlugin.setMolecule(mol);


        mmsPlugin.run();


        Molecule majorms = mmsPlugin.getMajorMicrospecies();


        Hydrogenize.convertImplicitHToExplicit(majorms);


        chargePlugin.setMolecule(majorms);


        chargePlugin.run();


        int count = majorms.getAtomCount();


        double totalCharge=0;


        for (int i=0; i < count; ++i) {


              double charge = chargePlugin.getTotalCharge(i);


                  totalCharge+=charge;


        }


        System.out.println("sum of atomic charge for molecule "+(molOn)+" is "+totalCharge);


 


        System.out.println("total charge: "+majorms.getTotalCharge());


 


It works for the SMILES inputs (for example): 


COc1cc(OC)c(C(=O)CCCN2CCCC2)c(OC)c1


NC1CCN(C1)c1nc2n(cc(C(O)=O)c(=O)c2cc1F)-c1ccc(F)cc1F


But for:


Cc1[nH]cnc1CN1CCc2c(C1=O)c1ccccc1n2C


the sum of atomic charges is off by about 0.06. When I try more inputs, I find that about 90% of inputs give roughly the right answer (up to machine precision) whereas the other 10% are off by about 0.05-0.1 of a charge. Do you know what could be causing this?


Full code and input file attached.

ChemAxon d51151248d

26-05-2016 15:15:31

Hi, 


Thank you for sending this issue to us. We are investigating it. 


Daniel

ChemAxon d51151248d

30-05-2016 14:21:40

Hi, 


We managed to reproduce this calculation bug. We will fix it soon. 


Thank you, 


Daniel

User b98d0d9f19

14-09-2016 14:55:40

Hi,


Have you figured out the source of the bug and/or fixed it?

ChemAxon d51151248d

18-10-2016 11:31:30

Hi Jacob, 


This bug has been fixed already. Please update your current version to get the fixed version. 


Daniel