Molecular Geometry

get_center(mol)[source]

Get the geometric center of an RDKit molecule

Parameters:

mol – RDKit molecule

Return type:

ndarray

Returns:

center as a numpy array

get_shape_moments(mol)[source]

Calculate principal moments of inertia as defined in https://pubs.acs.org/doi/10.1021/ci025599w

Parameters:

mol – RDKit molecule

Return type:

tuple

Returns:

first 2 moments as a tuple

gen_3d(mol)[source]

Generate a 3D structure for a RDKit molecule

Parameters:

mol (Mol) – input molecule

Return type:

Optional[Mol]

Returns:

molecule with 3D coordinates

gen_conformers(mol, num_confs=50)[source]

Generate conformers for a molecule.

Parameters:
  • mol (Mol) – RDKit molecule

  • num_confs (int) – Number of conformers to generate

Return type:

Optional[Mol]

Returns:

Molecule with conformers or None if generation fails

refine_conformers(mol, energy_threshold=50, rms_threshold=0.5)[source]

Refine the conformers of a molecule by removing those with high energy or low RMSD.

Parameters:
  • mol (Mol) – RDKit molecule with conformers.

  • energy_threshold (float) – Energy threshold above which conformers are removed.

  • rms_threshold (Optional[float]) – RMSD threshold below which conformers are considered redundant and removed. If None, RMSD filtering is skipped.

Return type:

Mol

Returns:

RDKit molecule with refined conformers.

get_conformer_energies(mol)[source]

Retrieve the energies of all conformers in a molecule.

Parameters:

mol (Mol) – RDKit molecule containing conformers.

Return type:

List[float]

Returns:

A list of energies for each conformer as floats.

mcs_rmsd(mol_1, mol_2, id_1=0, id_2=0)[source]

Calculate the RMSD (Root Mean Square Deviation) between the MCS (Maximum Common Substructure) of two molecules.

Parameters:
  • mol_1 (Mol) – First RDKit molecule

  • mol_2 (Mol) – Second RDKit molecule

  • id_1 (int) – Conformer ID for the first molecule

  • id_2 (int) – Conformer ID for the second molecule

Return type:

Tuple[int, float]

Returns:

A tuple containing the number of MCS atoms and the RMSD value

mol_to_3D_view(mol_list, size=(300, 300), style='stick', surface=False, opacity=0.5)[source]

Draw a list of molecules in 3D

Mol_list:

list[rdMol], a list of rdMols to show

Size:

tuple(int, int), canvas size

Style:

str, type of drawing molecule, style can be ‘line’, ‘stick’, ‘sphere’, ‘carton’

Surface:

bool, display SAS

Opacity:

float, opacity of surface, range 0.0-1.0

Return type:

view

Returns:

viewer: py3Dmol.view, a class for constructing embedded 3Dmol.js views in ipython notebooks.