# mdtraj.geometry.squareform

mdtraj.geometry.squareform(distances, residue_pairs)

  Reshape the contact distance to square contact maps

  Parameters:

    - distances (np.ndarray, shape=(n_frames, n_pairs)) – Distances between pairs of residues, as computed by mdtraj.geometry.compute_contacts.

    - residue_pairs (np.ndarray, shape=(n_pairs, 2)) – The indices of the residues involved in each pair, as returned by mdtraj.geometry.compute_contacts

  Returns:

    contact_maps – Reshaped version of distances, such that the distance, in the k`th 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.

  Return type:

    np.ndarray, shape=(n_frames, n_residues, n_residues)

  See also

  `mdtraj.compute_contacts`

    Compute the array of contact distances