.. index:: pair: class; dimer::Dimer .. _doxid-classdimer_1_1_dimer: class dimer::Dimer ================== .. toctree:: :hidden: enum_dimer_Dimer_RotationStepResult.rst Overview ~~~~~~~~ :ref:`Dimer ` method. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Dimer { public: // typedefs typedef std::function`&)> :target:`Image1Evaluator`; typedef std::function :target:`HessianVectorEvaluator`; // enums enum :ref:`RotationStepResult`; // construction :ref:`Dimer`(double separation, bool is_subsystem = false); virtual :target:`~Dimer`(); // methods void :ref:`translate`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& F, const double curv, const :ref:`gpr::TransitionParameters`& param_trans, :ref:`gpr::LBFGSInfo`& transinfo, :ref:`gpr::Coord`& R_new); void :ref:`translateWithForce`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& force, const :ref:`gpr::TransitionParameters`& parameters, :ref:`gpr::LBFGSInfo`& history, :ref:`gpr::Coord`& output); void :ref:`rotate`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const uint8_t potential, const double T_anglerot, const bool estim_Curv, const :ref:`gpr::Observation`& all_obs, :ref:`gpr::GaussianProcessRegression`* gpr_model, :ref:`gpr::LBFGSInfo`& rotinfo, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1); :ref:`RotationStepResult` :target:`rotateWithImage1Evaluator`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const double T_anglerot, const bool estim_Curv, const :ref:`Image1Evaluator`& image1_evaluator, :ref:`gpr::LBFGSInfo`& rotinfo, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1); :ref:`RotationStepResult` :ref:`rotateWithHessian`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const bool estim_Curv, const :ref:`Image1Evaluator`& image1_evaluator, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1, const :ref:`HessianVectorEvaluator`& hessian_evaluator); :ref:`RotationStepResult` :ref:`rotateWithRgminDimer`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const bool estim_Curv, const :ref:`Image1Evaluator`& image1_evaluator, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1); :ref:`RotationStepResult` :target:`rotateWithRgminDimer`(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const bool estim_Curv, const :ref:`Image1Evaluator`& image1_evaluator, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1, const :ref:`HessianVectorEvaluator`& hessian_evaluator); void :ref:`rotateForce`(const :ref:`gpr::Coord`& G01, const :ref:`gpr::Coord`& orient, :ref:`gpr::Coord`& F_rot); void :ref:`setForceVariance`(const Eigen::VectorXd& variance); void :target:`clearForceVariance`(); bool :target:`hasForceVariance`() const; void :ref:`translateForce`(const :ref:`gpr::Coord`& F, const :ref:`gpr::Coord`& orient, :ref:`gpr::Coord`& F_trans); double :ref:`estimateRotationalAngle`(const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const :ref:`gpr::Coord`& F_rot_oriented); void :ref:`setProjectRotations`(bool enabled); void :ref:`setRotationBasis`(Eigen::MatrixXd basis); void :ref:`setRotationObservation`(const :ref:`gpr::Observation`* endpoint); void :ref:`bindRgminTranslation`(:ref:`gpr::optim::RgminStep`* session); double :ref:`calculateCurvature`(const :ref:`gpr::Coord`& G01, const :ref:`gpr::Coord`& orient); void :ref:`calculatePotential`(const uint8_t potential, :ref:`gpr::GaussianProcessRegression`* gpr_model, :ref:`gpr::Observation`& image1); }; .. _details-classdimer_1_1_dimer: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ :ref:`Dimer ` method. Construction ------------ .. index:: pair: function; Dimer .. _doxid-classdimer_1_1_dimer_1a196001521e3fd346a4262239b07d46a1: .. ref-code-block:: cpp :class: doxyrest-title-code-block Dimer(double separation, bool is_subsystem = false) Default constructor. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - separation - :ref:`Dimer ` separation * - is_subsystem - True when the dimer coordinates are a subset of a larger system. Skips rigid rotation/translation removal, which is not robust on partial coordinates. Methods ------- .. index:: pair: function; translate .. _doxid-classdimer_1_1_dimer_1a4b23b595b5ace2d8be589ce9b3bd91d1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void translate(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& F, const double curv, const :ref:`gpr::TransitionParameters`& param_trans, :ref:`gpr::LBFGSInfo`& transinfo, :ref:`gpr::Coord`& R_new) Translate dimer. The dimer is translated one step towards saddle point by the bound rgmin L-BFGS session (bindRgminTranslation), or by rgmin's empty-memory step when no session is bound. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - R - Coordinates of the middle point of the dimer. * - orient - Unit vector along the direction of the dimer. * - F - Force at the middle point of the dimer. * - curv - Curvature of energy along the direction of the dimer. * - param_trans - Predefined step length for convex regions, maximum step length. * - transinfo - Unused; the curvature pairs live in the rgmin session. * - R_new - Coordinates of the new middle point of the dimer. .. index:: pair: function; translateWithForce .. _doxid-classdimer_1_1_dimer_1a555122763b1e19d9cc77a9eddbcf7842: .. ref-code-block:: cpp :class: doxyrest-title-code-block void translateWithForce(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& force, const :ref:`gpr::TransitionParameters`& parameters, :ref:`gpr::LBFGSInfo`& history, :ref:`gpr::Coord`& output) Apply a caller-assembled dimer force through the same rgmin translation step. .. index:: pair: function; rotate .. _doxid-classdimer_1_1_dimer_1a82d6cde92d5c8f212ba336e6b2510335: .. ref-code-block:: cpp :class: doxyrest-title-code-block void rotate(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const uint8_t potential, const double T_anglerot, const bool estim_Curv, const :ref:`gpr::Observation`& all_obs, :ref:`gpr::GaussianProcessRegression`* gpr_model, :ref:`gpr::LBFGSInfo`& rotinfo, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1) Rotate dimer. The dimer is rotated one step towards its minimum energy orientation. The first call seeds the mode with rgmin's measured Rayleigh-Ritz plane solve; later calls with the same rotinfo continue a persistent sphere L-BFGS refinement of the curvature. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - R - Coordinates of the middle point of the dimer. * - orient - Unit vector along the direction of the dimer. * - G01 - Gradient at the middle point and image 1 of the dimer. * - potential - Potential and gradient function. * - T_anglerot - Unused; the caller owns rotation convergence. * - estim_Curv - If *true*, an estimate for the curvature along the direction of the dimer after the rotation is calculated. * - all_obs - Object of all observed points. * - gpr_model - Pointer to the GPR model. * - rotinfo - Structure with information on previous external iterations. * - orient_new - Unit vector along the direction of the dimer after optimal rotation. * - Curv - Estimate for the curvature along the direction of the dimer after the rotation (0 if estim_Curv = 0 or no rotation). * - image1 - Observation of the new observed location. .. index:: pair: function; rotateWithHessian .. _doxid-classdimer_1_1_dimer_1a2648d5d9afd6aac324a5781c593f6aae: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`RotationStepResult` rotateWithHessian(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const bool estim_Curv, const :ref:`Image1Evaluator`& image1_evaluator, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1, const :ref:`HessianVectorEvaluator`& hessian_evaluator) Minimize the analytic curvature in the seed and Hessian-residual plane, then query the resulting endpoint on the supplied potential. .. index:: pair: function; rotateWithRgminDimer .. _doxid-classdimer_1_1_dimer_1a5f2ec2dd6203fa0f6d5854f47116ac7a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`RotationStepResult` rotateWithRgminDimer(const :ref:`gpr::Coord`& R, const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const bool estim_Curv, const :ref:`Image1Evaluator`& image1_evaluator, :ref:`gpr::Coord`& orient_new, double& Curv, :ref:`gpr::Observation`& image1) Rotate through rgmin's dimer plane solve and query the resulting endpoint. The Hessian action overload uses a fixed linear operator at R; the image-only overload uses finite dimer differences. .. index:: pair: function; rotateForce .. _doxid-classdimer_1_1_dimer_1a478ef27287131bf7682fb14d995cc807: .. ref-code-block:: cpp :class: doxyrest-title-code-block void rotateForce(const :ref:`gpr::Coord`& G01, const :ref:`gpr::Coord`& orient, :ref:`gpr::Coord`& F_rot) Calculate rotational force acting on image 1 of the dimer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - G01 - Gradient vectors at the middle point and image 1 of the dimer. * - orient - Unit vector along the direction of the dimer. * - F_rot - Rotational force acting on image 1 of the dimer. .. index:: pair: function; setForceVariance .. _doxid-classdimer_1_1_dimer_1a9da0a135354dcf6f5d4d69534a4cc87e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setForceVariance(const Eigen::VectorXd& variance) UA-Dimer: per-degree-of-freedom force variance from the surrogate. When set and sized to the configuration, rotateForce removes the axial component in that Sigma^{-1} metric rather than the Euclidean one (Yu and Wang, DOI 10.48550/arxiv.2605.24401), so the rotation follows curvature the model resolves instead of the largest raw force difference. Unset leaves the classical arithmetic untouched. .. index:: pair: function; translateForce .. _doxid-classdimer_1_1_dimer_1a9d767cb4231664363d41a1f44c906084: .. ref-code-block:: cpp :class: doxyrest-title-code-block void translateForce(const :ref:`gpr::Coord`& F, const :ref:`gpr::Coord`& orient, :ref:`gpr::Coord`& F_trans) Calculate translational force acting on image 1 of the dimer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - F - Force at the middle point of the dimer. * - orient - Unit vector along the direction of the dimer. * - F_trans - Translational force acting on image 1 of the dimer. .. index:: pair: function; estimateRotationalAngle .. _doxid-classdimer_1_1_dimer_1af5e02df8b9e17b00e59f1e693363d29c: .. ref-code-block:: cpp :class: doxyrest-title-code-block double estimateRotationalAngle(const :ref:`gpr::Coord`& orient, const :ref:`gpr::Coord`& G01, const :ref:`gpr::Coord`& F_rot_oriented) Calculate a rough estimate of the optimal Rotation angle. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - orient - Unit vector along the direction of the dimer (before rotation). * - G01 - Gradient at the middle point and image 1 of the dimer (before rotation). Each point occupies one row in the field. * - F_rot_oriented - Oriented rotational force acting on image 1 of the dimer. .. rubric:: Returns: Rough estimate of the optimal Rotation angle. .. index:: pair: function; setProjectRotations .. _doxid-classdimer_1_1_dimer_1aa26a1aff0c909b89dbe2099c39a34736: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setProjectRotations(bool enabled) A fixed periodic cell admits translations but not rigid rotations. .. index:: pair: function; setRotationBasis .. _doxid-classdimer_1_1_dimer_1a87deb9e6f23a81a53cb67034e6194141: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setRotationBasis(Eigen::MatrixXd basis) Orthonormal columns span the allowed Cartesian rotation directions. .. index:: pair: function; setRotationObservation .. _doxid-classdimer_1_1_dimer_1aa2c12a7822a7b22ae34b69dd693ca0ea: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setRotationObservation(const :ref:`gpr::Observation`* endpoint) The observed endpoint supplies the sphere objective's energy origin. .. index:: pair: function; bindRgminTranslation .. _doxid-classdimer_1_1_dimer_1a2a381f5c2ad3114ccedc059db15d6a00: .. ref-code-block:: cpp :class: doxyrest-title-code-block void bindRgminTranslation(:ref:`gpr::optim::RgminStep`* session) The owner supplies a session that outlives each :ref:`Dimer ` call so accepted L-BFGS pairs persist across outer iterations. .. index:: pair: function; calculateCurvature .. _doxid-classdimer_1_1_dimer_1aa3a8bd2fd4c082e9be2d694a352fcd00: .. ref-code-block:: cpp :class: doxyrest-title-code-block double calculateCurvature(const :ref:`gpr::Coord`& G01, const :ref:`gpr::Coord`& orient) Calculate curvature of the energy along the dimer. Two-point estimate from the gradients at the midpoint and at image 1; also the index-1 witness a force-converged start must pass. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - G01 - Gradient at the middle point and image 1 of the dimer. * - orient - Unit vector along the direction of the dimer. .. rubric:: Returns: Curvature. .. index:: pair: function; calculatePotential .. _doxid-classdimer_1_1_dimer_1a88ae3d986e10bc510b96ceb4dfe2cbd2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculatePotential(const uint8_t potential, :ref:`gpr::GaussianProcessRegression`* gpr_model, :ref:`gpr::Observation`& image1) Calculate potential. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - potential - Potential type. * - gpr_model - Pointer to the GPR model (or nullptr). * - image1 - Observation to populate with the selected potential's energy and gradient.