# 12.2.9. Fast QCP RMSD structure alignment — MDAnalysis.lib.qcprot¶

Author: Joshua L. Adelman, University of Pittsburgh Robert R. Delgado, Cornell University and Arizona State University jla65@pitt.edu 2011, 2016 BSD

PyQCPROT is a python/cython implementation of Douglas Theobald’s QCP method for calculating the minimum RMSD between two structures [Theobald2005] and determining the optimal least-squares rotation matrix [Liu2010].

A full description of the method, along with the original C implementation can be found at http://theobald.brandeis.edu/qcp/

Changed in version 0.16.0: Call signatures were changed to directly interface with MDAnalysis coordinate arrays: shape (N, 3)

References

If you use this QCP rotation calculation method in a publication, please reference:

 [Theobald2005] Douglas L. Theobald (2005) “Rapid calculation of RMSD using a quaternion-based characteristic polynomial.” Acta Crystallographica A 61(4):478-480.
 [Liu2010] Pu Liu, Dmitris K. Agrafiotis, and Douglas L. Theobald (2010) “Fast determination of the optimal rotational matrix for macromolecular superpositions.” J. Comput. Chem. 31, 1561-1563.

## 12.2.9.1. Functions¶

Users will typically use the CalcRMSDRotationalMatrix() function.

MDAnalysis.lib.qcprot.CalcRMSDRotationalMatrix()

Calculate the RMSD & rotational matrix.

Parameters: ref (ndarray, np.float64_t) – reference structure coordinates conf (ndarray, np.float64_t) – condidate structure coordinates N (int) – size of the system rot (ndarray, np.float64_t) – array to store rotation matrix. Must be flat weights (ndarray, npfloat64_t (optional)) – weights for each component rmsd (float) – RMSD value .. versionchanged:: 0.16.0 – Array size changed from 3xN to Nx3.
MDAnalysis.lib.qcprot.InnerProduct()

Calculate the inner product of two structures.

Parameters: A (ndarray np.float64_t) – result inner product array, modified in place coords1 (ndarray np.float64_t) – reference structure coord2 (ndarray np.float64_t) – candidate structure N (int) – size of system weights (ndarray np.float64_t (optional)) – use to calculate weighted inner product E0 (float) 0.5 * (G1 + G2), can be used as input for FastCalcRMSDAndRotation()

Notes

1. You MUST center the structures, coords1 and coords2, before calling this function.
2. Coordinates are stored as Nx3 arrays (as everywhere else in MDAnalysis).

Changed in version 0.16.0: Array size changed from 3xN to Nx3.

MDAnalysis.lib.qcprot.FastCalcRMSDAndRotation()

Calculate the RMSD, and/or the optimal rotation matrix.

Parameters: rot (ndarray np.float64_t) – result rotation matrix, modified inplace A (ndarray np.float64_t) – the inner product of two structures E0 (float64) – 0.5 * (G1 + G2) N (int) – size of the system rmsd – RMSD value for two structures float

Changed in version 0.16.0: Array sized changed from 3xN to Nx3.