sorter_exposed#

irmsd.api.sorter_exposed._pack_ids(ids_list: Sequence[ndarray | None] | None, nall: int, N: int) → ndarray[source]#

Pack per-structure canonical ids into a contiguous (nall, N) int32 array.

A structure with no ids (None) becomes an all-zero block, which the Fortran side reads as “not provided” (so its ids won’t be allocated). When ids_list is None entirely, a full zero array is returned.

irmsd.api.sorter_exposed.cregen_raw(atom_numbers_list: Sequence[ndarray], positions_list: Sequence[ndarray], energies_list: Sequence[ndarray], nat: int, rthr: float = 0.125, ethr: float = 7.96800686e-05, bthr: float = 0.01, printlvl: int = 0) → Tuple[ndarray, List[ndarray], List[ndarray]][source]#

High-level API: call the cregen_exposed_fortran Fortran routine. Note, this routine assumes (and checks) if all structures have the same sequence of atomic numbers

Parameters:
  • atom_numbers_list (sequence of (N,) int32 arrays) – Per-structure atom numbers.

  • positions_list (sequence of (N,3) float64 arrays) – Per-structure coordinates.

  • energies_list (sequence of (Nall,) float64) – List of energies for the passed structures (optional). In Hartree.

  • nat (int) – Number of atoms for which the groups array is defined. Must satisfy 1 <= nat <= N.

  • rthr (float) – Distance threshold for the Fortran sorter. In Angström.

  • ethr (float) – Inter-conformer energy threshold. In Hartree.

  • bthr (float) – Inter-conformer rotational constant threshold (relative)

  • printlvl (int) – Verbosity level.

Returns:

  • groups ((nat,) int32) – Group index for each of the first nat atoms.

  • xyz_structs (list of (N,3) float64 arrays) – Updated coordinates for each structure.

  • energies_list – Updated energies_list

Raises:

ValueError – If input arrays have inconsistent shapes or invalid parameters.

irmsd.api.sorter_exposed.delta_irmsd_list(atom_numbers_list: Sequence[ndarray], positions_list: Sequence[ndarray], nat: int, iinversion: int = 0, allcanon: bool = True, printlvl: int = 0, ids_list: Sequence[ndarray | None] | None = None) → Tuple[ndarray, List[ndarray], List[ndarray]][source]#

High-level API: call the delta_irmsd_list_fortran Fortran routine.

Parameters:
  • atom_numbers_list (sequence of (N,) int32 arrays) – Per-structure atom numbers.

  • positions_list (sequence of (N,3) float64 arrays) – Per-structure coordinates.

  • nat (int) – Number of atoms for which the groups array is defined. Must satisfy 1 <= nat <= N.

  • iinversion (int) – Inversion symmetry flag.

  • allcanon (bool) – Canonicalization flag.

  • printlvl (int) – Verbosity level.

Returns:

  • delta ((nall,) float64) – iRMSD value between structure x_i and x_i-1

  • xyz_structs (list of (N,3) float64 arrays) – Updated coordinates for each structure.

  • Z_structs (list of (N,) int32 arrays) – Updated atom numbers for each structure.

Raises:

ValueError – If input arrays have inconsistent shapes or invalid parameters.

irmsd.api.sorter_exposed.openmp_info() → dict[source]#

Report how the compiled library handles parallel sorting.

Returns:

enabled: True if the library was built with OpenMP. max_threads: number of threads the iRMSD sorter uses per parallel region (OMP_NUM_THREADS if set, otherwise all available cores; 1 without OpenMP).

Return type:

dict

irmsd.api.sorter_exposed.sorter_irmsd(atom_numbers_list: Sequence[ndarray], positions_list: Sequence[ndarray], nat: int, rthr: float, iinversion: int = 0, allcanon: bool = True, printlvl: int = 0, ethr: float | None = None, energies_list: Sequence[ndarray] | None = None, ids_list: Sequence[ndarray | None] | None = None) → Tuple[ndarray, List[ndarray], List[ndarray]][source]#

High-level API: call the sorter_exposed_xyz_fortran Fortran routine.

Parameters:
  • atom_numbers_list (sequence of (N,) int32 arrays) – Per-structure atom numbers.

  • positions_list (sequence of (N,3) float64 arrays) – Per-structure coordinates.

  • nat (int) – Number of atoms for which the groups array is defined. Must satisfy 1 <= nat <= N.

  • rthr (float) – Distance threshold for the Fortran sorter. In Angström.

  • iinversion (int) – Inversion symmetry flag.

  • allcanon (bool) – Canonicalization flag.

  • printlvl (int) – Verbosity level.

  • ethr (float | None) – Inter-conformer energy threshold (optional). In Hartree.

  • energies_list (sequence of (Nall,) floats | None) – List of energies for the passed structures (optional). In Hartree.

Returns:

  • groups ((nat,) int32) – Group index for each of the first nat atoms.

  • xyz_structs (list of (N,3) float64 arrays) – Updated coordinates for each structure.

  • Z_structs (list of (N,) int32 arrays) – Updated atom numbers for each structure.

Raises:

ValueError – If input arrays have inconsistent shapes or invalid parameters.