Hi All,

I'm a bit confused about counting hydrogen atoms.  It's a perennial problem
with cheminformatics toolkits in my experience, but this seems particularly
perverse.  If I run the code:

from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.MolFromSmiles( 'CCO' )
mol = Chem.AddHs( mol )
cids = AllChem.EmbedMultipleConfs(mol , useExpTorsionAnglePrefs=True ,
useBasicKnowledge=True , numConfs=1 )
AllChem.MMFFOptimizeMoleculeConfs( mol , mmffVariant='MMFF94s' )

for a in mol.GetAtoms() :
    num_heavy = a.GetTotalDegree() - a.GetTotalNumHs()
    print '%d : %d num_heavy = %d num_H = %d %d %d' % ( a.GetIdx() ,
a.GetAtomicNum() , num_heavy , a.GetTotalNumHs() , a.GetNumImplicitHs() ,
a.GetNumExplicitHs() )
    for nb in a.GetNeighbors() :
        print '  %d : %d' % ( nb.GetIdx() , nb.GetAtomicNum() )

I get the output

0 : 6 num_heavy = 4 num_H = 0 0 0
  1 : 6
  3 : 1
  4 : 1
  5 : 1
1 : 6 num_heavy = 4 num_H = 0 0 0
  0 : 6
  2 : 8
  6 : 1
  7 : 1
2 : 8 num_heavy = 2 num_H = 0 0 0
  1 : 6
  8 : 1
3 : 1 num_heavy = 1 num_H = 0 0 0
  0 : 6
4 : 1 num_heavy = 1 num_H = 0 0 0
  0 : 6
5 : 1 num_heavy = 1 num_H = 0 0 0
  0 : 6
6 : 1 num_heavy = 1 num_H = 0 0 0
  1 : 6
7 : 1 num_heavy = 1 num_H = 0 0 0
  1 : 6
8 : 1 num_heavy = 1 num_H = 0 0 0
  2 : 8


It seems that in a 3D mol, after embedding and minimisation, an H atom is
just like any other atom, and is ignored in the various H atom counting
functions.  Is that expected behaviour?  Depending on the answer, either
the documentation or the behaviour is incorrect.

Cheers,
Dave
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to