find_torsions
#
Functionality for finding and sampling torsions in a molecule.
Functions:
-
get_single_torsion_by_rot_bond–Get a single torsion for each rotatable bond matching the provided SMARTS pattern.
-
get_unwanted_bonds–Get a set of unwanted bonds in the molecule based on the provided SMARTS patterns.
-
get_rot_torsions_by_rot_bond–Find rotatable torsions in the molecule based on SMARTS patterns.
get_single_torsion_by_rot_bond
#
get_single_torsion_by_rot_bond(
mol: Molecule, smarts: str
) -> dict[tuple[int, int], tuple[int, int, int, int]]
Get a single torsion for each rotatable bond matching the provided SMARTS pattern.
For each rotatable bond, selects the torsion where the end atoms (positions 0 and 3) have the most heavy-atom neighbors.
Parameters:
-
mol(Molecule) –The molecule to search.
-
smarts(str) –SMARTS pattern to match rotatable bonds. This should specify the entire torsion, not just the rotatable bond.
Returns:
-
dict of tuple of int to tuple of int–A dictionary mapping each rotatable bond (as a tuple of atom indices) to a single torsion (as a tuple of four atom indices).
Source code in presto/find_torsions.py
get_unwanted_bonds
#
Get a set of unwanted bonds in the molecule based on the provided SMARTS patterns.
Parameters:
-
mol(Molecule) –The molecule to search.
-
smarts(str) –SMARTS pattern to match unwanted bonds. This should match only the rotatable bond, not the full torsion.
Returns:
-
set of tuple of int–A set of tuples representing the unwanted bonds, where each tuple contains the indices of the two atoms forming the bond.
Source code in presto/find_torsions.py
get_rot_torsions_by_rot_bond
#
get_rot_torsions_by_rot_bond(
molecule: Molecule,
include_smarts: list[
str
] = DEFAULT_TORSIONS_TO_INCLUDE_SMARTS,
exclude_smarts: list[str] | None = None,
) -> dict[tuple[int, int], tuple[int, int, int, int]]
Find rotatable torsions in the molecule based on SMARTS patterns.
Parameters:
-
molecule(Molecule) –The molecule to search.
-
include_smarts(list of str optional, default:DEFAULT_TORSIONS_TO_INCLUDE_SMARTS) –List of SMARTS patterns to include. These should match the entire torsion, not just the rotatable bond.
-
exclude_smarts(list of str, default:None) –List of SMARTS patterns to exclude. Defaults to empty list. These should match only the rotatable bond, not the full torsion.
Returns:
-
dict of tuple of int to tuple of int–A dictionary mapping each rotatable bond (as a tuple of atom indices) to a single torsion (as a tuple of four atom indices).