46 :
Potential(a_params.potential_options.potential) {}
55 void virtual force(
long nAtoms,
const double *positions,
const int *atomicNrs,
56 double *forces,
double *energy,
double *variance,
57 const double *box) = 0;
59 std::tuple<double, AtomMatrix>
66 [[nodiscard]]
virtual bool isSurrogate() const noexcept {
return false; }
79 [[nodiscard]]
virtual bool isThreadSafe() const noexcept {
return true; }
109 const double *
const *positions,
110 const int *
const *atomicNrs,
double *
const *forces,
111 double *energies,
double *variances,
112 const double *
const *boxes) {
113 for (
long i = 0; i < nSystems; i++) {
115 force(nAtoms, positions[i], atomicNrs[i], forces[i], &energies[i], &var,
Eigen::Matrix< double, 3, 3, eOnStorageOrder > Matrix3d
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
void on_destroyed(uint64_t id, PotType t, size_t force_calls, TimePoint created_at)
static PotRegistry & get() noexcept
Process-lifetime singleton.
void on_force_call(PotType t) noexcept
Clock::time_point TimePoint
Potential(PotType a_ptype, const Parameters &)
std::atomic< size_t > forceCallCounter
virtual bool supportsBatchEvaluation() const noexcept
Whether this potential supports batched evaluation of N systems in a single call.
virtual void force(long nAtoms, const double *positions, const int *atomicNrs, double *forces, double *energy, double *variance, const double *box)=0
virtual bool isSharedInstanceThreadSafe() const noexcept
Conservative gate for sharing one Potential instance across threads.
virtual bool isSurrogate() const noexcept
Whether this is a surrogate (GP) potential.
virtual bool needsPerImageInstance() const noexcept
Whether NEB should create separate Potential instances per image for true parallel force evaluation.
PotRegistry::TimePoint m_created_at
virtual 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)
Evaluate forces for N systems in a single call.
std::tuple< double, AtomMatrix > get_ef(const AtomMatrix &pos, const VectorXi &atmnrs, const Matrix3d &box)
virtual bool requiresIsolatedMoleculeLayout() const noexcept
True for molecular QM / non-PBC backends (NWChem socket, ASE ORCA/NWChem, …).
Potential(const Parameters &a_params)
virtual bool isThreadSafe() const noexcept
Whether this potential's force() can be called from multiple threads on the SAME instance.
Potential(PotType a_ptype)
std::shared_ptr< Potential > makePotential(const Parameters ¶ms)
RAII resource manager for the ARTn C library with global synchronization.