-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulation.h
executable file
·92 lines (75 loc) · 2.22 KB
/
simulation.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef _SIMULATION_
#define _SIMULATION_
#include "vector.h"
#include "fileIO.h"
#include <string>
class Lattice;
class MDBox;
class Material;
class Measure;
class SimulationParams;
class Simulation
{
friend MDBox;
friend void fileIO::SIM::write(const std::string& path, const std::string& file, const Simulation& sim);
public:
Simulation(const char* setFile = "../../settings/default.set"); // To help for VS
~Simulation();
void run();
private:
SimulationParams* params;
MDBox* box;
std::vector<Measure*> measures;
std::string filePrefix{ "" };
std::string visFile{ "md.vis" };
void setupMeasures();
void calculateMeasures(double t);
void saveMeasures();
void saveMetaData();
std::string filePath(bool withPrefix = true);
};
class SimulationParams
{
public:
SimulationParams(const char* file);
~SimulationParams();
// Parameters needing initialization
int timesteps{ -1 };
double timestepLength; // in femtoseconds
bool saveVisualizationData{ false };
int visualizationLogRate; // every x femtosecond
int measureDataLogRate; // every x femtosecond
double cutoffDistance{ -1.0 }; // in Ångström
double initialTemperature{ -1.0 }; // Kelvin
double goalTemperature; // Kelvin
double thermostatScaling{1.0};
Vector3 dimensions{ -1, -1, -1 }; // in Unit cells
bool pBCx{ true };
bool pBCy{ true };
bool pBCz{ true };
// Internal parameters
//int currentTimestep{-1};
int verletListUpdateFrequency{ 10 };
int calculateMeanAfter{0};
int threads{1};
std::string outputDirectory{ "" };
std::string settingsFileName;
Lattice* lattice{ nullptr };
Material* material{ nullptr };
// Measures
class KineticEnergy* kineticEnergy{nullptr};
class PotentialEnergy* potentialEnergy{nullptr};
class TotalEnergy* totalEnergy{nullptr};
class Temperature* temperature{nullptr};
class MSD* msd{ nullptr };
class SurfaceMSD* surfaceMSD{ nullptr };
class DebyeTemperature* debyeTemperature{ nullptr };
class SurfaceDebyeTemperature* surfaceDebyeTemperature{ nullptr };
class Pressure* pressure{ nullptr };
class SpecificHeat* specificHeat{ nullptr };
class Thermostat* thermostat{nullptr};
private:
void initSettings(const char*);
void validateSettings();
};
#endif