otmol.tl.molecule_alignment

otmol.tl.molecule_alignment(X_A, X_B, T_A, T_B, B_A=None, B_B=None, method='fGW', alpha_list=None, molecule_sizes=None, reflection=False, cst_D=0.0, minimize_mismatched_edges=False, save_path=None, return_BCI=False)

Compute alignment between two molecules or (molecular complexes) with optimal transport.

Parameters
  • X_A (numpy.ndarray) – Coordinates of molecule A.

  • X_B (numpy.ndarray) – Coordinates of molecule B.

  • T_A (array_like) – Atom labels of molecule A.

  • T_B (array_like) – Atom labels of molecule B.

  • method (list of str) – Optimal transport method to use, by default [‘fgw’, ‘emd’].

  • alpha_list (list) – List of alpha values to try for fGW or fsGW solver, by default None.

  • molecule_sizes (List[int], optional) – Sizes of molecules, by default None. It is only used when two structures contain multiple molecules, and molecules are ordered in the same way.

  • reflection (bool, optional) – Whether to allow reflection in the Kabsch algorithm, by default False.

  • cst_D (float, optional) – D = (1-cst_D)*Euclidean + cst_D*Geodesic, by default 0. If the user wants to reduce bond inconsistency, set cst_D to a value close to 1.

  • minimize_mismatched_edges (bool, optional) – Whether to prioritize minimizing mismatched edges in the alignment, by default False.

  • save_path (str, optional) – Path to save the aligned molecule, by default None. The atoms in the aligned molecule will be reordered.

  • return_BCI (bool, optional) – Whether to return the BCI value (in range [0, 1]), by default False. Only use when minimize_mismatched_edges is False.

Return type

Tuple[ndarray, float, float]

Returns

  • assignment (numpy.ndarray) – Optimal assignment between molecules.

  • rmsd (float) – Best RMSD value.

  • alpha (float) – Best alpha value.

  • BCI (float) – BCI value. If minimize_mismatched_edges or return_BCI is True, the BCI value will be returned. A mismatched edge is an edge that is present in A but not in B. BCI is defined as the number of mismatched edges divided by the total number of edges in A.