# mdtraj.geometry.squareform¶

mdtraj.geometry.squareform(distances, residue_pairs)

Reshape the contact distance to square contact maps

Parameters
distancesnp.ndarray, shape=(n_frames, n_pairs)

Distances between pairs of residues, as computed by mdtraj.geometry.compute_contacts.

residue_pairsnp.ndarray, shape=(n_pairs, 2)

The indices of the residues involved in each pair, as returned by mdtraj.geometry.compute_contacts

Returns
contact_mapsnp.ndarray, shape=(n_frames, n_residues, n_residues)

Reshaped version of distances, such that the distance, in the kth frame of the trajectory from residue i to residue j is given by contact_maps[k, i, j]. All entries in contact_maps corresponding to the distance between residues that were not part of residue_pairs are 0.0.

See also

mdtraj.compute_contacts

Compute the array of contact distances