eOn 3.2.0
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
RGPotEngine.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstddef>
4
#include <memory>
5
#include <string>
6
7
struct
RGPotEngineOptions
{
8
std::string
backend
;
9
std::string
basis
{
"sto-3g"
};
10
std::string
theory
{
"scf"
};
11
std::string
scf_type
{
"rhf"
};
12
std::string
functional
{
"BLYP"
};
13
double
cutoff_ry
{70.0};
14
int
charge
{0};
15
int
multiplicity
{1};
16
std::string
engine_path
;
17
std::string
engine_library
;
18
std::string
engine_root
;
19
std::string
title
;
20
int
memory_mb
{0};
21
std::string
scratch_dir
;
22
// NWChem inputBlocks, or CPMD text appended to inputBlocks.
23
std::string
input_block
;
24
std::string
permanent_dir
;
// CPMD FILEPATH for RESTART files (cpmdc)
25
// CPMDParams file. When set, scalar method keys are not written over it.
26
std::string
params_path
;
27
int
ranks_per_image
{0};
// cpmdc: ranks per calculator group, 0 = off
28
// Metatomic (backend=metatomic): dlopen libmetatomic_engine.so
29
std::string
model_path
;
30
std::string
device
{
"cpu"
};
31
std::string
length_unit
{
"angstrom"
};
32
std::string
extensions_directory
;
33
bool
check_consistency
{
false
};
34
double
uncertainty_threshold
{-1.0};
35
bool
torch_determinism_strict
{
false
};
36
// XTB (backend=xtb): dlopen libxtb_engine.so — not native -Dwith_xtb link
37
std::string
xtb_paramset
{
"GFN2xTB"
};
// GFNFF / GFN0xTB / GFN1xTB / GFN2xTB
38
double
xtb_accuracy
{1.0};
39
double
xtb_electronic_temperature
{300.0};
40
int
xtb_max_iterations
{250};
41
double
xtb_charge
{0.0};
42
int
xtb_uhf
{0};
43
};
44
46
class
RGPotEngine
{
47
public
:
48
explicit
RGPotEngine
(
const
RGPotEngineOptions
&opt);
49
~RGPotEngine
();
50
RGPotEngine
(
const
RGPotEngine
&) =
delete
;
51
RGPotEngine
&
operator=
(
const
RGPotEngine
&) =
delete
;
52
53
[[nodiscard]]
const
std::string &
backend
() const noexcept {
return
backend_
; }
54
[[nodiscard]]
bool
available
()
const
;
55
void
force
(
long
N,
const
double
*R,
const
int
*atomicNrs,
double
*F,
56
double
*U,
const
double
*box)
const
;
57
60
[[nodiscard]]
int
calculatorGroups
() const noexcept;
61
[[nodiscard]]
int
calculatorIndex
() const noexcept;
63
[[nodiscard]]
int
calculatorWorld
() const noexcept;
65
[[nodiscard]]
int
worldRank
() const noexcept;
68
void
broadcastFromDriver
(
void
*data, std::
size_t
bytes) const;
71
void
finalizeMpiAtExit
() const;
76
void
armGroupedExit
() const;
78
[[nodiscard]] static
bool
mpiAbortRequested
() noexcept;
80
void
shutdownModule
() noexcept;
87
bool
shareResult
(
int
owner,
long
N,
double
*F,
double
*U,
bool
ok,
88
std::
string
&error) const;
89
90
private:
91
struct Impl;
92
std::unique_ptr<
Impl
>
impl_
;
93
std::
string
backend_
;
94
};
RGPotEngine::available
bool available() const
Definition
RGPotEngine.cpp:504
RGPotEngine::RGPotEngine
RGPotEngine(const RGPotEngineOptions &opt)
Definition
RGPotEngine.cpp:260
RGPotEngine::broadcastFromDriver
void broadcastFromDriver(void *data, std::size_t bytes) const
Collective on MPI_COMM_WORLD: every rank leaves with world rank 0's bytes.
Definition
RGPotEngine.cpp:463
RGPotEngine::mpiAbortRequested
static bool mpiAbortRequested() noexcept
True once rgpot asked for MPI_Abort at exit in this process.
Definition
RGPotEngine.cpp:436
RGPotEngine::RGPotEngine
RGPotEngine(const RGPotEngine &)=delete
RGPotEngine::armGroupedExit
void armGroupedExit() const
After MPI_Finalize, _Exit.
Definition
RGPotEngine.cpp:440
RGPotEngine::calculatorGroups
int calculatorGroups() const noexcept
Number of calculator groups the MPI world is split into (1 when ranks_per_image is off) and the group...
Definition
RGPotEngine.cpp:412
RGPotEngine::shutdownModule
void shutdownModule() noexcept
Calls cpmdc_finalize while the engine is still mapped. MPI stays up.
Definition
RGPotEngine.cpp:451
RGPotEngine::calculatorWorld
int calculatorWorld() const noexcept
Ranks in the MPI world the groups were bound on (1 without MPI).
Definition
RGPotEngine.cpp:420
RGPotEngine::calculatorIndex
int calculatorIndex() const noexcept
Definition
RGPotEngine.cpp:416
RGPotEngine::operator=
RGPotEngine & operator=(const RGPotEngine &)=delete
RGPotEngine::backend
const std::string & backend() const noexcept
Definition
RGPotEngine.h:53
RGPotEngine::~RGPotEngine
~RGPotEngine()
RGPotEngine::worldRank
int worldRank() const noexcept
This process's rank in that world (0 without MPI).
Definition
RGPotEngine.cpp:424
RGPotEngine::finalizeMpiAtExit
void finalizeMpiAtExit() const
Registers MPI_Finalize at exit (once per process) when the world has more than one rank.
Definition
RGPotEngine.cpp:431
RGPotEngine::impl_
std::unique_ptr< Impl > impl_
Definition
RGPotEngine.h:92
RGPotEngine::shareResult
bool shareResult(int owner, long N, double *F, double *U, bool ok, std::string &error) const
Collective on MPI_COMM_WORLD: every rank leaves with the energy and the 3N forces computed by the fir...
Definition
RGPotEngine.cpp:471
RGPotEngine::backend_
std::string backend_
Definition
RGPotEngine.h:93
RGPotEngine::force
void force(long N, const double *R, const int *atomicNrs, double *F, double *U, const double *box) const
Definition
RGPotEngine.cpp:518
RGPotEngineOptions
Definition
RGPotEngine.h:7
RGPotEngineOptions::xtb_uhf
int xtb_uhf
Definition
RGPotEngine.h:42
RGPotEngineOptions::scf_type
std::string scf_type
Definition
RGPotEngine.h:11
RGPotEngineOptions::check_consistency
bool check_consistency
Definition
RGPotEngine.h:33
RGPotEngineOptions::title
std::string title
Definition
RGPotEngine.h:19
RGPotEngineOptions::multiplicity
int multiplicity
Definition
RGPotEngine.h:15
RGPotEngineOptions::xtb_paramset
std::string xtb_paramset
Definition
RGPotEngine.h:37
RGPotEngineOptions::basis
std::string basis
Definition
RGPotEngine.h:9
RGPotEngineOptions::scratch_dir
std::string scratch_dir
Definition
RGPotEngine.h:21
RGPotEngineOptions::ranks_per_image
int ranks_per_image
Definition
RGPotEngine.h:27
RGPotEngineOptions::engine_path
std::string engine_path
Definition
RGPotEngine.h:16
RGPotEngineOptions::cutoff_ry
double cutoff_ry
Definition
RGPotEngine.h:13
RGPotEngineOptions::params_path
std::string params_path
Definition
RGPotEngine.h:26
RGPotEngineOptions::xtb_max_iterations
int xtb_max_iterations
Definition
RGPotEngine.h:40
RGPotEngineOptions::memory_mb
int memory_mb
Definition
RGPotEngine.h:20
RGPotEngineOptions::backend
std::string backend
Definition
RGPotEngine.h:8
RGPotEngineOptions::extensions_directory
std::string extensions_directory
Definition
RGPotEngine.h:32
RGPotEngineOptions::engine_library
std::string engine_library
Definition
RGPotEngine.h:17
RGPotEngineOptions::xtb_electronic_temperature
double xtb_electronic_temperature
Definition
RGPotEngine.h:39
RGPotEngineOptions::permanent_dir
std::string permanent_dir
Definition
RGPotEngine.h:24
RGPotEngineOptions::charge
int charge
Definition
RGPotEngine.h:14
RGPotEngineOptions::functional
std::string functional
Definition
RGPotEngine.h:12
RGPotEngineOptions::length_unit
std::string length_unit
Definition
RGPotEngine.h:31
RGPotEngineOptions::torch_determinism_strict
bool torch_determinism_strict
Definition
RGPotEngine.h:35
RGPotEngineOptions::device
std::string device
Definition
RGPotEngine.h:30
RGPotEngineOptions::model_path
std::string model_path
Definition
RGPotEngine.h:29
RGPotEngineOptions::xtb_accuracy
double xtb_accuracy
Definition
RGPotEngine.h:38
RGPotEngineOptions::engine_root
std::string engine_root
Definition
RGPotEngine.h:18
RGPotEngineOptions::uncertainty_threshold
double uncertainty_threshold
Definition
RGPotEngine.h:34
RGPotEngineOptions::theory
std::string theory
Definition
RGPotEngine.h:10
RGPotEngineOptions::input_block
std::string input_block
Definition
RGPotEngine.h:23
RGPotEngineOptions::xtb_charge
double xtb_charge
Definition
RGPotEngine.h:41
RGPotEngine::Impl
Definition
RGPotEngine.cpp:246
include
eon
potentials
Rgpot
RGPotEngine.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf