Compute the distance between pairs of residues in a trajectory.
Parameters: | traj : md.Trajectory
contacts : array-like, ndim=2 or ‘all’
scheme : {‘ca’, ‘closest’, ‘closest-heavy’}
ignore_nonprotein : bool
|
---|---|
Returns: | distances : np.ndarray, shape=(n_frames, n_pairs), dtype=np.float32
residue_pairs : np.ndarray, shape=(n_pairs, 2), dtype=int
|
See also
Examples
>>> # To compute the contact distance between residue 0 and 10 and
>>> # residues 0 and 11
>>> md.compute_contacts(t, [[0, 10], [0, 11]])
>>> # the itertools library can be useful to generate the arrays of indices
>>> group_1 = [0, 1, 2]
>>> group_2 = [10, 11]
>>> pairs = list(itertools.product(group_1, group_2))
>>> print(pairs)
[(0, 10), (0, 11), (1, 10), (1, 11), (2, 10), (2, 11)]
>>> md.compute_contacts(t, pairs)