mdtraj.compute_dihedrals

mdtraj.compute_dihedrals(traj, indices, periodic=True, opt=True)[source]

Compute the dihedral angles between the supplied quartets of atoms in each frame in a trajectory.

Parameters:
  • traj (Trajectory) – An mtraj trajectory.

  • indices (np.ndarray, shape=(n_dihedrals, 4), dtype=int) – Each row gives the indices of four atoms which together make a dihedral angle. The angle is between the planes spanned by the first three atoms and the last three atoms, a torsion around the bond between the middle two atoms.

  • periodic (bool, default=True) – If periodic is True and the trajectory contains unitcell information, we will treat dihedrals that cross periodic images using the minimum image convention.

  • opt (bool, default=True) – Use an optimized native library to calculate angles.

Returns:

dihedrals – The output array gives, in each frame from the trajectory, each of the n_dihedrals torsion angles. The angles are measured in radians.

Return type:

np.ndarray, shape=(n_frames, n_dihedrals), dtype=float