1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35     This file is from LAMMPS
36     LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
37     http://lammps.sandia.gov, Sandia National Laboratories
38     Steve Plimpton, sjplimp@sandia.gov
39 
40     Copyright (2003) Sandia Corporation.  Under the terms of Contract
41     DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
42     certain rights in this software.  This software is distributed under
43     the GNU General Public License.
44 ------------------------------------------------------------------------- */
45 
46 #ifdef FIX_CLASS
47 
48 FixStyle(ave/spatial,FixAveSpatial)
49 
50 #else
51 
52 #ifndef LMP_FIX_AVE_SPATIAL_H
53 #define LMP_FIX_AVE_SPATIAL_H
54 
55 #include <stdio.h>
56 #include "fix.h"
57 
58 namespace LAMMPS_NS {
59 
60 class FixAveSpatial : public Fix {
61  public:
62   FixAveSpatial(class LAMMPS *, int, char **);
63   ~FixAveSpatial();
64   int setmask();
65   void init();
66   void setup(int);
67   void end_of_step();
68   double compute_array(int,int);
69   double memory_usage();
70   void reset_timestep(bigint);
71 
72  private:
73   int me,nvalues;
74   int nrepeat,nfreq,irepeat;
75   bigint nvalid;
76   int ndim,normflag,regionflag,iregion,overwrite;
77   char *tstring,*sstring,*idregion;
78   int *which,*argindex,*value2index;
79   char **ids;
80   FILE *fp;
81   FILE *fp2;
82   bool write_ts_;
83   class Region *region;
84 
85   int ave,nwindow,scaleflag;
86   int norm,iwindow,window_limit;
87   double xscale,yscale,zscale;
88   double bin_volume;
89 
90   long filepos;
91   int dim[3],originflag[3],nlayers[3];
92   double origin[3],delta[3];
93   double offset[3],invdelta[3];
94 
95   int maxvar;
96   double *varatom;
97 
98   int maxatom;
99   int *bin;
100 
101   int nbins,maxbin;
102   double **coord;
103   double *count_one,*count_many,*count_sum;
104   double **values_one,**values_many,**values_sum;
105   double *count_total,**count_list;
106   double **values_total,***values_list;
107 
108   int calcStd;
109   int lowerLimit, upperLimit;
110 
111   void setup_bins();
112   void atom2bin1d();
113   void atom2bin2d();
114   void atom2bin3d();
115   bigint nextvalid();
116 };
117 
118 }
119 
120 #endif
121 #endif
122 
123 /* ERROR/WARNING messages:
124 
125 E: Illegal ... command
126 
127 Self-explanatory.  Check the input script syntax and compare to the
128 documentation for the command.  You can use -echo screen as a
129 command-line option when running LAMMPS to see the offending line.
130 
131 E: Cannot use fix ave/spatial z for 2 dimensional model
132 
133 Self-explanatory.
134 
135 E: Same dimension twice in fix ave/spatial
136 
137 Self-explanatory.
138 
139 E: Region ID for fix ave/spatial does not exist
140 
141 Self-explanatory.
142 
143 E: Cannot open fix ave/spatial file %s
144 
145 The specified file cannot be opened.  Check that the path and name are
146 correct.
147 
148 E: Compute ID for fix ave/spatial does not exist
149 
150 Self-explanatory.
151 
152 E: Fix ave/spatial compute does not calculate per-atom values
153 
154 A compute used by fix ave/spatial must generate per-atom values.
155 
156 E: Fix ave/spatial compute does not calculate a per-atom vector
157 
158 A compute used by fix ave/spatial must generate per-atom values.
159 
160 E: Fix ave/spatial compute does not calculate a per-atom array
161 
162 Self-explanatory.
163 
164 E: Fix ave/spatial compute vector is accessed out-of-range
165 
166 The index for the vector is out of bounds.
167 
168 E: Fix ID for fix ave/spatial does not exist
169 
170 Self-explanatory.
171 
172 E: Fix ave/spatial fix does not calculate per-atom values
173 
174 A fix used by fix ave/spatial must generate per-atom values.
175 
176 E: Fix ave/spatial fix does not calculate a per-atom vector
177 
178 A fix used by fix ave/spatial must generate per-atom values.
179 
180 E: Fix ave/spatial fix does not calculate a per-atom array
181 
182 Self-explanatory.
183 
184 E: Fix ave/spatial fix vector is accessed out-of-range
185 
186 The index for the vector is out of bounds.
187 
188 E: Variable name for fix ave/spatial does not exist
189 
190 Self-explanatory.
191 
192 E: Fix ave/spatial variable is not atom-style variable
193 
194 A variable used by fix ave/spatial must generate per-atom values.
195 
196 E: Fix ave/spatial for triclinic boxes requires units reduced
197 
198 Self-explanatory.
199 
200 E: Fix ave/spatial settings invalid with changing box
201 
202 If the ave setting is "running" or "window" and the box size/shape
203 changes during the simulation, then the units setting must be
204 "reduced", else the number of bins may change.
205 
206 E: Fix for fix ave/spatial not computed at compatible time
207 
208 Fixes generate their values on specific timesteps.  Fix ave/spatial is
209 requesting a value on a non-allowed timestep.
210 
211 E: Fix ave/spatial missed timestep
212 
213 You cannot reset the timestep to a value beyond where the fix
214 expects to next perform averaging.
215 
216 U: Use of fix ave/spatial with undefined lattice
217 
218 A lattice must be defined to use fix ave/spatial with units = lattice.
219 
220 */
221