#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 | |
| 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 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 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) |
Public Attributes | |
| std::atomic< size_t > | forceCallCounter |
Protected Attributes | |
| PotType | ptype |
Private Attributes | |
| IPotRegistry & | registry_ |
| uint64_t | m_registry_id |
| IPotRegistry::TimePoint | m_created_at |
| bool | force_serial_ {false} |
Definition at line 42 of file Potential.h.
|
strong |
How the pot is executed. Combine with bitwise or.
| Enumerator | |
|---|---|
| InProcess | |
| NeedsWorkingDirectory | |
| Subprocess | |
Definition at line 129 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 59 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 70 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 >, SocketNWChemPot, and XTBPot.
Definition at line 176 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 159 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 >, SocketNWChemPot, and XTBPot.
Definition at line 172 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Finite interaction range in position length units.
0 means the potential is not finite-cutoff; the FD Hessian then stays one column per coordinate.
Reimplemented in RgpotAdapter< RPot >.
Definition at line 109 of file Potential.h.
|
pure virtual |
Implemented in AMS, AMS_IO, ASE, ASENwchemPot, ASEOrcaPot, CatLearnPot, EAM, EffectiveMediumTheory, eonc::MetatomicDynPot, ExtPot, GPRPotential, LAMMPSPot, MetatomicPotential, MPIPot, RgpotAdapter< RPot >, RgpotPot, SocketNWChemPot, SpceCcl, Tip4p, Tip4p_Pt, VASP, and XTBPot.
|
inline |
C++ call site: size-checked view over the raw FFI force().
Definition at line 82 of file Potential.h.
|
inlinevirtual |
Reimplemented in ASE, MetatomicPotential, RgpotAdapter< RPot >, and RgpotPot.
Definition at line 198 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 187 of file Potential.h.
| std::tuple< double, AtomMatrix > eonc::Potential::get_ef | ( | const AtomMatrix & | pos, |
| const VectorXi & | atmnrs, | ||
| const Matrix3d & | box ) |
Definition at line 118 of file Potential.cpp.
|
inlinenodiscard |
Definition at line 104 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 EAM, and EffectiveMediumTheory.
Definition at line 142 of file Potential.h.
|
inlinenodiscardvirtualnoexcept |
Whether this is a surrogate (GP) potential.
Override in SurrogatePotential.
Reimplemented in eonc::SurrogatePotential.
Definition at line 113 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, ExtPot, GPRPotential, MetatomicPotential, MPIPot, RgpotAdapter< RPot >, RgpotPot, SocketNWChemPot, VASP, and XTBPot.
Definition at line 126 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, VASP, and XTBPot.
Definition at line 153 of file Potential.h.
|
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, RgpotAdapter< RPot >, RgpotPot, and SocketNWChemPot.
Definition at line 117 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 96 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, MetatomicPotential, RgpotAdapter< RPot >, and RgpotPot.
Definition at line 166 of file Potential.h.
|
private |
Definition at line 50 of file Potential.h.
| std::atomic<size_t> eonc::Potential::forceCallCounter |
Definition at line 53 of file Potential.h.
|
private |
Definition at line 49 of file Potential.h.
|
private |
Definition at line 48 of file Potential.h.
|
protected |
Definition at line 44 of file Potential.h.
|
private |
Definition at line 47 of file Potential.h.