Type-erased wrapper around any potential that provides a force() interface. More...
#include <gpr/potentials/PotentialWrapper.h>
Public Types | |
| using | ForceFn |
| using | ForceWithUncertaintyFn |
| using | ForceBatchFn |
| using | ForceBatchWithForceNoiseFn |
| A batch with force noise and zero energy noise. | |
| using | ForceBatchWithUncertaintyFn |
| Both optional noise arrays use the single-call RMS conventions. | |
Public Member Functions | |
| PotentialWrapper (ForceFn fn) | |
| void | force (long N, const double *R, const int *atomicNrs, double *F, double *U, double *energy_noise_rms, const double *box) |
| Invoke the wrapped potential. | |
| void | forceWithUncertainty (long N, const double *R, const int *atomicNrs, double *F, double *U, double *energy_noise_rms, double *force_noise_rms, const double *box) |
| bool | hasForceBatch () const noexcept |
| bool | hasForceBatchWithUncertainty () const noexcept |
| void | setForceBatch (ForceBatchFn fn) |
| void | setForceBatch (std::nullptr_t) |
| void | setForceBatch (ForceBatchWithForceNoiseFn fn) |
| void | setForceBatchWithUncertainty (ForceBatchWithUncertaintyFn fn) |
| void | forceBatch (long N, std::size_t B, const double *R, const int *atomicNrs, double *F, double *U, const double *box) |
| Batched means; requires hasForceBatch(). | |
| void | forceBatch (long N, std::size_t B, const double *R, const int *atomicNrs, double *F, double *U, double *V, const double *box) |
| Batched evaluation with optional force noise. | |
| void | forceBatchWithUncertainty (long N, std::size_t B, const double *R, const int *atomicNrs, double *F, double *U, double *energy_noise, double *force_noise, const double *box) |
Static Public Member Functions | |
| static PotentialWrapper | from_force_with_uncertainty (ForceWithUncertaintyFn fn) |
| static PotentialWrapper | composeGeometryAndEnergyUncertainty (PotentialWrapper geometry, PotentialWrapper uncertainty) |
| Compose geometry output with an independent energy-uncertainty source. | |
| static PotentialWrapper | routeEnergyUncertaintyToForceChannel (PotentialWrapper source) |
| Route a legacy scalar uncertainty into the force-noise channel. | |
| template<typename RgPot> | |
| static PotentialWrapper | from_rgpot (RgPot &pot) |
| Factory: adapt an rgpot PotentialBase subclass. | |
| template<typename RgPot> | |
| static PotentialWrapper | from_rgpot (std::shared_ptr< RgPot > pot) |
| Factory: adapt and own an rgpot PotentialBase subclass. | |
| static PotentialWrapper | from_rgpot (std::shared_ptr< rgpot::PotentialBase > pot) |
| C++-only helper: wrap a virtual rgpot::PotentialBase. | |
Type-erased wrapper around any potential that provides a force() interface.
Accepts a std::function with the legacy EON force() signature, allowing any potential (EAM, Morse, rgpot, RPC, lambda) to be used without templates.
Definition at line 94 of file PotentialWrapper.h.
Batched means: B same-composition systems, B * 3N coordinates and forces, B energies, and one shared box.
Definition at line 110 of file PotentialWrapper.h.
A batch with force noise and zero energy noise.
Definition at line 114 of file PotentialWrapper.h.
Both optional noise arrays use the single-call RMS conventions.
Definition at line 118 of file PotentialWrapper.h.
The legacy force signature. The slot before the cell is the energy-noise RMS, a standard deviation in eV and not a variance; it is forwarded as the energy_noise_rms of ForceWithUncertaintyFn and there is no force-noise slot.
Definition at line 102 of file PotentialWrapper.h.
Definition at line 105 of file PotentialWrapper.h.
|
inlineexplicit |
Definition at line 123 of file PotentialWrapper.h.
|
inlinestatic |
Compose geometry output with an independent energy-uncertainty source.
Energy, forces, and force noise come from geometry. Energy noise is published from the second potential only after that call returns. The second potential is evaluated only when energy noise is requested; its energy and forces are discarded.
Definition at line 303 of file PotentialWrapper.h.
|
inline |
Invoke the wrapped potential.
Definition at line 145 of file PotentialWrapper.h.
|
inline |
Batched means; requires hasForceBatch().
Definition at line 217 of file PotentialWrapper.h.
|
inline |
Batched evaluation with optional force noise.
Definition at line 234 of file PotentialWrapper.h.
|
inline |
Preserve both noise channels, using single calls if the batch surface provides only means.
Definition at line 247 of file PotentialWrapper.h.
|
inline |
Definition at line 152 of file PotentialWrapper.h.
|
inlinestatic |
Definition at line 161 of file PotentialWrapper.h.
|
inlinestatic |
Factory: adapt an rgpot PotentialBase subclass.
Bridges rgpot's operator()(AtomMatrix, vector<int>, box) -> (energy, AtomMatrix) to the legacy force() signature.
Definition at line 367 of file PotentialWrapper.h.
|
inlinestatic |
Factory: adapt and own an rgpot PotentialBase subclass.
Use this when the wrapper outlives the local scope that creates the rgpot instance.
Definition at line 384 of file PotentialWrapper.h.
|
static |
C++-only helper: wrap a virtual rgpot::PotentialBase.
rgpot does not publish nanobind/pybind types, so Python cannot name this overload. C++ callers that already hold a PotentialBase use this (the caller does not need Potential.hpp in the same TU). Python from_rgpot accepts a bound PotentialBase via the nanobind trampoline, or a callable with the same operator() contract.
Definition at line 129 of file PotentialWrapper.cpp.
|
inlinenodiscardnoexcept |
True when the wrapped source can evaluate a same-composition batch in one call (rgpot forceBatch surface).
Definition at line 169 of file PotentialWrapper.h.
|
inlinenodiscardnoexcept |
Definition at line 175 of file PotentialWrapper.h.
|
inlinestatic |
Route a legacy scalar uncertainty into the force-noise channel.
This adapts sources whose three-value interface reports a force-scale diagnostic through the legacy energy-uncertainty slot.
Definition at line 342 of file PotentialWrapper.h.
|
inline |
Definition at line 180 of file PotentialWrapper.h.
|
inline |
Definition at line 191 of file PotentialWrapper.h.
|
inline |
Definition at line 186 of file PotentialWrapper.h.
|
inline |
Definition at line 210 of file PotentialWrapper.h.