Skip to content

AlignMol does not find substructure match... #7285

Answered by apahl
apahl asked this question in Q&A
Discussion options

You must be logged in to vote

But indeed, creating an atom map does work. So thank you anyway for pointing me into the right direction.

smi_core = "Cn2ccc1ccccc12"
smi_mol = "Cn2cc(CC(N)=O)c1ccccc12"

core = Chem.MolFromSmiles(smi_core)
mol = Chem.MolFromSmiles(smi_mol)

core_match = core.GetSubstructMatch(core)
mol_match = mol.GetSubstructMatch(core)
assert len(core_match) == len(mol_match), "Number of matching atoms is different."
atom_map = list(zip(mol_match, core_match))

core.Compute2DCoords()
mol.Compute2DCoords()

rdMolAlign.AlignMol(mol, core, atomMap=atom_map)

KR Axel

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@apahl
Comment options

Comment options

You must be logged in to vote
2 replies
@apahl
Comment options

@apahl
Comment options

Answer selected by apahl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants