Dear Jan,

I don't think you are doing anything wrong. I tried using coordMap myself a few weeks ago and it looked like the parameter was being ignored. I'll try and understand why that happens as soon as I have a bit of time.

Kind regards,
Paolo


On 11/28/17 10:16, Jan Halborg Jensen wrote:
The following code should produce 5 conformers of c1ccccc1CCCCCCC” where the 
coordinates of the benzene ring is the same.  But it doesn’t.  What I am doing 
wrong?

Best regards, Jan


from rdkit import Chem
from rdkit.Chem import AllChem

template_smiles = "c1ccccc1"
template = Chem.MolFromSmiles(template_smiles)
template = Chem.AddHs(template)

AllChem.EmbedMolecule(template)

prop = AllChem.MMFFGetMoleculeProperties(template, mmffVariant="MMFF94")
ff =AllChem.MMFFGetMoleculeForceField(template,prop)
ff.Minimize()

Chem.SDWriter("template.sdf").write(template)

mol_smiles = "c1ccccc1CCCCCCC"
mol = Chem.MolFromSmiles(mol_smiles)
mol = Chem.AddHs(mol)

core = Chem.MolFromSmiles(template_smiles)

mol_match = mol.GetSubstructMatch(core)
template_match = template.GetSubstructMatch(core)

print mol_match, template_match

coordMap = {}
templateConf = template.GetConformer(-1)
for i_template, i_mol in zip(template_match,mol_match):
     corePtI = templateConf.GetAtomPosition(i_template)
     #print corePtI.x, corePtI.y, corePtI.z
     coordMap[i_mol] = corePtI

AllChem.EmbedMultipleConfs(mol,5,coordMap=coordMap)

w = Chem.SDWriter('conformers.sdf')
for conf in mol.GetConformers():
     tm = Chem.Mol(mol,False,conf.GetId())
     w.write(tm)
------------------------------------------------------------------------------
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


------------------------------------------------------------------------------
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