Hi guys, Can anyone help me with the RemoveHs() and AddHs()? Please see example below.
from rdkit import Chem from rdkit.Chem import AllChem suppl = Chem.SDMolSupplier('123.sdf') # 123.sdf has 3D structure with Hs coordinates # By default, Hs are removed by SDMolSupplier (see mol1.sdf) for mol in suppl: print(mol.GetNumAtoms()) w1 = Chem.SDWriter('./mol1.sdf') w1.write(mol) mol2 = Chem.AddHs(mol) print(mol2.GetNumAtoms()) w2 = Chem.SDWriter('./mol2.sdf') w2.write(mol2) AllChem.EmbedMultipleConfs(mol2, numConfs=1000, maxAttempts=1000, pruneRmsThresh=1.0) cids = [conf.GetId() for conf in mol2.GetConformers()] It is strange that the Hs coordinates after calling Chem.AddHs(mol) are all zeros (see below for part of the mol2.sdf): ...... 5.1350 -0.0950 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 7.7331 0.4050 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 3.4030 -0.0950 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 ...... As you can see I am using mol2 for embedding, but its Hs coordinates are apparently problematic. Can anyone help me with this? I am planning to add Hs for embedding and optimization, then remove Hs for RMSD, and finally add Hs back for writing into output file. Thank you! Best, Leon
cid123.sdf
Description: Binary data
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss