.. index:: pair: namespace; gpr::geometry .. _doxid-namespacegpr_1_1geometry: namespace gpr::geometry ======================= .. toctree:: :hidden: enum_gpr_geometry_BondGraphKind.rst enum_gpr_geometry_PrimitiveKind.rst enum_gpr_geometry_RetractionStatus.rst struct_gpr_geometry_CutoffPair.rst struct_gpr_geometry_PrimitiveInternal.rst struct_gpr_geometry_ReactiveAtomTypes.rst class_gpr_geometry_AffineCoordinateChart.rst class_gpr_geometry_CoordinateChart.rst class_gpr_geometry_ElementPairContactFloor.rst class_gpr_geometry_InternalCoordinateChart.rst class_gpr_geometry_InternalCoordinateRetractionFailed.rst class_gpr_geometry_InternalCoordinateSet.rst class_gpr_geometry_PairBox.rst class_gpr_geometry_UndefinedInternalCoordinate.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block namespace geometry { // enums enum :ref:`BondGraphKind`; enum :ref:`PrimitiveKind`; enum :ref:`RetractionStatus`; // structs struct :ref:`CutoffPair`; struct :ref:`PrimitiveInternal`; struct :ref:`ReactiveAtomTypes`; // classes class :ref:`AffineCoordinateChart`; class :ref:`CoordinateChart`; class :ref:`ElementPairContactFloor`; class :ref:`InternalCoordinateChart`; class :ref:`InternalCoordinateRetractionFailed`; class :ref:`InternalCoordinateSet`; class :ref:`PairBox`; class :ref:`UndefinedInternalCoordinate`; // global variables std::array :ref:`kCorderoRadiusPm`; // global functions std::vector<:ref:`CutoffPair`> :ref:`cutoffNeighbors`(const double* positions, std::size_t count, const std::array& cell, const std::array& periodic, double cutoff); bool :ref:`angleIsCollinear`(double sin2); std::vector<:ref:`PrimitiveInternal`> :ref:`resolveCollinearAngles`(const std::vector<:ref:`PrimitiveInternal`>& primitives, const Eigen::VectorXd& positions, const std::array& cell = {}); std::vector<:ref:`PrimitiveInternal`> :target:`primitiveTopologyFromBondGraph`(int n_atoms, const std::vector>& bonds); std::vector<:ref:`PrimitiveInternal`> :ref:`resolveCollinearAngles`(const std::vector<:ref:`PrimitiveInternal`>& primitives, const std::vector& geometries, const std::array& cell = {}); std::vector> :ref:`gabrielBondGraph`(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms = {}, const std::array& cell = {}); std::vector> :ref:`relativeNeighborhoodBondGraph`(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms = {}, const std::array& cell = {}); std::vector> :ref:`bondGraph`(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms = {}, :ref:`BondGraphKind` kind = :ref:`BondGraphKind::Gabriel`, const std::array& cell = {}); std::vector> :ref:`unionBondGraph`(int n_atoms, const std::vector& geometries, const std::vector& moving_atoms = {}, :ref:`BondGraphKind` kind = :ref:`BondGraphKind::Gabriel`, const std::array& cell = {}); std::vector<:ref:`PrimitiveInternal`> :target:`primitiveTopologyFromGeometry`(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms, :ref:`BondGraphKind` kind, const std::array& cell); int :target:`countBonds`(const std::vector<:ref:`PrimitiveInternal`>& primitives); int :target:`countAngles`(const std::vector<:ref:`PrimitiveInternal`>& primitives); int :target:`countDihedrals`(const std::vector<:ref:`PrimitiveInternal`>& primitives); Eigen::VectorXd :ref:`sellaInternalTrust`(const :ref:`InternalCoordinateSet`& coordinates); Eigen::VectorXd :ref:`scaleCartesianStepToInternalTrust`(const :ref:`InternalCoordinateSet`& coordinates, const Eigen::VectorXd& positions, const Eigen::VectorXd& cartesian_step, const Eigen::VectorXd& internal_trust_per_primitive = {}); Eigen::VectorXd :ref:`retractRestrictedStep`(const :ref:`InternalCoordinateSet`& coordinates, const Eigen::VectorXd& positions, const Eigen::VectorXd& cartesian_step, const Eigen::VectorXd& internal_trust_per_primitive = {}); Eigen::MatrixXd :target:`constraintFreeBasis`(const Eigen::MatrixXd& constraint_jacobian); bool :ref:`cellIsZero`(const double cell[9]); bool :target:`cellIsZero`(const std::array& cell); bool :ref:`cellIsVacuumBox`(const double cell[9]); bool :target:`cellIsVacuumBox`(const std::array& cell); bool :ref:`cellIsMicLattice`(const double cell[9]); bool :target:`cellIsMicLattice`(const std::array& cell); bool :ref:`copyMicLattice`(double dest[9], const double src[9]); std::array :target:`micLattice`(const double cell[9]); std::array :target:`micLattice`(const std::array& cell); std::array :ref:`cellPeriodicAxes`(const double cell[9]); double :ref:`uniqueImageRadius`(const double cell[9]); double :target:`uniqueImageRadius`(const std::array& cell); void :ref:`zeroOpenAxes`(double cell[9], const std::array& periodic); Eigen::VectorXd :ref:`flatMinimumImageDisplacement`(const :ref:`PairBox`* box, const Eigen::VectorXd& from, const Eigen::VectorXd& to); double :ref:`minimumPairDistance`(const Eigen::VectorXd& positions, const std::array& cell, Eigen::Index moving_count = -1); double :ref:`minimumContactDistance`(const Eigen::VectorXd& positions, const std::array& cell, double cutoff, Eigen::Index moving_count = -1); template Eigen::VectorXd :ref:`limitPairDistanceStep`(const Eigen::VectorXd& positions, const Eigen::VectorXd& proposed, double floor, Distance&& distance); double :ref:`covalentRadius`(int atomic_number); std::vector> :ref:`covalentBondGraph`(const Eigen::VectorXd& positions, const std::vector& atomic_numbers, const std::array& cell = {}); :ref:`ReactiveAtomTypes` :ref:`assignReactiveAtomTypes`(const Eigen::VectorXd& reactant, const Eigen::VectorXd& product, const std::vector& atomic_numbers, const std::vector<:ref:`Index_t`>& types, const std::unordered_map`>& atomtypes, const std::array& cell = {}); } // namespace geometry .. _details-namespacegpr_1_1geometry: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Global Variables ---------------- .. index:: pair: variable; kCorderoRadiusPm .. _doxid-namespacegpr_1_1geometry_1a83bc9dc76936e762c76417852cdd6238: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::array kCorderoRadiusPm Cordero 2008 covalent radii (single-bond), indexed by atomic number Z = 1..96. Units: picometres. Z = 0 sentinel reserved for the "unknown / dummy" entry the lookup uses when Z is out of range. Global Functions ---------------- .. index:: pair: function; cutoffNeighbors .. _doxid-namespacegpr_1_1geometry_1aa59a122bbfe933075c10ba9bce6ab042: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`CutoffPair`> cutoffNeighbors(const double* positions, std::size_t count, const std::array& cell, const std::array& periodic, double cutoff) Half list of pairs inside a cutoff. Displacements belong to the caller's geometry convention; this function only supplies topology and image labels. Each call owns its allocation. A fully open cell calls linkcell ``pairs_open``. Any periodic axis calls ``pairs_within_pbc``. The command-line searches default to one neighbour thread per rank; RAYON_NUM_THREADS controls linkcell's pool. .. index:: pair: function; angleIsCollinear .. _doxid-namespacegpr_1_1geometry_1aaea40c98322fe9970607ae1658de5537: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool angleIsCollinear(double sin2) Treat a bending plane as unresolved when sin^2(theta) <= machine epsilon, consistent with the 1/sqrt(epsilon) conditioning limit for chart inverses. .. index:: pair: function; resolveCollinearAngles .. _doxid-namespacegpr_1_1geometry_1afe2779f36c425c9e4888afe9847329d5: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`PrimitiveInternal`> resolveCollinearAngles(const std::vector<:ref:`PrimitiveInternal`>& primitives, const Eigen::VectorXd& positions, const std::array& cell = {}) Replace every valence angle that is collinear at ~positions~ by the pair of linear bends with orthogonal references, and drop every dihedral whose inner triple is collinear (its plane is undefined). Angles that are not collinear are returned unchanged. .. index:: pair: function; resolveCollinearAngles .. _doxid-namespacegpr_1_1geometry_1ae6fdd342ef298e01f8bc817289ba28b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`PrimitiveInternal`> resolveCollinearAngles(const std::vector<:ref:`PrimitiveInternal`>& primitives, const std::vector& geometries, const std::array& cell = {}) Same over several geometries (a path): an angle collinear at ANY of them becomes the bend pair (references from the first geometry where it is collinear), a dihedral with an inner triple collinear at any is dropped. A chart built from a path topology is evaluated at every geometry of the path, so collinearity anywhere on it breaks the valence angle there. .. index:: pair: function; gabrielBondGraph .. _doxid-namespacegpr_1_1geometry_1ac286d35a23b445063bb538e71fe68fda: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector> gabrielBondGraph(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms = {}, const std::array& cell = {}) Open diametric-ball graph (Gabriel and Sokal 1969). Scale-free: no radial cutoff. Frozen-frozen pairs are omitted when a moving-atom mask is supplied. .. index:: pair: function; relativeNeighborhoodBondGraph .. _doxid-namespacegpr_1_1geometry_1ad9b4efc0b04983bdb895f88d852624c7: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector> relativeNeighborhoodBondGraph(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms = {}, const std::array& cell = {}) Relative neighborhood graph (Toussaint 1980). Strict Gabriel subgraph: edge (a,b) exists iff no k has both distances to a and b smaller than the distance between a and b. Same moving-atom rule, no cutoff. .. index:: pair: function; bondGraph .. _doxid-namespacegpr_1_1geometry_1a2eaf8fdc1bf297251b94b650068cb079: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector> bondGraph(int n_atoms, const Eigen::VectorXd& positions, const std::vector& moving_atoms = {}, :ref:`BondGraphKind` kind = :ref:`BondGraphKind::Gabriel`, const std::array& cell = {}) All distances, the Gabriel diametric ball and the lune test use the minimum-image convention of ~cell~ (minimage); an all-zero cell is vacuum. .. index:: pair: function; unionBondGraph .. _doxid-namespacegpr_1_1geometry_1af161e2f3ad82649a19e5220fe0deaadf: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector> unionBondGraph(int n_atoms, const std::vector& geometries, const std::vector& moving_atoms = {}, :ref:`BondGraphKind` kind = :ref:`BondGraphKind::Gabriel`, const std::array& cell = {}) Union of per-geometry bond graphs. A forming or breaking pair that is an edge at any listed geometry stays in the set. .. index:: pair: function; sellaInternalTrust .. _doxid-namespacegpr_1_1geometry_1ae8ee7020e81d1c7dd8bc398a46c6541a: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd sellaInternalTrust(const :ref:`InternalCoordinateSet`& coordinates) Sella restricted_step.MaxInternalStep radii: 0.2 Å for bonds and linear bends, 0.2 rad for valence angles, 0.3 rad for dihedrals. .. index:: pair: function; scaleCartesianStepToInternalTrust .. _doxid-namespacegpr_1_1geometry_1a02be45f61a0210bcd6a163a669870d7b: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd scaleCartesianStepToInternalTrust(const :ref:`InternalCoordinateSet`& coordinates, const Eigen::VectorXd& positions, const Eigen::VectorXd& cartesian_step, const Eigen::VectorXd& internal_trust_per_primitive = {}) Scale a Cartesian step so no linearized primitive change exceeds its trust radius (Sella MaxInternalStep). An empty trust vector uses ~sellaInternalTrust~. .. index:: pair: function; retractRestrictedStep .. _doxid-namespacegpr_1_1geometry_1a9f268a24639ea106673068e4ce63c391: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd retractRestrictedStep(const :ref:`InternalCoordinateSet`& coordinates, const Eigen::VectorXd& positions, const Eigen::VectorXd& cartesian_step, const Eigen::VectorXd& internal_trust_per_primitive = {}) MaxInternalStep, then Gauss-Newton retraction onto the linearized internal-coordinate target. A valence target outside the angle chart returns the scaled Cartesian trial. Any other failure throws ~InternalCoordinateRetractionFailed~. .. index:: pair: function; cellIsZero .. _doxid-namespacegpr_1_1geometry_1a471d3643d9ae55ea1e286bb25ca2b7aa: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool cellIsZero(const double cell[9]) Isolated molecule: every entry of the ASE-style 3x3 cell is zero. .. index:: pair: function; cellIsVacuumBox .. _doxid-namespacegpr_1_1geometry_1a1fed9b0a20a9c32de979315874f5c197: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool cellIsVacuumBox(const double cell[9]) Baker / Hermes 25 A cubic vacuum box. Oracle and CON convention (omitted-cell fallback, Baker endpoints), not a periodic lattice. Off-diagonal entries may be cos(90 deg) leftovers from expanding CON lengths and angles. .. index:: pair: function; cellIsMicLattice .. _doxid-namespacegpr_1_1geometry_1a5fd597c3c414f3bd9c3f52fd9f215147: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool cellIsMicLattice(const double cell[9]) Nonzero ASE 3x3 that is not the 25 A vacuum convention. .. index:: pair: function; copyMicLattice .. _doxid-namespacegpr_1_1geometry_1a92959e5a9017c6689a49c31aff1c280f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool copyMicLattice(double dest[9], const double src[9]) Copy src onto dest only when src is a MIC lattice. .. index:: pair: function; cellPeriodicAxes .. _doxid-namespacegpr_1_1geometry_1ab8f7b83764eb6e89f1613feef92fe08e: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::array cellPeriodicAxes(const double cell[9]) Axes of an ASE row-major cell that are periodic: the rows that are not zero. A periodic lattice has no zero row, so a zero row marks an open axis: a slab periodic in x and y carries a zero third row. .. index:: pair: function; uniqueImageRadius .. _doxid-namespacegpr_1_1geometry_1a52b3f4244e0304edd52363e05d9ce20c: .. ref-code-block:: cpp :class: doxyrest-title-code-block double uniqueImageRadius(const double cell[9]) Radius inside which every pair displacement has one nearest image. h_i is the length of lattice row i orthogonal to the span of the other periodic rows: the cell volume divided by the area of the other two rows for a bulk cell, the in-plane row spacing for a slab, or the row length for a wire. A sphere of radius min_i h_i / 2 fits inside the cell parallelepiped and so inside the Wigner-Seitz cell, whose boundary is where the nearest image changes and a pair displacement turns discontinuously. Zero for a cell that is not a MIC lattice. .. index:: pair: function; zeroOpenAxes .. _doxid-namespacegpr_1_1geometry_1a4aa2ad983d53ff1b9138eca09672d821: .. ref-code-block:: cpp :class: doxyrest-title-code-block void zeroOpenAxes(double cell[9], const std::array& periodic) Copy of cell with the rows of the open axes of periodic set to zero, the form every distance consumer reads a periodicity mask from. .. index:: pair: function; flatMinimumImageDisplacement .. _doxid-namespacegpr_1_1geometry_1ae8de016c0cd5d7efe0949c1fed256150: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd flatMinimumImageDisplacement(const :ref:`PairBox`* box, const Eigen::VectorXd& from, const Eigen::VectorXd& to) Per-atom displacement of a flat xyzxyz vector. A null box, or a box that is not periodic, returns ``to - from``. .. index:: pair: function; minimumPairDistance .. _doxid-namespacegpr_1_1geometry_1aa3e1af47201fa7ff3587fb43eaea3a1c: .. ref-code-block:: cpp :class: doxyrest-title-code-block double minimumPairDistance(const Eigen::VectorXd& positions, const std::array& cell, Eigen::Index moving_count = -1) Shortest pair distance under the minimum image, the metric every contact floor, step cap and limiter in the band shares. One routine keeps a floor set from the endpoints and a floor enforced on a step in the same rounding. At least one atom of each pair lies before moving_count, when specified. .. index:: pair: function; minimumContactDistance .. _doxid-namespacegpr_1_1geometry_1a0c2eab7fd9e952c18da260a01fea75ce: .. ref-code-block:: cpp :class: doxyrest-title-code-block double minimumContactDistance(const Eigen::VectorXd& positions, const std::array& cell, double cutoff, Eigen::Index moving_count = -1) Minimum distance capped at the contact radius. Vesin supplies candidates; MinImage owns their distances. Frozen atoms follow the moving coordinates, and frozen-frozen contacts do not constrain the moving domain. .. index:: pair: function; limitPairDistanceStep .. _doxid-namespacegpr_1_1geometry_1aecea222cd2da3e231cb57158cb86119f: .. ref-code-block:: cpp :class: doxyrest-title-code-block template Eigen::VectorXd limitPairDistanceStep(const Eigen::VectorXd& positions, const Eigen::VectorXd& proposed, double floor, Distance&& distance) Keep a proposed Cartesian geometry inside a fixed contact domain. A seed outside the domain may increase its minimum distance; it cannot compress further. Feasible proposals, including outward motion at the boundary, pass through. The lower bracket always holds a feasible point. .. index:: pair: function; covalentRadius .. _doxid-namespacegpr_1_1geometry_1a5e3c77c9276055a18ab571d5f129413b: .. ref-code-block:: cpp :class: doxyrest-title-code-block double covalentRadius(int atomic_number) Covalent radius in Å (Cordero et al., Dalton Trans. 2008, 2832; the low-spin values for Mn, Fe and Co, sp3 carbon). Throws for an atomic number outside the table. .. index:: pair: function; covalentBondGraph .. _doxid-namespacegpr_1_1geometry_1ae5d9ae04efbac2229aa1615fdf266eae: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector> covalentBondGraph(const Eigen::VectorXd& positions, const std::vector& atomic_numbers, const std::array& cell = {}) Chemical bond graph: pair (a, b) is bonded when its minimum-image distance is below 1.25 (R_a + R_b) with R the covalent radii, the conventional bond-perception tolerance. An all-zero cell is vacuum. .. index:: pair: function; assignReactiveAtomTypes .. _doxid-namespacegpr_1_1geometry_1aa8aac3cd272464719cb953cd7cad9f36: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ReactiveAtomTypes` assignReactiveAtomTypes(const Eigen::VectorXd& reactant, const Eigen::VectorXd& product, const std::vector& atomic_numbers, const std::vector<:ref:`Index_t`>& types, const std::unordered_map`>& atomtypes, const std::array& cell = {}) Split each element's atom type into a spectator and a reactive type. The :ref:`Sexpat ` kernel fits one length scale per pair of atom types, so with types by element alone the transferring hydrogen shares its C-H length scale with every spectator C-H bond, whose inverse distance barely moves along the path; the fit lands between the two and the misfit surfaces as learned noise far above the oracle's own spread. An atom is reactive when its covalent bond set differs between reactant and product; every such atom of element Z receives the type "Z\*", so the reactive pairs are fitted on their own. Requires matching atom counts and elements.