otmol.tl.kabsch

otmol.tl.kabsch(X1, X2, P, reflection=False)

Kabsch algorithm. Perform rigid body rotation (including reflection if reflection is set to True), and translation to align molecules.

Parameters
  • X1 (numpy.ndarray) – Coordinates of molecule 1 (reference) as an n x 3 array.

  • X2 (numpy.ndarray) – Coordinates of molecule 2 (to be aligned) as an m x 3 array.

  • P (numpy.ndarray) – A permutation matrix describing the atom assignment between molecules, where matrix[i, j] = 1 if assignment[i] = j.

  • reflection (bool, optional) – Whether to allow reflection, by default False.

Return type

Tuple[ndarray, ndarray, ndarray]

Returns

  • X2_aligned (numpy.ndarray) – Aligned coordinates of molecule 2.

  • R (numpy.ndarray) – Rotation matrix.

  • t (numpy.ndarray) – Translation vector.