canonical_exposed#

irmsd.api.canonical_exposed.get_canonical_fortran(atom_numbers: ndarray, positions: ndarray, wbo: ndarray | None = None, invtype: str = 'apsp+', heavy: bool = False) → ndarray[source]#

Core API: call the Fortran routine to calculate the canonical ranking of atoms

Parameters:
  • atom_numbers ((N,) int32-like) – Atomic numbers (or types).

  • positions ((N, 3) float64-like) – Cartesian coordinates in Å.

  • heavy (bool, optional) – Whether to consider only heavy atoms (default: False).

  • wbo ((natoms, natoms) float64, C-contiguous, optional) – Optional Wiberg bond order matrix, required if invtype is ‘cangen’, ignored in case of ‘apsp+’.

  • invtype (str, optional) – alogrithm type for invariants calculation (default: apsp+), alternativly ‘cangen’. The special value ‘apsp+nmr’ runs ‘apsp+’ and then splits any rank shared by exactly two non-hydrogen atoms into two distinct ranks (NMR equivalency hack); intended for rank requests only, not for iRMSD matching.

Returns:

rank – Rank array.

Return type:

(N,) int32

Raises:

ValueError – If positions does not have shape (N, 3).

irmsd.api.canonical_exposed.get_canonical_from_connect_fortran(atom_numbers: ndarray, connectivity: ndarray, heavy: bool = False) → ndarray[source]#

Core API: call the Fortran routine to calculate the canonical ranking of atoms from connectivity matrix

Parameters:
  • atom_numbers ((N,) int32-like) – Atomic numbers (or types).

  • connectivity ((N, N) int32-like) – Connectivity matrix

  • heavy (bool, optional) – Whether to consider only heavy atoms (default: False).

Returns:

rank – Rank array.

Return type:

(N,) int32

Raises:

ValueError – If connectivity does not have shape (N, N).