liveBook · Manning

Distance geometry

As explained in Build AI Drug Discovery Pipelines

Distance geometry is a method for generating molecular three-dimensional coordinates from constraints on distances between atoms.

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

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Traces bounds construction through embedding and force-field cleanup, but does not detail force-field equations.
Examples
Uses RDKit-generated esomeprazole conformers and overlays ten spatial arrangements for comparison.
What it assumes
Defines distance bounds and geometric validity before applying them to molecular conformer generation.
What you can do after
Operate RDKit to generate, align, visualize, and optimize multiple molecular conformers.
How it connects
Connects molecular conformers with distance bounds matrices, triangle inequalities, 3D embedding, and force fields.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.