-
Notifications
You must be signed in to change notification settings - Fork 0
/
fts_cpu.cc
51 lines (42 loc) · 1.84 KB
/
fts_cpu.cc
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
// #######################################################################
// Creates a new lfts_simulation(...) object, passing in input file to
// its contructor and subsequently accessing its public methods to
// equilibrate the system, gather statistics from the equilibrated system
// and finally output the system's energy
// #######################################################################
#include <string>
#include <iostream>
#include "wtmd_simulation.h"
#include <chrono>
using namespace std;
int main (int argc, char *argv[])
{
// Get input file name from command-line argument
if (argc != 3) {
cout << "Please supply input file names as command-line arguments: <lfts_input_file> <bias_input_file>" << endl << endl;
exit(1);
}
string inputFile(argv[1]);
string biasFile(argv[2]);
// New lfts_simulation object with input file name specified
wtmd_simulation *wtmd_sim = new wtmd_simulation(inputFile, biasFile);
// Time the equilibration period
cout << "Starting Equilibration..." << endl;
auto start = std::chrono::steady_clock::now();
wtmd_sim -> equilibrate();
auto end = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::seconds>(end - start);
cout << "Equlibration time = " << duration.count() << "secs" << endl << endl;
// Time the statistics gathering period
cout << "Starting Statistics..." << endl;
start = std::chrono::steady_clock::now();
wtmd_sim -> statistics();
end = std::chrono::steady_clock::now();
duration = std::chrono::duration_cast<std::chrono::seconds>(end - start);
cout << "Statistics time = " << duration.count() << "secs" << endl << endl;
// Output the final energy of the system
cout.precision(6);
cout << wtmd_sim->getH() << endl;
delete wtmd_sim;
return 0;
}