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 Potential {
20
21public:
22 ExtPot(const 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
36private:
37 void passToSystem(long N, const double *R, const int *atomicNrs,
38 const double *box);
39 void recieveFromSystem(long N, double *F, double *U);
42 void prepareExchangeDir();
43 // Owned by value: the Parameters this was built from may go out of scope
44 // long before the potential does.
45 std::string eon_extpot_path;
49 std::filesystem::path exchangeDir;
52 bool retainExchangeDir{false};
53};
void recieveFromSystem(long N, double *F, double *U)
Definition ExtPot.cpp:215
void prepareExchangeDir()
Definition ExtPot.cpp:138
ExtPot(const Parameters &p)
Definition ExtPot.cpp:120
~ExtPot()
Definition ExtPot.cpp:136
void cleanMemory(void)
Definition ExtPot.cpp:124
std::string eon_extpot_path
Definition ExtPot.h:45
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:52
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:49
void passToSystem(long N, const double *R, const int *atomicNrs, const double *box)
Definition ExtPot.cpp:186
void force(long N, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box) override
Definition ExtPot.cpp:166
Potential(PotType a_ptype)
Definition Potential.h:35