mdtraj.compute_angles

mdtraj.compute_angles(traj, angle_indices, periodic=True, opt=True)[source]

Compute the bond angles between the supplied triplets of indices in each frame of a trajectory.

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

  • angle_indices (np.ndarray, shape=(num_angles, 3), dtype=int) – Each row gives the indices of three atoms which together make an angle.

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

  • opt (bool, default=True) – Use an optimized native library to calculate distances. Our optimized SSE angle calculation implementation is 10-20x faster than the (itself optimized) numpy implementation.

Returns:

angles – The angles are in radians

Return type:

np.ndarray, shape=[n_frames, n_angles], dtype=float