moleculekit.tools.detect module#

moleculekit.tools.detect.connected_component_subgraphs(graph)#
moleculekit.tools.detect.detectEquivalentAtoms(molecule)#

Detect topologically equivalent atoms.

Parameters

molecule (Molecule) – Molecule object

Returns

  • equivalent_groups (list of tuples) – List of equivalent atom group. Each element is a tuple contain equivalent atom indices.

  • equivalent_atoms (list of tuples) – List of equivalent atom group for each atom. Each element is a tuple contain equivalent atom indices.

  • equivalent_group_by_atom (list) – List of equivalent group indices for each atom. The indices corresponds to equivalent_groups order.

Examples

>>> import os
>>> from moleculekit.home import home
>>> from moleculekit.molecule import Molecule
>>> from moleculekit.tools.detect import detectEquivalentAtoms

Get benzamidine >>> molFile = os.path.join(home(‘test-detect’), ‘benzamidine.mol2’) >>> mol = Molecule(molFile)

Find the equivalent atoms of bezamidine >>> equivalent_groups, equivalent_atoms, equivalent_group_by_atom = detectEquivalentAtoms(mol) >>> equivalent_groups [(0,), (1, 5), (2, 4), (3,), (6,), (7, 11), (8, 10), (9,), (12, 13), (14, 15, 16, 17)] >>> equivalent_atoms [(0,), (1, 5), (2, 4), (3,), (2, 4), (1, 5), (6,), (7, 11), (8, 10), (9,), (8, 10), (7, 11), (12, 13), (12, 13), (14, 15, 16, 17), (14, 15, 16, 17), (14, 15, 16, 17), (14, 15, 16, 17)] >>> equivalent_group_by_atom [0, 1, 2, 3, 2, 1, 4, 5, 6, 7, 6, 5, 8, 8, 9, 9, 9, 9]

Get dicarbothioic acid >>> molFile = os.path.join(home(‘test-detect’), ‘dicarbothioic_acid.mol2’) >>> mol = Molecule(molFile)

Find the equivalent atoms of dicarbothioic acid >>> equivalent_groups, equivalent_atoms, equivalent_group_by_atom = detectEquivalentAtoms(mol) >>> equivalent_groups [(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,)] >>> equivalent_atoms [(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,)] >>> equivalent_group_by_atom [0, 1, 2, 3, 4, 5, 6, 7]

moleculekit.tools.detect.detectParameterizableCores(graph)#

Detect parametrizable dihedral angle cores (central atom pairs)

The cores are detected by looking for bridges (bonds which divide the molecule into two parts) in a molecular graph. Terminal cores are skipped.

moleculekit.tools.detect.detectParameterizableDihedrals(molecule, exclude_atoms=())#

Detect parameterizable dihedral angles

Parameters
  • molecule (Molecule) – Molecule object

  • exclude_atoms (list) – Ignore dihedrals which consist purely of atoms in this list

Returns

dihedrals – List of equivalent dihedral angle groups. Each group is a list of equivalent dihedral angles. Each angle is defined as a tuple of four atom indices (0-based).

Return type

list of list of tuples

Examples

>>> import os
>>> from moleculekit.home import home
>>> from moleculekit.molecule import Molecule
>>> from moleculekit.tools.detect import detectParameterizableDihedrals

Find the parameterizable dihedrals of glycol >>> molFile = os.path.join(home(‘test-detect’), ‘glycol.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(0, 1, 2, 3)], [(1, 2, 3, 9), (2, 1, 0, 4)]]

Find the parameterizable dihedrals of ethanolamine >>> molFile = os.path.join(home(‘test-detect’), ‘ethanolamine.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(0, 1, 2, 3)], [(1, 2, 3, 9), (1, 2, 3, 10)], [(2, 1, 0, 4)]]

Find the parameterizable dihedrals of benzamidine >>> molFile = os.path.join(home(‘test-detect’), ‘benzamidine.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(0, 6, 12, 16), (0, 6, 12, 17), (0, 6, 13, 14), (0, 6, 13, 15)], [(1, 0, 6, 12), (1, 0, 6, 13), (5, 0, 6, 12), (5, 0, 6, 13)]]

# Check if the atom swapping does not affect results

Find the parameterizable dihedrals of chlorethene >>> molFile = os.path.join(home(‘test-detect’), ‘chlorethene_1.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(2, 1, 0, 4), (2, 1, 0, 5)]]

Find the parameterizable dihedrals of chlorethene (with swapped atoms) >>> molFile = os.path.join(home(‘test-detect’), ‘chlorethene_2.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(3, 1, 0, 4), (3, 1, 0, 5)]]

# Check if triple bonds are skipped

Find the parameterizable dihedrals of 4-hexinenitrile >>> molFile = os.path.join(home(‘test-detect’), ‘4-hexinenitrile.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(2, 3, 4, 5)]]

# Check the scoring function

Find the parameterizable dihedrals of dicarbothioic acid >>> molFile = os.path.join(home(‘test-detect’), ‘dicarbothioic_acid.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(0, 1, 3, 5)], [(1, 3, 5, 7)], [(3, 1, 0, 6)]]

Find the parameterizable dihedrals of 2-hydroxypyridine >>> molFile = os.path.join(home(‘test-detect’), ‘2-hydroxypyridine.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(6, 1, 0, 7)]]

Find the parameterizable dihedrals of fluorchlorcyclopronol >>> molFile = os.path.join(home(‘test-detect’), ‘fluorchlorcyclopronol.mol2’) >>> mol = Molecule(molFile, guess=(‘bonds’, ‘angles’, ‘dihedrals’)) >>> detectParameterizableDihedrals(mol) [[(2, 4, 5, 9)]]