The algorithm only computes the rotation matrix, but it also requires the computation of a translation vector. When both the translation and rotation are actually performed, the algorithm is sometimes called partial Procrustes superimposition (see also orthogonal Procrustes problem).
Description
Let P and Q be two sets, each containing N points in . We want to find the transformation from Q to P. For simplicity, we will consider the three-dimensional case ().
The sets P and Q can each be represented by N × 3matrices with the first row containing the coordinates of the first point, the second row containing the coordinates of the second point, and so on, as shown in this matrix:
The algorithm works in three steps: a translation, the computation of a covariance matrix, and the computation of the optimal rotation matrix.
Translation
Both sets of coordinates must be translated first, so that their centroid coincides with the origin of the coordinate system. This is done by subtracting the centroid coordinates from the point coordinates.
Computation of the covariance matrix
The second step consists of calculating a matrix H. In matrix notation,
It is possible to calculate the optimal rotation R based on the matrix formula
but implementing a numerical solution to this formula becomes complicated when all special cases are accounted for (for example, the case of H not having an inverse).
If singular value decomposition (SVD) routines are available the optimal rotation, R, can be calculated using the following simple algorithm.
First, calculate the SVD of the covariance matrix H,
where U and V are orthogonal and is diagonal. Next, record if the orthogonal matrices contain a reflection,
Finally, calculate our optimal rotation matrix R as
This R minimizes , where and are rows in Q and P respectively.
Alternatively, optimal rotation matrix can also be directly evaluated as quaternion.[2][3][4][5] This alternative description has been used in the development of a rigorous method for removing rigid-body motions from molecular dynamics trajectories of flexible molecules.[6] In 2002 a generalization for the application to probability distributions (continuous or not) was also proposed.[7]
Generalizations
The algorithm was described for points in a three-dimensional space. The generalization to D dimensions is immediate.
A free PyMol plugin easily implementing Kabsch is [1]. (This previously linked to CEalign [2], but this uses the Combinatorial Extension (CE) algorithm.) VMD uses the Kabsch algorithm for its alignment.
The FoldX modeling toolsuite incorporates the Kabsch algorithm to measure RMSD between Wild Type and Mutated protein structures.
Lin, Ying-Hung; Chang, Hsun-Chang; Lin, Yaw-Ling (December 15–17, 2004). A Study on Tools and Algorithms for 3-D Protein Structures Alignment and Comparison. International Computer Symposium. Taipei, Taiwan.
Umeyama, Shinji (1991). "Least-Squares Estimation of Transformation Parameters Between Two Point Patterns". IEEE Trans. Pattern Anal. Mach. Intell. 13 (4): 376–380. doi:10.1109/34.88573.