liveBook · Manning

3D molecular descriptor

As explained in Build AI Drug Discovery Pipelines

A 3D molecular descriptor is a numerical representation of properties derived from a molecule's three-dimensional geometry.

A 3D molecular descriptor numerically represents properties derived from a molecule’s three-dimensional geometry. Because conformers can vary substantially, reliable calculation may require generating and optimizing multiple conformers before aggregating their descriptors. section 6.1.2

A practical descriptor workflow can:

  • Generate multiple conformers for each protomer and optimize them with a force field. section 6.1.2
  • Weight conformer descriptors with Boltzmann factors, then aggregate them into ligand-level vectors. section 6.1.2
  • Append ligand-level 2D descriptors when additional non-geometric features are useful. section 6.1.2

Esomeprazole conformers

RDKit can generate ten esomeprazole conformers, align them around a shared substructure, and visualize their differing spatial arrangements before descriptor calculation. section 6.1.2

Listing 6.4 Boltzmann-weighted 3D Descriptor Computation
def compute_boltzmann_weights(protomer2energies):
    """Boltzmann weights over all conformers of one ligand. Energies are
    shifted by the global minimum before exponentiation for numerical
    stability; a constant shift cancels in the normalization."""
    T = 295  # Kelvin
    k_B = 1.987e-3  # kcal/(mol*K) (the molar gas constant R)
    RT = k_B * T
 
    all_energies = [
        e for energies in protomer2energies.values() for e in energies
    ]
    if not all_energies:    #A
        return {idx: [] for idx in protomer2energies}
    e_min = min(all_energies)    #B
 
    den = sum(
        np.exp(-(e - e_min) / RT)
        for energies in protomer2energies.values() for e in energies
    )
    protomer2weights = {}
    for protomer_idx, energies in protomer2energies.items():
        protomer2weights[protomer_idx] = [
            np.exp(-(e - e_min) / RT) / den for e in energies
        ]
    return protomer2weights
 
ligand_descs = []
for ligand_idx, protomers in tqdm(ligand2protomers.items()):
    protomers_c, protomer2energies = generate_conformers(
        protomers, numConfs=10
    )
    protomer2weights = compute_boltzmann_weights(protomer2energies)
 
    d = []
    for protomer_idx, protomer in enumerate(protomers_c):
        confs = protomer.GetConformers()
        weights = protomer2weights[protomer_idx]
        for conf, weight in zip(confs, weights):
            desc_values = Chem.Descriptors3D.CalcMolDescriptors3D(
                protomer, confId=conf.GetId()
            ).values()
            d.append([weight * v for v in desc_values])
 
    if not d:    #C
        raise ValueError(
            f"No valid conformers for ligand {ligand_idx}; "
            "drop it or relax the conformer settings."
        )
    ligand_descs.append(np.array(d).sum(axis=0))
 
ligand_descs = np.array(ligand_descs)

Inspect the RDKit implementation for calculating Boltzmann weights across conformers of one ligand. section 6.1.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Descends from descriptor definition to conformer generation, force-field optimization, Boltzmann aggregation, and computational trade-offs.
Examples
Uses RDKit workflows for esomeprazole conformers, UFF energies, and aggregated descriptor vectors.
What it assumes
Assumes basic molecular representations while defining protomers, conformers, descriptor aggregation, and the computational cost of 3D workflows.
What you can do after
Apply it via RDKit by generating conformers, optimizing geometries, computing descriptors, and aggregating them with Boltzmann weights.
How it connects
Connects molecular descriptors with conformer generation, protonation, tautomerism, force fields, and Boltzmann weighting.

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.