forked from lammps/lammps
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfix_widom.h
256 lines (171 loc) · 6.96 KB
/
fix_widom.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
248
249
250
251
252
253
254
255
256
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, 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
// clang-format off
FixStyle(widom,FixWidom);
// clang-format on
#else
#ifndef LMP_FIX_WIDOM_H
#define LMP_FIX_WIDOM_H
#include "fix.h"
namespace LAMMPS_NS {
class FixWidom : public Fix {
public:
FixWidom(class LAMMPS *, int, char **);
~FixWidom();
int setmask();
void init();
void pre_exchange();
void attempt_atomic_insertion();
void attempt_molecule_insertion();
void attempt_atomic_insertion_full();
void attempt_molecule_insertion_full();
double energy(int, int, tagint, double *);
double molecule_energy(tagint);
double energy_full();
void update_gas_atoms_list();
double compute_vector(int);
double memory_usage();
void write_restart(FILE *);
void restart(char *);
void grow_molecule_arrays(int);
private:
int molecule_group, molecule_group_bit;
int molecule_group_inversebit;
int exclusion_group, exclusion_group_bit;
int nwidom_type, nevery, seed;
int ninsertions;
int ngas; // # of gas atoms on all procs
int ngas_local; // # of gas atoms on this proc
int exchmode; // exchange ATOM or MOLECULE
int movemode; // move ATOM or MOLECULE
int regionflag; // 0 = anywhere in box, 1 = specific region
int iregion; // widom region
char *idregion; // widom region id
bool charge_flag; // true if user specified atomic charge
bool full_flag; // true if doing full system energy calculations
int natoms_per_molecule; // number of atoms in each inserted molecule
int nmaxmolatoms; // number of atoms allocated for molecule arrays
double ave_widom_chemical_potential;
int widom_nmax;
int max_region_attempts;
double gas_mass;
double insertion_temperature;
double beta, sigma, volume;
double charge;
double xlo, xhi, ylo, yhi, zlo, zhi;
double region_xlo, region_xhi, region_ylo, region_yhi, region_zlo, region_zhi;
double region_volume;
double energy_stored; // full energy of old/current configuration
double *sublo, *subhi;
int *local_gas_list;
double **cutsq;
double **molcoords;
double *molq;
imageint *molimage;
imageint imagezero;
double energy_intra;
class Pair *pair;
class RanPark *random_equal;
class Atom *model_atom;
class Molecule **onemols;
int imol, nmol;
int triclinic; // 0 = orthog box, 1 = triclinic
class Compute *c_pe;
void options(int, char **);
};
} // namespace LAMMPS_NS
#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: Fix Widom does not (yet) work with atom_style template
Self-explanatory.
E: Fix Widom region does not support a bounding box
Not all regions represent bounded volumes. You cannot use
such a region with the fix Widom command.
E: Fix Widom region cannot be dynamic
Only static regions can be used with fix Widom.
E: Fix Widom region extends outside simulation box
Self-explanatory.
E: Fix Widom molecule must have coordinates
The defined molecule does not specify coordinates.
E: Fix Widom molecule must have atom types
The defined molecule does not specify atom types.
E: Atom type must be zero in fix Widom mol command
Self-explanatory.
E: Fix Widom molecule has charges, but atom style does not
Self-explanatory.
E: Fix Widom molecule template ID must be same as atom_style template ID
When using atom_style template, you cannot insert molecules that are
not in that template.
E: Fix Widom atom has charge, but atom style does not
Self-explanatory.
UNDOCUMENTED
E: Molecule template ID for fix Widom does not exist
Self-explanatory.
W: Molecule template for fix Widom has multiple molecules
The fix Widom command will only create molecules of a single type,
i.e. the first molecule in the template.
E: Region ID for fix Widom does not exist
Self-explanatory.
W: Fix Widom using full_energy option
Fix Widom has automatically turned on the full_energy option since it
is required for systems like the one specified by the user. User input
included one or more of the following: kspace, a hybrid
pair style, an eam pair style, tail correction,
or no "single" function for the pair style.
E: Invalid atom type in fix Widom command
The atom type specified in the Widom command does not exist.
E: Fix Widom cannot exchange individual atoms belonging to a molecule
This is an error since you should not delete only one atom of a
molecule. The user has specified atomic (non-molecular) gas
exchanges, but an atom belonging to a molecule could be deleted.
E: All mol IDs should be set for fix Widom group atoms
The molecule flag is on, yet not all molecule ids in the fix group
have been set to non-zero positive values by the user. This is an
error since all atoms in the fix Widom group are eligible for deletion,
rotation, and translation and therefore must have valid molecule ids.
E: Fix Widom molecule command requires that atoms have molecule attributes
Should not choose the Widom molecule feature if no molecules are being
simulated. The general molecule flag is off, but Widom's molecule flag
is on.
E: Cannot use fix Widom in a 2d simulation
Fix Widom is set up to run in 3d only. No 2d simulations with fix Widom
are allowed.
E: Could not find fix Widom exclusion group ID
Self-explanatory.
E: Illegal fix Widom gas mass <= 0
The computed mass of the designated gas molecule or atom type was less
than or equal to zero.
E: Cannot do Widom on atoms in atom_modify first group
This is a restriction due to the way atoms are organized in a list to
enable the atom_modify first command.
W: Fix Widom is being applied to the default group all
This is allowed, but it will result in Monte Carlo moves
being performed on all the atoms in the system, which is
often not what is intended.
E: Could not find specified fix Widom group ID
Self-explanatory.
E: fix Widom does currently not support full_energy option with molecules on more than 1 MPI process.
UNDOCUMENTED
E: Fix Widom put atom outside box
This should not normally happen. Contact the developers.
E: Fix Widom ran out of available molecule IDs
See the setting for tagint in the src/lmptype.h file.
E: Fix Widom ran out of available atom IDs
See the setting for tagint in the src/lmptype.h file.
E: Too many total atoms
See the setting for bigint in the src/lmptype.h file.
*/