rdmc.conf#

This module provides class and methods for dealing with RDKit Conformer.

class rdmc.conf.EditableConformer(conf)#

Bases: object

A wrapper for rdchem.Conformer.

The method nomenclature follows the Camel style to be consistent with RDKit.

Canonicalize(ignoreHs: bool = False)#

Canonicalize the Conformer.

Parameters:

ignoreHs (bool, optional) – Whether ignore hydrogens. Default to False.

GetAllTorsionsDeg() list#

Get the dihedral angles of all torsional modes (rotors) of the Conformer. The sequence of the values are corresponding to the torsions of the molecule (GetTorsionalModes).

Returns:

list – A list of dihedral angles of all torsional modes.

GetAngleDeg(atomIds: Sequence[int]) float#

Get the angle between atoms in degrees.

Parameters:

atomIds (Sequence) – A 3-element sequence object containing atom indexes.

Returns:

float – Angle value in degrees.

GetAngleRad(atomIds: Sequence[int]) float#

Get the angle between atoms in rads.

Parameters:

atomIds (Sequence) – A 3-element sequence object containing atom indexes.

Returns:

float – Angle value in rads.

GetBondLength(atomIds: Sequence[int]) float#

Get the bond length between atoms in Angstrom.

Parameters:

atomIds (Sequence) – A 3-element sequence object containing atom indexes.

Returns:

float – Bond length in Angstrom.

GetCentroid(ignoreHs: bool = False) ndarray#

Get the centroid of the conformer.

Parameters:

ignoreHs (bool) – Whether ignore hydrogens. Default to False.

Returns:

array – The centroid of the conformer.

GetDistanceMatrix() ndarray#

Get the distance matrix of the conformer.

Returns:

array – n x n distance matrix such that n is the number of atom.

GetOwningMol()#

Get the owning molecule of the conformer.

Returns:

Union[Mol, RWMol, RDKitMol] – The owning molecule

GetPrincipalAxesAndMoments(ignoreHs: bool = False) tuple#

Get the principal axes and moments of the conformer.

Parameters:

ignoreHs (bool) – Whether ignore hydrogens. Default to False.

Returns:

tuple – A tuple containing the principal axes and moments.

GetTorsionDeg(torsion: list) float#

Get the dihedral angle of the torsion in degrees. The torsion can be defined by any atoms in the molecule (not necessarily bonded atoms.)

Parameters:

torsion (list) – A list of four atom indexes.

Returns:

float – The dihedral angle of the torsion.

GetTorsionalModes(indexed1: bool = False, excludeMethyl: bool = False, includeRings: bool = False) list#

Get all of the torsional modes (rotors) of the Conformer. This information is obtained from its owning molecule.

Parameters:
  • indexed1 – The atom index in RDKit starts from 0. If you want to have indexed 1 atom indexes, please set this argument to True.

  • excludeMethyl (bool) – Whether exclude the torsions with methyl groups. Defaults to False.

  • includeRings (bool) – Whether or not to include ring torsions. Defaults to False.

Returns:

Optinal[list] – A list of four-atom-indice to indicating the torsional modes.

HasCollidingAtoms(threshold=0.4) ndarray#

Whether has atoms are too close together (colliding).

Parameters:

threshold – float indicating the threshold to use in the vdw matrix

HasOwningMol()#

Whether the conformer has a owning molecule.

Returns:

boolTrue if the conformer has a owning molecule.

SetAllTorsionsDeg(angles: list)#

Set the dihedral angles of all torsional modes (rotors) of the Conformer. The sequence of the values are corresponding to the torsions of the molecule (GetTorsionalModes).

Parameters:

angles (list) – A list of dihedral angles of all torsional modes.

SetAngleDeg(atomIds: Sequence[int], value: int | float)#

Set the angle between atoms in degrees.

Parameters:
  • atomIds (Sequence) – A 3-element sequence object containing atom indexes.

  • value (int or float, optional) – Bond angle in degrees.

SetAngleRad(atomIds: Sequence[int], value: int | float)#

Set the angle between atoms in rads.

Parameters:
  • atomIds (Sequence) – A 3-element sequence object containing atom indexes.

  • value (int or float, optional) – Bond angle in rads.

SetBondLength(atomIds: Sequence[int], value: int | float)#

Set the bond length between atoms in Angstrom.

Parameters:
  • atomIds (Sequence) – A 3-element sequence object containing atom indexes.

  • value (int or float, optional) – Bond length in Angstrom.

SetOwningMol(owningMol: RDKitMol | Mol | RWMol)#

Set the owning molecule of the conformer. It can be either RDKitMol or Chem.rdchem.Mol.

Parameters:

owningMol – Union[RDKitMol, Chem.rdchem.Mol] The owning molecule of the conformer.

Raises:

ValueError – Not a valid owning_mol input, when giving something else.

SetPositions(coords: tuple | list)#

Set the Positions of atoms of the conformer.

Parameters:

coords – a list of tuple of atom coordinates.

SetTorsionDeg(torsion: list, degree: float | int)#

Set the dihedral angle of the torsion in degrees. The torsion can only be defined by a chain of bonded atoms.

Parameters:
  • torsion (list) – A list of four atom indexes.

  • degree (float, int) – The dihedral angle of the torsion.

SetTorsionalModes(torsions: list | tuple)#

Set the torsional modes (rotors) of the Conformer. This is useful when the default torsion is not correct.

Parameters:

torsions (Union[list, tuple]) – A list of four-atom-lists indicating the torsional modes.

Raises:

ValueError – The torsional mode used is not valid.

ToConformer() Conformer#

Get its backend RDKit Conformer object.

Returns:

Conformer – The backend conformer

ToMol() RDKitMol#

Convert conformer to mol.

Returns:

RDKitMol – The new mol generated from the conformer