-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathzargs.h
More file actions
275 lines (275 loc) · 6.92 KB
/
zargs.h
File metadata and controls
275 lines (275 loc) · 6.92 KB
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#ifndef ZARGS_H
#define ZARGS_H
#define ARG_STRING 1
#define ARG_INT 2
#define ARG_LONG 3
#define ARG_DOUBLE 4
#define ARG_LFVEC 5
#define ARG_LFVEC2 6
#define ARG_SPECIES 7
#define ARG_UPDATE 8
#define NAME_LENGTH 256
#define COMMENT '#'
#include <immintrin.h>
typedef struct arg{
char short_opt,*long_opt,*key;
void *value;
unsigned flag;
size_t mask;
size_t off;
size_t n;
char *help;
void *sub;
}arg;
typedef struct arg_set{
int n;
arg *args;
}arg_set;
typedef struct patch{
//linking
/////////
void *p;
void *c;
void *specie;
//
int id;
double *angle; //angle with respect to particle orientation
__m128d *q_angle; //
__m128d *q;
}patch;
//structure for a particle with patches
///////////////////////////////////////
typedef struct particle{
patch *patch; //pointer to array of patches
void *c; //pointer to the compound
void *specie; //poiter to the beging of the array of the particles of the same specie
//Energy
////////
unsigned int en_new,en_old;
unsigned nd; // number of cell neighbours
double *nd_r2;
__m128d *nd_rij;
//
__m128d *q; //position
__m128d *q_tmp; //old position
__m128d *q_track; //track -- for Einstein solid calculations
__m128d *q_well; //well -- for Einstein solid calculations
__m128d *or; //orientation
__m128d *or_well; //well orientation -- for Einstein solid
__m128d *qp_rij; //q-p orientational vector
double qp_r2; //save q-p r^2 distance
//for compounds
///////////////
__m128d *dq; //vector from the center of the compound
//Parameters
////////////
double sigma,sigma_well; //particle diameter and interaction range
//Patches
/////////
int npatch; // number of patches
double patch_width; // patch witdh (if patch width kept fixed)
//id
////
unsigned n; //ID
//HASH
//////
unsigned h;
//double *nd_d2;
struct particle **nd_list;
struct particle **new_list,**old_list;
struct particle *next,**prev;
//Flag
//////
int flag;
int type;
//Graphs
////////
int pass; // tags visited particles
int idx; // particle index
int id; //id
int npcycles; //number of pcycles -- for cycle analysis
void *pcycles; //pcycle -- pointer to the list of cycles
//Colors
////////
float *color;
}particle;
//structure for a compound particle
///////////////////////////////////
typedef struct compound_particle{
patch *s; //pointer to patches belonging to the compound
particle *p; //pointer to particles belonging to the compound
void *specie; //pointer to the beging of the array of the compounds of the same specie
int id;
int nparticle;
int npatch;
unsigned int flag,n; //flag, ID;
__m128d *q; //compound position;
__m128d *q_tmp; //compound position;
__m128d *q_well;
__m128d *or; //compound orientation;
__m128d *or_well;
void *cluster;
}compound_particle;
//hash table structure
typedef struct hash_table{
particle *p;
particle ***list;
}hash_table;
typedef struct update{
struct update *next;
void *value;
}update;
typedef struct species{
//linking
/////////
patch *s; //pointer to patch array
particle *p; //pointer to particle array
compound_particle *c; //pointer to compound particle array
//
unsigned int compound; //0: simple particle; 1: it is a particle compound
unsigned int nppc; //number of particles per compound
double rod_length;
unsigned int ncompound,ncompound_alloc; //number of compounds
unsigned int nparticle,nparticle_alloc; //number of particles
unsigned int npatches,npatches_alloc; //number of all patches
//N -- read from input line or command line
///////////////////////////////////////////
unsigned int N;//,Nalloc; //number of particles, number of allocated particles
struct species *next;
int flag;
//particle specs (if the individual particles are not modified)
///////////////////////////////////////////////////////////////
double sigma; //particle diameter
double sigma_well; //particle diameter plus patch range
int npatch; //number of patches per particle
double patch_width; //patch width for kern-frenkel potentials
char patch_type[256];
double patch_angle;
double *angles;
//Simulation settings for the specie
////////////////////////////////////
int grand_canonical; //grand canonical switch
double mu; //chemical potential
double *interaction_matrix;
}species;
typedef struct cluster{
compound_particle **p; //pointer to a pointer in cluster_list
int n; //number of compound particles in the cluster
}cluster;
typedef struct cluster_list{
int n; //number of stored compounds
int ncluster; //number of clusters
double avg_size; //average cluster size
double max_size; //max cluster size
compound_particle **c; //store compound particles
cluster *clusters;
}cluster_list;
typedef struct files{
FILE *fepsilon; // inverse temperature
FILE *fmu;
FILE *fpressure;
FILE *fen; // U/N
FILE *frho; // N/V
FILE *fvol; //volume
FILE *fn; //number of particles
FILE *ftime; //passed time
FILE *fstep; //passed MC steps
FILE *fncluster; //number of clusters
FILE *fcluster_avg_size; //average cluster size
FILE *fcluster_max_size; //max cluster size
}files;
typedef struct header{
char name[NAME_LENGTH];
//unsigned int N,Nalloc;// number of particles, number of particles allocated
unsigned int ncompound,ncompound_alloc; //number of compounds, number to compounds allocated
unsigned int nparticle,nparticle_alloc; //number of particles, number of particles allocated
unsigned int npatches,npatches_alloc;//number of all patches, number of patches allocated
long long int step;
species *specie;
species *update;
compound_particle *c;
particle *p;
patch *s;
//Clusters
//////////
cluster_list *cluster;
int nspecies;
//HASH
//////
int ndir;
__m128i *dir;
__m128i h;
__m128d h1;
__m128d hash_cell;
__m128d box;
__m128d copy;
hash_table *table;
//Arguments
///////////
arg_set argz;
//Energy
////////
int energy;
//Parameters
////////////
double epsilon,end_epsilon;
double pressure;
double uy;
//Time
//////
time_t t1,t2;
//Printing and writing
//////////////////////
int mod,pmod;
int optimize;
int snapshot;
int verbose;
int display;
int explore;
__m128d screen_geometry;
//Ensembles
///////////
int npt;
int nptxy;
int nptdxdy;
int shape;
//Max displacments
//////////////////
__m128d max_displacement;
double max_rotation;
double max_vol;
double max_xy;
double max_dxdy;
double max_uy;
double max_dsigma;
//Random seed
/////////////
int seed;
//Files
///////
files file;
//Einstein
//////////
double lambda;
double lambda_coupling;
__m128d q_dcm;
//Graphs
////////
int ncycles;//number of cycles detected
particle **matrix_list;
void *adj_matrix;
void *graph_pcycle;
time_t init_time;
long long int steps_passed;
//Colors
////////
float *particle_colors;
}header;
extern int command_line_args(int argc,char *argv[],arg_set argz);
extern void dump_args(FILE *f,arg_set argz);
extern void usage(FILE *f,arg_set argz,char *prog);
extern void set_args(header *t);
extern int file_args(FILE *f,arg_set argz);
extern int read_string(FILE *f,char *s,int n);
extern int read_stamp(FILE *f,char *s,int n);
#endif