.. index:: pair: class; gpr::neb::PairSplineModel .. _doxid-classgpr_1_1neb_1_1_pair_spline_model: class gpr::neb::PairSplineModel =============================== .. toctree:: :hidden: struct_gpr_neb_PairSplineModel_List.rst struct_gpr_neb_PairSplineModel_Pair.rst Overview ~~~~~~~~ Pair-additive energy with a cubic B-spline radial function. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class PairSplineModel { public: // structs struct :ref:`List`; struct :ref:`Pair`; // construction :target:`PairSplineModel`(Eigen::Index n_moving, Eigen::VectorXd frozen_positions, const std::array& cell, double r_min, double r_cut, double spacing); // methods Eigen::Index :target:`nMoving`() const; Eigen::Index :target:`nBasis`() const; double :target:`cutoff`() const; bool :target:`ready`() const; int :target:`observations`() const; void :ref:`setNoise`(double energy_sigma, double gradient_sigma); void :ref:`setPrior`(double weight_sigma, double curvature_sigma); void :ref:`setTailSplit`(double split, double refresh); void :ref:`staleTail`(int slot); void :ref:`observe`(const Eigen::VectorXd& x, double energy, const Eigen::VectorXd& gradient, int slot = 0); bool :ref:`fit`(); double :ref:`gradientResidual`() const; double :ref:`energy`(const Eigen::VectorXd& x, Eigen::VectorXd* gradient, int slot = 0) const; double :ref:`partialEnergy`(const Eigen::VectorXd& x, const std::vector& atom_mask, Eigen::VectorXd* gradient, int slot = 0) const; double :ref:`maskedEnergy`(const Eigen::VectorXd& x, const std::vector& atom_mask, Eigen::VectorXd* gradient, int slot = 0) const; Eigen::MatrixXd :ref:`hessian`(const Eigen::VectorXd& x, const std::vector& dofs, int slot = 0) const; void :ref:`radial`(double r, double& phi, double& dphi, double& d2phi) const; double :ref:`minimumSeparation`(const Eigen::VectorXd& x) const; int :target:`listBuilds`() const; double :target:`listSeconds`() const; }; .. _details-classgpr_1_1neb_1_1_pair_spline_model: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Pair-additive energy with a cubic B-spline radial function. E(x) = c + sum over pairs within the cutoff of phi(r), with phi a linear combination of cardinal cubic B-splines on a uniform knot grid. The weights are the posterior mean of a Bayesian linear model fitted to every measured energy and gradient, which makes the model the mean of a Gaussian process with a degenerate kernel. Pairs run over the moving atoms and between moving and frozen atoms under the minimum image convention of the cell; frozen-frozen pairs are a constant. A Verlet list with a skin keeps the per-call cost at the listed pairs between rebuilds. Methods ------- .. index:: pair: function; setNoise .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a19477f8de61d29a4f4844fae38da34b4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setNoise(double energy_sigma, double gradient_sigma) Noise standard deviations of the energy and gradient rows. .. index:: pair: function; setPrior .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a15a4b6466e5a557e3268268b0aa44394: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setPrior(double weight_sigma, double curvature_sigma) Prior standard deviation of the weights and of their second differences along the knot grid. .. index:: pair: function; setTailSplit .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a95d6067bfcaca35f3ba3cfdb1af283bb: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setTailSplit(double split, double refresh) Pairs beyond ``split`` are summed once per slot and held as a linear model until :ref:`staleTail() `, a list rebuild, a refit, or (when ``refresh`` is positive) an atom moving farther than ``refresh`` from that sum. A split of 0 evaluates every pair on every call. .. index:: pair: function; staleTail .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1ac4665194c3903e9307754bba3dbcf449: .. ref-code-block:: cpp :class: doxyrest-title-code-block void staleTail(int slot) Marks the slot's tail sum for recomputation at the next evaluation. .. index:: pair: function; observe .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a6d472cb4328ac77f2d8b9f5dfad602b2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void observe(const Eigen::VectorXd& x, double energy, const Eigen::VectorXd& gradient, int slot = 0) Accumulate one measurement into the normal equations. .. index:: pair: function; fit .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a5cde085fe4a6854f21236b6eec06bd7c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool fit() Solve for the weights. Returns false without enough rows. .. index:: pair: function; gradientResidual .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a29b9673b146ffc5629907f4f593a0812: .. ref-code-block:: cpp :class: doxyrest-title-code-block double gradientResidual() const Root-mean-square gradient residual of the retained measurements after the last fit (the fit quality on the force rows). .. index:: pair: function; energy .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a1bddc943ee78758ba00c58baa505090f: .. ref-code-block:: cpp :class: doxyrest-title-code-block double energy(const Eigen::VectorXd& x, Eigen::VectorXd* gradient, int slot = 0) const Energy and, when requested, the gradient on every moving coordinate. ``slot`` names the neighbour list to reuse: callers that evaluate several geometries in turn, such as band images, keep one list each. .. index:: pair: function; partialEnergy .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1ae284c99ad63f1da44e6b6de9ac0c5d7f: .. ref-code-block:: cpp :class: doxyrest-title-code-block double partialEnergy(const Eigen::VectorXd& x, const std::vector& atom_mask, Eigen::VectorXd* gradient, int slot = 0) const Energy restricted to the pairs that involve one of ``atoms``, with the gradient on those atoms' coordinates written into ``gradient`` at the atoms' flat positions. The omitted pairs are constant while the other atoms stay put. .. index:: pair: function; maskedEnergy .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1ad62c19923f224527fe2ecf943db9214f: .. ref-code-block:: cpp :class: doxyrest-title-code-block double maskedEnergy(const Eigen::VectorXd& x, const std::vector& atom_mask, Eigen::VectorXd* gradient, int slot = 0) const The same sum over the slot's flat arrays, from an index list of the pairs that touch a masked atom kept with the slot while the mask and the list stand; the gradient lands on every atom those pairs touch. .. index:: pair: function; hessian .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1abe2b01a1a20e7316ceecb95a7994ae0b: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd hessian(const Eigen::VectorXd& x, const std::vector& dofs, int slot = 0) const Hessian block over the listed coordinates at x. .. index:: pair: function; radial .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1a88a35027ef2995d4a5594fbb50329e33: .. ref-code-block:: cpp :class: doxyrest-title-code-block void radial(double r, double& phi, double& dphi, double& d2phi) const Radial function and its first two derivatives at r. .. index:: pair: function; minimumSeparation .. _doxid-classgpr_1_1neb_1_1_pair_spline_model_1aa2fbe7b0938778a9ac27fa3012dc652b: .. ref-code-block:: cpp :class: doxyrest-title-code-block double minimumSeparation(const Eigen::VectorXd& x) const Smallest moving-moving or moving-frozen separation at x.