Hello group,

Is there any fast way to count all hydrogen atoms in molecule?
The only idea which I have is:
sum([atom.GetTotalNumHs() for atom in mol.GetAtoms() ])
which probably is not the most optimal because it require iteration
over atom at python end.
For all other atoms I found such solution:
from rdkit.Chem import rdqueries 
q = rdqueries.AtomNumEqualsQueryAtom(6) 
len(mol.GetAtomsMatchingQuery(q))

(in mailing-list archive: 
https://sourceforge.net/p/rdkit/mailman/message/34524687/) 
but this is valid only for atoms present in molecular graph, so is there any 
smart solution for H?

Regards,

Rafal


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

Reply via email to