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
