[Rdkit-discuss] Problems with coordMap in EmbedMultipleConfs
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Jan H. J. <jhj...@ch...> - 2017-11-28 10:49:28
|
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) |