multicenter attachment points and getAtomCount()

User 870ab5b546

05-04-2013 15:59:39

Consider this molecule:


<?xml version="1.0"?>
<cml version="ChemAxon file format v5.10.0, generated by v5.11.5">
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray atomID="a1 a2 a3 a4 a5 a6" elementType="C C Pd X P P" sgroupRef="sg1 sg1 0 0 0 0" x2="2.40625 2.40625 0.24062499403953552 2.40625 -1.2113009299968418 -1.2113009299968418" y2="2.117500066757202 0.5775000667572021 1.3956249952316284 1.3475000667572021 2.8475509192680057 -0.05630092880474913"/>
<bondArray>
<bond atomRefs2="a1 a2" order="2"/>
<bond atomRefs2="a4 a3" convention="cxn:coord"/>
<bond atomRefs2="a5 a3" convention="cxn:coord"/>
<bond atomRefs2="a6 a3" convention="cxn:coord"/>
</bondArray>
<molecule id="sg1" role="MulticenterSgroup" molID="m2" atomRefs="a1 a2" center="a4"/>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

getAtomCount() returns 6, an incredibly counterintuitive result.  I understand why you need to have a method that returns this value, so I propose that you make a new method, Molecule.getAtomCount(boolean realAtomsOnly), where a value of true will count only the real atoms in the compound, and a value of false will return a number that includes the Sgroups, multicenter attachment points, etc.  

ChemAxon a202a732bf

14-05-2013 15:04:04

Hi Bob,


Sorry for the late answer, this forum topic got lost somehow in our system.


MoleculeGraph.getAtomCount() counts the number of nodes in the molecule graph that are represented as atomic objects in our representation of a chemical structure. For example, it counts all pseudo atoms, multicenter atoms(as you have mentioned) and S-group atoms. For Markush structures it adds all the atoms of the R-groups as well. It is rather a representational value than a value with real chemical meaning.


If you need the number of atoms in the  represented molecule then use ElementalAnalyser.atomCount() which returns the real number of atoms in the molecule, including implicit Hydrogens, atoms contained inside an abbreviation, etc.


Alternatively, if you really need the number of chemically meaningful heavy atoms which are in the molecule representation then you can count the atoms with getAtno() below the number of elements in the periodic system, all special atoms have an "atomic number" above that.


I hope that it could help.


Regards,


Zsuzsa

User 870ab5b546

14-05-2013 15:38:35

Thanks, ElementalAnalyser.atomCount() will do the trick for us.