chemcoord.Cartesian.align

Cartesian.align(other, indices=None, ignore_hydrogens=False)

Align two Cartesians.

Minimize the RMSD (root mean squared deviation) between self and other. Returns a tuple of copies of self and other where both are centered around their centroid and other is rotated unto self. The rotation minimises the distances between the atom pairs of same label. Uses the Kabsch algorithm implemented within get_kabsch_rotation()

Note

If indices is None, then len(self) == len(other) must be true and the elements in each index have to be the same.

Parameters:
  • other (Cartesian) –
  • indices (sequence) –

    It is possible to specify a subset of indices that is used for the determination of the best rotation matrix:

    [[i1, i2,...], [j1, j2,...]]
    

    If indices is given in this form, the rotation matrix minimises the distance between i1 and j1, i2 and j2 and so on.

  • ignore_hydrogens (bool) –
Returns:

Return type:

tuple