Distance geometry generates molecular conformers by converting a connection table into distance bounds, sampling geometrically valid distances, and embedding them as three-dimensional coordinates. section 6.1.2
A practical RDKit workflow proceeds through these steps:
- Calculate upper and lower distance bounds from molecular connectivity and geometric rules. section 6.1.2
- Smooth the bounds with triangle inequalities so pairwise distances remain mutually consistent. section 6.1.2
- Sample valid distance matrices, embed each into 3D coordinates, then optimize imperfect geometries with a force field. section 6.1.2
Generating esomeprazole conformers
RDKit adds hydrogens to esomeprazole and uses ETKDG to generate 10 conformers, which can then be aligned and visualized together. section 6.1.2
Listing 6.2 Generating and Visualizing Conformers for a Single Molecule
esomeprazole = Chem.MolFromSmiles(
'COc1ccc2[n-]c([S@@+]([O-])Cc3ncc(C)c(OC)c3C)nc2c1'
)
esomeprazole.GetNumConformers() # -> 0 (no conformers yet)
esomeprazole = Chem.AddHs(esomeprazole)
AllChem.EmbedMultipleConfs(
esomeprazole, numConfs=10, params=AllChem.ETKDG()
)
core = Chem.MolFromSmarts('c1[#7]c2ccccc2[#7]1') #A
match = esomeprazole.GetSubstructMatch(core) #A
if not match: #B #B
raise ValueError("Alignment core not found; check the SMARTS pattern.")
AllChem.AlignMolConformers(esomeprazole, match)
esomeprazole.GetNumConformers() # -> 10
def draw_conf(mol, grid, confId=-1):
mb = Chem.MolToMolBlock(mol, confId=confId)
grid.addModel(mb, 'sdf')
grid.setStyle({'stick':{}})
grid.setBackgroundColor('white')
grid.zoomTo()
grid = py3Dmol.view(width=500, height=500)
for conformer_id in range(10):
draw_conf(esomeprazole, grid, conformer_id)
grid.show()Runnable RDKit code demonstrates embedding multiple esomeprazole conformers, aligning them around a SMARTS-defined core, and visualizing their spatial variation. section 6.1.2
