Loading...
Searching...
No Matches
GPRPotential Class Reference

Template to use if user want to provide potential. More...

#include <GPRPotential.h>

Inheritance diagram for GPRPotential:

Public Member Functions

 GPRPotential (const Parameters &p)
void registerGPRObject (gpr::GaussianProcessRegression *_gpr_model)
void initialize (void)
void cleanMemory (void)
void force (long N, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box)
Public Member Functions inherited from eonc::Potential
 Potential (PotType a_ptype)
 Potential (PotType a_ptype, const Parameters &)
 Potential (const Parameters &a_params)
virtual ~Potential ()
std::tuple< double, AtomMatrixget_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 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 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 bool supportsBatchEvaluation () const noexcept
 Whether this potential supports batched evaluation of 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)
 Evaluate forces for N systems in a single call.

Private Attributes

gpr::GaussianProcessRegression * gpr_model

Additional Inherited Members

Public Attributes inherited from eonc::Potential
std::atomic< size_t > forceCallCounter
Protected Attributes inherited from eonc::Potential
PotType ptype

Detailed Description

Template to use if user want to provide potential.

Definition at line 18 of file GPRPotential.h.

Constructor & Destructor Documentation

◆ GPRPotential()

GPRPotential::GPRPotential ( const Parameters & p)

Definition at line 50 of file GPRPotential.cpp.

52 gpr_model = nullptr;
53}
gpr::GaussianProcessRegression * gpr_model
Potential(PotType a_ptype)
Definition Potential.h:35

Member Function Documentation

◆ cleanMemory()

void GPRPotential::cleanMemory ( void )

Definition at line 62 of file GPRPotential.cpp.

62{}

◆ force()

void GPRPotential::force ( long N,
const double * R,
const int * atomicNrs,
double * F,
double * U,
double * variance,
const double * box )
virtual

Implements eonc::Potential.

Definition at line 67 of file GPRPotential.cpp.

69 {
70 variance = nullptr;
71 gpr::Observation observation;
72
73 // Copy R points. Note, R should correspond to the moving atoms only.
74 observation.R.resize(1, N * 3);
75 for (int i = 0; i < N; i++) {
76 observation.R.set(i, {R[3 * i], R[3 * i + 1], R[3 * i + 2]});
77 }
78
79 // Note, the following functions should be called before calling for
80 // gpr_model->calculatePotential() gpr_model->decomposeCovarianceMatrix(R,
81 // ind) - takes covariance matrix and vector of repetitive indices
82 // gpr_model->calculateMeanPrediction() - takes a vector of combined energy
83 // and force gpr_model->calculatePosteriorMeanPrediction() - no arguments
84 gpr_model->calculatePotential(observation);
85
86 for (int i = 0; i < N; i++) {
87 F[3 * i] = observation.G[3 * i];
88 F[3 * i + 1] = observation.G[3 * i + 1];
89 F[3 * i + 2] = observation.G[3 * i + 2];
90 }
91
92 // FIXME: Test conversion, E should only have one element here
93 *U = observation.E[0];
94}

◆ initialize()

void GPRPotential::initialize ( void )

Definition at line 60 of file GPRPotential.cpp.

60{}

◆ registerGPRObject()

void GPRPotential::registerGPRObject ( gpr::GaussianProcessRegression * _gpr_model)

Definition at line 55 of file GPRPotential.cpp.

56 {
57 gpr_model = _gpr_model;
58}

Member Data Documentation

◆ gpr_model

gpr::GaussianProcessRegression* GPRPotential::gpr_model
private

Definition at line 21 of file GPRPotential.h.


The documentation for this class was generated from the following files:
  • /home/runner/work/eOn/eOn/include/eon/potentials/GPRPotential/GPRPotential.h
  • /home/runner/work/eOn/eOn/client/potentials/GPRPotential/GPRPotential.cpp