Skip to contents

Both sets are centred, the cross-covariance is formed and the rotation read off its singular value decomposition. The sign correction on the last singular direction is what stops the routine returning a reflection, which fits the points equally well but is not a rotation. The SVD comes from the Jacobi eigendecomposition of H'H, so no external linear algebra is used.

Usage

Kabsch(coords1, coords2)

Arguments

coords1

Matrix of points, one per row.

coords2

Matrix of the same shape.

Value

List with estimate (RMSD), rmsd, rotation, det_rotation, singular_values, n, method.

Details

Formula: H = P'Q, H = U S V', R = V diag(1, ..., d) U' with d = sign(det(V U')).

References

Kabsch (1976), Acta Crystallographica A32(5):922-923, doi:10.1107/S0567739476001873 ; Kabsch (1978), Acta Crystallographica A34(5):827-828. doi:10.1107/S0567739478001680

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Kabsch(V, V)
#> $estimate
#> [1] 0
#> 
#> $rmsd
#> [1] 0
#> 
#> $rotation
#>      [,1]
#> [1,]    1
#> 
#> $det_rotation
#> [1] 1
#> 
#> $singular_values
#> [1] 42
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "R = V diag(1,...,d) U' from H = P'Q, Kabsch (1976, 1978)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"