# mdtraj.lprmsd

mdtraj.lprmsd(target, reference, frame=0, atom_indices=None, permute_groups=None, bool parallel=True, bool superpose=False)

  Compute Linear-Programming Root-Mean-Squared Deviation (LP-RMSD) of all conformations in target to a reference conformation. The LP-RMSD is the minimum root-mean squared deviation between two sets of points, minimizing over both the rotational/translational degrees of freedom AND the label correspondences between points in the target and reference conformations. This means that it can be used meaningfully with atoms with exchange symmetry like, like multiple water molecules.

  Notes

  The optimization procedure used does necessary not find the rotation/mapping for the global minimum of the means squared deviation. It does usually find a pretty good solution though, using a 3 step procedure. For each frame in the target, (1) align the target reference frame using only the distinguishable atoms (2) using this fixed rotation matrix, find the optimal mapping for the labels in the permute groups (3) using this mapping, recompute a new optimal rotation matrix to align the frame, and get the final RMSD.

  Parameters:

    - target (md.Trajectory) – For each conformation in this trajectory, compute the RMSD to a particular ‘reference’ conformation in another trajectory object.

    - reference (md.Trajectory) – The object containing the reference conformation to measure distances to.

    - frame (int) – The index of the conformation in reference to measure distances to.

    - atom_indices (array_like, or None) – The indices of the atoms to use in the RMSD calculation. If not supplied, all atoms will be used.

    - permute_groups (list of array_like, or None) – A list of groups of permutable atoms. Each element in permute_groups is an array of indices containing atoms whose labels can be mutually exchanged within the group. All indices in permute_groups must be a subset of atom_indices. The default, None, corresponds to a single group containing all the atoms in atom_indices.

    - parallel (bool) – Use OpenMP to calculate each of the RMSDs in parallel over multiple cores.

    - superpose (bool) – Modify the trajectory `target` in-place to superpose each frame on reference.

  Returns:

    lprmsds – A 1-D numpy array of the linear programming root-mean-square deviations from each of the conformations in target to the frame-th conformation in reference.

  Return type:

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