irmsd_exposed#
- irmsd.api.irmsd_exposed.check_bond_preservation(atom_numbers1: ndarray, positions1: ndarray, atom_numbers2: ndarray, positions2: ndarray) Tuple[int, ndarray][source]#
Check whether the atom correspondence between two structures preserves the bonding pattern.
Atom
iof structure 1 is taken to correspond to atomiof structure 2, as in the aligned output ofget_irmsd(). Bonds are detected separately for each structure from its geometry, with the same covalent coordination-number criterion used for the canonical ranks.- Parameters:
atom_numbers1 (
(N,) int-like) – Atomic numbers of both structures, in matched order.atom_numbers2 (
(N,) int-like) – Atomic numbers of both structures, in matched order.positions1 (
(N,3) float-like) – Cartesian coordinates in Å, in matched order.positions2 (
(N,3) float-like) – Cartesian coordinates in Å, in matched order.
- Returns:
nmismatch (
int) – Number of atom pairs bonded in exactly one of the two structures. Zero means the correspondence is bond-preserving.per_atom (
(N,) int32 ndarray) – Number of such pairs each atom takes part in.
- Raises:
ValueError – If the structures differ in size or positions do not have shape (N, 3).
- irmsd.api.irmsd_exposed.get_irmsd(atom_numbers1: ndarray, positions1: ndarray, atom_numbers2: ndarray, positions2: ndarray, iinversion: int = 0, ranks1: ndarray | None = None, ranks2: ndarray | None = None) Tuple[float, ndarray, ndarray, ndarray, ndarray][source]#
Core API: call the Fortran routine to calculate the iRMSD between two structures
- Parameters:
atom_numbers1 (
(N1,) int32-like) – Atomic numbers (or types) of structure 1.positions1 (
(N1,3) float64-like) – Cartesian coordinates in Å of structure 1.atom_numbers2 (
(N2,) int32-like) – Atomic numbers (or types) of structure 2.positions2 (
(N2,3) float64-like) – Cartesian coordinates in Å of structure 2.iinversion (
int, optional) – Whether to consider inversion symmetry. Default is 0 (auto). Set to 1 to use inversion, set to 2 to disable inversion.ranks1 (
(N1,) int-like, optional) – Externally supplied per-atom canonical ranks for structure 1 (e.g. read from a file). Used directly only if bothranks1andranks2are given, contain no zeros, and pass the internal consistency check; otherwise the canonical ranks are recomputed. A zero entry is the “not provided” sentinel.ranks2 (
(N2,) int-like, optional) – Externally supplied per-atom canonical ranks for structure 2. Seeranks1.
- Returns:
rmsdval (
float) – The calculated iRMSD value.Z3 (
(N1,) int32 ndarray) – Atomic numbers of the aligned structure 1.P3 (
(N1,3) float64 ndarray) – Aligned and centered coordinates of structure 1.Z4 (
(N2,) int32 ndarray) – Atomic numbers of the aligned structure 2.P4 (
(N2,3) float64 ndarray) – Aligned and centered coordinates of structure 2.
Notes
The returned coordinates P3 and P4 are centered at the origin.
- Raises:
ValueError – If positions1 or positions2 do not have shape (Ni, 3).