-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPUSide.cpp
50 lines (46 loc) · 1.65 KB
/
CPUSide.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.31
Copyright (C) 2018 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
********************************************************************************/
#include "System.h"
#include "StaticVals.h"
#include "CPUSide.h" //Spec declaration
CPUSide::CPUSide(System & sys, StaticVals & statV) :
varRef(sys, statV), pdb(sys, statV), console(varRef), block(varRef),
hist(varRef)
#if ENSEMBLE == GCMC
, sample_N_E(varRef)
#endif
{}
void CPUSide::Init(PDBSetup const& pdbSet, config_setup::Output const& out,
const ulong tillEquil, const ulong totSteps)
{
equilSteps = tillEquil;
//Initialize arrays in object that collects references and calc'ed vals.
varRef.Init(pdbSet.atoms);
//Initialize output components.
timer.Init(out.console.frequency, totSteps);
outObj.push_back(&console);
outObj.push_back(&pdb);
if (out.statistics.settings.block.enable)
outObj.push_back(&block);
#if ENSEMBLE == GCMC
outObj.push_back(&hist);
outObj.push_back(&sample_N_E);
#endif
//Calculate pressure, heat of vap. (if applicable), etc.
varRef.CalcAndConvert(0);
for (uint o = 0; o < outObj.size(); o++)
outObj[o]->Init(pdbSet.atoms, out, tillEquil, totSteps);
}
void CPUSide::Output(const ulong step)
{
//Calculate pressure, heat of vap. (if applicable), etc.
varRef.CalcAndConvert(step);
//Do standard output events.
for (uint o = 0; o < outObj.size(); o++)
outObj[o]->Output(step);
timer.CheckTime(step);
}