-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
66 lines (65 loc) · 1.6 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "simulation_x.hpp"
#include <fstream>
#include <iostream>
#include <ctime>
int main(int argc, char *argv[]) {
if (argc < 3) {
std::cout << "Wrong number of arguments supplied" << std::endl;
return 0;
}
std::ifstream in_file;
in_file.open(std::string(argv[1]));
std::ofstream out_file;
out_file.open(std::string(argv[2]));
XSimulation simul;
/*simul.Initial(in_file);
simul.Dump(out_file);
simul.FillENk();
simul.FillVB();
simul.FillForceVB();
simul.DumpForce(out_file);
simul.DumpEnergy(out_file);
simul.UpdateMNHC_VV3();
simul.UpdateMNHC_VV3();
//simul.Dump(out_file);
for (int i = 0; i < 1000; ++i)
simul.UpdateMNHC_VV3();
simul.Dump(out_file);*/
simul.Initial(in_file);
int i;
clock_t t;
t = clock();
for (i = 0; i < simul.skip; ++i) {
simul.PeriodBoundary();
simul.UpdateMNHC_VV3();
if (!simul.ok) {
simul.Dump(out_file);
simul.DumpForce(out_file);
simul.DumpEnergy(out_file);
simul.NormalizeStat();
simul.DumpStat(out_file);
return 0;
}
}
for (i = 0; i < simul.step; ++i) {
simul.PeriodBoundary();
simul.UpdateMNHC_VV3();
if (!simul.ok) {
simul.Dump(out_file);
simul.DumpForce(out_file);
simul.DumpEnergy(out_file);
simul.NormalizeStat();
simul.DumpStat(out_file);
return 0;
}
simul.MakeStat();
if (i % 100000 == 0)
out_file << "i=" << i << std::endl;
}
//simul.Dump(out_file);
simul.NormalizeStat();
simul.DumpStat(out_file);
t = clock() - t;
out_file << (int)(((double)1000 * t) / CLOCKS_PER_SEC) << std::endl;
return 0;
}