xnn.krnn.common.permutations.match_pairs#

xnn.krnn.common.permutations.match_pairs(positions, atomic_numbers, cell=None)[source]#

Match every pair of geometries.

The cost matrices, the norms and the permuted distance matrices of one geometry against all later ones are formed at once. The assignment problem of a pair is solved only when its answer is not plain: when every row’s smallest cost is strictly smaller than the rest of its row and the rows pick distinct columns, that choice is the unique optimal assignment.

Parameters:
  • positions (ndarray) – (M, N, 3) geometries.

  • atomic_numbers (ndarray) – (N,) elements.

  • cell (ndarray, optional) – (3, 3) periodic cell.

Returns:

{(i, j): perm} for the pairs i < j whose matching improved the agreement of their distance matrices, and the (M, M) matching costs.

Return type:

tuple