/
atom.h
247 lines (218 loc) · 7.48 KB
/
atom.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#include <iostream>
#include <exception>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <sstream>
#include <time.h>
#include <vector>
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <pybind11/stl.h>
#include <complex>
namespace py = pybind11;
using namespace std;
const double PI = 3.141592653589793;
const int MAXNUMBEROFNEIGHBORS = 300;
const int NILVALUE = 333333;
//create a structure for sorting
struct datom{
double dist;
int index;
};
//create another for the sorting algorithm
struct by_dist{
bool operator()(datom const &datom1, datom const &datom2){
return (datom1.dist < datom2.dist);
}
};
class Atom{
/*
Class to hold the details of an atom. This is a list of all
members of the class.
Attributes
----------
Basic atom properties
---------------------
posx : float
x coordinate of atom
posy : float
y coordinate of atom
posz : float
z coordinate of atom
id : int
id of the atom
loc : int
location of the atom in the array of all atoms in
the system.
Neighbor related properties
---------------------------
n_neighbors : int
number of neighbors of the atom
Cluster related properties
--------------------------
frenkelnumber : int
frenkelnumber of the atom.
issolid : int
0 or 1. 1 if atom is solid.
structure : int
structure of the atom.
belongsto : int
id of the cluster to which atom belongs to.
*/
public:
//-------------------------------------------------------
// Constructor, Destructor
//-------------------------------------------------------
Atom(vector<double>, int, int);
virtual ~Atom();
//-------------------------------------------------------
// Basic Atom properties
//-------------------------------------------------------
int id;
int loc;
double posx,posy,posz;
vector<double> gx();
void sx(vector<double>);
py::dict custom;
int type;
int condition;
//mask for calculations to exclude atoms
bool mask;
//ghost properties
int ghost;
//-------------------------------------------------------
// Neighbor related properties
//-------------------------------------------------------
int neighbors[MAXNUMBEROFNEIGHBORS];
int masks[MAXNUMBEROFNEIGHBORS];
double neighbordist[MAXNUMBEROFNEIGHBORS];
double neighborweight[MAXNUMBEROFNEIGHBORS];
double n_diffx[MAXNUMBEROFNEIGHBORS];
double n_diffy[MAXNUMBEROFNEIGHBORS];
double n_diffz[MAXNUMBEROFNEIGHBORS];
double n_r[MAXNUMBEROFNEIGHBORS];
double n_phi[MAXNUMBEROFNEIGHBORS];
double n_theta[MAXNUMBEROFNEIGHBORS];
vector<datom> temp_neighbors;
double cutoff;
int n_neighbors;
int isneighborset;
//function to set neighbors
void sneighdist(vector<double>);
vector<double> gneighdist();
void sneighbors(vector<int> nns);
vector<int> gneighbors();
void sneighborweights(vector<double> nns);
vector<double> gneighborweights();
void sdistvecs(vector<vector<double>>);
vector<vector<double>> gdistvecs();
void slocalangles(vector<vector<double>>);
vector<vector<double>> glocalangles();
void find_filtered_neighbors(double);
vector<vector<int>> next_neighbors;
vector<vector<int>> next_neighbor_masks;
vector<vector<double>> next_neighbor_distances;
vector<int> next_neighbor_counts;
int head;
//-------------------------------------------------------
// Q parameter properties
//-------------------------------------------------------
double sij[MAXNUMBEROFNEIGHBORS];
double realQ6[13],imgQ6[13];
void ssij(vector<double>);
vector<double> gsij();
double q[11];
double aq[11];
double realq[11][25];
double imgq[11][25];
double arealq[11][25];
double aimgq[11][25];
vector<complex<double>> get_qcomps(int, bool);
vector<double> gallq();
vector<double> gallaq();
void sallq(vector<double>);
void sallaq(vector<double>);
double gq(int);
void sq(int, double);
double gq_big(int, bool);
void sq_big( int, double, bool);
vector<double> gq_big(vector<int>, bool);
void sq_big(vector<int>, vector<double>, bool);
double gaq(int);
void saq(int, double);
double sii;
double disorder;
double avgdisorder;
//-------------------------------------------------------
// Solid related properties
//-------------------------------------------------------
int frenkelnumber;
double avq6q6;
int belongsto;
bool lcluster;
bool issurface;
bool issolid;
int structure;
//-------------------------------------------------------
// Voronoi related properties
//-------------------------------------------------------
int facevertices[MAXNUMBEROFNEIGHBORS];
int faceverticenumbers[MAXNUMBEROFNEIGHBORS];
double faceperimeters[MAXNUMBEROFNEIGHBORS];
int n3, n4, n5, n6;
vector<vector<double>> edgelengths;
vector<vector<double>> vertex_positions;
vector<double> vertex_vectors;
vector<int> vertex_numbers;
double volume;
double avgvolume;
vector<int> gfacevertices();
void sfacevertices(vector<int>);
vector<double> gfaceperimeters();
void sfaceperimeters(vector<double>);
vector<vector<double>> gedgelengths();
void sedgelengths(vector<vector<double>>);
vector<int> gvorovector();
void svorovector(vector<int>);
vector<vector<double>> gvertexpositions();
void svertexpositions(vector<vector<double>>);
//-------------------------------------------------------
// Angle related properties
//-------------------------------------------------------
double angular;
double avg_angular;
vector<int> chiparams;
//-------------------------------------------------------
// CNA parameters
//-------------------------------------------------------
vector<vector<int>> cna;
vector<vector<int>> common;
vector<vector<int>> bonds;
int nn1[4];
//-------------------------------------------------------
// Other order parameters
//-------------------------------------------------------
vector<double> sro;
double centrosymmetry;
//these are the cutoffs for cna
double lcutsmall;
double lcutlarge;
int lneigh;
double sigma;
double rho;
double rstart;
double rstop;
double h;
double kb;
double gmr(double);
double entropy_integrand(double);
void trapezoid_integration();
//results
double entropy;
double avg_entropy;
double energy;
double avg_energy;
};