Basic Functionality Reference

Core Class

The class object which is at the center of the TABS workflow is DihedralsInfo.

class tabs.torsions.DihedralsInfo(mol, raiseOnWarn=False)

Bases: object

Stores multiple properties for each dihedral.

Instance attributes:

Variables:
  • molTemplate – RDKit molecule template

  • undefinedStereo – bool, True if the molecule has chiral centers with undefined stereo

  • smarts – list of SMARTS strings for each dihedral

  • torsionTypes – list of TorsionType for each dihedral

  • indices – list of atom indices for each dihedral, shape (nDihedrals, 4)

  • coeffs – list of coefficients for each dihedral

  • fitFuncs – list of FitFunc for each dihedral

  • bounds – list of bounds for each dihedral, shape (nDihedrals, nBins)

Instance properties:

Variables:
  • nDihedrals – int, number of dihedrals

  • multiplicities – list of multiplicities for each dihedral

  • nRegularTorsions – int, number of regular torsions

  • nSmallRingTorsions – int, number of small ring torsions

  • nMacroCycleTorsions – int, number of macrocycle torsions

  • nAdditionalTorsions – int, number of additional rotatable bonds

__init__(mol, raiseOnWarn=False)
Parameters:
  • mol – RDKit molecule template

  • raiseOnWarn – Raise errors instead of issuing warnings

Raises:

AssertionError – if the molecule does not have explicit hydrogens

An instance of the class DihedralsInfo can be created from an RDKit mol object using DihedralInfoFromTorsionLib.

tabs.DihedralInfoFromTorsionLib(mol, torsionLibs=None, raiseOnWarn=False)

build a TorsionInfoList based on the experimental torsions library

Parameters:
  • mol – RDKit molecule

  • torsionLibs – list of dictionaries with torsion information

  • raiseOnWarn – raise errors instead of warnings

Returns:

TorsionInfoList

Raises:
  • Warning – if no dihedrals are found

  • ValueError – if raiseOnWarn==True and no dihedrals are found

Core Class Methods

The following class methods are available for the DihedralsInfo class:

DihedralsInfo.GetTABS(confTorsions=None, raiseOnWarn=None)

Compute the Torsion Angular Bin Strings (TABS). This method calculates the TABS for each conformer of the molecule based on the torsion angles and predefined bounds. If no conformer torsions are provided, they will be directly calculated from the conformers.

Parameters:
  • confTorsions – (optional) Precalculated list of torsion angles for each conformer.

  • raiseOnWarn – (optional) Allow overwrite of self.raiseOnWarn, default for the class attribute is False.

Raises:
  • ValueError – If no conformers are found in the molecule and no torsion angles are provided.

  • ValueError – If raiseOnWarn and bounds for a dihedral are not sorted.

Returns:

A list of TABS for each conformer.

DihedralsInfo.GetnTABS(maxSize=1000000)

Calculate the number of possible unique TABS (nTABS) for the molecule. In this implementation, the nTABS calculation uses the Burnside Lemma (correction for symmetry equivalents). It also includes the corrections for highly correlated substructures.

Parameters:

maxSize – Fixed maximum value of nTABS. Default is 1,000,000.

Returns:

nTABS

Raises:

ValueError – If the calculated number of TABS is not an integer.

DihedralsInfo.GetConformerTorsions()

Calculate torsion angles for all conformers of the molecule. Computes the dihedral angles (torsions) for each conformer of the molecule based on the provided indices. The angles in range [0, 2π].

Raises:

ValueError – If the molecule has no conformers.

Returns:

2D np array where rows correspond to conformers and columns correspond to dihedral angles.