class rgpot::ExprPot¶
Overview¶
Energy \(E = f(E_0, E_1, \ldots)\) over named child potentials. More…
#include <ExprPot.hpp>
class ExprPot: public rgpot::Potential< ExprPot > {
public:
// typedefs
typedef std::pair<std::string, std::unique_ptr<PotentialBase>> Term;
// structs
struct Impl;
// construction
ExprPot(std::string expression, std::vector<Term> terms);
ExprPot(const ExprPot&);
ExprPot(ExprPot&& other);
~ExprPot();
// methods
ExprPot& operator=(const ExprPot&);
ExprPot& operator=(ExprPot&& other);
void forceImpl(const ForceInput& in, ForceOut* out) const;
virtual PotCaps caps() const;
virtual uint64_t paramsKey() const;
const std::string& expression() const;
double dEnergyDTerm(const std::string& name) const;
};
Detailed Documentation¶
Energy \(E = f(E_0, E_1, \ldots)\) over named child potentials.
The constructor parses expression with Lepton::Parser::parse, compiles the energy once, and compiles ParsedExpression::differentiate(name) once per term. Unknown, duplicate, unused, or non-identifier names fail closed before any force call. Forces are the chain rule \(F = \sum_i (\partial f/\partial E_i)\, F_i\).
Methods¶
virtual PotCaps caps() const
Concurrency and evaluation capabilities of this potential.
Multi-threaded callers (NEB images, dimer endpoints) derive their sharing and cloning policy from this instead of hard-coded lists.
virtual uint64_t paramsKey() const
Fingerprint of the potential’s parameter set.
Mixed into the result-cache key so results never cross parameter sets. Implementations hash their config field by field (see ParamHash.hpp) plus a kernel-version salt that changes whenever the numerics change. The default (0) suits parameter-free potentials whose numerics never changed.
double dEnergyDTerm(const std::string& name) const
Analytic \(\partial f/\partial E_{\mathrm{name}}\) from the construct-time compiled derivative, evaluated at the last child energies (zero if no force call has run).