Hi Leon,

check the documentation for Chem.AddHs():

http://rdkit.org/docs/source/rdkit.Chem.rdmolops.html?highlight=addhs#rdkit.Chem.rdmolops.AddHs

ARGUMENTS:

[...]

addCoords: (optional) if this toggle is set, The Hs will have 3D coordinates set. Default value is 0 (no 3D coords).

So if you wish hydrogen coordinates to be nonzero, you need to add the addCoords parameter:

mol2 = Chem.AddHs(mol, addCoords=True)

Cheers,
p.

On 10/12/2019 19:19, topgunhaides . wrote:
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




_______________________________________________
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