#include <Potential.h>
Public Types | |
| enum class | PotLayout : unsigned { InProcess = 1u << 0 , NeedsWorkingDirectory = 1u << 1 , Subprocess = 1u << 2 } |
| How the pot is executed. Combine with bitwise or. More... | |
Public Member Functions | |
| void | recordForceCall () noexcept |
| Charge one evaluated geometry to this potential and its owning registry. | |
| IPotRegistry & | registry () const noexcept |
| The registry this potential charges its force calls to. | |
| Potential (PotType a_ptype) | |
| Production default: construction-scope registry, else PotRegistry::get(). | |
| Potential (PotType a_ptype, IPotRegistry ®istry) | |
| Test seam: injected registry, no process-default get() counters. | |
| Potential (PotType a_ptype, const Parameters &p) | |
| Potential (const Parameters &a_params) | |
| virtual | ~Potential () |
| virtual void | force (long nAtoms, const double *positions, const int *atomicNrs, double *forces, double *energy, double *variance, const double *box)=0 |
| void | force (std::span< const double > positions, std::span< const int > atomicNrs, std::span< double > forces, double *energy, double *variance, std::span< const double > box) |
| C++ call site: size-checked view over the raw FFI force(). | |
| virtual void | setFixedMask (long nAtoms, const double *isFixed) |
| Optional frozen-atom mask (nAtoms*3, 1.0 = fixed). | |
| std::tuple< double, AtomMatrix > | get_ef (const AtomMatrix &pos, const VectorXi &atmnrs, const Matrix3d &box) |
| PotType | getType () const |
| virtual unsigned long long | surfaceEpoch () const noexcept |
| Host-visible surface generation. | |
| virtual double | finiteCutoff () const noexcept |
| Finite interaction range in position length units. | |
| virtual bool | isSurrogate () const noexcept |
| Whether this is a surrogate (GP) potential. | |
| virtual bool | requiresIsolatedMoleculeLayout () const noexcept |
| True for molecular QM / non-PBC backends (NWChem socket, ASE ORCA/NWChem, …). | |
| virtual bool | isThreadSafe () const noexcept |
| Whether this potential's force() can be called from multiple threads on the SAME instance. | |
| virtual unsigned | layoutFlags () const noexcept |
| virtual bool | isSharedInstanceThreadSafe () const noexcept |
| Conservative gate for sharing one Potential instance across threads. | |
| virtual bool | needsPerImageInstance () const noexcept |
| Whether NEB should create separate Potential instances per image for true parallel force evaluation. | |
| virtual std::shared_ptr< Potential > | clonePotential () const |
| Independent instance that does not reload from disk. | |
| virtual bool | supportsBatchEvaluation () const noexcept |
| Whether this potential supports batched evaluation of N systems in a single call. | |
| virtual void | bindBand (const std::vector< std::shared_ptr< Matter > > &) |
| NEB calls this with the finished band before the first force evaluation, so a host surface can name each image. | |
| virtual bool | forwardsStoredCell () const noexcept |
| A host that owns the cell reads the stored matrix. | |
| virtual bool | computesStress () const noexcept |
| True when force() leaves a Cauchy stress that cauchyStress() can read until the next force() on this instance. | |
| virtual Matrix3d | cauchyStress () const |
| Cauchy stress in eV/Angstrom^3. | |
| virtual void | forceBatchOwned (long nSystems, long nAtoms, const double *const *positions, const int *const *atomicNrs, double *const *forces, double *energies, double *variances, const double *const *boxes, const long *owners) |
| Evaluate forces for N systems in a single call. | |
| 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) |
| virtual double | hessianRange () const noexcept |
| Distance beyond which every Hessian block between two atoms is exactly zero, in position length units. | |
Public Attributes | |
| std::atomic< size_t > | forceCallCounter |
Protected Attributes | |
| PotType | ptype |
Private Attributes | |
| IPotRegistry & | registry_ |
| std::shared_ptr< RegistryLifetime > | lifetime_ |
| uint64_t | m_registry_id |
| IPotRegistry::TimePoint | m_created_at |
| bool | force_serial_ {false} |
Definition at line 45 of file Potential.h.
|
strong |
How the pot is executed. Combine with bitwise or.
| Enumerator | |
|---|---|
| InProcess | |
| NeedsWorkingDirectory | |
| Subprocess | |
Definition at line 154 of file Potential.h.
|
explicit |
Production default: construction-scope registry, else PotRegistry::get().
Definition at line 29 of file PotentialParams.cpp.
|
inline |
Test seam: injected registry, no process-default get() counters.
Definition at line 69 of file Potential.h.
| eonc::Potential::Potential | ( | PotType | a_ptype, |
| const Parameters & | p ) |
Definition at line 33 of file PotentialParams.cpp.
|
explicit |
Definition at line 38 of file PotentialParams.cpp.
|
inlinevirtual |
Definition at line 80 of file Potential.h.
|
inlinevirtual |
NEB calls this with the finished band before the first force evaluation, so a host surface can name each image.
Reimplemented in eonc::HostSurfacePotential.
Definition at line 197 of file Potential.h.
|
inlinenodiscardvirtual |
Cauchy stress in eV/Angstrom^3.
sigma = (1/V) dE/dε for the right strain h <- h (I+ε) at fixed fractional coordinates.
Reimplemented in LAMMPSPot, RgpotAdapter< RPot >, and SocketNWChemPot.
Definition at line 212 of file Potential.h.
|
inlinenodiscardvirtual |
Independent instance that does not reload from disk.
nullptr means the caller should use makePotential().
Reimplemented in MetatomicPotential.
Definition at line 184 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
True when force() leaves a Cauchy stress that cauchyStress() can read until the next force() on this instance.
Reimplemented in LAMMPSPot, RgpotAdapter< RPot >, and SocketNWChemPot.
Definition at line 208 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Finite interaction range in position length units.
Deprecated. Override hessianRange() instead. The default hessianRange() returns this value, so an existing override still colors the finite-difference Hessian. 0 means the range is unknown.
Definition at line 134 of file Potential.h.
|
pure virtual |
|
inline |
C++ call site: size-checked view over the raw FFI force().
Definition at line 96 of file Potential.h.
|
inlinevirtual |
Reimplemented in ASE, eonc::HostSurfacePotential, eonc::tunneling::RingPolymerPotential, MetatomicPotential, RgpotAdapter< RPot >, and RgpotPot.
Definition at line 234 of file Potential.h.
|
inlinevirtual |
Evaluate forces for N systems in a single call.
Default: loops over force(). Override in potentials that support native batching (e.g. MetatomicPotential uses a single model.forward() for all N systems). forceBatch with an owner hint per system: a stable identity (a NEB image index) a potential that spreads a batch over calculators can route by, so the same calculator keeps seeing the same image and its stored state stays close to it. Default: the hint is ignored.
Reimplemented in RgpotPot.
Definition at line 223 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
A host that owns the cell reads the stored matrix.
Pots that infer periodic boundaries from a non-zero box keep seeing a zero box when the image is not periodic.
Reimplemented in eonc::HostSurfacePotential.
Definition at line 202 of file Potential.h.
| std::tuple< double, AtomMatrix > eonc::Potential::get_ef | ( | const AtomMatrix & | pos, |
| const VectorXi & | atmnrs, | ||
| const Matrix3d & | box ) |
Definition at line 114 of file Potential.cpp.
|
inlinenodiscard |
Definition at line 118 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Distance beyond which every Hessian block between two atoms is exactly zero, in position length units.
The default returns finiteCutoff(), so an override of that deprecated method still colors. 0, or any non-finite value, means the range is unknown. The finite-difference Hessian then stays one column per coordinate. A potential opts in by overriding this. An interaction cutoff is not this distance: a many-body kernel is nonzero out to twice its cutoff, and a kernel that merely has a cutoff field stays at 0.
Reimplemented in RgpotAdapter< RPot >.
Definition at line 259 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Conservative gate for sharing one Potential instance across threads.
Defaults to isThreadSafe(); backends whose state lives outside the wrapper instance (global/common-block Fortran entry points) override this to false on their own classes.
Reimplemented in RgpotAdapter< RPot >.
Definition at line 167 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Whether this is a surrogate (GP) potential.
Override in SurrogatePotential.
Reimplemented in eonc::SurrogatePotential.
Definition at line 138 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Whether this potential's force() can be called from multiple threads on the SAME instance.
Python-based potentials return false. Potentials with internal mutex (MetatomicPotential) return true but serialize internally – use needsPerImageInstance() to check if separate instances would enable true parallelism.
Reimplemented in ASE, ASENwchemPot, ASEOrcaPot, CatLearnPot, eonc::MetatomicDynPot, eonc::tunneling::RingPolymerPotential, ExtPot, GPRPotential, MetatomicPotential, MPIPot, RgpotAdapter< RPot >, RgpotPot, SocketNWChemPot, and VASP.
Definition at line 151 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
|
inlinenodiscardvirtualnoexcept |
Whether NEB should create separate Potential instances per image for true parallel force evaluation.
When true, NEB calls makePotential() once per image instead of sharing one instance. Override in potentials that use internal mutexes (e.g. MetatomicPotential).
Reimplemented in ASE, ASENwchemPot, ASEOrcaPot, eonc::MetatomicDynPot, ExtPot, LAMMPSPot, MetatomicPotential, RgpotAdapter< RPot >, SocketNWChemPot, and VASP.
Definition at line 178 of file Potential.h.
|
noexcept |
Charge one evaluated geometry to this potential and its owning registry.
Definition at line 41 of file PotentialParams.cpp.
|
inlinenodiscardnoexcept |
|
inlinenodiscardvirtualnoexcept |
True for molecular QM / non-PBC backends (NWChem socket, ASE ORCA/NWChem, …).
Callers must not apply periodic wraps that can tear molecules (#188).
Reimplemented in ASENwchemPot, ASEOrcaPot, eonc::tunneling::RingPolymerPotential, RgpotAdapter< RPot >, RgpotPot, and SocketNWChemPot.
Definition at line 142 of file Potential.h.
|
inlinevirtual |
Optional frozen-atom mask (nAtoms*3, 1.0 = fixed).
Default no-op. Matter calls this immediately before force() so wrappers that need it (LAMMPS setforce) see Atom.fixed without changing force().
Reimplemented in LAMMPSPot.
Definition at line 110 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Whether this potential supports batched evaluation of N systems in a single call.
When true, callers (NEB, Dimer) should use forceBatch() instead of N individual force() calls for better GPU utilization.
Reimplemented in ASE, eonc::HostSurfacePotential, eonc::tunneling::RingPolymerPotential, MetatomicPotential, RgpotAdapter< RPot >, and RgpotPot.
Definition at line 191 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Host-visible surface generation.
A learning host increments this on every refit; Matter keys its energy and variance caches on the value so identical positions after a refit cannot return a stale energy or variance. Static pots stay 0.
Reimplemented in eonc::HostSurfacePotential.
Definition at line 124 of file Potential.h.
|
private |
Definition at line 54 of file Potential.h.
| std::atomic<size_t> eonc::Potential::forceCallCounter |
Definition at line 57 of file Potential.h.
|
private |
Definition at line 51 of file Potential.h.
|
private |
Definition at line 53 of file Potential.h.
|
private |
Definition at line 52 of file Potential.h.
|
protected |
Definition at line 47 of file Potential.h.
|
private |
Definition at line 50 of file Potential.h.