dihedrals#

Functions#

_dihedral_deg(atXYZ, a_index, b_index, c_index, d_index)

Function to calculate the limited (0 to pi radian) dihedral angle between the points in arrays a,b,c and d.

_dihedral_trig_(atXYZ, a_index, b_index, c_index, d_index)

Function to calculate the sine and cosine of the dihedral between the points in arrays a,b,c and d.

dihedral(…)

Calculate all dihedral angles between the atoms specified.

get_dihedrals(…)

Identify quadruples of bonded atoms (using RDKit) and calculate the corresponding proper bond torsion for each

Module Contents#

_dihedral_deg(atXYZ, a_index, b_index, c_index, d_index, full=False)#

Function to calculate the limited (0 to pi radian) dihedral angle between the points in arrays a,b,c and d.

if full=True, calculates the signed/full dihedral angle (up to +-pi radian) between the points in arrays a,b,c and d.

Parameters:
  • a_index (int) – The first atom index

  • b_index (int) – The second atom index

  • c_index (int) – The third atom index

  • d_index (int) – The fourth atom index

  • full (bool, optional) – Flag to enforce calculation of the full dihedral in the range (-pi,pi)

  • atXYZ (shnitsel.core.typedefs.AtXYZ)

Returns:

The array of dihedral angels between the four input indices.

Return type:

xr.DataArray | xr.Variable

_dihedral_trig_(atXYZ, a_index, b_index, c_index, d_index, full=False)#

Function to calculate the sine and cosine of the dihedral between the points in arrays a,b,c and d.

Parameters:
  • a_index (int) – The first atom index

  • b_index (int) – The second atom index

  • c_index (int) – The third atom index

  • d_index (int) – The fourth atom index

  • atXYZ (shnitsel.core.typedefs.AtXYZ)

  • full (bool)

Returns:

First the array of cosines and then the array of sines of the dihedral angle

Return type:

tuple[xr.DataArray, xr.DataArray]

dihedral(atXYZ: shnitsel.core.typedefs.AtXYZ, a_index: int, b_index: int, c_index: int, d_index: int, *, deg: Literal['trig'], full: bool = False) tuple[xarray.DataArray, xarray.DataArray]#
dihedral(atXYZ: shnitsel.core.typedefs.AtXYZ, a_index: int, b_index: int, c_index: int, d_index: int, *, deg: bool = True, full: bool = False) xarray.DataArray

Calculate all dihedral angles between the atoms specified. The atoms specified need to be bonded in this sequence (a-b), (b-c), (c-d).

Parameters:
  • atXYZ (AtXYZ) – A DataArray of coordinates, with atom and direction dimensions

  • a_index (int) – The four atom indices, where successive atoms should be bonded in this order.

  • b_index (int) – The four atom indices, where successive atoms should be bonded in this order.

  • c_index (int) – The four atom indices, where successive atoms should be bonded in this order.

  • d_index (int) – The four atom indices, where successive atoms should be bonded in this order.

  • deg (bool | Literal['trig'],optional) – Whether to return angles in degrees (True) or radians (False) or as cosine and sine (‘trig’), by default False

  • full (bool, optional) – Whether to return signed full dihedrals or unsigned (positive) dihedrals if False, by default False

Returns:

A DataArray containing dihedral angles (or the sin and cos thereof)

Return type:

xr.DataArray

get_dihedrals(atXYZ_source: shnitsel.data.tree.node.TreeNode[Any, shnitsel.data.dataset_containers.trajectory.Trajectory | shnitsel.data.dataset_containers.frames.Frames | xarray.Dataset | xarray.DataArray], structure_selection: shnitsel.filtering.structure_selection.StructureSelection | shnitsel.filtering.structure_selection.StructureSelectionDescriptor | None = None, deg: bool | Literal['trig'] = True, signed=True) shnitsel.data.tree.node.TreeNode[Any, xarray.DataArray]#
get_dihedrals(atXYZ_source: shnitsel.data.dataset_containers.trajectory.Trajectory | shnitsel.data.dataset_containers.frames.Frames | xarray.Dataset | xarray.DataArray, structure_selection: shnitsel.filtering.structure_selection.StructureSelection | shnitsel.filtering.structure_selection.StructureSelectionDescriptor | None = None, deg: bool | Literal['trig'] = True, signed=True) xarray.DataArray

Identify quadruples of bonded atoms (using RDKit) and calculate the corresponding proper bond torsion for each frame.

Parameters:
  • atXYZ_source (TreeNode[Any, Trajectory | Frames | xr.Dataset | xr.DataArray] | Trajectory | Frames | xr.Dataset | xr.DataArray) – An xarray.DataArray of molecular coordinates, with dimensions atom and direction or another source of positional data like a trajectory, a frameset, a dataset representing either of those or a tree structure holding such data.

  • structure_selection (StructureSelection | StructureSelectionDescriptor, optional) – Object encapsulating feature selection on the structure whose positional information is provided in atXYZ. If this argument is omitted altogether, a default selection for all bonds within the structure is created.

  • deg (bool | Literal['trig'], optional) – Whether to return angles in degrees (as opposed to radians), by default True. Alternatively, return cos and sin (option trig) for each dihedral

  • signed – Whether the result should be returned with a sign or just as an absolute value in the range. Triggers calculation of ‘full’ i.e. signed dihedrals.

  • optional – Whether the result should be returned with a sign or just as an absolute value in the range. Triggers calculation of ‘full’ i.e. signed dihedrals.

Returns:

An xarray.DataArray of bond torsions/dihedrals with dimension descriptor to index the dihedrals along.

Return type:

TreeNode[Any, xr.DataArray] | xr.DataArray