Namespaces | |
| namespace | distance |
Classes | |
| struct | AtomSignature |
| class | AuxiliaryFunctionality |
| Some auxiliary functions. More... | |
| struct | ChainRealignStats |
| class | Distance |
| Methods to calculate distances between atoms. More... | |
| struct | EndpointAlignResult |
| class | Gradient |
| Methods to calculate gradients (derivatives) with respect to different directions. More... | |
| struct | InverseDistanceCache |
| Methods to calculate distances between atoms. More... | |
| struct | LebedevNode |
| struct | OracleOrientation |
| class | ProblemSetUp |
| Set up the GP-dimer problem. More... | |
Functions | |
| ChainRealignStats | realignChainToPredecessors (gpr::neb::NEBPath &path, const std::vector< int > &atomic_numbers, std::vector< std::vector< uint64_t > > *image_ids, double kmax_factor) |
| std::pair< gpr::Coord, gpr::FieldMatrixIdx > | get_canonical_configuration (const gpr::Coord &x_in, const gpr::FieldMatrixIdx &types_in) |
| double | solve_assignment_problem (const Eigen::MatrixXd &cost_matrix) |
| Solves the assignment problem using the Hungarian algorithm. | |
| std::vector< int > | solve_assignment_indices (const Eigen::MatrixXd &cost_matrix) |
| Like solve_assignment_problem, but returns the optimal assignment. | |
| double | calculate_aligned_rmsd (const gpr::Coord &P, const gpr::Coord &Q) |
| const double * | farFieldCentre (const gpr::AtomsConfiguration &conf, Eigen::Index atom) |
| void | farFieldDifference (const gpr::geometry::PairBox &box, const double centre[3], const double left[3], const double right[3], double delta[3]) |
| void | addFarSource (double tensor[3][3], const double r[3], double weight) |
| double | farQuadratic (const double tensor[3][3], const double delta[3]) |
| void | farContract (const double tensor[3][3], const double delta[3], double out[3]) |
| bool | farFromCentre (const gpr::geometry::PairBox &box, const double centre[3], const double frozen[3], double radius) |
| EndpointAlignResult | alignProductToReactant (const Eigen::VectorXd &reactant_positions, const Eigen::VectorXd &product_positions, const std::vector< int > &reactant_types, const std::vector< int > &product_types, double kmax_factor) |
| EndpointAlignResult | alignProductToReactantMinDist (const Eigen::VectorXd &reactant_positions, const Eigen::VectorXd &product_positions, const std::vector< int > &reactant_types, const std::vector< int > &product_types) |
| Eigen::VectorXd | unwrapEndpointsMinimumImage (const Eigen::VectorXd &reactant_positions, const Eigen::VectorXd &product_positions, const std::array< double, 9 > &cell) |
| EndpointAlignResult | alignProductPeriodicMinImage (const Eigen::VectorXd &reactant_positions, const Eigen::VectorXd &product_positions, const std::vector< int > &reactant_types, const std::vector< int > &product_types, const std::array< double, 9 > &cell) |
| Eigen::VectorXd | kabschAlignProductToReactant (const Eigen::VectorXd &reactant_positions, const Eigen::VectorXd &product_positions) |
| double | rigidAlignedRmsd (const Eigen::VectorXd &reference, const Eigen::VectorXd &mobile) |
| void | lebedevAddOrbit (std::vector< LebedevNode > &nodes, double x, double y, double z, double weight) |
| std::vector< LebedevNode > | lebedevLaikovGrid (int order) |
order is 6, 14, or 26. Any other value throws. | |
| double | lebedevWeightSum (int order) |
| Eigen::Matrix3d | lebedevNodeRotation (const LebedevNode &node) |
| Proper rotation taking e_z to the node. Identity for the north pole. | |
| OracleOrientation | orientGeometryForOracle (const Eigen::VectorXd &positions, const Eigen::VectorXd &reference, const std::vector< int > &types, bool align, double kmax_factor) |
| void | pullForcesToCallerFrame (double *forces, long n_atoms, const Eigen::Matrix3d &rotation) |
| template<class Eval> | |
| void | averageOverLebedev (long n_atoms, const double *positions, int order, Eval eval, double *energy, double *forces, double *energy_noise, double *force_noise) |
|
inline |
Definition at line 49 of file FarField.h.
| EndpointAlignResult aux::alignProductPeriodicMinImage | ( | const Eigen::VectorXd & | reactant_positions, |
| const Eigen::VectorXd & | product_positions, | ||
| const std::vector< int > & | reactant_types, | ||
| const std::vector< int > & | product_types, | ||
| const std::array< double, 9 > & | cell ) |
Same correspondence as alignProductToReactantMinDist, with minimum-image distances and no rigid rotation. aligned is the unwrapped product.
Definition at line 387 of file IRAAlign.cpp.
| EndpointAlignResult aux::alignProductToReactant | ( | const Eigen::VectorXd & | reactant_positions, |
| const Eigen::VectorXd & | product_positions, | ||
| const std::vector< int > & | reactant_types, | ||
| const std::vector< int > & | product_types, | ||
| double | kmax_factor = 1.8 ) |
Match the product endpoint onto the reactant frame.
Coordinates are flat 3N arrays (xyzxyz), which is exactly the Fortran-side (3, nat) column-major layout libira expects. Types are atomic numbers per endpoint in that endpoint's own file order. kmax_factor is libira_match's km_factor (must exceed 1.0; the IRA examples and eOn's tests use values in [1.0, 10.0], default 1.8).
When the assignment comes back as the identity (permutation[i] == i, rotation within 1e-9 of I, translation within 1e-9 of 0) the result sets identity=true and leaves aligned empty: consistently ordered inputs pass through without picking up floating-point noise from the rotation product.
Collinear molecules (e.g. HCN) have no IRA rotation basis, so libira_match reports "no basis could be found"; the helper then falls back to libira_cshda_svd (geometric-center CShDA assignment + single-shot SVD), which resolves permutations and translations in an already rotation-consistent frame – exactly the scrambled-order endpoint case.
Definition at line 63 of file IRAAlign.cpp.
| EndpointAlignResult aux::alignProductToReactantMinDist | ( | const Eigen::VectorXd & | reactant_positions, |
| const Eigen::VectorXd & | product_positions, | ||
| const std::vector< int > & | reactant_types, | ||
| const std::vector< int > & | product_types ) |
Endpoint correspondence by minimum total displacement, computed consistently.
Anchors the rigid alignment to the IDENTITY atom correspondence (a Kabsch rotation over the input pairing), then solves the type-constrained minimum-total-distance assignment (Hungarian) in that fixed frame. Decoupling the rotation from the permutation is what makes the result consistent: a free-rotation RMSD/Hausdorff search (IRA) co-optimises both and shuffles a reaction's equivalent atoms into a lower-score but chemically wrong reordering. Minimising total distance in the identity-anchored frame re-pairs atoms that are closer to a different partner; the re-pairing is kept only when the permutation maps the covalent bond graph (Cordero radii, 1.2 tolerance) of the reactant or of the product onto itself, so equivalent atoms of an endpoint may be renamed while the reaction stays that of the supplied ordering. Endpoints that do not list the same elements in the same order have no supplied correspondence and take the assignment.
Needs no IRA: pure Eigen Kabsch + Hungarian, so it is always available and deterministic. Returns identity=true for a bit-equal pass-through.
Definition at line 211 of file IRAAlign.cpp.
|
inline |
Weighted mean of evaluations at the Lebedev node rotations. eval(pos, forces, energy, energy_noise, force_noise) sees one rotated copy; forces it writes are in that copy's frame.
Definition at line 251 of file LebedevLaikov.h.
| double aux::calculate_aligned_rmsd | ( | const gpr::Coord & | P, |
| const gpr::Coord & | Q ) |
Definition at line 283 of file Distance.cpp.
|
inline |
Definition at line 71 of file FarField.h.
|
inline |
Definition at line 15 of file FarField.h.
|
inline |
Definition at line 36 of file FarField.h.
|
inline |
Definition at line 81 of file FarField.h.
|
inline |
Definition at line 60 of file FarField.h.
| std::pair< gpr::Coord, gpr::FieldMatrixIdx > aux::get_canonical_configuration | ( | const gpr::Coord & | x_in, |
| const gpr::FieldMatrixIdx & | types_in ) |
Definition at line 44 of file Distance.cpp.
| Eigen::VectorXd aux::kabschAlignProductToReactant | ( | const Eigen::VectorXd & | reactant_positions, |
| const Eigen::VectorXd & | product_positions ) |
Rigid (rotation + translation) alignment of the product endpoint onto the reactant frame using the identity atom correspondence (rgmin's rgmin_rigid_align, the Horn quaternion solution of the Wahba problem, over flat 3N xyzxyz coordinates).
Unlike alignProductToReactant this never permutes atoms. A reaction whose endpoints are written in a rotated or translated frame (e.g. a .con where the heavy atoms appear swapped end-to-end, as in the HCN / HNC isomerisation) still interpolates physically because the rigid transform removes the spurious frame difference; at the same time the input atom identities are preserved, so a reaction whose endpoints share an atom-type multiset (the migrating vs spectator hydrogens of a tautomerisation) is never re-indexed into a different reaction. Rigid motion is an energy-invariant symmetry operation, so the product's internal geometry is unchanged.
Returns the flat 3N aligned product. On a size mismatch or an empty / non-multiple-of-three input the product is returned unchanged.
Definition at line 34 of file KabschAlign.cpp.
|
inline |
Definition at line 44 of file LebedevLaikov.h.
|
inline |
order is 6, 14, or 26. Any other value throws.
Definition at line 65 of file LebedevLaikov.h.
|
inline |
Proper rotation taking e_z to the node. Identity for the north pole.
Definition at line 97 of file LebedevLaikov.h.
|
inline |
Definition at line 88 of file LebedevLaikov.h.
|
inline |
Rigid frame for one oracle energy evaluation.
When align is false the returned coordinates are positions unchanged (a rotated copy of an identical geometry stays rotated). When align is true, IRA matches positions onto reference. A non-identity atom permutation is rejected and the identity-paired Kabsch rotation is used instead, so a reacting image is never reindexed. An identity match returns positions bit-equal.
Definition at line 204 of file LebedevLaikov.h.
|
inline |
Definition at line 236 of file LebedevLaikov.h.
| ChainRealignStats aux::realignChainToPredecessors | ( | gpr::neb::NEBPath & | path, |
| const std::vector< int > & | atomic_numbers, | ||
| std::vector< std::vector< uint64_t > > * | image_ids, | ||
| double | kmax_factor = 1.8 ) |
IRA-align every interior image of path onto its predecessor.
Sequential sweep i = 1 .. numImages()-2: image i is matched onto the already-processed image i-1, so frames compose along the chain. Endpoints stay untouched (they are fixed by the NEB and the product endpoint already went through the startup endpoint assignment). Identity assignments are skipped entirely (bit-equal no-op), so a drift-free chain passes through unchanged.
For a non-identity assignment the image positions become R * x[perm] + t, the stored gradient (if evaluated) co-rotates as R * g[perm] (gradients are covariant under rigid motion and follow their atoms under permutation; the energy is invariant), and the per-image id row in image_ids (when non-null and sized to the path) is permuted alongside so write-out restores the original atom identities.
Definition at line 12 of file ChainRealign.cpp.
| double aux::rigidAlignedRmsd | ( | const Eigen::VectorXd & | reference, |
| const Eigen::VectorXd & | mobile ) |
RMSD after the same rigid alignment, sqrt(sum_i norm(R m_i + t - r_i)^2 / n_atoms) in the given atom order. NaN on a size mismatch, an empty or non-multiple-of-three input, or a non-finite coordinate.
Definition at line 45 of file KabschAlign.cpp.
| std::vector< int > aux::solve_assignment_indices | ( | const Eigen::MatrixXd & | cost_matrix | ) |
Like solve_assignment_problem, but returns the optimal assignment.
| cost_matrix | A square matrix where cost_matrix(i, j) is the cost of assigning worker i to job j. |
Definition at line 193 of file Distance.cpp.
| double aux::solve_assignment_problem | ( | const Eigen::MatrixXd & | cost_matrix | ) |
Solves the assignment problem using the Hungarian algorithm.
Given a cost matrix, this function finds the minimum cost assignment of workers to jobs, which is equivalent to finding the minimum total distance when pairing atoms of the same type.
| cost_matrix | A square matrix where cost_matrix(i, j) is the cost of assigning worker i to job j. |
Definition at line 179 of file Distance.cpp.
| Eigen::VectorXd aux::unwrapEndpointsMinimumImage | ( | const Eigen::VectorXd & | reactant_positions, |
| const Eigen::VectorXd & | product_positions, | ||
| const std::array< double, 9 > & | cell ) |
Place each product atom on the minimum image relative to the reactant atom in the same slot. No rotation and no permutation: a periodic cell is not free to rotate, and a fixed atom stays on its site.
Definition at line 367 of file IRAAlign.cpp.