-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetxyz.cc
80 lines (64 loc) · 1.82 KB
/
getxyz.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
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
#include <iostream>
#include "structure.h"
#include "iop.h"
#include "potential.h"
using namespace std;
int main (int argc, char *argv[])
{
cout << endl;
if (argc < 2)
{
cerr << "Please provide filename!" << endl;
return 1;
}
string fileName = argv[argc-1];
if (fexists(fileName))
{
cout << "\tFile " << fileName << " exists." << endl;
}
else
{
cout << "\tFile " << fileName << " does not exist." << endl;
return 1;
}
//READ SETTINGS FILE
if (fexists("settings")) {
cout << "\t" << "Settings file found." << endl;
}
else {
cout << "\t" << "No settings file in working directory" << endl;
return 1;
}
vector<double> p;
parameter<double> opt; //vector of algo settings, 0 == accuracy, 1 == dforce, 2 == stepsize, 3 == nsteps
parameter<int> switches; //vector of switches, 0 == potential, 1 == algo, 2 == scaling
double scalingFactor(1.0);
int status = readsettings(opt, p, switches, scalingFactor);
std::unique_ptr< pairPotential > potential;
switch (status)
{
case 0:
cerr << "Failed reading settings file" << endl;
return 1;
case 1:
potential.reset( LJ::readPotential() );
break;
case 2:
potential.reset( ELJ::readPotential() );
break;
case 3:
potential.reset( RangeLJ::readPotential() );
break;
default:
cerr << "readsettings returned an unknown status" << endl;
return 1;
}
cout << endl;
vector<structure> allKS = readallstruct(fileName);
for (vector<structure>::size_type i = 0; i < allKS.size(); i++)
{
allKS[i].setEnergy(potential->calcEnergy(allKS[i]));
}
xyzoutall(allKS);
return 0;
}