rgpycrumbs.geom.api.alignment¶
Attributes¶
Classes¶
Encapsulates the raw arrays required for an IRA graph match. |
|
Encapsulates the transformation outputs from the IRA algorithm. |
|
Configuration parameters for the Iterative Rotations and Alignment. |
|
Tracks which algorithm was successfully applied. |
|
Container for alignment outputs. |
Functions¶
|
Performs the low-level IRA isomorphism and affine transformation. |
|
Aligns a mobile structure to a reference using IRA with an ASE fallback. |
|
Align one image and return its RMSD (thread-safe on a copy). |
|
Calculates the RMSD of each structure in a list relative to a reference. |
Module Contents¶
- class rgpycrumbs.geom.api.alignment.IRAMatchInputs[source]¶
Encapsulates the raw arrays required for an IRA graph match.
Added in version 0.1.0.
- ref_numbers: numpy.ndarray[source]¶
- ref_positions: numpy.ndarray[source]¶
- mobile_numbers: numpy.ndarray[source]¶
- mobile_positions: numpy.ndarray[source]¶
- class rgpycrumbs.geom.api.alignment.IRAMatchResults[source]¶
Encapsulates the transformation outputs from the IRA algorithm.
Added in version 0.1.0.
- rotation: numpy.ndarray[source]¶
- translation: numpy.ndarray[source]¶
- permutation: numpy.ndarray[source]¶
- class rgpycrumbs.geom.api.alignment.IRAConfig[source]¶
Configuration parameters for the Iterative Rotations and Alignment.
Added in version 0.1.0.
- class rgpycrumbs.geom.api.alignment.AlignmentMethod(*args, **kwds)[source]¶
Bases:
enum.EnumTracks which algorithm was successfully applied.
Added in version 0.1.0.
- class rgpycrumbs.geom.api.alignment.AlignmentResult[source]¶
Container for alignment outputs.
Added in version 0.1.0.
- Parameters:
atoms – The aligned structure (modified in-place, but returned for chaining).
method – The specific algorithm that was used.
- method: AlignmentMethod[source]¶
- rgpycrumbs.geom.api.alignment._apply_ira_alignment(ref_atoms: ase.Atoms, mobile_atoms: ase.Atoms, config: IRAConfig) bool[source]¶
Performs the low-level IRA isomorphism and affine transformation.
This function modifies mobile_atoms in-place. It returns True if the alignment succeeds, or False if an error occurs or IRA remains unavailable.
- rgpycrumbs.geom.api.alignment.align_structure_robust(ref_atoms: ase.Atoms, mobile_atoms: ase.Atoms, ira_config: IRAConfig) AlignmentResult[source]¶
Aligns a mobile structure to a reference using IRA with an ASE fallback.
Added in version 0.1.0.
This method minimizes the RMSD between the reference and mobile structures. It first attempts to solve the isomorphism problem (finding $P, R, t$) using IRA. If IRA fails or remains unavailable, it defaults to standard Procrustes superimposition (finding $R, t$) via ASE.
- Parameters:
ref_atoms – The fixed reference configuration.
mobile_atoms – The configuration to align (modified in-place).
ira_config – Configuration object with state of IRA and the adjacency cutoff distance for IRA graph matching.
- Returns:
An AlignmentResult.
- rgpycrumbs.geom.api.alignment._rmsd_single(ref_atom, atom_i, config, coords_ref)[source]¶
Align one image and return its RMSD (thread-safe on a copy).
- rgpycrumbs.geom.api.alignment.calculate_rmsd_from_ref(atoms_list: list[ase.Atoms], ira_instance, ref_atom: ase.Atoms, ira_kmax: float) numpy.ndarray[source]¶
Calculates the RMSD of each structure in a list relative to a reference.
Added in version 1.0.0.
The function first attempts the IRA algorithm to handle atom permutations. If IRA fails or lacks the necessary library, the code falls back to standard ASE Procrustes alignment via align_structure_robust.
Alignment of individual images is parallelized over threads; the IRA Fortran library and numpy both release the GIL.
- Parameters:
atoms_list – A list of ASE Atoms objects.
ira_instance – An instantiated IRA object (or None).
ref_atom – The reference Atoms object to align against.
ira_kmax – kmax factor for IRA.
- Returns:
An array of RMSD values.