-
Notifications
You must be signed in to change notification settings - Fork 5
/
fix_ordern.h
212 lines (149 loc) · 6.66 KB
/
fix_ordern.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
/* ----------------------------------------------------------------------
fix ordern is a child class of "fix", developed based on two classes
of "fix ave/time" and "fix ave/correlate/long", provided by LAMMPS.
This command is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, [email protected]
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(ordern,FixOrderN)
#else
#ifndef LMP_FIX_ORDERN_H
#define LMP_FIX_ORDERN_H
#include "fix.h"
#include <cstdio>
namespace LAMMPS_NS {
class FixOrderN : public Fix {
public:
FixOrderN(class LAMMPS *, int, char **); // constructor
~FixOrderN(); // destructor
int setmask(); // the code is needed at the end of step
void init(); // initialization
void setup(int);
void end_of_step();
void invoke_scalar(bigint);
void write_restart(FILE *);
void restart(char *);
private:
int me; // the ID of the local processor
int mode; // which type of transport properties (defined as enum)
int nvalues; // the number of input values (it must be 1)
int nfreq; // the frequency of writing files to disk
int icompute; // the ID of compute for the tranpsort property
int nrows; // number of data passed to fix ordern via compute
int startstep; // the first timestep that it starts sampling
int tnb; // total number of blocks (different time scales)
int tnbe; // total number of block elements (elemets of similar timescales)
int vecsize; // number of vector elements constructed from nrows (exp. diff)
int sampsize; // number of vector elements for constructing sample arrays
int flag_Dxyz; // if components of diffusivities in x, y, & z should be written
int flag_TCconv; // if convective components of thermal conductivity should be written
int restart_continue; // checks to not sample twice in a timestep due to restarting
bigint nvalid; // the next(current) timestep to call end_of_step()
bigint nvalid_last; // the previous timestep that end_of_step() was called
double deltat; // timeinterval (nevery*dt)
double time; // correlation time (only for writting data)
double boltz; // Boltzmann constant
double nktv2p; // conversion factors
double volume; // volume of the simulation box
double coef; // conversion coefficient
long filepos1; // the location of header lines for file 1
long filepos2; // the location of header lines for file 2
double *recdata; // data passed from compute to fix;
char *filename1; // filename for self-diffusion, shear viscosity, and conductivity
char *filename2; // filename for onsager coefficients and bulk viscosity
char *format; // the default format of writing data to files (%g)
char *format_user; // user-defined format of writing data to files
char *title; // optional text for the first line of the text
char *idcompute; // the ID of compute
FILE *fp1; // output file 1 (self-diffusion, shear viscosity, thermal conductivity)
FILE *fp2; // output file 2 (onsager coefficients, bulk viscosity)
// General variables
int count; // how many cycles have been passed
int icount; // how many nevery, used for integration
// ORDER-N ALGORITHM variables
double **nsamp; // total number of samples
double ***oldint; // The lowest bound of the integral
double *rint; // running integral
int *nbe; // (BlockLength) number of active elements of blocks
int cnb; // (NumberOfBlock) current active number of blocks
int cnbe; // (CurrentBlockLength) current active number of elemets of the block
// DIFFUSIVITY vairables
double ***PosC_ii;
double ***PosC_iix;
double ***PosC_iiy;
double ***PosC_iiz;
double ****PosC_ij;
double ****PosC_ijx;
double ****PosC_ijy;
double ****PosC_ijz;
double ****PosCorrSum;
int **groupinfo;
int **atomingroup;
int atomgroup; // the ID of each group
int tngroup; // total # of defined groups (tngroup >= ngroup)
int ngroup; // total # of groups
int tnatom; // total # of atoms in system
int natom; // total # of atoms in groups
int sortID; // A virtual ID of the atom in a for loop (to tnatom)
int ID; // the real ID of an atom on all cores (to tnatom)
int atomID; // the ID of an atom inside a group (to natom)
int atommask; // the group mask of an atom
// VISCOSITY/THERMCOND vairables
double ***samp; // samples of MSDs
double *data; // accumulated integrals
double sumP, numP, avgP; // hydrostatic pressure (sum/num = avg)
double *simpf0, *simpf1; // Simpson's rule of integration
double dist; // (integral) The integral we need to sample, i.e., "accint-oldint"
// PRIVATE METHODS
bigint nextvalid();
void integrate();
void write_diffusivity();
void write_viscosity();
void write_thermcond();
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Incorrect number of inputs for fix ordern command
There should be only one compute ID.
E: All components of the vector are required for fix ordern command
No use of brackets []
E: Illegal fix ordern command: illegal numbers for fix ordern command
Self-explanatory.
E: Illegal fix ordern command: nevery is not a factor of nfreq
In case of viscosity and thermal conductivity, 2*nevery should be a factor of nfreq
E: Illegal fix ordern command: nevery is not a factor of start
Self-explanatory.
E: No compute ID for fix ordern command
Self-explanatory.
E: No global compute vector is computed for fix ordern command
Self-explanatory.
E: Input vector for fix ordern command has variable size
Self-explanatory.
E: Cannot open fix ordern files
Self-explanatory.
E: Error in writing file header for fix ordern command
Self-explanatory.
E: Invalid timestep reset for fix order
Self-explanatory.
E: restart is not possible with different parameters
Self-explanatory.
E: restart error: change in the number of group
Self-explanatory.
E: restart error: change in the number of atoms
Self-explanatory.
*/