Loading...
Searching...
No Matches
ExtPot.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13
14#include "eon/Potential.h"
15
16#include <filesystem>
17#include <string>
18
19class ExtPot : public eonc::Potential {
20
21public:
22 ExtPot(const eonc::Parameters &p);
23 ~ExtPot();
24 void cleanMemory(void);
25 void force(long N, const double *R, const int *atomicNrs, double *F,
26 double *U, double *variance, const double *box) override;
29 [[nodiscard]] bool isThreadSafe() const noexcept override { return false; }
32 [[nodiscard]] bool needsPerImageInstance() const noexcept override {
33 return true;
34 }
35 [[nodiscard]] unsigned layoutFlags() const noexcept override {
36 return static_cast<unsigned>(eonc::Potential::PotLayout::Subprocess) |
37 static_cast<unsigned>(
39 }
40
41private:
42 void passToSystem(long N, const double *R, const int *atomicNrs,
43 const double *box);
44 void recieveFromSystem(long N, double *F, double *U);
47 void prepareExchangeDir();
48 // Owned by value: the Parameters this was built from may go out of scope
49 // long before the potential does.
50 std::string eon_extpot_path;
54 std::filesystem::path exchangeDir;
57 bool retainExchangeDir{false};
58};
unsigned layoutFlags() const noexcept override
Definition ExtPot.h:35
void recieveFromSystem(long N, double *F, double *U)
Definition ExtPot.cpp:218
void prepareExchangeDir()
Definition ExtPot.cpp:139
~ExtPot()
Definition ExtPot.cpp:137
void cleanMemory(void)
Definition ExtPot.cpp:125
std::string eon_extpot_path
Definition ExtPot.h:50
bool isThreadSafe() const noexcept override
One instance owns one exchange directory, so two threads in force() on it write the same structure fi...
Definition ExtPot.h:29
bool retainExchangeDir
Definition ExtPot.h:57
ExtPot(const eonc::Parameters &p)
Definition ExtPot.cpp:121
bool needsPerImageInstance() const noexcept override
The external program runs as a subprocess and each instance runs it in a directory of its own,...
Definition ExtPot.h:32
std::filesystem::path exchangeDir
Definition ExtPot.h:54
void passToSystem(long N, const double *R, const int *atomicNrs, const double *box)
Definition ExtPot.cpp:189
void force(long N, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box) override
Definition ExtPot.cpp:167