Loading...
Searching...
No Matches
EffectiveMediumTheory Class Reference

EMT potential. More...

#include <EffectiveMediumTheory.h>

Inheritance diagram for EffectiveMediumTheory:

Public Member Functions

 EffectiveMediumTheory (const Parameters &p)
 ~EffectiveMediumTheory ()
void cleanMemory ()
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

bool emtRasmussen {false}
long numberOfAtoms {0}
bool periodicity [3] {true, true, true}
AtomsAtomsObj {nullptr}
EMTDefaultParameterProviderEMTParameterObj {nullptr}
EMTEMTObj {nullptr}
SuperCellSuperCellObj {nullptr}

Additional Inherited Members

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

Detailed Description

EMT potential.

Inspect the EMT_parms.h to see what the EMT potential is hardcoded to describe.

Definition at line 29 of file EffectiveMediumTheory.h.

Constructor & Destructor Documentation

◆ EffectiveMediumTheory()

EffectiveMediumTheory::EffectiveMediumTheory ( const Parameters & p)
inline

Definition at line 41 of file EffectiveMediumTheory.h.

42 : Potential(p),
struct eonc::Parameters::potential_options_t potential_options
Potential(PotType a_ptype)
Definition Potential.h:35

◆ ~EffectiveMediumTheory()

EffectiveMediumTheory::~EffectiveMediumTheory ( )
inline

Definition at line 44 of file EffectiveMediumTheory.h.

Member Function Documentation

◆ cleanMemory()

void EffectiveMediumTheory::cleanMemory ( )

Definition at line 18 of file EffectiveMediumTheory.cpp.

18 {
19 delete EMTObj;
20 EMTObj = nullptr;
21 delete SuperCellObj;
22 SuperCellObj = nullptr;
23 delete AtomsObj;
24 AtomsObj = nullptr;
25 delete EMTParameterObj;
26 EMTParameterObj = nullptr;
27}
EMTDefaultParameterProvider * EMTParameterObj

◆ force()

void EffectiveMediumTheory::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 32 of file EffectiveMediumTheory.cpp.

34 {
35 variance = nullptr;
36
37 // Copy positions (Asap may modify them internally)
38 std::vector<double> pos(R, R + 3 * N);
39
40 // Reinitialize if atom count changed
41 if (numberOfAtoms != N) {
42 numberOfAtoms = N;
44
45 Vec tempBasis[3] = {
46 Vec(box[0], box[1], box[2]),
47 Vec(box[3], box[4], box[5]),
48 Vec(box[6], box[7], box[8]),
49 };
50
51 SuperCellObj = new SuperCell(tempBasis, periodicity);
52 AtomsObj = new Atoms(reinterpret_cast<Vec *>(pos.data()), N, SuperCellObj);
53
54 std::vector<int> atomicNrsTemp(atomicNrs, atomicNrs + N);
55 AtomsObj->SetAtomicNumbers(atomicNrsTemp.data());
56
57 if (emtRasmussen) {
58 EMTParameterObj = new EMTRasmussenParameterProvider();
60 } else {
61 EMTObj = new EMT(nullptr);
62 }
63 AtomsObj->SetCalculator(EMTObj);
64 }
65
66 AtomsObj->SetCartesianPositions(reinterpret_cast<Vec *>(pos.data()));
67
68 // Update the box
69 Vec tempBasis[3] = {
70 Vec(box[0], box[1], box[2]),
71 Vec(box[3], box[4], box[5]),
72 Vec(box[6], box[7], box[8]),
73 };
74 AtomsObj->SetUnitCell(tempBasis, true);
75
76 *U = EMTObj->GetPotentialEnergy();
77
78 const Vec *tempF = EMTObj->GetCartesianForces();
79 std::memcpy(F, tempF, N * sizeof(Vec));
80}

Member Data Documentation

◆ AtomsObj

Atoms* EffectiveMediumTheory::AtomsObj {nullptr}
private

Definition at line 35 of file EffectiveMediumTheory.h.

35{nullptr};

◆ EMTObj

EMT* EffectiveMediumTheory::EMTObj {nullptr}
private

Definition at line 37 of file EffectiveMediumTheory.h.

37{nullptr};

◆ EMTParameterObj

EMTDefaultParameterProvider* EffectiveMediumTheory::EMTParameterObj {nullptr}
private

Definition at line 36 of file EffectiveMediumTheory.h.

36{nullptr};

◆ emtRasmussen

bool EffectiveMediumTheory::emtRasmussen {false}
private

Definition at line 32 of file EffectiveMediumTheory.h.

32{false};

◆ numberOfAtoms

long EffectiveMediumTheory::numberOfAtoms {0}
private

Definition at line 33 of file EffectiveMediumTheory.h.

33{0};

◆ periodicity

bool EffectiveMediumTheory::periodicity[3] {true, true, true}
private

Definition at line 34 of file EffectiveMediumTheory.h.

34{true, true, true};

◆ SuperCellObj

SuperCell* EffectiveMediumTheory::SuperCellObj {nullptr}
private

Definition at line 38 of file EffectiveMediumTheory.h.

38{nullptr};

The documentation for this class was generated from the following files: