-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathg3.h
65 lines (53 loc) · 1.65 KB
/
g3.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
/*
* C++ implementation the three-body correlation function
*
* Implemented by Sergey Sukhomlinov (2019)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated files, without restriction to use, copy,
* modify, merge and/or distribute copies of this software.
*/
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
string ltrim(const string& s){
size_t start = s.find_first_not_of(" ");
return (start == string::npos) ? "" : s.substr(start);
}
string rtrim(const string& s){
size_t end = s.find_last_not_of(" ");
return (end == string::npos) ? "" : s.substr(0, end + 1);
}
string trim(const string& s){
return rtrim(ltrim(s));
}
const double pi2i=1./M_PI/2;
// main parameters
// declare variables and assign default values
// while reading in the config file, the values are rewritten
int nAtom = 1000, nType = 1, nConf = 201;
int nrGrid = 201, naGrid = 201;
double Rmin = 1.5, Rmax = 2.5, LRcut = 6.0;
int TypeC = 1, TypeE = 1; // atomic type of the Central and of the End atom
string inputFile = "config.dat", outputFile = "g3distr.dat";
double aveVolC, aveVolE;
double LRcut2, dr, dr1; // grid in r
double da, da1; // grid in cos
double dr2da1;
double LRcutMod1; // for binning
int nRnA;
int rBinMin, rBinMax;
ifstream inCoords;
vector <int> Type;
vector < vector <double> > g3;
//----------------------------------------
void InputData();
void setParameters();
void g3Calc(vector<int>);
void OutputData(vector< vector< double > >);
void pbc(double [], double []);