Wraps one rgpot kernel as an eOn Potential. More...
#include <RgpotAdapter.h>
Public Member Functions | |
| template<class Cfg> requires (!std::is_base_of_v<eonc::IPluginLoader, std::remove_cvref_t<Cfg>>) | |
| RgpotAdapter (eonc::PotType ptype, const eonc::Parameters ¶ms, const Cfg &cfg) | |
| Kernels construct in place from their config: several hold mutexes or other immovable state, so the adapter never copies or moves them. | |
| template<class Cfg> requires (!std::is_base_of_v<eonc::IPluginLoader, std::remove_cvref_t<Cfg>>) | |
| RgpotAdapter (eonc::PotType ptype, const eonc::Parameters ¶ms, const Cfg &cfg, eonc::IPluginLoader &loader) | |
| Test seam: injected loader, no process-default search-path mutation. | |
| RgpotAdapter (eonc::PotType ptype, const eonc::Parameters ¶ms) | |
| Kernels with no configuration surface default-construct in place. | |
| RgpotAdapter (eonc::PotType ptype, const eonc::Parameters ¶ms, eonc::IPluginLoader &loader) | |
| Test seam: injected loader, no process-default search-path mutation. | |
| RgpotAdapter (eonc::PotType ptype, const eonc::Parameters ¶ms, RPot &&kernel) | |
| Take a pre-built kernel (ExprPot and other move-only constructors). | |
| RgpotAdapter (eonc::PotType ptype, const eonc::Parameters ¶ms, RPot &&kernel, eonc::IPluginLoader &loader) | |
| Test seam: injected loader, no process-default search-path mutation. | |
| void | force (long N, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box) override |
| bool | computesStress () const noexcept override |
| True when force() leaves a Cauchy stress that cauchyStress() can read until the next force() on this instance. | |
| Matrix3d | cauchyStress () const override |
| Cauchy stress from the last force() that reported one. | |
| bool | supportsBatchEvaluation () const noexcept override |
| Reports whether the kernel serves a batch natively. | |
| 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 |
| Hands eOn's batch straight to the kernel. | |
| bool | isThreadSafe () const noexcept override |
| Whether this potential's force() can be called from multiple threads on the SAME instance. | |
| bool | requiresIsolatedMoleculeLayout () const noexcept override |
| Kernels that do not implement periodic boundaries must not have their coordinates wrapped. | |
| bool | needsPerImageInstance () const noexcept override |
| Whether NEB should create separate Potential instances per image for true parallel force evaluation. | |
| bool | isSharedInstanceThreadSafe () const noexcept override |
| Conservative gate for sharing one Potential instance across threads. | |
| const RPot & | kernel () const noexcept |
| double | hessianRange () const noexcept override |
| Hessian block range from HessianRangeOf<RPot>, not from whether the kernel happens to have a cutoff field. | |
| Public Member Functions inherited from eonc::Potential | |
| 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 () |
| 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 unsigned | layoutFlags () const noexcept |
| virtual std::shared_ptr< Potential > | clonePotential () const |
| Independent instance that does not reload from disk. | |
| 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 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. | |
Private Member Functions | |
| void | finishConstruct (const eonc::Parameters ¶ms) |
| void | validateCaps () const |
| void | storeStress (const rgpot::ForceOut &out) |
Private Attributes | |
| RPot | pot_ |
| eonc::IPluginLoader & | loader_ |
| Matrix3d | stress_ {Matrix3d::Zero()} |
| bool | haveStress_ {false} |
Additional Inherited Members | |
| Public Types inherited from eonc::Potential | |
| enum class | PotLayout : unsigned { InProcess = 1u << 0 , NeedsWorkingDirectory = 1u << 1 , Subprocess = 1u << 2 } |
| How the pot is executed. Combine with bitwise or. More... | |
| Public Attributes inherited from eonc::Potential | |
| std::atomic< size_t > | forceCallCounter |
| Protected Attributes inherited from eonc::Potential | |
| PotType | ptype |
Wraps one rgpot kernel as an eOn Potential.
force() passes eOn's flat arrays straight into the kernel's forceImpl — the layouts match field for field, including the row-major 3x3 box — bypassing rgpot's AtomMatrix wrapper and its optional result cache. Thread-sharing policy derives from the kernel's capability descriptor instead of per-type lists.
Definition at line 32 of file RgpotAdapter.h.
|
inline |
Kernels construct in place from their config: several hold mutexes or other immovable state, so the adapter never copies or moves them.
Production: process-default PluginLoader.
Definition at line 39 of file RgpotAdapter.h.
|
inline |
Test seam: injected loader, no process-default search-path mutation.
Definition at line 45 of file RgpotAdapter.h.
|
inline |
Kernels with no configuration surface default-construct in place.
Definition at line 52 of file RgpotAdapter.h.
|
inline |
Test seam: injected loader, no process-default search-path mutation.
Definition at line 58 of file RgpotAdapter.h.
|
inline |
Take a pre-built kernel (ExprPot and other move-only constructors).
Definition at line 65 of file RgpotAdapter.h.
|
inline |
Test seam: injected loader, no process-default search-path mutation.
Definition at line 70 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtual |
Cauchy stress from the last force() that reported one.
sigma = (1/V) dE/dε, eV/Angstrom^3.
Reimplemented from eonc::Potential.
Definition at line 95 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
True when force() leaves a Cauchy stress that cauchyStress() can read until the next force() on this instance.
Reimplemented from eonc::Potential.
Definition at line 89 of file RgpotAdapter.h.
|
inlineprivate |
Definition at line 182 of file RgpotAdapter.h.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Hands eOn's batch straight to the kernel.
eOn batches images of one system, so every system shares an atom count; rgpot allows them to differ, and filling nAtoms per system costs nothing and keeps the two contracts independent.
Calls forceBatchImpl rather than forceBatch for the same reason force() calls forceImpl: eOn owns caching, and routing through rgpot's cache would key the same geometry twice.
Reimplemented from eonc::Potential.
Definition at line 118 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
Hessian block range from HessianRangeOf<RPot>, not from whether the kernel happens to have a cutoff field.
0 leaves coloring off.
Reimplemented from eonc::Potential.
Definition at line 177 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
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 from eonc::Potential.
Definition at line 166 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
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 from eonc::Potential.
Definition at line 149 of file RgpotAdapter.h.
|
inlinenodiscardnoexcept |
Definition at line 173 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
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 from eonc::Potential.
Definition at line 160 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
Kernels that do not implement periodic boundaries must not have their coordinates wrapped.
A free cluster with an atom on the cell face is torn by that wrap on the first optimizer step.
Reimplemented from eonc::Potential.
Definition at line 156 of file RgpotAdapter.h.
|
inlineprivate |
|
inlinenodiscardoverridevirtualnoexcept |
Reports whether the kernel serves a batch natively.
rgpot answers every batch call, falling back to a per-system loop, so this asks the narrower question the eOn callers care about: is one batched call cheaper than N single ones? Only a native kernel makes it so.
Reimplemented from eonc::Potential.
Definition at line 106 of file RgpotAdapter.h.
|
inlineprivate |
Definition at line 187 of file RgpotAdapter.h.
|
private |
Definition at line 212 of file RgpotAdapter.h.
|
private |
Definition at line 210 of file RgpotAdapter.h.
|
private |
Definition at line 209 of file RgpotAdapter.h.
|
private |
Definition at line 211 of file RgpotAdapter.h.