#include <gpr/potentials/EnginePotential.h>
Public Member Functions | |
| ~EnginePotential () | |
| EnginePotential (const EnginePotential &)=delete | |
| EnginePotential & | operator= (const EnginePotential &)=delete |
| int | force (long n_atoms, const double *positions, const int *atomic_nrs, const double *box, double *forces, double *energy, double *variance) |
| bool | hasBatch () const noexcept |
| True when the engine exports rgpot_engine_force_batch. | |
| int | forceBatch (long n_systems, long n_atoms, const double *positions, const int *atomic_nrs, const double *boxes, double *forces, double *energies, double *variances) |
| bool | hasCallbacks () const noexcept |
| True when the engine exports rgpot_engine_set_callbacks. | |
| int | setCallbacks (const RgpotEngineCallbacks &callbacks) |
| Register host callbacks for a learning engine. | |
| bool | hasHessianChecked () const noexcept |
| True when the engine exports rgpot_engine_hessian_checked. | |
| int | hessianChecked (long n_atoms, const double *positions, std::size_t positions_len, const int *atomic_nrs, double *hessian_out, std::size_t hessian_len, const double *box) |
| Extent-checked dense Hessian at one geometry. | |
| bool | hasHessianActionChecked () const noexcept |
| True when the engine exports rgpot_engine_hessian_action_checked. | |
| int | hessianActionChecked (long n_atoms, const double *positions, std::size_t positions_len, const int *atomic_nrs, const double *direction, std::size_t direction_len, double *hv_out, std::size_t hv_len, const double *box, unsigned long long *ops_out, double *scale_out) |
| bool | hasPredictionSupportedChecked () const noexcept |
| int | predictionSupportedChecked (long n_atoms, const double *positions, std::size_t positions_len, const int *atomic_nrs, const double *box, int *supported_out) |
| Extent-checked prediction-support query. | |
| bool | hasGprStats () const noexcept |
| True when the engine exports rgpot_engine_gpr_stats. | |
| int | gprStats (RgpotEngineGprStats &stats_out) const |
| Read learning-engine operation counters. | |
| unsigned long long | modelState () const |
| Monotone model-state counter; zero for an engine without one. | |
| int | hint (const std::vector< unsigned char > &message, std::string &err) |
| EngineAbiStamp | abiStamp () const noexcept |
| The stamp the plugin reported, or {1, 0, 1} when it exports none. | |
| int | caps (EngineCaps &out, std::string &err) |
| int | hvp (long n_atoms, const double *positions, const int *atomic_nrs, const double *direction, double *hv_out, const double *box, std::string &err) |
| int | taylorJet (long n_systems, long n_atoms, const double *positions, const int *atomic_nrs, const double *directions, long order, double *jet_out, EngineDerivativeReport *report, const double *boxes, std::string &err) |
| int | setCache (const char *path, std::string &err) |
| int | cacheCounts (std::uint64_t &computed, std::uint64_t &served, std::string &err) |
| std::string | lastError () const |
| bool | unloadSafe () const |
| int | abiVersion () const noexcept |
| int | threadCount () const noexcept |
| OpenMP team requested explicitly by the host for every engine call. | |
| void | setThreadCount (int threads) |
| const std::string & | library () const noexcept |
| const std::string & | resolvedPath () const noexcept |
| Absolute path of the loaded object, from the dynamic loader. | |
| bool | dead () const noexcept |
| True once a negative status was returned: the handle is unusable. | |
Static Public Member Functions | |
| static std::unique_ptr< EnginePotential > | open (const std::string &library, const std::vector< unsigned char > &config, std::string &err, bool torch_cuda=false, int oracle_threads=1) |
| static PotentialWrapper | wrap (std::shared_ptr< EnginePotential > engine) |
One instance owns one engine handle. caps().reentrancy says whether the plugin allows concurrent calls on that handle. This host still uses one handle from one thread; a caller that evaluates from several threads opens one instance per thread.
Definition at line 87 of file EnginePotential.h.
| pot::EnginePotential::~EnginePotential | ( | ) |
Definition at line 382 of file EnginePotential.cpp.
|
delete |
|
inlinenodiscardnoexcept |
The stamp the plugin reported, or {1, 0, 1} when it exports none.
Definition at line 189 of file EnginePotential.h.
|
inlinenodiscardnoexcept |
Definition at line 233 of file EnginePotential.h.
| int pot::EnginePotential::cacheCounts | ( | std::uint64_t & | computed, |
| std::uint64_t & | served, | ||
| std::string & | err ) |
Kernel-computed and cache-served counts since the cache was attached. Returns 3 when the plugin exports no query, or when none is attached.
Definition at line 754 of file EnginePotential.cpp.
| int pot::EnginePotential::caps | ( | EngineCaps & | out, |
| std::string & | err ) |
rgpot_engine_caps. Returns 3 when the plugin exports no caps symbol. jet_order is zero when the written size ends before that field.
Definition at line 521 of file EnginePotential.cpp.
|
inlinenodiscardnoexcept |
True once a negative status was returned: the handle is unusable.
Definition at line 253 of file EnginePotential.h.
| int pot::EnginePotential::force | ( | long | n_atoms, |
| const double * | positions, | ||
| const int * | atomic_nrs, | ||
| const double * | box, | ||
| double * | forces, | ||
| double * | energy, | ||
| double * | variance ) |
Energy and forces for one system. Returns the engine status; zero is success. variance may be null.
Definition at line 395 of file EnginePotential.cpp.
| int pot::EnginePotential::forceBatch | ( | long | n_systems, |
| long | n_atoms, | ||
| const double * | positions, | ||
| const int * | atomic_nrs, | ||
| const double * | boxes, | ||
| double * | forces, | ||
| double * | energies, | ||
| double * | variances ) |
Strided-uniform batch: n_systems systems of one composition. boxes holds 9 doubles per system.
Definition at line 408 of file EnginePotential.cpp.
| int pot::EnginePotential::gprStats | ( | RgpotEngineGprStats & | stats_out | ) | const |
Read learning-engine operation counters.
Definition at line 476 of file EnginePotential.cpp.
|
inlinenodiscardnoexcept |
True when the engine exports rgpot_engine_force_batch.
Definition at line 112 of file EnginePotential.h.
|
inlinenodiscardnoexcept |
True when the engine exports rgpot_engine_set_callbacks.
Definition at line 124 of file EnginePotential.h.
|
inlinenodiscardnoexcept |
True when the engine exports rgpot_engine_gpr_stats.
Definition at line 173 of file EnginePotential.h.
|
inlinenodiscardnoexcept |
True when the engine exports rgpot_engine_hessian_action_checked.
Definition at line 145 of file EnginePotential.h.
|
inlinenodiscardnoexcept |
True when the engine exports rgpot_engine_hessian_checked.
Definition at line 133 of file EnginePotential.h.
|
inlinenodiscardnoexcept |
True when the engine exports rgpot_engine_prediction_supported_checked.
Definition at line 161 of file EnginePotential.h.
| int pot::EnginePotential::hessianActionChecked | ( | long | n_atoms, |
| const double * | positions, | ||
| std::size_t | positions_len, | ||
| const int * | atomic_nrs, | ||
| const double * | direction, | ||
| std::size_t | direction_len, | ||
| double * | hv_out, | ||
| std::size_t | hv_len, | ||
| const double * | box, | ||
| unsigned long long * | ops_out, | ||
| double * | scale_out ) |
Extent-checked Hessian-vector product with optional operation accounting.
Definition at line 444 of file EnginePotential.cpp.
| int pot::EnginePotential::hessianChecked | ( | long | n_atoms, |
| const double * | positions, | ||
| std::size_t | positions_len, | ||
| const int * | atomic_nrs, | ||
| double * | hessian_out, | ||
| std::size_t | hessian_len, | ||
| const double * | box ) |
Extent-checked dense Hessian at one geometry.
Definition at line 430 of file EnginePotential.cpp.
| int pot::EnginePotential::hint | ( | const std::vector< unsigned char > & | message, |
| std::string & | err ) |
Send a runtime hint message; returns the engine status, or -1 when the engine exports no hint entry point.
Definition at line 491 of file EnginePotential.cpp.
| int pot::EnginePotential::hvp | ( | long | n_atoms, |
| const double * | positions, | ||
| const int * | atomic_nrs, | ||
| const double * | direction, | ||
| double * | hv_out, | ||
| const double * | box, | ||
| std::string & | err ) |
Analytic Hessian-vector product. Returns 3 when the plugin does not export rgpot_engine_hvp or rgpot_engine_caps, or when analytic_hvp is clear. A negative status marks the handle dead.
Definition at line 566 of file EnginePotential.cpp.
|
nodiscard |
Text of rgpot_engine_last_error, or empty when the plugin exports none or there is no message.
Definition at line 767 of file EnginePotential.cpp.
|
inlinenodiscardnoexcept |
Definition at line 243 of file EnginePotential.h.
|
nodiscard |
Monotone model-state counter; zero for an engine without one.
Definition at line 484 of file EnginePotential.cpp.
|
static |
| library | path or soname handed to dlopen (RTLD_LOCAL). |
| config | capnp flat-array message for the engine's params arm. |
| err | failure detail when construction returns nullptr. |
| torch_cuda | the engine evaluates on a CUDA device: load the libtorch_cuda runtime next to the libtorch_cpu the engine brought in before the engine is created. A torch engine links libtorch_cpu only, and the CUDA hooks register when libtorch_cuda is loaded. |
| oracle_threads | Evaluation thread count; at least one. |
Definition at line 189 of file EnginePotential.cpp.
|
delete |
| int pot::EnginePotential::predictionSupportedChecked | ( | long | n_atoms, |
| const double * | positions, | ||
| std::size_t | positions_len, | ||
| const int * | atomic_nrs, | ||
| const double * | box, | ||
| int * | supported_out ) |
Extent-checked prediction-support query.
Definition at line 461 of file EnginePotential.cpp.
|
inlinenodiscardnoexcept |
Absolute path of the loaded object, from the dynamic loader.
Definition at line 248 of file EnginePotential.h.
| int pot::EnginePotential::setCache | ( | const char * | path, |
| std::string & | err ) |
Attach a persistent result cache, or detach it when path is null. Returns 3 when the plugin exports no rgpot_engine_set_cache.
Definition at line 742 of file EnginePotential.cpp.
| int pot::EnginePotential::setCallbacks | ( | const RgpotEngineCallbacks & | callbacks | ) |
Register host callbacks for a learning engine.
Definition at line 423 of file EnginePotential.cpp.
| void pot::EnginePotential::setThreadCount | ( | int | threads | ) |
Definition at line 365 of file EnginePotential.cpp.
| int pot::EnginePotential::taylorJet | ( | long | n_systems, |
| long | n_atoms, | ||
| const double * | positions, | ||
| const int * | atomic_nrs, | ||
| const double * | directions, | ||
| long | order, | ||
| double * | jet_out, | ||
| EngineDerivativeReport * | report, | ||
| const double * | boxes, | ||
| std::string & | err ) |
Directional derivatives of the gradient up to order, one uniform batch. Returns 3 when the plugin exports no jet or caps symbol, or when order exceeds jet_order. A non-finite position, direction or cell, an order below 1, and a negative or non-finite report scale are status 1 and do not replace report. Inputs and output must not overlap.
Definition at line 622 of file EnginePotential.cpp.
|
inlinenodiscardnoexcept |
OpenMP team requested explicitly by the host for every engine call.
Definition at line 238 of file EnginePotential.h.
|
nodiscard |
True only when the stamp minor is at least 7 and rgpot_engine_unload_policy returns RGPOT_ENGINE_UNLOAD_SAFE.
Definition at line 777 of file EnginePotential.cpp.
|
static |
Adapt a shared engine handle to the host's potential interface. Positive statuses throw EngineError; negative statuses mark the handle dead and throw as well.
Definition at line 788 of file EnginePotential.cpp.