11#ifndef RD_FOURTHDIMCONTRIBS_H
12#define RD_FOURTHDIMCONTRIBS_H
44 dp_forceField = owner;
48 d_contribs.emplace_back(idx, weight);
54 constexpr unsigned int ffdim = 4;
56 for (
const auto &contrib : d_contribs) {
57 unsigned int pid = contrib.idx * ffdim + 3;
58 res += contrib.weight * pos[pid] * pos[pid];
65 void getGrad(
double *pos,
double *grad)
const override {
67 constexpr unsigned int ffdim = 4;
68 for (
const auto &contrib : d_contribs) {
69 unsigned int pid = contrib.idx * ffdim + 3;
70 grad[pid] += contrib.weight * pos[pid];
76 bool empty()
const {
return d_contribs.empty(); }
77 unsigned int size()
const {
return d_contribs.size(); }
80 std::vector<FourthDimContribsParams> d_contribs;
#define PRECONDITION(expr, mess)
FourthDimContribs()=default
FourthDimContribs * copy() const override
return a copy
FourthDimContribs(ForceFields::ForceField *owner)
Constructor.
unsigned int size() const
void addContrib(unsigned int idx, double weight)
double getEnergy(double *pos) const override
return the contribution of this contrib to the energy of a given state
void getGrad(double *pos, double *grad) const override
abstract base class for contributions to ForceFields
A class to store forcefields and handle minimization.
unsigned int dimension() const
returns the dimension of the forcefield
#define RDKIT_DISTGEOMETRY_EXPORT
FourthDimContribsParams(unsigned int idx, double w)