mdtraj.compute_distances¶
- 
mdtraj.compute_distances(traj, atom_pairs, periodic=True, opt=True)¶
- Compute the distances between pairs of atoms in each frame. - Parameters
- trajTrajectory
- An mtraj trajectory. 
- atom_pairsnp.ndarray, shape=(num_pairs, 2), dtype=int
- Each row gives the indices of two atoms involved in the interaction. 
- periodicbool, default=True
- If periodic is True and the trajectory contains unitcell information, we will compute distances under the minimum image convention. 
- optbool, default=True
- Use an optimized native library to calculate distances. Our optimized SSE minimum image convention calculation implementation is over 1000x faster than the naive numpy implementation. 
 
- Returns
- distancesnp.ndarray, shape=(n_frames, num_pairs), dtype=float
- The distance, in each frame, between each pair of atoms.