Hi all,

I am trying to add a fragment to an existing molecule using RDkit - I start
by generating the desired molecules I would like to combine:

oh = '[OH-]'
ohh = Chem.MolFromSmiles(oh)
oh = Chem.AddHs(ohh)
oh.SetProp("_Name","OH-")
AllChem.EmbedMolecule(oh, AllChem.ETKDG())

smiles_ = 'CCCCC'
m = Chem.MolFromSmiles(smiles_)
m_h = Chem.AddHs(vxm)
m_h.SetProp("_Name","XP")
AllChem.EmbedMolecule(m_h, AllChem.ETKDG())

I combine them which works fine:

combo = Chem.CombineMols(m_h,oh)

and I can add the bond between the desired atoms:


edcombo = Chem.EditableMol(combo)

edcombo.AddBond(3,1,order=Chem.rdchem.BondType.SINGLE)
back = edcombo.GetMol()

The problems arises when I want to edit the geometry between the two :

from rdkit.Chem import rdMolTransforms as rdmt
conf = back.GetConformer(0)

rdmt.SetBondLength(conf,3,43,10)

writer3 = Chem.SDWriter('out_long.sdf')
writer3.write(back,confId=0)



RuntimeError                              Traceback (most recent call
last)<ipython-input-193-36d3c0480a45> in <module>()      2 conf =
back.GetConformer(0)      3 ----> 4 rdmt.SetBondLength(conf,3,43,10)
   5       6 writer3 = Chem.SDWriter('out_long.sdf')
RuntimeError: Pre-condition Violation
        RingInfo not initialized
        Violation occurred on line 66 in file Code/GraphMol/RingInfo.cpp
        Failed Expression: df_init
        RDKIT: 2017.03.3
        BOOST: 1_56


So I am not sure how fix - thanks in advance


-- 
With kind regards

Per
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to