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. | |
| const RPot & | kernel () const noexcept |
| double | finiteCutoff () const noexcept override |
| Classical kernels expose config().cutoff. | |
| Public Member Functions inherited from eonc::Potential | |
| 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 bool | isSurrogate () const noexcept |
| Whether this is a surrogate (GP) potential. | |
| virtual unsigned | layoutFlags () const noexcept |
| virtual bool | isSharedInstanceThreadSafe () const noexcept |
| Conservative gate for sharing one Potential instance across threads. | |
| virtual std::shared_ptr< Potential > | clonePotential () const |
| Independent instance that does not reload from disk. | |
| 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 31 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 38 of file RgpotAdapter.h.
|
inline |
Test seam: injected loader, no process-default search-path mutation.
Definition at line 44 of file RgpotAdapter.h.
|
inline |
Kernels with no configuration surface default-construct in place.
Definition at line 51 of file RgpotAdapter.h.
|
inline |
Test seam: injected loader, no process-default search-path mutation.
Definition at line 57 of file RgpotAdapter.h.
|
inline |
Take a pre-built kernel (ExprPot and other move-only constructors).
Definition at line 64 of file RgpotAdapter.h.
|
inline |
Test seam: injected loader, no process-default search-path mutation.
Definition at line 69 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 94 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 88 of file RgpotAdapter.h.
|
inlineprivate |
Definition at line 179 of file RgpotAdapter.h.
|
inlinenodiscardoverridevirtualnoexcept |
Classical kernels expose config().cutoff.
Anything else is not treated as finite-range.
Reimplemented from eonc::Potential.
Definition at line 170 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 117 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 166 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 105 of file RgpotAdapter.h.
|
inlineprivate |
Definition at line 184 of file RgpotAdapter.h.
|
private |
Definition at line 209 of file RgpotAdapter.h.
|
private |
Definition at line 207 of file RgpotAdapter.h.
|
private |
Definition at line 206 of file RgpotAdapter.h.
|
private |
Definition at line 208 of file RgpotAdapter.h.