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

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


An mtraj trajectory.

indicesnp.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.

periodicbool, 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.

optbool, default=True

Use an optimized native library to calculate angles.

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

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