Hi Lukas,

in the RDKit notation all atoms are explicit if they are present in the molecule graph, including hydrogens. You mention that hydrogens are explicitly present in your input structure, so that's the expected behaviour.

If you wish to retrieve the number of heavy atoms you can use mol.GetNumHeavyAtoms().

If you want to remove hydrogens from the molecule graph and make them implicit, you may call Chem.RemoveHs().

Hope this helps, cheers
p.


On 05/01/19 15:23, Lukas Pravda wrote:

Dear all,

I construct my own rdkit.Mol objects from mmcif files. I wanted to use mol.GetNumAtoms(onlyExplicit=True) to get the number of heavy atoms for that molecule, however, I have noticed that the function returns all the time number of all atoms in the molecule including hydrogens (47 vs. expected 31). When I try to iterate over the atoms to get number of Implicit/Explicit Hs for each atom I get 0 for all the atoms in the molecule, although the element types are correct (C’s, O’s, H’s etc.)

So I assume that I construct the molecule incorrectly and wonder if there’s a way to tag hydrogen atoms correctly when I construct them.

Hydrogens are explicitly present in my input structures and I’d like to get GetNumAtoms(onlyExplicit=True) function to work as expected. Attached is a python pickle of ATP molecule with two conformations.

Interestingly rdkit.Chem.Descriptors.HeavyAtomCount(self.mol) returns correct value as expected.

My configuration:

OS: MacOS: 10.14.4

Rdkit: 2019.03.01

Python: 3.7.3

Best,

Lukas





_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to