31 double spring,
double energyShift,
32 std::vector<double> eta,
bool fold, VectorXd modeDir);
34 void force(
long nAtoms,
const double *positions,
const int *atomicNrs,
35 double *forces,
double *energy,
double *variance,
36 const double *box)
override;
38 void forceBatch(
long nSystems,
long nAtoms,
const double *
const *positions,
39 const int *
const *atomicNrs,
double *
const *forces,
40 double *energies,
double *variances,
41 const double *
const *boxes)
override;
53 [[nodiscard]]
bool isThreadSafe() const noexcept
override {
return false; }
59 throw std::invalid_argument(
"physical bath uses the full ring");
66 if (!weights.empty()) {
67 if (
fold_ ||
static_cast<long>(weights.size()) !=
nBeads_) {
68 throw std::invalid_argument(
69 "link weights require one value per full-ring bead");
71 for (
double value : weights) {
72 if (!(value > 0.0) || !std::isfinite(value)) {
73 throw std::invalid_argument(
74 "link weights must be positive and finite");
81 void packActive(
const std::vector<VectorXd> &active,
double *positions)
const;
82 [[nodiscard]] std::vector<VectorXd>
unpack(
const double *positions)
const;
86 void fixLayout(
long nBeads,
long dof,
bool fold,
const VectorXd &modeDir);
87 [[nodiscard]]
double writeForces(
const std::vector<VectorXd> &grad,
88 const double *positions,
89 double *forces)
const;
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Potential(PotType a_ptype)
Production default: construction-scope registry, else PotRegistry::get().
void forceBatch(long nSystems, long nAtoms, const double *const *positions, const int *const *atomicNrs, double *const *forces, double *energies, double *variances, const double *const *boxes) override
bool requiresIsolatedMoleculeLayout() const noexcept override
True for molecular QM / non-PBC backends (NWChem socket, ASE ORCA/NWChem, …).
double writeForces(const std::vector< VectorXd > &grad, const double *positions, double *forces) const
bool isThreadSafe() const noexcept override
The bead batch is a caller-supplied function and is not safe to enter from two threads.
void packActive(const std::vector< VectorXd > &active, double *positions) const
std::vector< double > discretization_
bool supportsBatchEvaluation() const noexcept override
Whether this potential supports batched evaluation of N systems in a single call.
std::vector< VectorXd > unpack(const double *positions) const
void packMode(const VectorXd &dir, AtomMatrix &mode) const
std::vector< double > eta_
void force(long nAtoms, const double *positions, const int *atomicNrs, double *forces, double *energy, double *variance, const double *box) override
void setDiscretization(std::vector< double > weights)
RingPolymerPotential(BatchPotential beads, long nBeads, long dof, double spring, double energyShift, std::vector< double > eta, bool fold, VectorXd modeDir)
long structureAtoms() const
void fixLayout(long nBeads, long dof, bool fold, const VectorXd &modeDir)
void setPhysicalBath(std::shared_ptr< const PhysicalQuadraticBath > bath)
std::shared_ptr< const PhysicalQuadraticBath > physicalBath_
std::function< void(const std::vector< VectorXd > &q, std::vector< double > &v, std::vector< VectorXd > &grad)> BatchPotential
V (eV) and dV/dq (eV / (amu^0.5 Angstrom)) at every point of q, all in one call so a potential can sp...