.. index:: pair: class; gpr::optim::RgminStep .. _doxid-classgpr_1_1optim_1_1_rgmin_step: class gpr::optim::RgminStep =========================== .. toctree:: :hidden: enum_gpr_optim_RgminStep_Objective.rst struct_gpr_optim_RgminStep_PairRecord.rst Overview ~~~~~~~~ One bounded quasi-Newton step from a persistent rgmin session. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class RgminStep { public: // enums enum :ref:`Objective`; // structs struct :ref:`PairRecord`; // construction :target:`RgminStep`(); :target:`RgminStep`(const RgminStep&); :target:`~RgminStep`(); // methods static std::vector<:ref:`PairRecord`>*& :ref:`pairTrace`(); :ref:`RgminStep`& :target:`operator=`(const :ref:`RgminStep`&); void :ref:`forget`(); bool :target:`ready`() const; std::size_t :ref:`pairCount`() const; bool :ref:`step`(Eigen::VectorXd& x, const Eigen::VectorXd& gradient, double max_move, double empty_scale, :ref:`Objective` objective = :ref:`Objective::Unspecified`); }; .. _details-classgpr_1_1optim_1_1_rgmin_step: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ One bounded quasi-Newton step from a persistent rgmin session. The removed in-tree LBFGS returned a direction from its own two-loop and the caller applied it as the step, rescaling afterwards only when the result was longer than max_step_length. Nothing bounded a step that was shorter than that but wrong, and a non-finite direction reached the geometry before anything checked it. The caller owns the curvature pairs. A dimer supplies one gradient per outer iteration, and a stepping entry that evaluates a trial point is handed that same frozen gradient, so it records y = 0 and the two-loop degenerates. push_pair takes the pair the caller already knows from its own previous outer, and search_direction returns d = -H g without evaluating anything. Methods ------- .. index:: pair: function; pairTrace .. _doxid-classgpr_1_1optim_1_1_rgmin_step_1a771c9954789edb4b2e383852f2fc9907: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::vector<:ref:`PairRecord`>*& pairTrace() Receives a :ref:`PairRecord ` for every pair pushed on this thread while it is set. For tests; null in production. .. index:: pair: function; forget .. _doxid-classgpr_1_1optim_1_1_rgmin_step_1afe35c830721c8e67830255518d8b66de: .. ref-code-block:: cpp :class: doxyrest-title-code-block void forget() Drop the curvature history; the next step starts from steepest descent. .. index:: pair: function; pairCount .. _doxid-classgpr_1_1optim_1_1_rgmin_step_1a26b9e3cc394a013771c1764873183f1c: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::size_t pairCount() const Curvature pairs the session currently holds. .. index:: pair: function; step .. _doxid-classgpr_1_1optim_1_1_rgmin_step_1aba2853ebef4bdb1092ccc5e26af1373e: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool step(Eigen::VectorXd& x, const Eigen::VectorXd& gradient, double max_move, double empty_scale, :ref:`Objective` objective = :ref:`Objective::Unspecified`) x is the geometry, read and written in place: an L-BFGS history is built from successive iterates, so restarting x at a fixed point would pair curvature across unrelated geometries. ``max_move`` bounds the norm of the displacement, matching what the dimer's max_step_length means; a per-atom bound lets the total exceed it. Non-positive leaves it unbounded. Returns false and leaves x untouched when the session refuses the step, so the caller can fall back rather than propagate a non-finite geometry. One bounded quasi-Newton step from the gradient at x. x is the geometry, read and written in place. ``empty_scale`` scales the first step taken on empty memory, where the two-loop is plain steepest descent: an unscaled -g overshoots the move bound on every outer and the search cycles instead of settling. Returns false and leaves x untouched when the direction is unusable, so the caller falls back rather than propagating a non-finite geometry. A refusal after this call pushed a pair forgets the whole session: rgmin cannot pop a single pair, so every stored pair and the previous-point anchor are cleared and the next step starts from empty memory. ``objective`` names the function ``gradient`` belongs to. When it differs from the objective of the previous step the curvature history is dropped and no pair is formed, so the history only ever holds pairs whose two gradients are of one objective.