Pair-additive energy with a cubic B-spline radial function. More...
#include <gpr/neb/PairSplineModel.h>
Public Member Functions | |
| PairSplineModel (Eigen::Index n_moving, Eigen::VectorXd frozen_positions, const std::array< double, 9 > &cell, double r_min, double r_cut, double spacing) | |
| Eigen::Index | nMoving () const noexcept |
| Eigen::Index | nBasis () const noexcept |
| double | cutoff () const noexcept |
| bool | ready () const noexcept |
| int | observations () const noexcept |
| void | setNoise (double energy_sigma, double gradient_sigma) |
| Noise standard deviations of the energy and gradient rows. | |
| void | setPrior (double weight_sigma, double curvature_sigma) |
| void | setTailSplit (double split, double refresh) |
| void | staleTail (int slot) |
| Marks the slot's tail sum for recomputation at the next evaluation. | |
| void | observe (const Eigen::VectorXd &x, double energy, const Eigen::VectorXd &gradient, int slot=0) |
| Accumulate one measurement into the normal equations. | |
| bool | fit () |
| Solve for the weights. Returns false without enough rows. | |
| double | gradientResidual () const noexcept |
| double | energy (const Eigen::VectorXd &x, Eigen::VectorXd *gradient, int slot=0) const |
| double | partialEnergy (const Eigen::VectorXd &x, const std::vector< char > &atom_mask, Eigen::VectorXd *gradient, int slot=0) const |
| double | maskedEnergy (const Eigen::VectorXd &x, const std::vector< char > &atom_mask, Eigen::VectorXd *gradient, int slot=0) const |
| Eigen::MatrixXd | hessian (const Eigen::VectorXd &x, const std::vector< Eigen::Index > &dofs, int slot=0) const |
| Hessian block over the listed coordinates at x. | |
| void | radial (double r, double &phi, double &dphi, double &d2phi) const |
| Radial function and its first two derivatives at r. | |
| double | minimumSeparation (const Eigen::VectorXd &x) const |
| Smallest moving-moving or moving-frozen separation at x. | |
| int | listBuilds () const noexcept |
| double | listSeconds () const noexcept |
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.
Definition at line 31 of file PairSplineModel.h.
| gpr::neb::PairSplineModel::PairSplineModel | ( | Eigen::Index | n_moving, |
| Eigen::VectorXd | frozen_positions, | ||
| const std::array< double, 9 > & | cell, | ||
| double | r_min, | ||
| double | r_cut, | ||
| double | spacing ) |
Definition at line 53 of file PairSplineModel.cpp.
|
inlinenoexcept |
Definition at line 45 of file PairSplineModel.h.
| double gpr::neb::PairSplineModel::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.
Definition at line 733 of file PairSplineModel.cpp.
| bool gpr::neb::PairSplineModel::fit | ( | ) |
Solve for the weights. Returns false without enough rows.
Definition at line 508 of file PairSplineModel.cpp.
|
inlinenoexcept |
Root-mean-square gradient residual of the retained measurements after the last fit (the fit quality on the force rows).
Definition at line 78 of file PairSplineModel.h.
| Eigen::MatrixXd gpr::neb::PairSplineModel::hessian | ( | const Eigen::VectorXd & | x, |
| const std::vector< Eigen::Index > & | dofs, | ||
| int | slot = 0 ) const |
Hessian block over the listed coordinates at x.
Definition at line 812 of file PairSplineModel.cpp.
|
inlinenoexcept |
Definition at line 180 of file PairSplineModel.h.
|
inlinenoexcept |
Definition at line 184 of file PairSplineModel.h.
| double gpr::neb::PairSplineModel::maskedEnergy | ( | const Eigen::VectorXd & | x, |
| const std::vector< char > & | 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.
Definition at line 706 of file PairSplineModel.cpp.
| double gpr::neb::PairSplineModel::minimumSeparation | ( | const Eigen::VectorXd & | x | ) | const |
Smallest moving-moving or moving-frozen separation at x.
Definition at line 76 of file PairSplineModel.cpp.
|
inlinenoexcept |
Definition at line 41 of file PairSplineModel.h.
|
inlinenoexcept |
Definition at line 37 of file PairSplineModel.h.
|
inlinenoexcept |
Definition at line 53 of file PairSplineModel.h.
| void gpr::neb::PairSplineModel::observe | ( | const Eigen::VectorXd & | x, |
| double | energy, | ||
| const Eigen::VectorXd & | gradient, | ||
| int | slot = 0 ) |
Accumulate one measurement into the normal equations.
Definition at line 484 of file PairSplineModel.cpp.
| double gpr::neb::PairSplineModel::partialEnergy | ( | const Eigen::VectorXd & | x, |
| const std::vector< char > & | 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.
Definition at line 774 of file PairSplineModel.cpp.
| void gpr::neb::PairSplineModel::radial | ( | double | r, |
| double & | phi, | ||
| double & | dphi, | ||
| double & | d2phi ) const |
Radial function and its first two derivatives at r.
Definition at line 172 of file PairSplineModel.cpp.
|
inlinenoexcept |
Definition at line 49 of file PairSplineModel.h.
| void gpr::neb::PairSplineModel::setNoise | ( | double | energy_sigma, |
| double | gradient_sigma ) |
Noise standard deviations of the energy and gradient rows.
Definition at line 96 of file PairSplineModel.cpp.
| void gpr::neb::PairSplineModel::setPrior | ( | double | weight_sigma, |
| double | curvature_sigma ) |
Prior standard deviation of the weights and of their second differences along the knot grid.
Definition at line 102 of file PairSplineModel.cpp.
| void gpr::neb::PairSplineModel::setTailSplit | ( | double | split, |
| double | refresh ) |
Pairs beyond split are summed once per slot and held as a linear model until 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.
Definition at line 108 of file PairSplineModel.cpp.
| void gpr::neb::PairSplineModel::staleTail | ( | int | slot | ) |
Marks the slot's tail sum for recomputation at the next evaluation.
Definition at line 116 of file PairSplineModel.cpp.