From d7c50255302f705e67df7ef2da0d1c288b9b1c18 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 31 May 2016 13:58:37 +0000
Subject: [PATCH 001/111] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@15068
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
tools/msi2lmp/frc_files/clayff.frc | 61 ++++++++++++++++--------------
1 file changed, 33 insertions(+), 28 deletions(-)
diff --git a/tools/msi2lmp/frc_files/clayff.frc b/tools/msi2lmp/frc_files/clayff.frc
index bdc9c2c004..6072bea792 100644
--- a/tools/msi2lmp/frc_files/clayff.frc
+++ b/tools/msi2lmp/frc_files/clayff.frc
@@ -2,34 +2,36 @@
#atom_types cvff
-!Ver Ref Type Mass Element Connections Comment
+!Ver Ref Type Mass Element Connections Description and charge
!---- --- ---- ---------- ------- -----------------------------------------
- 1.0 1 st 28.08550 Si 4
- 1.0 1 ao 26.98154 Al 6
- 1.0 1 at 26.98154 Al 4
- 1.0 1 mgo 24.30500 Mg 6
- 1.0 1 cao 40.08000 Ca 6
- 1.0 1 feo 55.84700 Fe 6
- 1.0 1 lio 6.941000 Li 6
- 1.0 1 ob 15.99940 O 2
- 1.0 1 obss 15.99940 O 3
- 1.0 1 obts 15.99940 O 2
- 1.0 1 obos 15.99940 O 2
- 1.0 1 ohs 15.99940 O 2
- 1.0 1 oh 15.99940 O 2
- 1.0 1 oh- 15.99940 O 1
- 1.0 1 o* 15.99940 O 2
- 1.0 1 ho 1.007970 H 1
- 1.0 1 h* 1.007970 H 1
- 1.0 1 Na 22.99000 Na 0
- 1.0 1 K 39.10 K 0
- 1.0 1 Cs 132.9100 Cs 0
- 1.0 1 Ca 40.07980 Ca 0
- 1.0 1 Ba 137.3300 Ba 0
- 1.0 1 Mg 24.3050 Mg 0
- 1.0 1 Sr 87.6200 Sr 0
- 1.0 1 Pb 207.2000 Pb 0
- 1.0 1 Cl 35.45300 Cl 0
+ 1.0 1 st 28.08550 Si 4 tetrahedral silicon 2.1
+ 1.0 1 ao 26.98154 Al 6 octahedral aluminum 1.575
+ 1.0 1 at 26.98154 Al 4 tetrahedral aluminum 1.575
+ 1.0 1 mgo 24.30500 Mg 6 octahedral magnesium 1.36
+ 1.0 1 mgh 24.30500 Mg 6 hydroxide magnesium 1.05
+ 1.0 1 cao 40.08000 Ca 6 octahedral calcium 1.36
+ 1.0 1 cah 40.08000 Ca 6 hydroxide calcium 1.05
+ 1.0 1 feo 55.84700 Fe 6 octahedral iron 1.575
+ 1.0 1 lio 6.941000 Li 6 octahedral lithium 0.525
+ 1.0 1 ob 15.99940 O 2 bridging oxygen -1.05
+ 1.0 1 obss 15.99940 O 3 oxygen double sub. -1.2996
+ 1.0 1 obts 15.99940 O 2 oxygen tet. sub. -1.1688
+ 1.0 1 obos 15.99940 O 2 oxygen oct. sub. -1.1808
+ 1.0 1 ohs 15.99940 O 2 hydroxyl O sub. -1.0808
+ 1.0 1 oh 15.99940 O 2 hydroxyl O -0.95
+ 1.0 1 oh- 15.99940 O 1 hydroxide O
+ 1.0 1 o* 15.99940 O 2 spc water O -0.82
+ 1.0 1 ho 1.007970 H 1 hydroxyl H 0.425
+ 1.0 1 h* 1.007970 H 1 spc water H 0.41
+ 1.0 1 Na 22.99000 Na 0 sodium ion 1.0
+ 1.0 1 K 39.10 K 0 potassium ion 1.0
+ 1.0 1 Cs 132.9100 Cs 0 cesium ion 1.0
+ 1.0 1 Ca 40.07980 Ca 0 calcium ion 2.0
+ 1.0 1 Ba 137.3300 Ba 0 barium ion 2.0
+ 1.0 1 Mg 24.3050 Mg 0 magnesium ion 2.0
+ 1.0 1 Sr 87.6200 Sr 0 strontium ion 2.0
+ 1.0 1 Pb 207.2000 Pb 0 lead ion 2.0
+ 1.0 1 Cl 35.45300 Cl 0 chloride ion -1.0
#equivalence cvff
@@ -74,6 +76,7 @@
!Ver Ref I J R0 K2
!---- --- ---- ---- ------- --------
+ 2.1 28 o* h* 1.0000 553.9350
2.1 28 oh ho 1.0000 553.9350
2.1 28 ohs ho 1.0000 553.9350
@@ -84,7 +87,7 @@
!Ver Ref I J K Theta0 K2
!---- --- ---- ---- ---- -------- -------
- 2.3 23 cp cp c' 120.0000 34.6799
+ 1.0 1 h* o* h* 109.4700 45.7530
@@ -122,7 +125,9 @@
1.0 1 ao 196.1446 0.03230
1.0 1 at 12.3645 0.00954
1.0 1 mgo 1636.3265 0.07688
+ 1.0 1 mgh 1636.3265 0.07688
1.0 1 cao 17814.73 0.5987
+ 1.0 1 cah 17624.076 0.595
1.0 1 feo 702.54 0.0504
1.0 1 lio 112.01 0.0201
1.0 1 ob 629358.0000 625.50000
From 8fa54096d38f2ae3c18fa301ab6c20f11231a9f7 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 31 May 2016 14:48:46 +0000
Subject: [PATCH 002/111] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@15069
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
doc/src/Section_commands.txt | 2 -
doc/src/change_box.txt | 12 +-
doc/src/compute.txt | 13 +-
doc/src/compute_property_atom.txt | 4 +-
doc/src/compute_temp_deform.txt | 2 +-
doc/src/fix.txt | 10 +-
doc/src/fix_ave_atom.txt | 4 +-
doc/src/fix_ave_chunk.txt | 4 +-
doc/src/fix_ave_correlate.txt | 10 +-
doc/src/fix_ave_histo.txt | 2 +-
doc/src/fix_ave_spatial.txt | 418 ---------------------------
doc/src/fix_ave_spatial_sphere.txt | 324 ---------------------
doc/src/fix_ave_time.txt | 4 +-
doc/src/fix_deform.txt | 2 +-
doc/src/fix_thermal_conductivity.txt | 11 +-
doc/src/fix_viscosity.txt | 6 +-
doc/src/prd.txt | 6 +-
doc/src/tad.txt | 6 +-
doc/src/variable.txt | 2 +-
19 files changed, 47 insertions(+), 795 deletions(-)
delete mode 100644 doc/src/fix_ave_spatial.txt
delete mode 100644 doc/src/fix_ave_spatial_sphere.txt
diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt
index a67f39c8e8..e02fd934cc 100644
--- a/doc/src/Section_commands.txt
+++ b/doc/src/Section_commands.txt
@@ -495,7 +495,6 @@ g = GPU, i = USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
"ave/correlate"_fix_ave_correlate.html,
"ave/histo"_fix_ave_histo.html,
"ave/histo/weight"_fix_ave_histo.html,
-"ave/spatial"_fix_ave_spatial.html,
"ave/time"_fix_ave_time.html,
"balance"_fix_balance.html,
"bond/break"_fix_bond_break.html,
@@ -613,7 +612,6 @@ package"_Section_start.html#start_3.
"addtorque"_fix_addtorque.html,
"atc"_fix_atc.html,
"ave/correlate/long"_fix_ave_correlate_long.html,
-"ave/spatial/sphere"_fix_ave_spatial_sphere.html,
"colvars"_fix_colvars.html,
"drude"_fix_drude.html,
"drude/transform/direct"_fix_drude_transform.html,
diff --git a/doc/src/change_box.txt b/doc/src/change_box.txt
index 7fc6198232..15111fec08 100644
--- a/doc/src/change_box.txt
+++ b/doc/src/change_box.txt
@@ -315,12 +315,12 @@ been previously used to define the lattice spacing.
If you use the {ortho} or {triclinic} keywords, then at the point in
the input script when this command is issued, no "dumps"_dump.html can
-be active, nor can a "fix ave/spatial"_fix_ave_spatial.html or "fix
-deform"_fix_deform.html be active. This is because these commands
-test whether the simulation box is orthogonal when they are first
-issued. Note that these commands can be used in your script before a
-change_box command is issued, so long as an "undump"_undump.html or
-"unfix"_unfix.html command is also used to turn them off.
+be active, nor can a "fix deform"_fix_deform.html be active. This is
+because these commands test whether the simulation box is orthogonal
+when they are first issued. Note that these commands can be used in
+your script before a change_box command is issued, so long as an
+"undump"_undump.html or "unfix"_unfix.html command is also used to
+turn them off.
[Related commands:]
diff --git a/doc/src/compute.txt b/doc/src/compute.txt
index b847985bf7..3da2143411 100644
--- a/doc/src/compute.txt
+++ b/doc/src/compute.txt
@@ -99,11 +99,10 @@ custom"_thermo_style.html or "fix ave/time"_fix_ave_time.html command.
Or the values can be referenced in a "variable equal"_variable.html or
"variable atom"_variable.html command. :l
-Per-atom values can be output via the "dump custom"_dump.html command
-or the "fix ave/spatial"_fix_ave_spatial.html command. Or they can be
-time-averaged via the "fix ave/atom"_fix_ave_atom.html command or
-reduced by the "compute reduce"_compute_reduce.html command. Or the
-per-atom values can be referenced in an "atom-style
+Per-atom values can be output via the "dump custom"_dump.html command.
+Or they can be time-averaged via the "fix ave/atom"_fix_ave_atom.html
+command or reduced by the "compute reduce"_compute_reduce.html
+command. Or the per-atom values can be referenced in an "atom-style
variable"_variable.html. :l
Local values can be reduced by the "compute
@@ -255,7 +254,7 @@ section of "this page"_Section_commands.html#cmd_5.
[Related commands:]
"uncompute"_uncompute.html, "compute_modify"_compute_modify.html, "fix
-ave/atom"_fix_ave_atom.html, "fix ave/spatial"_fix_ave_spatial.html,
-"fix ave/time"_fix_ave_time.html, "fix ave/histo"_fix_ave_histo.html
+ave/atom"_fix_ave_atom.html, "fix ave/time"_fix_ave_time.html, "fix
+ave/histo"_fix_ave_histo.html
[Default:] none
diff --git a/doc/src/compute_property_atom.txt b/doc/src/compute_property_atom.txt
index 9b7483fd8d..6fe4c79b37 100644
--- a/doc/src/compute_property_atom.txt
+++ b/doc/src/compute_property_atom.txt
@@ -91,7 +91,7 @@ in the group. This is useful so that the values can be used by other
"output commands"_Section_howto.html#howto_15 that take computes as
inputs. See for example, the "compute reduce"_compute_reduce.html,
"fix ave/atom"_fix_ave_atom.html, "fix ave/histo"_fix_ave_histo.html,
-"fix ave/spatial"_fix_ave_spatial.html, and "atom-style
+"fix ave/chunk"_fix_ave_chunk.html, and "atom-style
variable"_variable.html commands.
The list of possible attributes is the same as that used by the "dump
@@ -157,7 +157,7 @@ units for q, etc.
[Related commands:]
"dump custom"_dump.html, "compute reduce"_compute_reduce.html, "fix
-ave/atom"_fix_ave_atom.html, "fix ave/spatial"_fix_ave_spatial.html,
+ave/atom"_fix_ave_atom.html, "fix ave/chunk"_fix_ave_chunk.html,
"fix property/atom"_fix_property_atom.html
[Default:] none
diff --git a/doc/src/compute_temp_deform.txt b/doc/src/compute_temp_deform.txt
index ed7da650e0..168b0b3880 100644
--- a/doc/src/compute_temp_deform.txt
+++ b/doc/src/compute_temp_deform.txt
@@ -88,7 +88,7 @@ matches the box deformation. If not, then the compute will subtract
off an incorrect stream velocity, yielding a bogus thermal
temperature. You should NOT assume that your atoms are streaming at
the same rate the box is deforming. Rather, you should monitor their
-velocity profile, e.g. via the "fix ave/spatial"_fix_ave_spatial.html
+velocity profile, e.g. via the "fix ave/chunk"_fix_ave_chunk.html
command. And you can compare the results of this compute to "compute
temp/profile"_compute_temp_profile.html, which actually calculates the
stream profile before subtracting it. If the two computes do not give
diff --git a/doc/src/fix.txt b/doc/src/fix.txt
index 0f65677b58..577d2b1f2e 100644
--- a/doc/src/fix.txt
+++ b/doc/src/fix.txt
@@ -122,11 +122,10 @@ custom"_thermo_style.html or "fix ave/time"_fix_ave_time.html command.
Or the values can be referenced in a "variable equal"_variable.html or
"variable atom"_variable.html command. :ulb,l
-Per-atom values can be output via the "dump custom"_dump.html command
-or the "fix ave/spatial"_fix_ave_spatial.html command. Or they can be
-time-averaged via the "fix ave/atom"_fix_ave_atom.html command or
-reduced by the "compute reduce"_compute_reduce.html command. Or the
-per-atom values can be referenced in an "atom-style
+Per-atom values can be output via the "dump custom"_dump.html command.
+Or they can be time-averaged via the "fix ave/atom"_fix_ave_atom.html
+command or reduced by the "compute reduce"_compute_reduce.html
+command. Or the per-atom values can be referenced in an "atom-style
variable"_variable.html. :l
Local values can be reduced by the "compute
@@ -171,7 +170,6 @@ of "this page"_Section_commands.html#cmd_5.
"ave/chunk"_fix_ave_chunk.html - compute per-chunk time-averaged quantities
"ave/correlate"_fix_ave_correlate.html - compute/output time correlations
"ave/histo"_fix_ave_histo.html - compute/output time-averaged histograms
-"ave/spatial"_fix_ave_spatial.html - compute/output time-averaged per-atom quantities by layer
"ave/time"_fix_ave_time.html - compute/output global time-averaged quantities
"balance"_fix_balance.html - perform dynamic load-balancing
"bond/break"_fix_bond_break.html - break bonds on the fly
diff --git a/doc/src/fix_ave_atom.txt b/doc/src/fix_ave_atom.txt
index af38f3a1e0..1d5053d37b 100644
--- a/doc/src/fix_ave_atom.txt
+++ b/doc/src/fix_ave_atom.txt
@@ -38,7 +38,7 @@ Use one or more per-atom vectors as inputs every few timesteps, and
average them atom by atom over longer timescales. The resulting
per-atom averages can be used by other "output
commands"_Section_howto.html#howto_15 such as the "fix
-ave/spatial"_fix_ave_spatial.html or "dump custom"_dump.html commands.
+ave/chunk"_fix_ave_chunk.html or "dump custom"_dump.html commands.
The group specified with the command means only atoms within the group
have their averages computed. Results are set to 0.0 for atoms not in
@@ -147,7 +147,7 @@ minimization"_minimize.html.
[Related commands:]
"compute"_compute.html, "fix ave/histo"_fix_ave_histo.html, "fix
-ave/spatial"_fix_ave_spatial.html, "fix ave/time"_fix_ave_time.html,
+ave/chunk"_fix_ave_chunk.html, "fix ave/time"_fix_ave_time.html,
"variable"_variable.html,
[Default:] none
diff --git a/doc/src/fix_ave_chunk.txt b/doc/src/fix_ave_chunk.txt
index fd31369d2a..0ebbafd6ca 100644
--- a/doc/src/fix_ave_chunk.txt
+++ b/doc/src/fix_ave_chunk.txt
@@ -67,8 +67,8 @@ fix 1 flow ave/chunk 100 5 1000 binchunk density/mass ave running :pre
[NOTE:]
-If you are trying to replace an older fix ave/spatial command with the
-newer, more flexible fix ave/chunk and "compute
+If you are trying to replace a deprectated fix ave/spatial command
+with the newer, more flexible fix ave/chunk and "compute
chunk/atom"_compute_chunk_atom.html commands, you simply need to split
the fix ave/spatial arguments across the two new commands. For
example, this command:
diff --git a/doc/src/fix_ave_correlate.txt b/doc/src/fix_ave_correlate.txt
index 2394185b5d..ae785b4fc5 100644
--- a/doc/src/fix_ave_correlate.txt
+++ b/doc/src/fix_ave_correlate.txt
@@ -83,10 +83,10 @@ Each listed value can be the result of a "compute"_compute.html or
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
from a compute, fix, or variable, then see the "fix
-ave/spatial"_fix_ave_spatial.html, "fix ave/atom"_fix_ave_atom.html,
-or "fix ave/histo"_fix_ave_histo.html commands. If you wish to
-convert a per-atom quantity into a single global value, see the
-"compute reduce"_compute_reduce.html command.
+ave/chunk"_fix_ave_chunk.html, "fix ave/atom"_fix_ave_atom.html, or
+"fix ave/histo"_fix_ave_histo.html commands. If you wish to convert a
+per-atom quantity into a single global value, see the "compute
+reduce"_compute_reduce.html command.
"Computes"_compute.html that produce global quantities are those which
do not have the word {atom} in their style name. Only a few
@@ -332,7 +332,7 @@ minimization"_minimize.html.
"fix ave/correlate/long"_fix_ave_correlate_long.html,
"compute"_compute.html, "fix ave/time"_fix_ave_time.html, "fix
-ave/atom"_fix_ave_atom.html, "fix ave/spatial"_fix_ave_spatial.html,
+ave/atom"_fix_ave_atom.html, "fix ave/chunk"_fix_ave_chunk.html,
"fix ave/histo"_fix_ave_histo.html, "variable"_variable.html
[Default:] none
diff --git a/doc/src/fix_ave_histo.txt b/doc/src/fix_ave_histo.txt
index 58b234d363..3d287d4fe4 100644
--- a/doc/src/fix_ave_histo.txt
+++ b/doc/src/fix_ave_histo.txt
@@ -331,7 +331,7 @@ minimization"_minimize.html.
[Related commands:]
"compute"_compute.html, "fix ave/atom"_fix_ave_atom.html, "fix
-ave/spatial"_fix_ave_spatial.html, "fix ave/time"_fix_ave_time.html,
+ave/chunk"_fix_ave_chunk.html, "fix ave/time"_fix_ave_time.html,
"variable"_variable.html, "fix ave/correlate"_fix_ave_correlate.html,
[Default:] none
diff --git a/doc/src/fix_ave_spatial.txt b/doc/src/fix_ave_spatial.txt
deleted file mode 100644
index 12b452cd56..0000000000
--- a/doc/src/fix_ave_spatial.txt
+++ /dev/null
@@ -1,418 +0,0 @@
-"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
-
-:link(lws,http://lammps.sandia.gov)
-:link(ld,Manual.html)
-:link(lc,Section_commands.html#comm)
-
-:line
-
-fix ave/spatial command :h3
-
-[Syntax:]
-
-fix ID group-ID ave/spatial Nevery Nrepeat Nfreq dim origin delta ... value1 value2 ... keyword args ... :pre
-
-ID, group-ID are documented in "fix"_fix.html command :ulb,l
-ave/spatial = style name of this fix command :l
-Nevery = use input values every this many timesteps :l
-Nrepeat = # of times to use input values for calculating averages :l
-Nfreq = calculate averages every this many timesteps :l
-dim, origin, delta can be repeated 1, 2, or 3 times for 1d, 2d, or 3d bins :l
- dim = {x} or {y} or {z}
- origin = {lower} or {center} or {upper} or coordinate value (distance units)
- delta = thickness of spatial bins in dim (distance units) :pre
-one or more input values can be listed :l
-value = vx, vy, vz, fx, fy, fz, density/mass, density/number, c_ID, c_ID\[I\], f_ID, f_ID\[I\], v_name :l
- vx,vy,vz,fx,fy,fz = atom attribute (velocity, force component)
- density/number, density/mass = number or mass density
- c_ID = per-atom vector calculated by a compute with ID
- c_ID\[I\] = Ith column of per-atom array calculated by a compute with ID
- f_ID = per-atom vector calculated by a fix with ID
- f_ID\[I\] = Ith column of per-atom array calculated by a fix with ID
- v_name = per-atom vector calculated by an atom-style variable with name :pre
-
-zero or more keyword/arg pairs may be appended :l
-keyword = {region} or {bound} or {discard} or {norm} or {ave} or {units} or {file} or {overwrite} or {title1} or {title2} or {title3} :l
- {region} arg = region-ID
- {bound} args = x/y/z lo hi
- x/y/z = {x} or {y} or {z} to bound bins in this dimension
- lo = {lower} or coordinate value (distance units)
- hi = {upper} or coordinate value (distance units)
- {discard} arg = {mixed} or {no} or {yes}
- mixed = discard atoms outside bins only if bin bounds are explicitly set
- no = always keep out-of-bounds atoms
- yes = always discard out-of-bounds atoms
- {norm} arg = {all} or {sample}
- region-ID = ID of region atoms must be in to contribute to spatial averaging
- {ave} args = {one} or {running} or {window M}
- one = output new average value every Nfreq steps
- running = output cumulative average of all previous Nfreq steps
- window M = output average of M most recent Nfreq steps
- {units} arg = {box} or {lattice} or {reduced}
- {file} arg = filename
- filename = file to write results to
- {overwrite} arg = none = overwrite output file with only latest output
- {title1} arg = string
- string = text to print as 1st line of output file
- {title2} arg = string
- string = text to print as 2nd line of output file
- {title3} arg = string
- string = text to print as 3rd line of output file :pre
-:ule
-
-[Examples:]
-
-fix 1 all ave/spatial 10000 1 10000 z lower 0.02 c_myCentro units reduced &
- title1 "My output values"
-fix 1 flow ave/spatial 100 10 1000 y 0.0 1.0 vx vz norm sample file vel.profile
-fix 1 flow ave/spatial 100 5 1000 z lower 1.0 y 0.0 2.5 density/mass ave running
-fix 1 flow ave/spatial 100 5 1000 z lower 1.0 y 0.0 2.5 density/mass bound y 5.0 20.0 discard yes ave running :pre
-
-[NOTE:]
-
- The fix ave/spatial command has been replaced by the more flexible
-"fix ave/chunk"_fix_ave_chunk.html and "compute
-chunk/atom"_compute_chunk_atom.html commands. The fix ave/spatial
-command will be removed from LAMMPS sometime in the summer of 2015.
-
-Any fix ave/spatial command can be replaced by the two new commands.
-You simply need to split the fix ave/spatial arguments across the two
-new commands. For example, this command:
-
-fix 1 flow ave/spatial 100 10 1000 y 0.0 1.0 vx vz norm sample file vel.profile :pre
-
-could be replaced by:
-
-compute cc1 flow chunk/atom bin/1d y 0.0 1.0
-fix 1 flow ave/chunk 100 10 1000 cc1 vx vz norm sample file vel.profile :pre
-
-[Description:]
-
-Use one or more per-atom vectors as inputs every few timesteps, bin
-their values spatially into 1d, 2d, or 3d bins based on current atom
-coordinates, and average the bin values over longer timescales. The
-resulting bin averages can be used by other "output
-commands"_Section_howto.html#howto_15 such as "thermo_style
-custom"_thermo_style.html, and can also be written to a file.
-
-The group specified with the command means only atoms within the group
-contribute to bin averages. If the {region} keyword is used, the atom
-must be in both the specified group and the specified geometric
-"region"_region.html in order to contribute to bin averages.
-
-Each listed value can be an atom attribute (position, velocity, force
-component), a mass or number density, or the result of a
-"compute"_compute.html or "fix"_fix.html or the evaluation of an
-atom-style "variable"_variable.html. In the latter cases, the
-compute, fix, or variable must produce a per-atom quantity, not a
-global quantity. If you wish to time-average global quantities from a
-compute, fix, or variable, then see the "fix
-ave/time"_fix_ave_time.html command.
-
-"Computes"_compute.html that produce per-atom quantities are those
-which have the word {atom} in their style name. See the doc pages for
-individual "fixes"_fix.html to determine which ones produce per-atom
-quantities. "Variables"_variable.html of style {atom} are the only
-ones that can be used with this fix since all other styles of variable
-produce global quantities.
-
-The per-atom values of each input vector are binned and averaged
-independently of the per-atom values in other input vectors.
-
-The size and dimensionality of the bins (1d = layers or slabs, 2d =
-pencils, 3d = boxes) are determined by the {dim}, {origin}, and
-{delta} settings and how many times they are specified (1, 2, or 3).
-See details below.
-
-NOTE: This fix works by creating an array of size Nbins by Nvalues on
-each processor. Nbins is the total number of bins; Nvalues is the
-number of input values specified. Each processor loops over its
-atoms, tallying its values to the appropriate bin. Then the entire
-array is summed across all processors. This means that using a large
-number of bins (easy to do for 2d or 3d bins) will incur an overhead
-in memory and computational cost (summing across processors), so be
-careful to use reasonable numbers of bins.
-
-:line
-
-The {Nevery}, {Nrepeat}, and {Nfreq} arguments specify on what
-timesteps the input values will be used to bin them and contribute to
-the average. The final averaged quantities are generated on timesteps
-that are a multiples of {Nfreq}. The average is over {Nrepeat}
-quantities, computed in the preceding portion of the simulation every
-{Nevery} timesteps. {Nfreq} must be a multiple of {Nevery} and
-{Nevery} must be non-zero even if {Nrepeat} is 1. Also, the timesteps
-contributing to the average value cannot overlap,
-i.e. Nrepeat*Nevery can not exceed Nfreq.
-
-For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
-timesteps 90,92,94,96,98,100 will be used to compute the final average
-on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
-timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
-averaging is done; values are simply generated on timesteps
-100,200,etc.
-
-:line
-
-Each per-atom property is also averaged over atoms in each bin. The
-way the averaging is one across the {Nrepeat} timesteps to produce
-output on the {Nfreq} timesteps, and across multiple {Nfreq} outputs,
-is determined by the {norm} and {av} keyword settings, as discussed
-below.
-
-Bins can be 1d layers or slabs, 2d pencils, or 3d boxes. This depends
-on how many times (1, 2, or 3) the {dim}, {origin}, and {delta}
-settings are specified in the fix ave/spatial command. For 2d or 3d
-bins, there is no restriction on specifying dim = x before dim = y, or
-dim = y before dim = z. Bins in a particular {dim} have a bin size in
-that dimension given by {delta}. Every Nfreq steps, when averaging is
-being performed and the per-atom property is calculated for the first
-time, the number of bins and the bin sizes and boundaries are
-computed. Thus if the simulation box changes size during a
-simulation, the number of bins and their boundaries may also change.
-In each dimension, bins are defined relative to a specified {origin},
-which may be the lower/upper edge of the simulation box in that
-dimension, or its center point, or a specified coordinate value.
-Starting at the origin, sufficient bins are created in both directions
-to completely span the bin extent in that dimension. By default the
-bin extent is the entire simulation box.
-
-The {bound} keyword can be used one or more times to limit the extent
-of bin coverage in specified dimensions, i.e. to only bin a portion of
-the box. If the {lo} setting is {lower} or the {hi} setting is
-{upper}, the bin extent in that direction extends to the box boundary.
-If a numeric value is used for {lo} and/or {hi}, then the bin extent
-in the {lo} or {hi} direction extends only to that value, which is
-assumed to be inside (or at least near) the simulation box boundaries,
-though LAMMPS does not check for this.
-
-On each sampling timestep, each atom is mapped to the bin it currently
-belongs to, based on its current position. Note that the group-ID and
-region keyword can exclude specific atoms from this operation, as
-discussed above. Note that between reneighboring timesteps, atoms can
-move outside the current simulation box. If the box is periodic (in
-that dimension) the atom is remapping into the periodic box for
-purposes of binning. If the box in not periodic, the atom may have
-moved outside the bounds of any bin.
-
-The {discard} keyword determines what is done with any atom which is
-outside the bounds of any bin. If {discard} is set to {yes}, the atom
-will be ignored and not contribute to any bin averages. If {discard}
-is set to {no}, the atom will be counted as if it were in the first or
-last bin in that dimension. If (discard} is set to {mixed}, which is
-the default, it will only be counted in the first or last bin if bins
-extend to the box boundary in that dimension. This is the case if the
-{bound} keyword settings are {lower} and {upper}, which is the
-default. If the {bound} keyword settings are numeric values, then the
-atom will be ignored if it is outside the bounds of any bin. Note
-that in this case, it is possible that the first or last bin extends
-beyond the numeric {bounds} settings, depending on the specified
-{origin}. If this is the case, the atom is only ignored if it is
-outside the first or last bin, not if it is simply outside the numeric
-{bounds} setting.
-
-For orthogonal simulation boxes, the bins are also layers, pencils, or
-boxes aligned with the xyz coordinate axes. For triclinic
-(non-orthogonal) simulation boxes, the bins are so that they are
-parallel to the tilted faces of the simulation box. See "this
-section"_Section_howto.html#howto_12 of the manual for a discussion of
-the geometry of triclinic boxes in LAMMPS. As described there, a
-tilted simulation box has edge vectors a,b,c. In that nomenclature,
-bins in the x dimension have faces with normals in the "b" cross "c"
-direction. Bins in y have faces normal to the "a" cross "c"
-direction. And bins in z have faces normal to the "a" cross "b"
-direction. Note that in order to define the size and position of
-these bins in an unambiguous fashion, the {units} option must be set
-to {reduced} when using a triclinic simulation box, as noted below.
-
-:line
-
-The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory.
-Note that other atom attributes (including atom postitions x,y,z) can
-be used as inputs to this fix by using the "compute
-property/atom"_compute_property_atom.html command and then specifying
-an input value from that compute.
-
-The {density/number} value means the number density is computed in
-each bin, i.e. a weighting of 1 for each atom. The {density/mass}
-value means the mass density is computed in each bind, i.e. each atom
-is weighted by its mass. The resulting density is normalized by the
-volume of the bin so that units of number/volume or density are
-output. See the "units"_units.html command doc page for the
-definition of density for each choice of units, e.g. gram/cm^3.
-
-If a value begins with "c_", a compute ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the compute is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the compute is used. Users can also write code for
-their own compute styles and "add them to LAMMPS"_Section_modify.html.
-
-If a value begins with "f_", a fix ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the fix is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the fix is used. Note that some fixes only produce
-their values on certain timesteps, which must be compatible with
-{Nevery}, else an error results. Users can also write code for their
-own fix styles and "add them to LAMMPS"_Section_modify.html.
-
-If a value begins with "v_", a variable name must follow which has
-been previously defined in the input script. Variables of style
-{atom} can reference thermodynamic keywords and various per-atom
-attributes, or invoke other computes, fixes, or variables when they
-are evaluated, so this is a very general means of generating per-atom
-quantities to spatially average.
-
-:line
-
-Additional optional keywords also affect the operation of this fix.
-The {region}, {bound}, and {discard} keywords were discussed above.
-
-The {norm} keyword affects how averaging is done for the output
-produced every {Nfreq} timesteps. For an {all} setting, a bin
-quantity is summed over all atoms in all {Nrepeat} samples, as is the
-count of atoms in the bin. The printed value for the bin is
-Total-quantity / Total-count. In other words it is an average over
-the entire {Nfreq} timescale.
-
-For a {sample} setting, the bin quantity is summed over atoms for only
-a single sample, as is the count, and a "average sample value" is
-computed, i.e. Sample-quantity / Sample-count. The printed value for
-the bin is the average of the {Nrepeat} "average sample values", In
-other words it is an average of an average.
-
-The {ave} keyword determines how the bin values produced every {Nfreq}
-steps are averaged with bin values produced on previous steps that
-were multiples of {Nfreq}, before they are accessed by another output
-command or written to a file.
-
-If the {ave} setting is {one}, then the bin values produced on
-timesteps that are multiples of {Nfreq} are independent of each other;
-they are output as-is without further averaging.
-
-If the {ave} setting is {running}, then the bin values produced on
-timesteps that are multiples of {Nfreq} are summed and averaged in a
-cumulative sense before being output. Each output bin value is thus
-the average of the bin value produced on that timestep with all
-preceding values for the same bin. This running average begins when
-the fix is defined; it can only be restarted by deleting the fix via
-the "unfix"_unfix.html command, or re-defining the fix by
-re-specifying it.
-
-If the {ave} setting is {window}, then the bin values produced on
-timesteps that are multiples of {Nfreq} are summed and averaged within
-a moving "window" of time, so that the last M values for the same bin
-are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then
-the output on step 10000 will be the average of the individual bin
-values on steps 8000,9000,10000. Outputs on early steps will average
-over less than M values if they are not available.
-
-The {units} keyword determines the meaning of the distance units used
-for the bin size {delta} and for {origin} and {bounds} values if they
-are coordinate value. For orthogonal simulation boxes, any of the 3
-options may be used. For non-orthogonal (triclinic) simulation boxes,
-only the {reduced} option may be used.
-
-A {box} value selects standard distance units as defined by the
-"units"_units.html command, e.g. Angstroms for units = real or metal.
-A {lattice} value means the distance units are in lattice spacings.
-The "lattice"_lattice.html command must have been previously used to
-define the lattice spacing. A {reduced} value means normalized
-unitless values between 0 and 1, which represent the lower and upper
-faces of the simulation box respectively. Thus an {origin} value of
-0.5 means the center of the box in any dimension. A {delta} value of
-0.1 means 10 bins span the box in that dimension.
-
-Consider a non-orthogonal box, with bins that are 1d layers or slabs
-in the x dimension. No matter how the box is tilted, an {origin} of
-0.0 means start layers at the lower "b" cross "c" plane of the
-simulation box and an {origin} of 1.0 means to start layers at the
-upper "b" cross "c" face of the box. A {delta} value of 0.1 means
-there will be 10 layers from 0.0 to 1.0, regardless of the current
-size or shape of the simulation box.
-
-The {file} keyword allows a filename to be specified. Every {Nfreq}
-timesteps, a section of bin info will be written to a text file in the
-following format. A line with the timestep and number of bin is
-written. Then one line per bin is written, containing the bin ID
-(1-N), the coordinate of the center of the bin, the number of atoms
-in the bin, and one or more calculated values. The number of values
-in each line corresponds to the number of values specified in the fix
-ave/spatial command. The number of atoms and the value(s) are average
-quantities. If the value of the {units} keyword is {box} or
-{lattice}, the "coord" is printed in box units. If the value of the
-{units} keyword is {reduced}, the "coord" is printed in reduced units
-(0-1).
-
-The {overwrite} keyword will continuously overwrite the output file
-with the latest output, so that it only contains one timestep worth of
-output. This option can only be used with the {ave running} setting.
-
-The {title1} and {title2} and {title3} keywords allow specification of
-the strings that will be printed as the first 3 lines of the output
-file, assuming the {file} keyword was used. LAMMPS uses default
-values for each of these, so they do not need to be specified.
-
-By default, these header lines are as follows:
-
-# Spatial-averaged data for fix ID and group name
-# Timestep Number-of-bins
-# Bin Coord1 Coord2 Coord3 Count value1 value2 ... :pre
-
-In the first line, ID and name are replaced with the fix-ID and group
-name. The second line describes the two values that are printed at
-the first of each section of output. In the third line the values are
-replaced with the appropriate fields from the fix ave/spatial command.
-The Coord2 and Coord3 entries in the third line only appear for 2d and
-3d bins respectively. For 1d bins, the word Coord1 is replaced by
-just Coord.
-
-:line
-
-[Restart, fix_modify, output, run start/stop, minimize info:]
-
-No information about this fix is written to "binary restart
-files"_restart.html. None of the "fix_modify"_fix_modify.html options
-are relevant to this fix.
-
-This fix computes a global array of values which can be accessed by
-various "output commands"_Section_howto.html#howto_15. The values can
-only be accessed on timesteps that are multiples of {Nfreq} since that
-is when averaging is performed. The global array has # of rows =
-Nbins and # of columns = Ndim+1+Nvalues, where Ndim = 1,2,3 for
-1d,2d,3d bins. The first 1 or 2 or 3 columns have the bin coordinates
-(center of the bin) in the appropriate dimensions, the next column has
-the count of atoms in that bin, and the remaining columns are the
-Nvalue quantities. When the array is accessed with an I that exceeds
-the current number of bins, than a 0.0 is returned by the fix instead
-of an error, since the number of bins can vary as a simulation runs,
-depending on the simulation box size. 2d or 3d bins are ordered so
-that the last dimension(s) vary fastest. The array values calculated
-by this fix are "intensive", since they are already normalized by the
-count of atoms in each bin.
-
-No parameter of this fix can be used with the {start/stop} keywords of
-the "run"_run.html command. This fix is not invoked during "energy
-minimization"_minimize.html.
-
-[Restrictions:]
-
-When the {ave} keyword is set to {running} or {window} then the number
-of bins must remain the same during the simulation, so that the
-appropriate averaging can be done. This will be the case if the
-simulation box size doesn't change or if the {units} keyword is set to
-{reduced}.
-
-[Related commands:]
-
-"compute"_compute.html, "fix ave/atom"_fix_ave_atom.html, "fix
-ave/histo"_fix_ave_histo.html, "fix ave/time"_fix_ave_time.html,
-"variable"_variable.html, "fix ave/correlate"_fix_ave_correlate.html,
-"fix ave/spatial/sphere"_fix_ave_spatial_sphere.html
-
-[Default:]
-
-The option defaults are bound = lower and upper in all dimensions,
-discard = mixed, norm = all, ave = one, units = lattice, no file
-output, and title 1,2,3 = strings as described above.
diff --git a/doc/src/fix_ave_spatial_sphere.txt b/doc/src/fix_ave_spatial_sphere.txt
deleted file mode 100644
index 8223e7fd5b..0000000000
--- a/doc/src/fix_ave_spatial_sphere.txt
+++ /dev/null
@@ -1,324 +0,0 @@
-"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
-
-:link(lws,http://lammps.sandia.gov)
-:link(ld,Manual.html)
-:link(lc,Section_commands.html#comm)
-
-:line
-
-fix ave/spatial/sphere command :h3
-
-[Syntax:]
-
-fix ID group-ID ave/spatial/sphere Nevery Nrepeat Nfreq origin_x origin_y origin_z r_min r_max nbins value1 value2 ... keyword args ... :pre
-
-ID, group-ID are documented in "fix"_fix.html command :ulb,l
-ave/spatial = style name of this fix command :l
-Nevery = use input values every this many timesteps :l
-Nrepeat = # of times to use input values for calculating averages :l
-Nfreq = calculate averages every this many timesteps :l
-origin_x, origin_y, origin_z = center of the sphere. can be the result of variables or computes (see below) :l
-r_min = radial distance at which binning begins :l
-r_max = radial distance at which binning ends :l
-nbins = number of spherical shells to create between r_min and r_max :l
-one or more input values can be listed :l
-value = vx, vy, vz, fx, fy, fz, density/mass, density/number, c_ID, c_ID\[I\], f_ID, f_ID\[I\], v_name :l
- vx,vy,vz,fx,fy,fz = atom attribute (velocity, force component)
- density/number, density/mass = number or mass density
- c_ID = per-atom vector calculated by a compute with ID
- c_ID\[I\] = Ith column of per-atom array calculated by a compute with ID
- f_ID = per-atom vector calculated by a fix with ID
- f_ID\[I\] = Ith column of per-atom array calculated by a fix with ID
- v_name = per-atom vector calculated by an atom-style variable with name :pre
-
-zero or more keyword/arg pairs may be appended :l
-keyword = {region} or {norm} or {units} or {ave} or {file} or {overwrite} or {title1} or {title2} or {title3} :l
- {region} arg = region-ID
- region-ID = ID of region atoms must be in to contribute to spatial averaging
- {norm} arg = {all} or {sample}
- {units} arg = {box} or {lattice} or {reduced}
- {ave} args = {one} or {running} or {window M}
- one = output new average value every Nfreq steps
- running = output cumulative average of all previous Nfreq steps
- window M = output average of M most recent Nfreq steps
- {file} arg = filename
- filename = file to write results to
- {overwrite} arg = none = overwrite output file with only latest output
- {title1} arg = string
- string = text to print as 1st line of output file
- {title2} arg = string
- string = text to print as 2nd line of output file
- {title3} arg = string
- string = text to print as 3rd line of output file :pre
-:ule
-
-[Examples:]
-
-fix 1 all ave/spatial/sphere 10000 1 10000 0.5 0.5 0.5 0.1 0.5 5 density/number vx vy vz units reduced title1 "My output values"
-fix 1 flow ave/spatial/sphere 100 10 1000 20.0 20.0 20.0 0.0 20.0 20 vx vz norm sample file vel.profile :pre
-
-[Description:]
-
-Use one or more per-atom vectors as inputs every few timesteps, bin
-their values spatially into spherical shells based on current atom
-coordinates, and average the bin values over longer timescales. The
-resulting bin averages can be used by other "output
-commands"_Section_howto.html#howto_15 such as "thermo_style
-custom"_thermo_style.html, and can also be written to a file.
-
-The group specified with the command means only atoms within the group
-contribute to bin averages. If the {region} keyword is used, the atom
-must be in both the group and the specified geometric
-"region"_region.html in order to contribute to bin averages.
-
-Each listed value can be an atom attribute (position, velocity, force
-component), a mass or number density, or the result of a
-"compute"_compute.html or "fix"_fix.html or the evaluation of an
-atom-style "variable"_variable.html. In the latter cases, the
-compute, fix, or variable must produce a per-atom quantity, not a
-global quantity. If you wish to time-average global quantities from a
-compute, fix, or variable, then see the "fix
-ave/time"_fix_ave_time.html command.
-
-"Computes"_compute.html that produce per-atom quantities are those
-which have the word {atom} in their style name. See the doc pages for
-individual "fixes"_fix.html to determine which ones produce per-atom
-quantities. "Variables"_variable.html of style {atom} are the only
-ones that can be used with this fix since all other styles of variable
-produce global quantities.
-
-The per-atom values of each input vector are binned and averaged
-independently of the per-atom values in other input vectors.
-
-{Nbins} specifies the number of spherical shells which will be created
-between r_min and r_max centered at (origin_x, origin_y, origin_z).
-
-NOTE: This fix works by creating an array of size Nbins by Nvalues on
-each processor. Nbins is the total number of bins; Nvalues is the
-number of input values specified. Each processor loops over its
-atoms, tallying its values to the appropriate bin. Then the entire
-array is summed across all processors. This means that using a large
-number of bins will incur an overhead in memory and computational cost
-(summing across processors), so be careful to use reasonable numbers
-of bins.
-
-:line
-
-The {Nevery}, {Nrepeat}, and {Nfreq} arguments specify on what
-timesteps the input values will be used to bin them and contribute to
-the average. The final averaged quantities are generated on timesteps
-that are a multiples of {Nfreq}. The average is over {Nrepeat}
-quantities, computed in the preceding portion of the simulation every
-{Nevery} timesteps. {Nfreq} must be a multiple of {Nevery} and
-{Nevery} must be non-zero even if {Nrepeat} is 1.
-Also, the timesteps
-contributing to the average value cannot overlap,
-i.e. Nrepeat*Nevery can not exceed Nfreq.
-
-For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
-timesteps 90,92,94,96,98,100 will be used to compute the final average
-on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
-timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
-averaging is done; values are simply generated on timesteps
-100,200,etc.
-
-:line
-
-The {origin_x}, {origin_y}, and {origin_z} parameters may be specified
-by either a compute or a variable. This allows, for example, the
-center of the spherical bins to be attached to the center of mass of a
-group of atoms. If a variable origin is used and periodic boundary
-conditions are in effect, then the origin will be wrapped across
-periodic boundaries whenever it changes so that it is always inside
-the simulation box.
-
-:line
-
-The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory.
-Note that other atom attributes (including atom postitions x,y,z) can
-be used as inputs to this fix by using the "compute
-property/atom"_compute_property_atom.html command and then specifying
-an input value from that compute.
-
-The {density/number} value means the number density is computed in
-each bin, i.e. a weighting of 1 for each atom. The {density/mass}
-value means the mass density is computed in each bin, i.e. each atom
-is weighted by its mass. The resulting density is normalized by the
-volume of the bin so that units of number/volume or density are
-output. See the "units"_units.html command doc page for the
-definition of density for each choice of units, e.g. gram/cm^3.
-The bin volume will always be calculated in box units, independent
-of the use of the {units} keyword in this command.
-
-If a value begins with "c_", a compute ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the compute is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the compute is used. Users can also write code for
-their own compute styles and "add them to LAMMPS"_Section_modify.html.
-
-If a value begins with "f_", a fix ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the fix is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the fix is used. Note that some fixes only produce
-their values on certain timesteps, which must be compatible with
-{Nevery}, else an error results. Users can also write code for their
-own fix styles and "add them to LAMMPS"_Section_modify.html.
-
-If a value begins with "v_", a variable name must follow which has
-been previously defined in the input script. Variables of style
-{atom} can reference thermodynamic keywords and various per-atom
-attributes, or invoke other computes, fixes, or variables when they
-are evaluated, so this is a very general means of generating per-atom
-quantities to spatially average.
-
-:line
-
-Additional optional keywords also affect the operation of this fix.
-The {region} keyword was discussed above.
-
-The {norm} keyword affects how averaging is done for the output
-produced every {Nfreq} timesteps. For an {all} setting, a bin
-quantity is summed over all atoms in all {Nrepeat} samples, as is the
-count of atoms in the bin. The printed value for the bin is
-Total-quantity / Total-count. In other words it is an average over
-the entire {Nfreq} timescale.
-
-For a {sample} setting, the bin quantity is summed over atoms for only
-a single sample, as is the count, and a "average sample value" is
-computed, i.e. Sample-quantity / Sample-count. The printed value for
-the bin is the average of the {Nrepeat} "average sample values", In
-other words it is an average of an average.
-
-The {ave} keyword determines how the bin values produced every {Nfreq}
-steps are averaged with bin values produced on previous steps that
-were multiples of {Nfreq}, before they are accessed by another output
-command or written to a file.
-
-If the {ave} setting is {one}, then the bin values produced on
-timesteps that are multiples of {Nfreq} are independent of each other;
-they are output as-is without further averaging.
-
-If the {ave} setting is {running}, then the bin values produced on
-timesteps that are multiples of {Nfreq} are summed and averaged in a
-cumulative sense before being output. Each output bin value is thus
-the average of the bin value produced on that timestep with all
-preceding values for the same bin. This running average begins when
-the fix is defined; it can only be restarted by deleting the fix via
-the "unfix"_unfix.html command, or re-defining the fix by
-re-specifying it.
-
-If the {ave} setting is {window}, then the bin values produced on
-timesteps that are multiples of {Nfreq} are summed and averaged within
-a moving "window" of time, so that the last M values for the same bin
-are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then
-the output on step 10000 will be the average of the individual bin
-values on steps 8000,9000,10000. Outputs on early steps will average
-over less than M values if they are not available.
-
-The {units} keyword determines the meaning of the distance units used
-for the sphere origin and the two radial lengths. For orthogonal
-simulation boxes, any of the 3 options may be used. For
-non-orthogonal (triclinic) simulation boxes, only the {reduced} option
-may be used.
-
-A {box} value selects standard distance units as defined by the
-"units"_units.html command, e.g. Angstroms for units = real or metal.
-A {lattice} value means the distance units are in lattice spacings.
-The "lattice"_lattice.html command must have been previously used to
-define the lattice spacing.
-
-NOTE: The {lattice} style may only be used if the lattice spacing is
-the same in each direction.
-
-A {reduced} value means normalized unitless values between 0 and 1,
-which represent the lower and upper faces of the simulation box
-respectively. Thus an {origin} value of 0.5 means the center of the
-box in any dimension.
-
-The {file} keyword allows a filename to be specified. Every {Nfreq}
-timesteps, a section of bin info will be written to a text file in the
-following format. A line with the timestep and number of bin is
-written. Then one line per bin is written, containing the bin ID
-(1-N), the coordinate of the center of the bin, the number of atoms in
-the bin, and one or more calculated values. The number of values in
-each line corresponds to the number of values specified in the fix
-ave/spatial command. The number of atoms and the value(s) are average
-quantities. If the value of the {units} keyword is {box} or
-{lattice}, the "coord" is printed in box units. If the value of the
-{units} keyword is {reduced}, the "coord" is printed in reduced units
-(0-1).
-
-The {overwrite} keyword will continuously overwrite the output file
-with the latest output, so that it only contains one timestep worth of
-output. This option can only be used with the {ave running} setting.
-
-The {title1} and {title2} and {title3} keywords allow specification of
-the strings that will be printed as the first 3 lines of the output
-file, assuming the {file} keyword was used. LAMMPS uses default
-values for each of these, so they do not need to be specified.
-
-By default, these header lines are as follows:
-
-# Spatial-averaged data for fix ID and group name
-# Timestep Number-of-bins
-# Bin r Count value1 value2 ... :pre
-
-In the first line, ID and name are replaced with the fix-ID and group
-name. The second line describes the two values that are printed at
-the first of each section of output. In the third line the values are
-replaced with the appropriate fields from the fix ave/spatial command.
-The Coord2 and Coord3 entries in the third line only appear for 2d and
-3d bins respectively. For 1d bins, the word Coord1 is replaced by
-just Coord.
-
-:line
-
-[Restart, fix_modify, output, run start/stop, minimize info:]
-
-No information about this fix is written to "binary restart
-files"_restart.html. None of the "fix_modify"_fix_modify.html options
-are relevant to this fix.
-
-This fix computes a global array of values which can be accessed by
-various "output commands"_Section_howto.html#howto_15. The values can
-only be accessed on timesteps that are multiples of {Nfreq} since that
-is when averaging is performed. The global array has # of rows =
-Nbins and # of columns = 2+Nvalues. The first column contains the
-radius at the center of the shell. For units {reduced}, this is in
-reduced units, while for units {box} and {lattice} this is in box
-units. The next column has the count of atoms in that bin, and the
-remaining columns are the Nvalue quantities. When the array is
-accessed with an I that exceeds the current number of bins, than a 0.0
-is returned by the fix instead of an error. The array values
-calculated by this fix are "intensive", since they are already
-normalized by the count of atoms in each bin.
-
-No parameter of this fix can be used with the {start/stop} keywords of
-the "run"_run.html command. This fix is not invoked during "energy
-minimization"_minimize.html.
-
-[Restrictions:]
-
-When the {ave} keyword is set to {running} or {window} then the number
-of bins must remain the same during the simulation, so that the
-appropriate averaging can be done. This will be the case if the
-simulation box size doesn't change or if the {units} keyword is set to
-{reduced}.
-
-This style is part of the USER-MISC package. It is only enabled if
-LAMMPS is build with that package. See the "Making of
-LAMMPS"_Section_start.html#3 section for more info.
-
-[Related commands:]
-
-"compute"_compute.html, "fix ave/atom"_fix_ave_atom.html, "fix
-ave/histo"_fix_ave_histo.html, "fix ave/time"_fix_ave_time.html,
-"variable"_variable.html, "fix ave/correlate"_fix_ave_correlate.html,
-"fix ave/spatial"_fix_ave_spatial.html,
-
-[Default:]
-
-The option defaults are norm = all, ave = one, units = lattice, no
-file output, and title 1,2,3 = strings as described above.
diff --git a/doc/src/fix_ave_time.txt b/doc/src/fix_ave_time.txt
index 386bbcf6a0..7eca1abe6d 100644
--- a/doc/src/fix_ave_time.txt
+++ b/doc/src/fix_ave_time.txt
@@ -79,7 +79,7 @@ Each listed value can be the result of a "compute"_compute.html or
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
from a compute, fix, or variable, then see the "fix
-ave/spatial"_fix_ave_spatial.html, "fix ave/atom"_fix_ave_atom.html,
+ave/chunk"_fix_ave_chunk.html, "fix ave/atom"_fix_ave_atom.html,
or "fix ave/histo"_fix_ave_histo.html commands. If you wish to sum a
per-atom quantity into a single global quantity, see the "compute
reduce"_compute_reduce.html command.
@@ -322,7 +322,7 @@ minimization"_minimize.html.
[Related commands:]
"compute"_compute.html, "fix ave/atom"_fix_ave_atom.html, "fix
-ave/spatial"_fix_ave_spatial.html, "fix ave/histo"_fix_ave_histo.html,
+ave/chunk"_fix_ave_chunk.html, "fix ave/histo"_fix_ave_histo.html,
"variable"_variable.html, "fix ave/correlate"_fix_ave_correlate.html,
[Default:]
diff --git a/doc/src/fix_deform.txt b/doc/src/fix_deform.txt
index 1d786cc322..e2cbe14868 100644
--- a/doc/src/fix_deform.txt
+++ b/doc/src/fix_deform.txt
@@ -496,7 +496,7 @@ box. E.g. for a shearing system the box deformation velocity may vary
from 0 at the bottom to 10 at the top of the box. But the stream
velocity profile of the atoms may vary from -5 at the bottom to +5 at
the top. You can monitor these effects using the "fix
-ave/spatial"_fix_ave_spatial.html, "compute
+ave/chunk"_fix_ave_chunk.html, "compute
temp/deform"_compute_temp_deform.html, and "compute
temp/profile"_compute_temp_profile.html commands. One way to induce
atoms to stream consistent with the box deformation is to give them an
diff --git a/doc/src/fix_thermal_conductivity.txt b/doc/src/fix_thermal_conductivity.txt
index 307bb9982a..05984b7e3f 100644
--- a/doc/src/fix_thermal_conductivity.txt
+++ b/doc/src/fix_thermal_conductivity.txt
@@ -63,8 +63,8 @@ temperature profile (assuming z = edim) to the file tmp.profile:
compute ke all ke/atom
variable temp atom c_ke/1.5
-fix 3 all ave/spatial 10 100 1000 z lower 0.05 v_temp &
- file tmp.profile units reduced :pre
+compute layers all chunk/atom bin/1d z lower 0.05 units reduced
+fix 3 all ave/chunk 10 100 1000 layers v_temp file tmp.profile :pre
Note that by default, Nswap = 1, though this can be changed by the
optional {swap} keyword. Setting this parameter appropriately, in
@@ -145,10 +145,9 @@ bewteen solvent particles.
[Related commands:]
-"fix ehex"_fix_ehex.html, "fix heat"_fix_heat.html,
-"fix ave/spatial"_fix_ave_spatial.html, "fix
-viscosity"_fix_viscosity.html, "compute
-heat/flux"_compute_heat_flux.html
+"fix ehex"_fix_ehex.html, "fix heat"_fix_heat.html, "fix
+ave/chunk"_fix_ave_chunk.html, "fix viscosity"_fix_viscosity.html,
+"compute heat/flux"_compute_heat_flux.html
[Default:]
diff --git a/doc/src/fix_viscosity.txt b/doc/src/fix_viscosity.txt
index 4b9c8174b0..87cc9618e4 100644
--- a/doc/src/fix_viscosity.txt
+++ b/doc/src/fix_viscosity.txt
@@ -60,8 +60,8 @@ directions. Over time, this induces a shear velocity profile in the
system which can be measured using commands such as the following,
which writes the profile to the file tmp.profile:
-fix f1 all ave/spatial 100 10 1000 z lower 0.05 vx &
- file tmp.profile units reduced :pre
+compute layers all chunk/atom z lower 0.05 units reduced
+fix f1 all ave/chunk 100 10 1000 layers vx file tmp.profile :pre
Note that by default, Nswap = 1 and vtarget = INF, though this can be
changed by the optional {swap} and {vtarget} keywords. When vtarget =
@@ -152,7 +152,7 @@ solvent particles.
[Related commands:]
-"fix ave/spatial"_fix_ave_spatial.html, "fix
+"fix ave/chunk"_fix_ave_chunk.html, "fix
thermal/conductivity"_fix_thermal_conductivity.html
[Default:]
diff --git a/doc/src/prd.txt b/doc/src/prd.txt
index b4f5184e1d..484e36004c 100644
--- a/doc/src/prd.txt
+++ b/doc/src/prd.txt
@@ -295,9 +295,9 @@ for dephasing.
This command cannot be used when any fixes are defined that keep track
of elapsed time to perform time-dependent operations. Examples
-include the "ave" fixes such as "fix
-ave/spatial"_fix_ave_spatial.html. Also "fix
-dt/reset"_fix_dt_reset.html and "fix deposit"_fix_deposit.html.
+include the "ave" fixes such as "fix ave/chunk"_fix_ave_chunk.html.
+Also "fix dt/reset"_fix_dt_reset.html and "fix
+deposit"_fix_deposit.html.
[Related commands:]
diff --git a/doc/src/tad.txt b/doc/src/tad.txt
index 6a291d181d..8e93b93c3b 100644
--- a/doc/src/tad.txt
+++ b/doc/src/tad.txt
@@ -284,9 +284,9 @@ restart, but "fix langevin"_fix_langevin.html will not.
This command cannot be used when any fixes are defined that keep track
of elapsed time to perform time-dependent operations. Examples
-include the "ave" fixes such as "fix
-ave/spatial"_fix_ave_spatial.html. Also "fix
-dt/reset"_fix_dt_reset.html and "fix deposit"_fix_deposit.html.
+include the "ave" fixes such as "fix ave/chunk"_fix_ave_chunk.html.
+Also "fix dt/reset"_fix_dt_reset.html and "fix
+deposit"_fix_deposit.html.
[Related commands:]
diff --git a/doc/src/variable.txt b/doc/src/variable.txt
index 408e4beda9..c84dc8df99 100644
--- a/doc/src/variable.txt
+++ b/doc/src/variable.txt
@@ -1096,7 +1096,7 @@ variable formula.
Referencing a variable with a leading "v_" is an optional or required
kind of argument for some commands (e.g. the "fix
-ave/spatial"_fix_ave_spatial.html or "dump custom"_dump.html or
+ave/chunk"_fix_ave_chunk.html or "dump custom"_dump.html or
"thermo_style"_thermo_style.html commands) if you wish it to evaluate
a variable periodically during a run. It can also be used in a
variable formula if you wish to reference a second variable. The
From 0a01592d0aa3496e755b70e50af013f8224ea930 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 31 May 2016 14:49:26 +0000
Subject: [PATCH 003/111] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@15070
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/USER-MISC/README | 1 -
src/USER-MISC/fix_ave_spatial_sphere.cpp | 1063 ----------------------
src/USER-MISC/fix_ave_spatial_sphere.h | 186 ----
3 files changed, 1250 deletions(-)
delete mode 100644 src/USER-MISC/fix_ave_spatial_sphere.cpp
delete mode 100644 src/USER-MISC/fix_ave_spatial_sphere.h
diff --git a/src/USER-MISC/README b/src/USER-MISC/README
index dc1a76e014..131befd5ca 100644
--- a/src/USER-MISC/README
+++ b/src/USER-MISC/README
@@ -35,7 +35,6 @@ dihedral_style nharmonic, Loukas Peristeras, loukas.peristeras at scienomics.com
dihedral_style quadratic, Loukas Peristeras, loukas.peristeras at scienomics.com, 27 Oct 12
dihedral_style table, Andrew Jewett, jewett.aij@gmail.com, 10 Jan 12
fix addtorque, Laurent Joly (U Lyon), ljoly.ulyon at gmail.com, 8 Aug 11
-fix ave/spatial/sphere, Niall Jackson (Imperial College), niall.jackson at gmail.com, 18 Nov 14
fix ave/correlate/long, Jorge Ramirez (UPM Madrid), jorge.ramirez at upm.es, 21 Oct 2015
fix gle, Michele Ceriotti (EPFL Lausanne), michele.ceriotti at gmail.com, 24 Nov 2014
fix imd, Axel Kohlmeyer, akohlmey at gmail.com, 9 Nov 2009
diff --git a/src/USER-MISC/fix_ave_spatial_sphere.cpp b/src/USER-MISC/fix_ave_spatial_sphere.cpp
deleted file mode 100644
index 77a5d48960..0000000000
--- a/src/USER-MISC/fix_ave_spatial_sphere.cpp
+++ /dev/null
@@ -1,1063 +0,0 @@
-/* ----------------------------------------------------------------------
- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
- http://lammps.sandia.gov, Sandia National Laboratories
- Steve Plimpton, sjplimp@sandia.gov
-
- 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.
-------------------------------------------------------------------------- */
-
-/* ----------------------------------------------------------------------
- Adapted from fix ave/spatial by Niall Jackson
-------------------------------------------------------------------------- */
-
-#include
-#include
-#include
-#include "fix_ave_spatial_sphere.h"
-#include "atom.h"
-#include "update.h"
-#include "force.h"
-#include "domain.h"
-#include "region.h"
-#include "lattice.h"
-#include "modify.h"
-#include "compute.h"
-#include "input.h"
-#include "variable.h"
-#include "memory.h"
-#include "error.h"
-#include "math_const.h"
-
-using namespace LAMMPS_NS;
-using namespace FixConst;
-using namespace MathConst;
-
-//the different types of variables that we can track
-enum{V,F,DENSITY_NUMBER,DENSITY_MASS,COMPUTE,FIX,VARIABLE,CONSTANT};
-//normalisation types
-enum{SAMPLE,ALL};
-//unit scaling options
-enum{BOX,LATTICE,REDUCED};
-//averaging types
-enum{ONE,RUNNING,WINDOW};
-
-#define INVOKED_SCALAR 1
-#define INVOKED_VECTOR 2
-#define INVOKED_PERATOM 8
-#define BIG 1000000000
-
-/* ---------------------------------------------------------------------- */
-
-FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) :
- Fix(lmp, narg, arg) {
-
- if (narg < 12) error->all(FLERR, "Illegal fix ave/spatial/sphere command");
-
- MPI_Comm_rank(world, &me);
-
- nevery= force->inumeric(FLERR, arg[3]);
- nrepeat= force->inumeric(FLERR, arg[4]);
- nfreq= force->inumeric(FLERR, arg[5]);
-
- global_freq= nfreq;
-
- for (int iarg = 6; iarg < 9; ++iarg) {
- int dim= iarg-6;
- origin_ids[dim]= NULL;
- if (strncmp(arg[iarg],"c_",2) == 0 ||
- strncmp(arg[iarg],"v_",2) == 0) {
- if(arg[iarg][0] == 'c') {
- origin_type[dim]= COMPUTE;
- } else {
- origin_type[dim]= VARIABLE;
- }
-
- //strip the v_/c_ off the front of the variable name
- int n= strlen(arg[iarg]);
- char *suffix= new char[n];
- strcpy(suffix, &arg[iarg][2]);
- //does the variable name contain a [?
- //(in other words, is this an array element?)
- char *ptr= strchr(suffix, '[');
- if(ptr) {
- //if the last character ISN'T ], then the array syntax
- //has been used wrongly
- if(suffix[strlen(suffix)-1] != ']') {
- error->all(FLERR, "Illegal fix ave/spatial/sphere command");
- }
- origin_index[dim]= atoi(ptr+1);
- *ptr= '\0';
- } else {
- origin_index[dim]= 0;
- }
- //store the name of the variable
- n= strlen(suffix)+1;
- origin_ids[dim]= new char[n];
- strcpy(origin_ids[dim], suffix);
- //tidy up the array we allocated earlier
- delete[] suffix;
-
- if(origin_type[dim] == COMPUTE) {
- int icompute= modify->find_compute(origin_ids[dim]);
- if(icompute < 0)
- error->all(FLERR,
- "Compute ID for fix ave/spatial/sphere does not exist");
-
- if(origin_index[dim] == 0 &&
- modify->compute[icompute]->scalar_flag != 0)
- error->all(FLERR,"Compute for fix ave/spatial/sphere does not calculate a scalar");
- else if(origin_index[dim] && modify->compute[icompute]->vector_flag == 0)
- error->all(FLERR, "Compute for fix ave/spatial/sphere does not calculate a vector");
- else if(origin_index[dim] && origin_index[dim] > modify->compute[icompute]->size_vector)
- error->all(FLERR, "Fix ave/spatial/sphere compute vector accessed out of range");
- } else if(origin_type[dim] == VARIABLE) {
- int ivariable = input->variable->find(origin_ids[dim]);
- if (ivariable < 0)
- error->all(FLERR,"Variable name for fix ave/spatial/sphere does not exist");
- else if (input->variable->equalstyle(ivariable) == 0)
- error->all(FLERR,"Fix ave/spatial/sphere variable is not equal-style variable");
- }
- } else {
- origin_type[dim]= CONSTANT;
- origin[dim]= force->numeric(FLERR, arg[iarg]);
- }
- }
-
- //the extrema of the radius
- r_min= force->numeric(FLERR, arg[9]);
- r_max= force->numeric(FLERR, arg[10]);
-
- //and finally, the number of spherical bins
- nbins= force->inumeric(FLERR, arg[11]);
-
- if (r_min >= r_max) {
- error->all(FLERR, "r_min must be less than r_max in fix ave/spatial/sphere");
- }
-
- if (nbins <= 0) {
- error->all(FLERR, "nbins must be positive in fix ave/spatial/sphere");
- }
-
- int iarg= 12;
- which= new int[narg-12];
- argindex= new int[narg-12];
- ids= new char*[narg-12];
- value2index= new int[narg-12];
- nvalues= 0;
-
- while(iarg < narg) {
- ids[nvalues]= NULL;
-
- if(strcmp(arg[iarg], "vx") == 0) {
- which[nvalues] = V;
- argindex[nvalues++]= 0;
- } else if(strcmp(arg[iarg], "vy") == 0) {
- which[nvalues] = V;
- argindex[nvalues++]= 1;
- } else if(strcmp(arg[iarg], "vz") == 0) {
- which[nvalues] = V;
- argindex[nvalues++]= 2;
- } else if(strcmp(arg[iarg], "fx") == 0) {
- which[nvalues] = F;
- argindex[nvalues++]= 0;
- } else if(strcmp(arg[iarg], "fy") == 0) {
- which[nvalues] = F;
- argindex[nvalues++]= 1;
- } else if(strcmp(arg[iarg], "fz") == 0) {
- which[nvalues] = F;
- argindex[nvalues++]= 2;
- } else if(strcmp(arg[iarg], "density/number") == 0) {
- which[nvalues] = DENSITY_NUMBER;
- argindex[nvalues++]= 0;
- } else if(strcmp(arg[iarg], "density/mass") == 0) {
- which[nvalues] = DENSITY_MASS;
- argindex[nvalues++]= 0;
- } else if (strncmp(arg[iarg],"c_",2) == 0 ||
- strncmp(arg[iarg],"f_",2) == 0 ||
- strncmp(arg[iarg],"v_",2) == 0) {
- if(arg[iarg][0] == 'c') which[nvalues] = COMPUTE;
- else if(arg[iarg][0] == 'f') which[nvalues] = FIX;
- else if(arg[iarg][0] == 'v') which[nvalues] = VARIABLE;
-
- //strip the v_/c_/f_ off the front of the variable name
- int n= strlen(arg[iarg]);
- char *suffix= new char[n];
- strcpy(suffix, &arg[iarg][2]);
-
- //does the variable name contain a [?
- //(in other words, is this an array element?)
- char *ptr= strchr(suffix, '[');
- if(ptr) {
- //if the last character ISN'T ], then the array syntax
- //has been used wrongly
- if(suffix[strlen(suffix)-1] != ']') {
- error->all(FLERR, "Illegal fix ave/spatial/sphere command");
- }
- argindex[nvalues]= atoi(ptr+1);
- *ptr= '\0';
- } else {
- argindex[nvalues]= 0;
- }
-
- //store the name of the variable
- n= strlen(suffix)+1;
- ids[nvalues]= new char[n];
- strcpy(ids[nvalues], suffix);
- nvalues++;
- //tidy up the array we allocated earlier
- delete[] suffix;
- } else break;
-
- iarg++;
- }
-
- //process the optional arguments
- normflag= ALL; //normalise the average right at the end
- scaleflag= LATTICE; // lattice units are the default
- regionflag= 0; //are we restricted to a particular region?
- idregion= NULL; //name of the region to sue, if so
- fp= NULL; //output file
- ave= ONE; //averaging mode
- nwindow= 0; //number of averaging windows
- overwrite= 0; //continuously overwrite output?
- char *title1= NULL;
- char *title2= NULL;
- char *title3= NULL;
-
- while (iarg < narg) {
- if (strcmp(arg[iarg],"norm") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (strcmp(arg[iarg+1],"all") == 0) normflag = ALL;
- else if (strcmp(arg[iarg+1],"sample") == 0) normflag = SAMPLE;
- else error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- iarg += 2;
- } else if (strcmp(arg[iarg],"units") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (strcmp(arg[iarg+1],"box") == 0) scaleflag = BOX;
- else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = LATTICE;
- else if (strcmp(arg[iarg+1],"reduced") == 0) scaleflag = REDUCED;
- else error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- iarg += 2;
- } else if (strcmp(arg[iarg],"region") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- int iregion = domain->find_region(arg[iarg+1]);
- if (iregion == -1)
- error->all(FLERR,"Region ID for fix ave/spatial does not exist");
- int n = strlen(arg[iarg+1]) + 1;
- idregion = new char[n];
- strcpy(idregion,arg[iarg+1]);
- regionflag = 1;
- iarg += 2;
- } else if (strcmp(arg[iarg],"file") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (me == 0) {
- fp = fopen(arg[iarg+1],"w");
- if (fp == NULL) {
- char str[128];
- sprintf(str,"Cannot open fix ave/spatial file %s",arg[iarg+1]);
- error->one(FLERR,str);
- }
- }
- iarg += 2;
- } else if (strcmp(arg[iarg],"ave") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (strcmp(arg[iarg+1],"one") == 0) ave = ONE;
- else if (strcmp(arg[iarg+1],"running") == 0) ave = RUNNING;
- else if (strcmp(arg[iarg+1],"window") == 0) ave = WINDOW;
- else error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (ave == WINDOW) {
- if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- nwindow = force->inumeric(FLERR,arg[iarg+2]);
- if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- }
- iarg += 2;
- if (ave == WINDOW) iarg++;
- } else if (strcmp(arg[iarg],"overwrite") == 0) {
- overwrite = 1;
- iarg += 1;
- } else if (strcmp(arg[iarg],"title1") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- delete [] title1;
- int n = strlen(arg[iarg+1]) + 1;
- title1 = new char[n];
- strcpy(title1,arg[iarg+1]);
- iarg += 2;
- } else if (strcmp(arg[iarg],"title2") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- delete [] title2;
- int n = strlen(arg[iarg+1]) + 1;
- title2 = new char[n];
- strcpy(title2,arg[iarg+1]);
- iarg += 2;
- } else if (strcmp(arg[iarg],"title3") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- delete [] title3;
- int n = strlen(arg[iarg+1]) + 1;
- title3 = new char[n];
- strcpy(title3,arg[iarg+1]);
- iarg += 2;
- } else error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- }
-
- //setup and error checking
- if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0)
- error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (nfreq % nevery || nrepeat*nevery > nfreq)
- error->all(FLERR,"Illegal fix ave/spatial/sphere command");
- if (ave != RUNNING && overwrite)
- error->all(FLERR,"Illegal fix ave/spatial/sphere command");
-
- //setup the variables that we need to average
- for (int i = 0; i < nvalues; i++) {
- if (which[i] == COMPUTE) {
- int icompute = modify->find_compute(ids[i]);
- if (icompute < 0)
- error->all(FLERR,"Compute ID for fix ave/spatial/sphere does not exist");
- if (modify->compute[icompute]->peratom_flag == 0)
- error->all(FLERR,"Fix ave/spatial/sphere compute does not "
- "calculate per-atom values");
- if (argindex[i] == 0 &&
- modify->compute[icompute]->size_peratom_cols != 0)
- error->all(FLERR,"Fix ave/spatial/sphere compute does not "
- "calculate a per-atom vector");
- if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
- error->all(FLERR,"Fix ave/spatial/sphere compute does not "
- "calculate a per-atom array");
- if (argindex[i] &&
- argindex[i] > modify->compute[icompute]->size_peratom_cols)
- error->all(FLERR,
- "Fix ave/spatial/sphere compute vector is accessed out-of-range");
-
- } else if (which[i] == FIX) {
- int ifix = modify->find_fix(ids[i]);
- if (ifix < 0)
- error->all(FLERR,"Fix ID for fix ave/spatial/sphere does not exist");
- if (modify->fix[ifix]->peratom_flag == 0)
- error->all(FLERR,
- "Fix ave/spatial/sphere fix does not calculate per-atom values");
- if (argindex[i] && modify->fix[ifix]->size_peratom_cols != 0)
- error->all(FLERR,
- "Fix ave/spatial/spherefix does not calculate a per-atom vector");
- if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
- error->all(FLERR,
- "Fix ave/spatial/sphere fix does not calculate a per-atom array");
- if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols)
- error->all(FLERR,"Fix ave/spatial/sphere fix vector is accessed out-of-range");
- } else if (which[i] == VARIABLE) {
- int ivariable = input->variable->find(ids[i]);
- if (ivariable < 0)
- error->all(FLERR,"Variable name for fix ave/spatial/sphere does not exist");
- if (input->variable->atomstyle(ivariable) == 0)
- error->all(FLERR,"Fix ave/spatial/sphere variable is not atom-style variable");
- }
- }
-
- // setup the scaling
- int triclinic= domain->triclinic;
- if(scaleflag != REDUCED) {
- if (triclinic) {
- error->all(FLERR, "Fix ave/spatial/sphere for triclinic boxes requires units reduced");
- } else {
- // if not in reduced units, the box must not become triclinic
- no_change_box= 1;
- }
- }
-
- if(scaleflag == LATTICE) {
- scale= domain->lattice->xlattice;
- if(domain->lattice->xlattice != domain->lattice->ylattice
- && domain->lattice->xlattice != domain->lattice->zlattice)
- error->all(FLERR, "Fix ave/spatial/sphere with lattice units requires that the lattice "
- "spacing be equal in all dimensions");
- } else if(scaleflag == REDUCED) {
- scale= 1.0;
- } else {
- scale= 1.0;
- }
-
- //apply the scaling factors
- origin[0]*= scale;
- origin[1]*= scale;
- origin[2]*= scale;
- r_min*= scale;
- r_max*= scale;
- r_minsq= r_min*r_min;
- r_maxsq= r_max*r_max;
- deltar= (r_max-r_min)/nbins;
- inv_deltar= 1.0/deltar;
-
- //print file comment lines
- if (fp && me == 0) {
- if (title1) {
- fprintf(fp,"%s\n",title1);
- } else {
- fprintf(fp,"# Spatial-averaged data for fix %s and group %s\n", id,arg[1]);
- fprintf(fp,"# Spherical bins centred at (");
- for (int i= 0; i < 3; ++i) {
- if(origin_type[i] == CONSTANT) fprintf(fp,"%g",origin[i]);
- else fprintf(fp,"%s",arg[i+6]);
-
- if(i != 2) fprintf(fp, ", ");
- else fprintf(fp, ")");
- }
- if (scaleflag == REDUCED) {
- fprintf(fp, " [reduced units]");
- }
- fprintf(fp, "\n");
- }
- if (title2) fprintf(fp,"%s\n",title2);
- else fprintf(fp,"# Timestep Number-of-bins\n");
- if (title3) fprintf(fp,"%s\n",title3);
- else {
- fprintf(fp,"# Bin r Ncount");
- for (int i = 0; i < nvalues; i++) fprintf(fp," %s",arg[12+i]);
- fprintf(fp,"\n");
- }
- filepos = ftell(fp);
- }
-
- delete [] title1;
- delete [] title2;
- delete [] title3;
-
- //this fix produces a global array
- array_flag= 1;
- size_array_rows= BIG;
- size_array_cols= 1 + 1 + nvalues;
- extarray= 0; //intensive value (don't divide by N when we output this)
-
- //initialization of remaining variables
- irepeat= 0;
- iwindow= window_limit= 0;
- norm= 0;
- maxvar= 0;
- varatom= NULL;
- maxatom= 0;
- bin= NULL;
- binvol= NULL;
- maxbin= 0;
- count_one= count_many= count_sum= count_total= NULL;
- coord= NULL;
- count_list= NULL;
- values_one= values_many= values_sum= values_total= NULL;
- values_list= NULL;
-
- //nvalid = next step on which end_of_step does something
- nvalid= nextvalid();
- //make every compute update itself on step nvalid
- //since we don't yet know which ones we need
- //can correct this when we call end_of_step
- modify->addstep_compute_all(nvalid);
-}
-
-/* ---------------------------------------------------------------------- */
-
-FixAveSpatialSphere::~FixAveSpatialSphere()
-{
- delete [] which;
- delete [] argindex;
- for (int i = 0; i < nvalues; i++) delete [] ids[i];
- delete [] ids;
- delete [] value2index;
- delete [] idregion;
- for (int i= 0; i < 3; ++i) delete [] origin_ids[i];
-
- if (fp && me == 0) fclose(fp);
-
- memory->destroy(varatom);
- memory->destroy(bin);
- memory->destroy(binvol);
-
- memory->destroy(count_one);
- memory->destroy(count_many);
- memory->destroy(count_sum);
- memory->destroy(count_total);
- memory->destroy(coord);
- memory->destroy(count_list);
- memory->destroy(values_one);
- memory->destroy(values_many);
- memory->destroy(values_sum);
- memory->destroy(values_total);
- memory->destroy(values_list);
-}
-
-/* ----------------------------------------------------------------------
- tell LAMMPS at which stages in the timestep we want to be called
- we only care about running at the end of a step
-------------------------------------------------------------------------- */
-
-int FixAveSpatialSphere::setmask()
-{
- int mask = 0;
- mask |= END_OF_STEP;
- return mask;
-}
-
-/* ---------------------------------------------------------------------- */
-
-void FixAveSpatialSphere::init()
-{
- //set up the region and check it's valid
- if(regionflag) {
- int iregion= domain->find_region(idregion);
- if(iregion == -1)
- error->all(FLERR,"Region ID for fix ave/spatial/sphere does not exist");
- region = domain->regions[iregion];
- }
-
- // set indices and check validity of all computes,fixes,variables
- // check that fix frequency is acceptable
-
- for (int m = 0; m < 3; ++m) {
- if (origin_type[m] == COMPUTE) {
- int icompute = modify->find_compute(origin_ids[m]);
- if (icompute < 0)
- error->all(FLERR, "Compute ID for fix ave/spatial/sphere does not exist");
- origin_val2idx[m]= icompute;
- } else if (origin_type[m] == VARIABLE) {
- int ivariable = input->variable->find(origin_ids[m]);
- if (ivariable < 0)
- error->all(FLERR, "Variable name for fix ave/spatial/sphere does not exist");
- origin_val2idx[m]= ivariable;
- }
- }
-
- for (int m = 0; m < nvalues; m++) {
- if (which[m] == COMPUTE) {
- int icompute = modify->find_compute(ids[m]);
- if (icompute < 0)
- error->all(FLERR,"Compute ID for fix ave/spatial/sphere does not exist");
- value2index[m] = icompute;
-
- } else if (which[m] == FIX) {
- int ifix = modify->find_fix(ids[m]);
- if (ifix < 0)
- error->all(FLERR,"Fix ID for fix ave/spatial/sphere does not exist");
- value2index[m] = ifix;
-
- if (nevery % modify->fix[ifix]->peratom_freq)
- error->all(FLERR,
- "Fix for fix ave/spatial/sphere not computed at compatible time");
-
- } else if (which[m] == VARIABLE) {
- int ivariable = input->variable->find(ids[m]);
- if (ivariable < 0)
- error->all(FLERR,"Variable name for fix ave/spatial/sphere does not exist");
- value2index[m] = ivariable;
-
- } else value2index[m] = -1;
- }
-
-
- // need to reset nvalid if nvalid < ntimestep b/c minimize was performed
- if (nvalid < update->ntimestep) {
- irepeat = 0;
- nvalid = nextvalid();
- modify->addstep_compute_all(nvalid);
- }
-}
-
-/* ----------------------------------------------------------------------
- setup initial bins
- only does averaging if nvalid = current timestep
-------------------------------------------------------------------------- */
-
-void FixAveSpatialSphere::setup(int vflag)
-{
- setup_bins();
- end_of_step();
-}
-
-/* ---------------------------------------------------------------------- */
-
-void FixAveSpatialSphere::end_of_step()
-{
- //skip this step if we don't need to do anything
- bigint ntimestep= update->ntimestep;
- if(ntimestep != nvalid) return;
-
- //update region if necessary
- if (regionflag) region->prematch();
-
- //zero out arrays that accumulate over many samples
- if(irepeat == 0) {
- for(int m= 0; m < nbins; m++) {
- count_many[m]= count_sum[m]= 0.0;
- for(int i= 0; i < nvalues; i++) values_many[m][i]= 0.0;
- }
- }
-
- //if in reduced units, we need to update the bin volumes
- if (scaleflag == REDUCED && domain->box_change) set_bin_volumes();
-
- //zero out arrays for one sample
- for(int m= 0; m < nbins; m++) {
- count_one[m]= 0.0;
- for (int i= 0; i < nvalues; i++) values_one[m][i]= 0.0;
- }
-
- //bin each atom
- int *mask= atom->mask;
- int nlocal= atom->nlocal;
-
- if (nlocal > maxatom) {
- maxatom= atom->nmax;
- memory->destroy(bin);
- memory->create(bin,maxatom,"ave/spatial/sphere:bin");
- }
-
- // perform the computation for one sample
- // accumulate results of attributes,computes,fixes,variables to local copy
- // sum within each bin, only include atoms in fix group
- // compute/fix/variable may invoke computes so wrap with clear/add
- modify->clearstep_compute();
-
- //allocates the bins array
- //each atom gets either the number of the bin into which
- //it fits, or -1
- bin_atoms();
-
- for(int m= 0; m < nvalues; m++) {
- int n= value2index[m];
- int j= argindex[m];
-
- if(which[m] == V || which[m] == F) {
- double **attribute;
- if(which[m] == V) attribute= atom->v;
- else attribute= atom->f;
-
- for(int i= 0; i < nlocal; i++) {
- if(mask[i] & groupbit && bin[i] > -1) {
- values_one[bin[i]][m] += attribute[i][j];
- }
- }
- } else if(which[m] == DENSITY_NUMBER) {
- for(int i= 0; i < nlocal; i++) {
- if(mask[i] & groupbit && bin[i] > -1) {
- values_one[bin[i]][m] += 1.0;
- }
- }
- // density is additionally normalized by bin volume
- for (int j = 0; j < nbins; j++)
- values_one[j][m] /= binvol[j];
- } else if(which[m] == DENSITY_MASS) {
- int *type = atom->type;
- double *mass = atom->mass;
- double *rmass = atom->rmass;
- for(int i= 0; i < nlocal; i++) {
- if(mask[i] & groupbit && bin[i] > -1) {
- if (rmass) values_one[bin[i]][m] += rmass[i];
- else values_one[bin[i]][m] += mass[type[i]];
- }
- }
- // density is additionally normalized by bin volume
- for (int j = 0; j < nbins; j++)
- values_one[j][m] /= binvol[j];
- } else if(which[m] == COMPUTE) {
- Compute *compute = modify->compute[n];
- if (!(compute->invoked_flag & INVOKED_PERATOM)) {
- compute->compute_peratom();
- compute->invoked_flag |= INVOKED_PERATOM;
- }
- double *vector = compute->vector_atom;
- double **array = compute->array_atom;
- int jm1 = j - 1;
-
- for (int i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] > -1) {
- if (j == 0) values_one[bin[i]][m] += vector[i];
- else values_one[bin[i]][m] += array[i][jm1];
- }
-
- } else if(which[m] == FIX) {
- double *vector = modify->fix[n]->vector_atom;
- double **array = modify->fix[n]->array_atom;
- int jm1 = j - 1;
- for (int i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] > -1) {
- if (j == 0) values_one[bin[i]][m] += vector[i];
- else values_one[bin[i]][m] += array[i][jm1];
- }
- } else if(which[m] == VARIABLE) {
- if (nlocal > maxvar) {
- maxvar = atom->nmax;
- memory->destroy(varatom);
- memory->create(varatom,maxvar,"ave/spatial:varatom");
- }
-
- input->variable->compute_atom(n,igroup,varatom,1,0);
- for (int i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] > -1)
- values_one[bin[i]][m] += varatom[i];
- }
- }
-
- // process a single sample
- // if normflag = ALL, accumulate values,count separately to many
- // if normflag = SAMPLE, one = value/count, accumulate one to many
- // exception is SAMPLE density: no normalization by atom count
-
- if (normflag == ALL) {
- for (int m = 0; m < nbins; m++) {
- count_many[m] += count_one[m];
- for (int j = 0; j < nvalues; j++)
- values_many[m][j] += values_one[m][j];
- }
- } else {
- MPI_Allreduce(count_one,count_many,nbins,MPI_DOUBLE,MPI_SUM,world);
- for (int m = 0; m < nbins; m++) {
- if (count_many[m] > 0.0)
- for (int j = 0; j < nvalues; j++) {
- if (which[j] == DENSITY_NUMBER || which[j] == DENSITY_MASS)
- values_many[m][j] += values_one[m][j];
- else values_many[m][j] += values_one[m][j]/count_many[m];
- }
- count_sum[m] += count_many[m];
- }
- }
-
- // done if irepeat < nrepeat
- // else reset irepeat and nvalid
- irepeat++;
- if (irepeat < nrepeat) {
- nvalid += nevery;
- modify->addstep_compute(nvalid);
- return;
- }
-
- irepeat++;
- if (irepeat < nrepeat) {
- nvalid += nevery;
- modify->addstep_compute(nvalid);
- return;
- }
-
- irepeat = 0;
- nvalid = ntimestep+nfreq - (nrepeat-1)*nevery;
- modify->addstep_compute(nvalid);
-
- // time average across samples
- // if normflag = ALL, final is total value / total count
- // if normflag = SAMPLE, final is sum of ave / repeat
- // exception is densities: normalized by repeat, not total count
-
- double repeat = nrepeat;
- double mv2d = force->mv2d;
- if (normflag == ALL) {
- MPI_Allreduce(count_many,count_sum,nbins,MPI_DOUBLE,MPI_SUM,world);
- MPI_Allreduce(&values_many[0][0],&values_sum[0][0],nbins*nvalues,
- MPI_DOUBLE,MPI_SUM,world);
- for (int m = 0; m < nbins; m++) {
- if (count_sum[m] > 0.0)
- for (int j = 0; j < nvalues; j++)
- if (which[j] == DENSITY_NUMBER) values_sum[m][j] /= repeat;
- else if (which[j] == DENSITY_MASS) values_sum[m][j] *= mv2d/repeat;
- else values_sum[m][j] /= count_sum[m];
- count_sum[m] /= repeat;
- }
- } else {
- MPI_Allreduce(&values_many[0][0],&values_sum[0][0],nbins*nvalues,
- MPI_DOUBLE,MPI_SUM,world);
- for (int m = 0; m < nbins; m++) {
- for (int j = 0; j < nvalues; j++)
- values_sum[m][j] /= repeat;
- count_sum[m] /= repeat;
- }
- }
-
- // if ave = ONE, only single Nfreq timestep value is needed
- // if ave = RUNNING, combine with all previous Nfreq timestep values
- // if ave = WINDOW, comine with nwindow most recent Nfreq timestep values
-
- if (ave == ONE) {
- for (int m = 0; m < nbins; m++) {
- for (int i = 0; i < nvalues; i++)
- values_total[m][i] = values_sum[m][i];
- count_total[m] = count_sum[m];
- }
- norm = 1;
-
- } else if (ave == RUNNING) {
- for (int m = 0; m < nbins; m++) {
- for (int i = 0; i < nvalues; i++)
- values_total[m][i] += values_sum[m][i];
- count_total[m] += count_sum[m];
- }
- norm++;
-
- } else if (ave == WINDOW) {
- for (int m = 0; m < nbins; m++) {
- for (int i = 0; i < nvalues; i++) {
- values_total[m][i] += values_sum[m][i];
- if (window_limit) values_total[m][i] -= values_list[iwindow][m][i];
- values_list[iwindow][m][i] = values_sum[m][i];
- }
- count_total[m] += count_sum[m];
- if (window_limit) count_total[m] -= count_list[iwindow][m];
- count_list[iwindow][m] = count_sum[m];
- }
-
- iwindow++;
- if (iwindow == nwindow) {
- iwindow = 0;
- window_limit = 1;
- }
- if (window_limit) norm = nwindow;
- else norm = iwindow;
- }
-
- // output result to file
-
- if (fp && me == 0) {
- if (overwrite) fseek(fp,filepos,SEEK_SET);
- fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nbins);
- for (int m = 0; m < nbins; m++) {
- fprintf(fp," %d %g %g",m+1,coord[m],
- count_total[m]/norm);
- for (int i = 0; i < nvalues; i++)
- fprintf(fp," %g",values_total[m][i]/norm);
- fprintf(fp,"\n");
- }
-
- fflush(fp);
- if (overwrite) {
- long fileend = ftell(fp);
- if (fileend > 0) ftruncate(fileno(fp),fileend);
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- setup the bins
- called at setup()
-------------------------------------------------------------------------- */
-
-void FixAveSpatialSphere::setup_bins()
-{
- if(nbins > maxbin) {
- maxbin= nbins;
- memory->grow(count_one,nbins,"ave/spatial/sphere:count_one");
- memory->grow(count_many,nbins,"ave/spatial/sphere:count_many");
- memory->grow(count_sum,nbins,"ave/spatial/sphere:count_sum");
- memory->grow(count_total,nbins,"ave/spatial/sphere:count_total");
-
- memory->grow(coord,nbins,"ave/spatial/sphere:coord");
- memory->grow(binvol,nbins, "ave/spatial/sphere:binvol");
- memory->grow(values_one,nbins,nvalues,"ave/spatial/sphere:values_one");
- memory->grow(values_many,nbins,nvalues,"ave/spatial/sphere:values_many");
- memory->grow(values_sum,nbins,nvalues,"ave/spatial/sphere:values_sum");
- memory->grow(values_total,nbins,nvalues,"ave/spatial/sphere:values_total");
-
- //the count and value lists are only relevant for windowed averaging
- if(ave == WINDOW) {
- memory->create(count_list,nwindow,nbins,"ave/spatial/sphere:count_list");
- memory->create(values_list,nwindow,nbins,nvalues,
- "ave/spatial/sphere:values_list");
- }
-
- //reinitialize the regrown count and values
- for(int m= 0; m < nbins; m++) {
- for(int i= 0; i < nvalues; i++) values_total[m][i]= 0.0;
- count_total[m]= 0.0;
- }
- }
-
- //set the bin coordinates
- for(int i= 0; i < nbins; i++)
- coord[i]= r_min + (i+0.5)*deltar;
-
- set_bin_volumes();
-}
-
-/* ----------------------------------------------------------------------
- set the bin volumes
- called at setup() and when averaging occurs if box size changes
-------------------------------------------------------------------------- */
-
-void FixAveSpatialSphere::set_bin_volumes()
-{
- double last_vol= THIRD*MY_4PI*r_minsq*r_min;
- for(int i= 0; i < nbins; i++) {
- double temp_r= r_min + (i+1)*deltar;
- double temp_vol= THIRD*MY_4PI*temp_r*temp_r*temp_r;
- binvol[i]= temp_vol-last_vol;
- last_vol= temp_vol;
- }
-
- //if in reduced co-ordinates, need to adjust the bin volumes appropriately
- if (scaleflag == REDUCED) {
- double xprd= domain->xprd;
- double yprd= domain->yprd;
- double zprd= domain->zprd;
- for(int i= 0; i < nbins; i++) {
- binvol[i]*= xprd*yprd*zprd;
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- assign atoms to bins
-------------------------------------------------------------------------- */
-
-void FixAveSpatialSphere::bin_atoms()
-{
- //update the origin coordinates if necessary
- //unscale the existing coordinates
- if(scaleflag == REDUCED) domain->lamda2x(origin, origin);
-
- for (int i = 0; i < 3; ++i) {
- if (origin_type[i] == COMPUTE) {
- Compute *compute = modify->compute[origin_val2idx[i]];
- if (origin_index[i] == 0) {
- if (!(compute->invoked_flag & INVOKED_SCALAR)) {
- compute->compute_scalar();
- compute->invoked_flag |= INVOKED_SCALAR;
- }
- origin[i] = compute->scalar;
- } else {
- if (!(compute->invoked_flag & INVOKED_VECTOR)) {
- compute->compute_vector();
- compute->invoked_flag |= INVOKED_VECTOR;
- }
- origin[i] = compute->vector[origin_index[i]-1];
- }
- } else if (origin_type[i] == VARIABLE) {
- origin[i] = input->variable->compute_equal(origin_val2idx[i]);
- }
- }
- //make sure that the origin point is INSIDE the box
- domain->remap(origin);
- //rescale if necessary
- if(scaleflag == REDUCED) domain->x2lamda(origin, origin);
-
- double **x= atom->x;
- int *mask = atom->mask;
- int nlocal = atom->nlocal;
-
- double *prd,*prd_half;
- //deal with the periodic boundary conditions
- if(domain->periodicity[0] || domain->periodicity[1] || domain->periodicity[2]) {
- if(scaleflag == REDUCED) {
- prd= domain->prd_lamda;
- prd_half= domain->prd_half_lamda;
- } else {
- prd= domain->prd;
- prd_half= domain->prd_half;
- }
- }
-
- double rsq, tmp;
-
- if(!regionflag) {
- if(scaleflag == REDUCED) {
- //convert the atomic coordinates into reduced coordinates
- domain->x2lamda(nlocal);
- }
- for(int i= 0; i < nlocal; i++) {
- if(mask[i] & groupbit) {
- rsq= 0.0;
- for(int dim= 0; dim < 3; dim++) {
- tmp= x[i][dim] - origin[dim];
- if(domain->periodicity[dim]) {
- if(tmp < -prd_half[dim]) tmp+= prd[dim];
- else if(tmp >= prd_half[dim]) tmp-= prd[dim];
- }
- rsq+= tmp*tmp;
- }
- if(rsq >= r_minsq && rsq <= r_maxsq) {
- double r= sqrt(rsq);
- int ibin= static_cast((r-r_min)*inv_deltar);
- ibin = MAX(ibin,0);
- ibin = MIN(ibin,nbins-1);
- bin[i]= ibin;
- count_one[ibin]+= 1.0;
- } else {
- bin[i]= -1;
- }
- }
- }
- if(scaleflag == REDUCED) {
- //convert the atomic coordinates back into "real" coordinates
- domain->lamda2x(nlocal);
- }
- } else {
- for(int i= 0; i < nlocal; i++) {
- if(mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) {
- rsq= 0.0;
- for(int dim= 0; dim < 3; dim++) {
- tmp= x[i][dim] - origin[dim];
- if(domain->periodicity[dim]) {
- if(tmp < -0.5*prd[dim]) tmp+= prd[dim];
- else if(tmp >= 0.5*prd[dim]) tmp-= prd[dim];
- }
- rsq+= tmp*tmp;
- }
- if(rsq >= r_minsq && rsq <= r_maxsq) {
- double r= sqrt(rsq);
- int ibin= static_cast((r-r_min)*inv_deltar);
- ibin = MAX(ibin,0);
- ibin = MIN(ibin,nbins-1);
- bin[i]= ibin;
- count_one[ibin]+= 1.0;
- } else {
- bin[i]= -1;
- }
- }
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- return I,J array value
- if I exceeds current bins, return 0.0 instead of generating an error
- column 1 = bin coords, next column = count, remaining columns = Nvalues
-------------------------------------------------------------------------- */
-
-double FixAveSpatialSphere::compute_array(int i, int j)
-{
- if (values_total == NULL) return 0.0;
- if (i >= nbins || j > nvalues) return 0.0;
- if (!norm) return 0.0;
- if (j == 0) return coord[i];
- if (j == 1) return count_total[i]/norm;
- return values_total[i][j]/norm;
-}
-
-
-/* ----------------------------------------------------------------------
- calculate nvalid = next step on which end_of_step does something
- can be this timestep if multiple of nfreq and nrepeat = 1
- else backup from next multiple of nfreq
-------------------------------------------------------------------------- */
-
-bigint FixAveSpatialSphere::nextvalid()
-{
- bigint nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
- if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
- nvalid = update->ntimestep;
- else
- nvalid -= (nrepeat-1)*nevery;
- if (nvalid < update->ntimestep) nvalid += nfreq;
- return nvalid;
-}
-
-/* ----------------------------------------------------------------------
- memory usage of varatom and bins
-------------------------------------------------------------------------- */
-
-double FixAveSpatialSphere::memory_usage()
-{
- double bytes = maxvar * sizeof(double); // varatom
- bytes += maxatom * sizeof(int); // bin
- bytes += 4*nbins * sizeof(double); // count one,many,sum,total
- bytes += nbins * sizeof(double); // coord
- bytes += nvalues*nbins * sizeof(double); // values one,many,sum,total
- bytes += nwindow*nbins * sizeof(double); // count_list
- bytes += nwindow*nbins*nvalues * sizeof(double); // values_list
- return bytes;
-}
diff --git a/src/USER-MISC/fix_ave_spatial_sphere.h b/src/USER-MISC/fix_ave_spatial_sphere.h
deleted file mode 100644
index 1ac550c5e0..0000000000
--- a/src/USER-MISC/fix_ave_spatial_sphere.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- c++ -*- ----------------------------------------------------------
- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
- http://lammps.sandia.gov, Sandia National Laboratories
- Steve Plimpton, sjplimp@sandia.gov
-
- 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.
-------------------------------------------------------------------------- */
-
-/* Adapted from fix ave/spatial by Niall Jackson */
-
-#ifdef FIX_CLASS
-
-FixStyle(ave/spatial/sphere,FixAveSpatialSphere)
-
-#else
-
-#ifndef LMP_FIX_AVE_SPATIAL_SPHERE_H
-#define LMP_FIX_AVE_SPATIAL_SPHERE_H
-
-#include
-#include "fix.h"
-
-namespace LAMMPS_NS {
-
-class FixAveSpatialSphere : public Fix {
- public:
- FixAveSpatialSphere(class LAMMPS *, int, char **);
- ~FixAveSpatialSphere();
- int setmask();
- void init();
- void setup(int);
- void end_of_step();
- double memory_usage();
- double compute_array(int,int);
-
- private:
- int me; //rank of the MPI Process
- int nfreq; //fix nfreq parameter
- int nrepeat; //fix nrepeat parameter
- bigint nvalid; //the next timestep on which I'll be invoked
-
- //controls for various optional behaviours
- int normflag; //what type of normalisation to do
- int norm;
- int scaleflag; //default units (lattice, box, etc.)
- double scale; //coordinate scaling factor
- int regionflag; //restricted to a particular region?
- char *idregion; //name of the region to use
- class Region *region; //pointer to the region
- FILE *fp; //pointer for the output file
- long int filepos; //file position pointer
- int ave; //averaging mode
- int nwindow; //number of averaging windows
- int iwindow; //current window
- int window_limit;
- int overwrite; //continuously overwrite the output (requires ave running)
-
- //used to keep track of which per-atom values we deal with
- int nvalues; //number of variables to average
- int *argindex; //if the variable is an array, this is the offset in that array
- int *value2index;
- int *which; //what sort of variable is arg i? Variable, compute, etc?
- char **ids; //names of the variables
- int maxvar; //current size of the varatom array
- double* varatom; //contains the peratom values of a variable
-
- //details of the sphere and the bins
- int maxbin; //current number of bins in memory (relevant if box changes)
- int nbins; //number of spherical bins
- int maxatom; //current size of the bin array
- int *bin; //stores the bin of each atom
- double *coord; //values of r at the mid points of the bins
- double *binvol; //volumes of the bins
- double *count_one, *count_many, *count_sum, *count_total; //bin populations
- double **values_one, **values_many, **values_sum, **values_total; //accumulated bin values
- double origin[3]; //origin coordinates of the sphere
- int origin_type[3]; //are origin coordinates constant or variable?
- char *origin_ids[3]; //store the names of variables used to access the origin
- int origin_index[3]; //indices for the origin variables
- int origin_val2idx[3]; //compute/variable indices
- double r_min, r_minsq; //minimum radius, and its square
- double r_max, r_maxsq; //maximum radius, and its square
- double deltar, inv_deltar; //radial width of a bin, and its inverse (and their squares)
-
- void setup_bins(); //create the bin arrays
- void set_bin_volumes(); //calculate the volume of each bin
- void bin_atoms(); //put the atom into bins based on their coordinates
- bigint nextvalid(); //return the next timestep on which this is invoked
-
- //NEED TO BE CATEGORISED
- int irepeat;
- double **count_list;
- double ***values_list;
-
-};
-
-}
-
-#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: Region ID for fix ave/spatial/spherical does not exist
-
-Self-explanatory.
-
-E: Cannot open fix ave/spatial/spherical file %s
-
-The specified file cannot be opened. Check that the path and name are
-correct.
-
-E: Compute ID for fix ave/spatial/spherical does not exist
-
-Self-explanatory.
-
-E: Fix ave/spatial/spherical compute does not calculate per-atom values
-
-A compute used by fix ave/spatial/spherical must generate per-atom values.
-
-E: Fix ave/spatial/spherical compute does not calculate a per-atom vector
-
-A compute used by fix ave/spatial/spherical must generate per-atom values.
-
-E: Fix ave/spatial/spherical compute does not calculate a per-atom array
-
-Self-explanatory.
-
-E: Fix ave/spatial/spherical compute vector is accessed out-of-range
-
-The index for the vector is out of bounds.
-
-E: Fix ID for fix ave/spatial/spherical does not exist
-
-Self-explanatory.
-
-E: Fix ave/spatial/spherical fix does not calculate per-atom values
-
-A fix used by fix ave/spatial/spherical must generate per-atom values.
-
-E: Fix ave/spatial/spherical fix does not calculate a per-atom vector
-
-A fix used by fix ave/spatial/spherical must generate per-atom values.
-
-E: Fix ave/spatial/spherical fix does not calculate a per-atom array
-
-Self-explanatory.
-
-E: Fix ave/spatial/spherical fix vector is accessed out-of-range
-
-The index for the vector is out of bounds.
-
-E: Variable name for fix ave/spatial/spherical does not exist
-
-Self-explanatory.
-
-E: Fix ave/spatial/spherical variable is not atom-style variable
-
-A variable used by fix ave/spatial/spherical must generate per-atom values.
-
-E: Fix ave/spatial/spherical for triclinic boxes requires units reduced
-
-Self-explanatory.
-
-E: Fix ave/spatial/spherical requires reduced units if the box changes size.
-
-If the box size changes, only the units reduced option can be
-used.
-
-E: Invalid timestep reset for fix ave/spatial/sphere
-
-Resetting the timestep has invalidated the sequence of timesteps this
-fix needs to process.
-
-*/
From 9d3d6193f39a43984e458cadb9f8204e931f4799 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 31 May 2016 14:49:49 +0000
Subject: [PATCH 004/111] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@15071
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/fix_ave_spatial.cpp | 1522 +--------------------------------------
src/fix_ave_spatial.h | 157 +---
src/pair_table.cpp | 29 +-
3 files changed, 40 insertions(+), 1668 deletions(-)
diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp
index bf32065e22..ef9e04a373 100644
--- a/src/fix_ave_spatial.cpp
+++ b/src/fix_ave_spatial.cpp
@@ -11,1528 +11,30 @@
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
-/* ----------------------------------------------------------------------
- Contributing author: Pieter in 't Veld (SNL)
-------------------------------------------------------------------------- */
-
-#include
-#include
-#include
#include "fix_ave_spatial.h"
-#include "atom.h"
-#include "update.h"
-#include "force.h"
-#include "domain.h"
-#include "region.h"
-#include "lattice.h"
-#include "modify.h"
-#include "compute.h"
-#include "input.h"
-#include "variable.h"
#include "comm.h"
-#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
-using namespace FixConst;
-
-enum{LOWER,CENTER,UPPER,COORD};
-enum{V,F,DENSITY_NUMBER,DENSITY_MASS,COMPUTE,FIX,VARIABLE};
-enum{SAMPLE,ALL};
-enum{BOX,LATTICE,REDUCED};
-enum{ONE,RUNNING,WINDOW};
-enum{NODISCARD,MIXED,YESDISCARD};
-
-#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */
FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
- if (comm->me == 0)
- error->warning(FLERR,"The fix ave/spatial command has been replaced "
- "by the more flexible fix ave/chunk and compute chunk/atom "
- "commands -- fix ave/spatial will be removed in "
- "the summer of 2015");
+ const char *message = "\n"
+ "NOTE: The fix ave/spatial command has been replaced by the\n"
+ "more general fix ave/chunk and compute chunk/atom commands.\n"
+ "All ave/spatial functionality is available in the new commands.\n"
+ "These ave/spatial keywords & options are part of fix ave/chunk:\n"
+ " Nevery, Nrepeat, Nfreq, input values, norm, ave, file, overwrite, title123\n"
+ "These ave/spatial keywords & options for binning are part of compute chunk/atom:\n"
+ " dim, origin, delta, region, bound, discard, units\n\n";
- if (narg < 6) error->all(FLERR,"Illegal fix ave/spatial command");
-
- MPI_Comm_rank(world,&me);
-
- nevery = force->inumeric(FLERR,arg[3]);
- nrepeat = force->inumeric(FLERR,arg[4]);
- nfreq = force->inumeric(FLERR,arg[5]);
-
- global_freq = nfreq;
- no_change_box = 1;
-
- ndim = 0;
- int iarg = 6;
- while (iarg < narg && ndim < 3) {
- if (iarg+3 > narg) break;
- if (strcmp(arg[iarg],"x") == 0) dim[ndim] = 0;
- else if (strcmp(arg[iarg],"y") == 0) dim[ndim] = 1;
- else if (strcmp(arg[iarg],"z") == 0) dim[ndim] = 2;
- else break;
-
- if (dim[ndim] == 2 && domain->dimension == 2)
- error->all(FLERR,"Cannot use fix ave/spatial z for 2 dimensional model");
-
- if (strcmp(arg[iarg+1],"lower") == 0) originflag[ndim] = LOWER;
- else if (strcmp(arg[iarg+1],"center") == 0) originflag[ndim] = CENTER;
- else if (strcmp(arg[iarg+1],"upper") == 0) originflag[ndim] = UPPER;
- else originflag[ndim] = COORD;
- if (originflag[ndim] == COORD)
- origin[ndim] = force->numeric(FLERR,arg[iarg+1]);
-
- delta[ndim] = force->numeric(FLERR,arg[iarg+2]);
- ndim++;
- iarg += 3;
+ if (comm->me == 0) {
+ if (screen) fprintf(screen,message);
+ if (logfile) fprintf(logfile,message);
}
- if (!ndim) error->all(FLERR,"Illegal fix ave/spatial command");
- if (ndim == 2 && dim[0] == dim[1])
- error->all(FLERR,"Same dimension twice in fix ave/spatial");
- if (ndim == 3 && (dim[0] == dim[1] || dim[1] == dim[2] || dim[0] == dim[2]))
- error->all(FLERR,"Same dimension twice in fix ave/spatial");
-
- // parse values until one isn't recognized
-
- which = new int[narg-9];
- argindex = new int[narg-9];
- ids = new char*[narg-9];
- value2index = new int[narg-9];
- nvalues = 0;
-
- while (iarg < narg) {
- ids[nvalues] = NULL;
-
- if (strcmp(arg[iarg],"vx") == 0) {
- which[nvalues] = V;
- argindex[nvalues++] = 0;
- } else if (strcmp(arg[iarg],"vy") == 0) {
- which[nvalues] = V;
- argindex[nvalues++] = 1;
- } else if (strcmp(arg[iarg],"vz") == 0) {
- which[nvalues] = V;
- argindex[nvalues++] = 2;
-
- } else if (strcmp(arg[iarg],"fx") == 0) {
- which[nvalues] = F;
- argindex[nvalues++] = 0;
- } else if (strcmp(arg[iarg],"fy") == 0) {
- which[nvalues] = F;
- argindex[nvalues++] = 1;
- } else if (strcmp(arg[iarg],"fz") == 0) {
- which[nvalues] = F;
- argindex[nvalues++] = 2;
-
- } else if (strcmp(arg[iarg],"density/number") == 0) {
- which[nvalues] = DENSITY_NUMBER;
- argindex[nvalues++] = 0;
- } else if (strcmp(arg[iarg],"density/mass") == 0) {
- which[nvalues] = DENSITY_MASS;
- argindex[nvalues++] = 0;
-
- } else if (strncmp(arg[iarg],"c_",2) == 0 ||
- strncmp(arg[iarg],"f_",2) == 0 ||
- strncmp(arg[iarg],"v_",2) == 0) {
- if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE;
- else if (arg[iarg][0] == 'f') which[nvalues] = FIX;
- else if (arg[iarg][0] == 'v') which[nvalues] = VARIABLE;
-
- int n = strlen(arg[iarg]);
- char *suffix = new char[n];
- strcpy(suffix,&arg[iarg][2]);
-
- char *ptr = strchr(suffix,'[');
- if (ptr) {
- if (suffix[strlen(suffix)-1] != ']')
- error->all(FLERR,"Illegal fix ave/spatial command");
- argindex[nvalues] = atoi(ptr+1);
- *ptr = '\0';
- } else argindex[nvalues] = 0;
-
- n = strlen(suffix) + 1;
- ids[nvalues] = new char[n];
- strcpy(ids[nvalues],suffix);
- nvalues++;
- delete [] suffix;
-
- } else break;
-
- iarg++;
- }
-
- if (nvalues == 0) error->all(FLERR,"No input values for fix ave/spatial");
-
- // optional args
-
- regionflag = 0;
- idregion = NULL;
- minflag[0] = LOWER;
- minflag[1] = LOWER;
- minflag[2] = LOWER;
- maxflag[0] = UPPER;
- maxflag[1] = UPPER;
- maxflag[2] = UPPER;
- discard = MIXED;
- normflag = ALL;
- ave = ONE;
- scaleflag = LATTICE;
- fp = NULL;
- nwindow = 0;
- overwrite = 0;
- char *title1 = NULL;
- char *title2 = NULL;
- char *title3 = NULL;
-
- while (iarg < narg) {
- if (strcmp(arg[iarg],"region") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- int iregion = domain->find_region(arg[iarg+1]);
- if (iregion == -1)
- error->all(FLERR,"Region ID for fix ave/spatial does not exist");
- int n = strlen(arg[iarg+1]) + 1;
- idregion = new char[n];
- strcpy(idregion,arg[iarg+1]);
- regionflag = 1;
- iarg += 2;
- } else if (strcmp(arg[iarg],"bound") == 0) {
- if (iarg+4 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- int idim;
- if (strcmp(arg[iarg+1],"x") == 0) idim = 0;
- else if (strcmp(arg[iarg+1],"y") == 0) idim = 1;
- else if (strcmp(arg[iarg+1],"z") == 0) idim = 2;
- else error->all(FLERR,"Illegal fix ave/spatial command");
- if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER;
- else minflag[idim] = COORD;
- if (minflag[idim] == COORD)
- minvalue[idim] = force->numeric(FLERR,arg[iarg+2]);
- if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER;
- else maxflag[idim] = COORD;
- if (maxflag[idim] == COORD)
- maxvalue[idim] = force->numeric(FLERR,arg[iarg+3]);
- else error->all(FLERR,"Illegal fix ave/spatial command");
- iarg += 4;
- } else if (strcmp(arg[iarg],"discard") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- if (strcmp(arg[iarg+1],"mixed") == 0) discard = MIXED;
- else if (strcmp(arg[iarg+1],"no") == 0) discard = NODISCARD;
- else if (strcmp(arg[iarg+1],"yes") == 0) discard = YESDISCARD;
- else error->all(FLERR,"Illegal fix ave/spatial command");
- iarg += 2;
- } else if (strcmp(arg[iarg],"norm") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- if (strcmp(arg[iarg+1],"all") == 0) normflag = ALL;
- else if (strcmp(arg[iarg+1],"sample") == 0) normflag = SAMPLE;
- else error->all(FLERR,"Illegal fix ave/spatial command");
- iarg += 2;
- } else if (strcmp(arg[iarg],"ave") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- if (strcmp(arg[iarg+1],"one") == 0) ave = ONE;
- else if (strcmp(arg[iarg+1],"running") == 0) ave = RUNNING;
- else if (strcmp(arg[iarg+1],"window") == 0) ave = WINDOW;
- else error->all(FLERR,"Illegal fix ave/spatial command");
- if (ave == WINDOW) {
- if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- nwindow = force->inumeric(FLERR,arg[iarg+2]);
- if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/spatial command");
- }
- iarg += 2;
- if (ave == WINDOW) iarg++;
- } else if (strcmp(arg[iarg],"units") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- if (strcmp(arg[iarg+1],"box") == 0) scaleflag = BOX;
- else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = LATTICE;
- else if (strcmp(arg[iarg+1],"reduced") == 0) scaleflag = REDUCED;
- else error->all(FLERR,"Illegal fix ave/spatial command");
- iarg += 2;
- } else if (strcmp(arg[iarg],"file") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- if (me == 0) {
- fp = fopen(arg[iarg+1],"w");
- if (fp == NULL) {
- char str[128];
- sprintf(str,"Cannot open fix ave/spatial file %s",arg[iarg+1]);
- error->one(FLERR,str);
- }
- }
- iarg += 2;
- } else if (strcmp(arg[iarg],"overwrite") == 0) {
- overwrite = 1;
- iarg += 1;
- } else if (strcmp(arg[iarg],"title1") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- delete [] title1;
- int n = strlen(arg[iarg+1]) + 1;
- title1 = new char[n];
- strcpy(title1,arg[iarg+1]);
- iarg += 2;
- } else if (strcmp(arg[iarg],"title2") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- delete [] title2;
- int n = strlen(arg[iarg+1]) + 1;
- title2 = new char[n];
- strcpy(title2,arg[iarg+1]);
- iarg += 2;
- } else if (strcmp(arg[iarg],"title3") == 0) {
- if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
- delete [] title3;
- int n = strlen(arg[iarg+1]) + 1;
- title3 = new char[n];
- strcpy(title3,arg[iarg+1]);
- iarg += 2;
- } else error->all(FLERR,"Illegal fix ave/spatial command");
- }
-
- // setup and error check
-
- if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0)
- error->all(FLERR,"Illegal fix ave/spatial command");
- if (nfreq % nevery || nrepeat*nevery > nfreq)
- error->all(FLERR,"Illegal fix ave/spatial command");
- if (delta[0] <= 0.0) error->all(FLERR,"Illegal fix ave/spatial command");
- if (ndim >= 2 && delta[1] <= 0.0)
- error->all(FLERR,"Illegal fix ave/spatial command");
- if (ndim == 3 && delta[2] <= 0.0)
- error->all(FLERR,"Illegal fix ave/spatial command");
- if (ave != RUNNING && overwrite)
- error->all(FLERR,"Illegal fix ave/spatial command");
-
- for (int i = 0; i < nvalues; i++) {
- if (which[i] == COMPUTE) {
- int icompute = modify->find_compute(ids[i]);
- if (icompute < 0)
- error->all(FLERR,"Compute ID for fix ave/spatial does not exist");
- if (modify->compute[icompute]->peratom_flag == 0)
- error->all(FLERR,"Fix ave/spatial compute does not "
- "calculate per-atom values");
- if (argindex[i] == 0 &&
- modify->compute[icompute]->size_peratom_cols != 0)
- error->all(FLERR,"Fix ave/spatial compute does not "
- "calculate a per-atom vector");
- if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
- error->all(FLERR,"Fix ave/spatial compute does not "
- "calculate a per-atom array");
- if (argindex[i] &&
- argindex[i] > modify->compute[icompute]->size_peratom_cols)
- error->all(FLERR,
- "Fix ave/spatial compute vector is accessed out-of-range");
-
- } else if (which[i] == FIX) {
- int ifix = modify->find_fix(ids[i]);
- if (ifix < 0)
- error->all(FLERR,"Fix ID for fix ave/spatial does not exist");
- if (modify->fix[ifix]->peratom_flag == 0)
- error->all(FLERR,
- "Fix ave/spatial fix does not calculate per-atom values");
- if (argindex[i] == 0 && modify->fix[ifix]->size_peratom_cols != 0)
- error->all(FLERR,
- "Fix ave/spatial fix does not calculate a per-atom vector");
- if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
- error->all(FLERR,
- "Fix ave/spatial fix does not calculate a per-atom array");
- if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols)
- error->all(FLERR,"Fix ave/spatial fix vector is accessed out-of-range");
- } else if (which[i] == VARIABLE) {
- int ivariable = input->variable->find(ids[i]);
- if (ivariable < 0)
- error->all(FLERR,"Variable name for fix ave/spatial does not exist");
- if (input->variable->atomstyle(ivariable) == 0)
- error->all(FLERR,"Fix ave/spatial variable is not atom-style variable");
- }
- }
-
- // print file comment lines
-
- if (fp && me == 0) {
- if (title1) fprintf(fp,"%s\n",title1);
- else fprintf(fp,"# Spatial-averaged data for fix %s and group %s\n",
- id,arg[1]);
- if (title2) fprintf(fp,"%s\n",title2);
- else fprintf(fp,"# Timestep Number-of-bins\n");
- if (title3) fprintf(fp,"%s\n",title3);
- else {
- if (ndim == 1) fprintf(fp,"# Bin Coord Ncount");
- else if (ndim == 2) fprintf(fp,"# Bin Coord1 Coord2 Ncount");
- else if (ndim == 3) fprintf(fp,"# Bin Coord1 Coord2 Coord3 Ncount");
- for (int i = 0; i < nvalues; i++) fprintf(fp," %s",arg[6+3*ndim+i]);
- fprintf(fp,"\n");
- }
- filepos = ftell(fp);
- }
-
- delete [] title1;
- delete [] title2;
- delete [] title3;
-
- // this fix produces a global array
- // size_array_rows set by setup_bins()
-
- array_flag = 1;
- size_array_cols = 1 + ndim + nvalues;
- extarray = 0;
-
- // setup scaling
-
- int triclinic = domain->triclinic;
- if (triclinic == 1 && scaleflag != REDUCED)
- error->all(FLERR,
- "Fix ave/spatial for triclinic boxes requires units reduced");
-
- if (scaleflag == LATTICE) {
- xscale = domain->lattice->xlattice;
- yscale = domain->lattice->ylattice;
- zscale = domain->lattice->zlattice;
- } else xscale = yscale = zscale = 1.0;
-
- // apply scaling factors
-
- double scale;
- for (int idim = 0; idim < ndim; idim++) {
- if (dim[idim] == 0) scale = xscale;
- else if (dim[idim] == 1) scale = yscale;
- else if (dim[idim] == 2) scale = zscale;
- delta[idim] *= scale;
- invdelta[idim] = 1.0/delta[idim];
- if (originflag[idim] == COORD) origin[idim] *= scale;
- if (minflag[idim] == COORD) minvalue[idim] *= scale;
- if (maxflag[idim] == COORD) maxvalue[idim] *= scale;
- }
-
- // initializations
- // invoke setup_bins() now to set size_array_rows
- // will be reset in setup(), but needed now so Thermo custom can access it
-
- irepeat = 0;
- iwindow = window_limit = 0;
- norm = 0;
-
- maxvar = 0;
- varatom = NULL;
-
- maxatom = 0;
- bin = NULL;
-
- nbins = maxbin = 0;
- count_one = count_many = count_sum = count_total = NULL;
- coord = NULL;
- count_list = NULL;
- values_one = values_many = values_sum = values_total = NULL;
- values_list = NULL;
-
- setup_bins();
-
- // nvalid = next step on which end_of_step does something
- // add nvalid to all computes that store invocation times
- // since don't know a priori which are invoked by this fix
- // once in end_of_step() can set timestep for ones actually invoked
-
- nvalid_last = -1;
- nvalid = nextvalid();
- modify->addstep_compute_all(nvalid);
-}
-
-/* ---------------------------------------------------------------------- */
-
-FixAveSpatial::~FixAveSpatial()
-{
- delete [] which;
- delete [] argindex;
- for (int i = 0; i < nvalues; i++) delete [] ids[i];
- delete [] ids;
- delete [] value2index;
- delete [] idregion;
-
- if (fp && me == 0) fclose(fp);
-
- memory->destroy(varatom);
- memory->destroy(bin);
-
- memory->destroy(count_one);
- memory->destroy(count_many);
- memory->destroy(count_sum);
- memory->destroy(count_total);
- memory->destroy(coord);
- memory->destroy(count_list);
- memory->destroy(values_one);
- memory->destroy(values_many);
- memory->destroy(values_sum);
- memory->destroy(values_total);
- memory->destroy(values_list);
-}
-/* ---------------------------------------------------------------------- */
-
-int FixAveSpatial::setmask()
-{
- int mask = 0;
- mask |= END_OF_STEP;
- return mask;
-}
-
-/* ---------------------------------------------------------------------- */
-
-void FixAveSpatial::init()
-{
- // set and check validity of region
-
- if (regionflag) {
- int iregion = domain->find_region(idregion);
- if (iregion == -1)
- error->all(FLERR,"Region ID for fix ave/spatial does not exist");
- region = domain->regions[iregion];
- }
-
- // # of bins cannot vary for ave = RUNNING or WINDOW
-
- if (ave == RUNNING || ave == WINDOW) {
- if (scaleflag != REDUCED && domain->box_change_size)
- error->all(FLERR,
- "Fix ave/spatial settings invalid with changing box size");
- }
-
- // set indices and check validity of all computes,fixes,variables
- // check that fix frequency is acceptable
-
- for (int m = 0; m < nvalues; m++) {
- if (which[m] == COMPUTE) {
- int icompute = modify->find_compute(ids[m]);
- if (icompute < 0)
- error->all(FLERR,"Compute ID for fix ave/spatial does not exist");
- value2index[m] = icompute;
-
- } else if (which[m] == FIX) {
- int ifix = modify->find_fix(ids[m]);
- if (ifix < 0)
- error->all(FLERR,"Fix ID for fix ave/spatial does not exist");
- value2index[m] = ifix;
-
- if (nevery % modify->fix[ifix]->peratom_freq)
- error->all(FLERR,
- "Fix for fix ave/spatial not computed at compatible time");
-
- } else if (which[m] == VARIABLE) {
- int ivariable = input->variable->find(ids[m]);
- if (ivariable < 0)
- error->all(FLERR,"Variable name for fix ave/spatial does not exist");
- value2index[m] = ivariable;
-
- } else value2index[m] = -1;
- }
-
- // need to reset nvalid if nvalid < ntimestep b/c minimize was performed
-
- if (nvalid < update->ntimestep) {
- irepeat = 0;
- nvalid = nextvalid();
- modify->addstep_compute_all(nvalid);
- }
-}
-
-/* ----------------------------------------------------------------------
- setup initial bins
- only does averaging if nvalid = current timestep
-------------------------------------------------------------------------- */
-
-void FixAveSpatial::setup(int vflag)
-{
- setup_bins();
- end_of_step();
-}
-
-/* ---------------------------------------------------------------------- */
-
-void FixAveSpatial::end_of_step()
-{
- int i,j,m,n;
-
- // skip if not step which requires doing something
- // error check if timestep was reset in an invalid manner
-
- bigint ntimestep = update->ntimestep;
- if (ntimestep < nvalid_last || ntimestep > nvalid)
- error->all(FLERR,"Invalid timestep reset for fix ave/spatial");
- if (ntimestep != nvalid) return;
- nvalid_last = nvalid;
-
- // update region if necessary
-
- if (regionflag) region->prematch();
-
- // zero out arrays that accumulate over many samples
- // if box changes, first re-setup bins
-
- if (irepeat == 0) {
- if (domain->box_change) setup_bins();
- for (m = 0; m < nbins; m++) {
- count_many[m] = count_sum[m] = 0.0;
- for (i = 0; i < nvalues; i++) values_many[m][i] = 0.0;
- }
- }
-
- // zero out arrays for one sample
-
- for (m = 0; m < nbins; m++) {
- count_one[m] = 0.0;
- for (i = 0; i < nvalues; i++) values_one[m][i] = 0.0;
- }
-
- // assign each atom to a bin
-
- double **x = atom->x;
- int *mask = atom->mask;
- int nlocal = atom->nlocal;
-
- if (nlocal > maxatom) {
- maxatom = atom->nmax;
- memory->destroy(bin);
- memory->create(bin,maxatom,"ave/spatial:bin");
- }
-
- if (ndim == 1) atom2bin1d();
- else if (ndim == 2) atom2bin2d();
- else atom2bin3d();
-
- // perform the computation for one sample
- // accumulate results of attributes,computes,fixes,variables to local copy
- // sum within each bin, only include atoms in fix group
- // compute/fix/variable may invoke computes so wrap with clear/add
-
- modify->clearstep_compute();
-
- for (m = 0; m < nvalues; m++) {
- n = value2index[m];
- j = argindex[m];
-
- // V,F adds velocities,forces to values
-
- if (which[m] == V || which[m] == F) {
- double **attribute;
- if (which[m] == V) attribute = atom->v;
- else attribute = atom->f;
-
- if (!regionflag) {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] >= 0)
- values_one[bin[i]][m] += attribute[i][j];
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) &&
- bin[i] >= 0)
- values_one[bin[i]][m] += attribute[i][j];
- }
-
- // DENSITY_NUMBER adds 1 to values
-
- } else if (which[m] == DENSITY_NUMBER) {
-
- if (!regionflag) {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] >= 0)
- values_one[bin[i]][m] += 1.0;
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) &&
- bin[i] >= 0)
- values_one[bin[i]][m] += 1.0;
- }
-
- // DENSITY_MASS adds mass to values
-
- } else if (which[m] == DENSITY_MASS) {
- int *type = atom->type;
- double *mass = atom->mass;
- double *rmass = atom->rmass;
-
- if (!regionflag) {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] >= 0) {
- if (rmass) values_one[bin[i]][m] += rmass[i];
- else values_one[bin[i]][m] += mass[type[i]];
- }
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) &&
- bin[i] >= 0) {
- if (rmass) values_one[bin[i]][m] += rmass[i];
- else values_one[bin[i]][m] += mass[type[i]];
- }
- }
-
- // COMPUTE adds its scalar or vector component to values
- // invoke compute if not previously invoked
-
- } else if (which[m] == COMPUTE) {
- Compute *compute = modify->compute[n];
- if (!(compute->invoked_flag & INVOKED_PERATOM)) {
- compute->compute_peratom();
- compute->invoked_flag |= INVOKED_PERATOM;
- }
- double *vector = compute->vector_atom;
- double **array = compute->array_atom;
- int jm1 = j - 1;
-
- if (!regionflag) {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] >= 0) {
- if (j == 0) values_one[bin[i]][m] += vector[i];
- else values_one[bin[i]][m] += array[i][jm1];
- }
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) &&
- bin[i] >= 0) {
- if (j == 0) values_one[bin[i]][m] += vector[i];
- else values_one[bin[i]][m] += array[i][jm1];
- }
- }
-
- // FIX adds its scalar or vector component to values
- // access fix fields, guaranteed to be ready
-
- } else if (which[m] == FIX) {
- double *vector = modify->fix[n]->vector_atom;
- double **array = modify->fix[n]->array_atom;
- int jm1 = j - 1;
-
- if (!regionflag) {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] >= 0) {
- if (j == 0) values_one[bin[i]][m] += vector[i];
- else values_one[bin[i]][m] += array[i][jm1];
- }
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) &&
- bin[i] >= 0) {
- if (j == 0) values_one[bin[i]][m] += vector[i];
- else values_one[bin[i]][m] += array[i][jm1];
- }
- }
-
- // VARIABLE adds its per-atom quantities to values
- // evaluate atom-style variable
-
- } else if (which[m] == VARIABLE) {
- if (nlocal > maxvar) {
- maxvar = atom->nmax;
- memory->destroy(varatom);
- memory->create(varatom,maxvar,"ave/spatial:varatom");
- }
-
- input->variable->compute_atom(n,igroup,varatom,1,0);
-
- if (!regionflag) {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && bin[i] >= 0)
- values_one[bin[i]][m] += varatom[i];
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) &&
- bin[i] >= 0)
- values_one[bin[i]][m] += varatom[i];
- }
- }
- }
-
- // process a single sample
- // if normflag = ALL, accumulate values,count separately to many
- // if normflag = SAMPLE, one = value/count, accumulate one to many
- // exception is SAMPLE density: no normalization by atom count
-
- if (normflag == ALL) {
- for (m = 0; m < nbins; m++) {
- count_many[m] += count_one[m];
- for (j = 0; j < nvalues; j++)
- values_many[m][j] += values_one[m][j];
- }
- } else {
- MPI_Allreduce(count_one,count_many,nbins,MPI_DOUBLE,MPI_SUM,world);
- for (m = 0; m < nbins; m++) {
- if (count_many[m] > 0.0)
- for (j = 0; j < nvalues; j++) {
- if (which[j] == DENSITY_NUMBER || which[j] == DENSITY_MASS)
- values_many[m][j] += values_one[m][j];
- else values_many[m][j] += values_one[m][j]/count_many[m];
- }
- count_sum[m] += count_many[m];
- }
- }
-
- // done if irepeat < nrepeat
- // else reset irepeat and nvalid
-
- irepeat++;
- if (irepeat < nrepeat) {
- nvalid += nevery;
- modify->addstep_compute(nvalid);
- return;
- }
-
- irepeat = 0;
- nvalid = ntimestep+nfreq - (nrepeat-1)*nevery;
- modify->addstep_compute(nvalid);
-
- // time average across samples
- // if normflag = ALL, final is total value / total count
- // if normflag = SAMPLE, final is sum of ave / repeat
- // exception is densities: normalized by repeat, not total count
-
- double repeat = nrepeat;
- double mv2d = force->mv2d;
-
- if (normflag == ALL) {
- MPI_Allreduce(count_many,count_sum,nbins,MPI_DOUBLE,MPI_SUM,world);
- MPI_Allreduce(&values_many[0][0],&values_sum[0][0],nbins*nvalues,
- MPI_DOUBLE,MPI_SUM,world);
- for (m = 0; m < nbins; m++) {
- if (count_sum[m] > 0.0)
- for (j = 0; j < nvalues; j++) {
- if (which[j] == DENSITY_NUMBER) values_sum[m][j] /= repeat;
- else if (which[j] == DENSITY_MASS) {
- values_sum[m][j] *= mv2d/repeat;
- } else values_sum[m][j] /= count_sum[m];
- }
- count_sum[m] /= repeat;
- }
- } else {
- MPI_Allreduce(&values_many[0][0],&values_sum[0][0],nbins*nvalues,
- MPI_DOUBLE,MPI_SUM,world);
- for (m = 0; m < nbins; m++) {
- for (j = 0; j < nvalues; j++)
- values_sum[m][j] /= repeat;
- count_sum[m] /= repeat;
- }
- }
-
- // density is additionally normalized by bin volume
-
- for (j = 0; j < nvalues; j++)
- if (which[j] == DENSITY_NUMBER || which[j] == DENSITY_MASS)
- for (m = 0; m < nbins; m++)
- values_sum[m][j] /= bin_volume;
-
- // if ave = ONE, only single Nfreq timestep value is needed
- // if ave = RUNNING, combine with all previous Nfreq timestep values
- // if ave = WINDOW, comine with nwindow most recent Nfreq timestep values
-
- if (ave == ONE) {
- for (m = 0; m < nbins; m++) {
- for (i = 0; i < nvalues; i++)
- values_total[m][i] = values_sum[m][i];
- count_total[m] = count_sum[m];
- }
- norm = 1;
-
- } else if (ave == RUNNING) {
- for (m = 0; m < nbins; m++) {
- for (i = 0; i < nvalues; i++)
- values_total[m][i] += values_sum[m][i];
- count_total[m] += count_sum[m];
- }
- norm++;
-
- } else if (ave == WINDOW) {
- for (m = 0; m < nbins; m++) {
- for (i = 0; i < nvalues; i++) {
- values_total[m][i] += values_sum[m][i];
- if (window_limit) values_total[m][i] -= values_list[iwindow][m][i];
- values_list[iwindow][m][i] = values_sum[m][i];
- }
- count_total[m] += count_sum[m];
- if (window_limit) count_total[m] -= count_list[iwindow][m];
- count_list[iwindow][m] = count_sum[m];
- }
-
- iwindow++;
- if (iwindow == nwindow) {
- iwindow = 0;
- window_limit = 1;
- }
- if (window_limit) norm = nwindow;
- else norm = iwindow;
- }
-
- // output result to file
-
- if (fp && me == 0) {
- if (overwrite) fseek(fp,filepos,SEEK_SET);
- fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nbins);
- if (ndim == 1) {
- for (m = 0; m < nbins; m++) {
- fprintf(fp," %d %g %g",m+1,coord[m][0],
- count_total[m]/norm);
- for (i = 0; i < nvalues; i++)
- fprintf(fp," %g",values_total[m][i]/norm);
- fprintf(fp,"\n");
- }
- } else if (ndim == 2)
- for (m = 0; m < nbins; m++) {
- fprintf(fp," %d %g %g %g",m+1,coord[m][0],coord[m][1],
- count_total[m]/norm);
- for (i = 0; i < nvalues; i++)
- fprintf(fp," %g",values_total[m][i]/norm);
- fprintf(fp,"\n");
- }
- else
- for (m = 0; m < nbins; m++) {
- fprintf(fp," %d %g %g %g %g",m+1,coord[m][0],coord[m][1],coord[m][2],
- count_total[m]/norm);
- for (i = 0; i < nvalues; i++)
- fprintf(fp," %g",values_total[m][i]/norm);
- fprintf(fp,"\n");
- }
-
- fflush(fp);
- if (overwrite) {
- long fileend = ftell(fp);
- if (fileend > 0) ftruncate(fileno(fp),fileend);
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- setup 1d, 2d, or 3d bins and their extent and coordinates
- called at setup() and when averaging occurs if box size changes
-------------------------------------------------------------------------- */
-
-void FixAveSpatial::setup_bins()
-{
- int i,j,k,m,n,idim;
- double lo,hi,coord1,coord2;
-
- // lo = bin boundary immediately below boxlo or minvalue
- // hi = bin boundary immediately above boxhi or maxvalue
- // allocate and initialize arrays based on new bin count
-
- double binlo[3],binhi[3];
- double *prd;
- if (scaleflag == REDUCED) {
- binlo[0] = domain->boxlo_lamda[0];
- binlo[1] = domain->boxlo_lamda[1];
- binlo[2] = domain->boxlo_lamda[2];
- binhi[0] = domain->boxhi_lamda[0];
- binhi[1] = domain->boxhi_lamda[1];
- binhi[2] = domain->boxhi_lamda[2];
- prd = domain->prd_lamda;
- } else {
- binlo[0] = domain->boxlo[0];
- binlo[1] = domain->boxlo[1];
- binlo[2] = domain->boxlo[2];
- binhi[0] = domain->boxhi[0];
- binhi[1] = domain->boxhi[1];
- binhi[2] = domain->boxhi[2];
- prd = domain->prd;
- }
-
- if (minflag[0] == COORD) binlo[0] = minvalue[0];
- if (minflag[1] == COORD) binlo[1] = minvalue[1];
- if (minflag[2] == COORD) binlo[2] = minvalue[2];
- if (maxflag[0] == COORD) binhi[0] = maxvalue[0];
- if (maxflag[1] == COORD) binhi[1] = maxvalue[1];
- if (maxflag[2] == COORD) binhi[2] = maxvalue[2];
-
- if (domain->dimension == 3)
- bin_volume = domain->xprd * domain->yprd * domain->zprd;
- else bin_volume = domain->xprd * domain->yprd;
- nbins = 1;
-
- for (m = 0; m < ndim; m++) {
- idim = dim[m];
- if (originflag[m] == LOWER) origin[m] = binlo[idim];
- else if (originflag[m] == UPPER) origin[m] = binhi[idim];
- else if (originflag[m] == CENTER)
- origin[m] = 0.5 * (binlo[idim] + binhi[idim]);
-
- if (origin[m] < binlo[idim]) {
- n = static_cast ((binlo[idim] - origin[m]) * invdelta[m]);
- lo = origin[m] + n*delta[m];
- } else {
- n = static_cast ((origin[m] - binlo[idim]) * invdelta[m]);
- lo = origin[m] - n*delta[m];
- if (lo > binlo[idim]) lo -= delta[m];
- }
- if (origin[m] < binhi[idim]) {
- n = static_cast ((binhi[idim] - origin[m]) * invdelta[m]);
- hi = origin[m] + n*delta[m];
- if (hi < binhi[idim]) hi += delta[m];
- } else {
- n = static_cast ((origin[m] - binhi[idim]) * invdelta[m]);
- hi = origin[m] - n*delta[m];
- }
-
- if (lo > hi) error->all(FLERR,"Invalid bin bounds in fix ave/spatial");
-
- offset[m] = lo;
- nlayers[m] = static_cast ((hi-lo) * invdelta[m] + 0.5);
- nbins *= nlayers[m];
- bin_volume *= delta[m]/prd[idim];
- }
-
- size_array_rows = nbins;
-
- // reallocate bin arrays if needed
-
- if (nbins > maxbin) {
- maxbin = nbins;
- memory->grow(count_one,nbins,"ave/spatial:count_one");
- memory->grow(count_many,nbins,"ave/spatial:count_many");
- memory->grow(count_sum,nbins,"ave/spatial:count_sum");
- memory->grow(count_total,nbins,"ave/spatial:count_total");
-
- memory->grow(coord,nbins,ndim,"ave/spatial:coord");
- memory->grow(values_one,nbins,nvalues,"ave/spatial:values_one");
- memory->grow(values_many,nbins,nvalues,"ave/spatial:values_many");
- memory->grow(values_sum,nbins,nvalues,"ave/spatial:values_sum");
- memory->grow(values_total,nbins,nvalues,"ave/spatial:values_total");
-
- // only allocate count and values list for ave = WINDOW
-
- if (ave == WINDOW) {
- memory->create(count_list,nwindow,nbins,"ave/spatial:count_list");
- memory->create(values_list,nwindow,nbins,nvalues,
- "ave/spatial:values_list");
- }
-
- // reinitialize regrown count/values total since they accumulate
-
- for (m = 0; m < nbins; m++) {
- for (i = 0; i < nvalues; i++) values_total[m][i] = 0.0;
- count_total[m] = 0.0;
- }
- }
-
- // set bin coordinates
-
- if (ndim == 1) {
- for (i = 0; i < nlayers[0]; i++)
- coord[i][0] = offset[0] + (i+0.5)*delta[0];
- } else if (ndim == 2) {
- m = 0;
- for (i = 0; i < nlayers[0]; i++) {
- coord1 = offset[0] + (i+0.5)*delta[0];
- for (j = 0; j < nlayers[1]; j++) {
- coord[m][0] = coord1;
- coord[m][1] = offset[1] + (j+0.5)*delta[1];
- m++;
- }
- }
- } else if (ndim == 3) {
- m = 0;
- for (i = 0; i < nlayers[0]; i++) {
- coord1 = offset[0] + (i+0.5)*delta[0];
- for (j = 0; j < nlayers[1]; j++) {
- coord2 = offset[1] + (j+0.5)*delta[1];
- for (k = 0; k < nlayers[2]; k++) {
- coord[m][0] = coord1;
- coord[m][1] = coord2;
- coord[m][2] = offset[2] + (k+0.5)*delta[2];
- m++;
- }
- }
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- assign each atom to a 1d bin
-------------------------------------------------------------------------- */
-
-void FixAveSpatial::atom2bin1d()
-{
- int i,ibin;
- double *boxlo,*boxhi,*prd;
- double xremap;
- double lamda[3];
-
- double **x = atom->x;
- int *mask = atom->mask;
- int nlocal = atom->nlocal;
-
- int idim = dim[0];
- int nlayer1m1 = nlayers[0] - 1;
- int periodicity = domain->periodicity[idim];
-
- if (periodicity) {
- if (scaleflag == REDUCED) {
- boxlo = domain->boxlo_lamda;
- boxhi = domain->boxhi_lamda;
- prd = domain->prd_lamda;
- } else {
- boxlo = domain->boxlo;
- boxhi = domain->boxhi;
- prd = domain->prd;
- }
- }
-
- // remap each atom's relevant coord back into box via PBC if necessary
- // apply discard rule
- // if scaleflag = REDUCED, box coords -> lamda coords
-
- if (!regionflag) {
- if (scaleflag == REDUCED) domain->x2lamda(nlocal);
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit) {
- bin[i] = -1;
-
- xremap = x[i][idim];
- if (periodicity) {
- if (xremap < boxlo[idim]) xremap += prd[idim];
- if (xremap >= boxhi[idim]) xremap -= prd[idim];
- }
-
- ibin = static_cast ((xremap - offset[0]) * invdelta[0]);
- if (xremap < offset[0]) ibin--;
-
- if (discard== MIXED) {
- if (!minflag[idim]) ibin = MAX(ibin,0);
- else if (ibin < 0) continue;
- if (!maxflag[idim]) ibin = MIN(ibin,nlayer1m1);
- else if (ibin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- ibin = MAX(ibin,0);
- ibin = MIN(ibin,nlayer1m1);
- } else {
- if (ibin < 0 || ibin > nlayer1m1) continue;
- }
-
- bin[i] = ibin;
- count_one[ibin] += 1.0;
- }
- if (scaleflag == REDUCED) domain->lamda2x(nlocal);
-
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
- bin[i] = -1;
-
- if (scaleflag == REDUCED) {
- domain->x2lamda(x[i],lamda);
- xremap = lamda[idim];
- } else xremap = x[i][idim];
- if (periodicity) {
- if (xremap < boxlo[idim]) xremap += prd[idim];
- if (xremap >= boxhi[idim]) xremap -= prd[idim];
- }
-
- ibin = static_cast ((xremap - offset[0]) * invdelta[0]);
- if (xremap < offset[0]) ibin--;
-
- if (discard == MIXED) {
- if (!minflag[idim]) ibin = MAX(ibin,0);
- else if (ibin < 0) continue;
- if (!maxflag[idim]) ibin = MIN(ibin,nlayer1m1);
- else if (ibin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- ibin = MAX(ibin,0);
- ibin = MIN(ibin,nlayer1m1);
- } else {
- if (ibin < 0 || ibin > nlayer1m1) continue;
- }
-
- bin[i] = ibin;
- count_one[ibin] += 1.0;
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- assign each atom to a 2d bin
-------------------------------------------------------------------------- */
-
-void FixAveSpatial::atom2bin2d()
-{
- int i,ibin,i1bin,i2bin;
- double *boxlo,*boxhi,*prd;
- double xremap,yremap;
- double lamda[3];
-
- double **x = atom->x;
- int *mask = atom->mask;
- int nlocal = atom->nlocal;
-
- int idim = dim[0];
- int jdim = dim[1];
- int nlayer1m1 = nlayers[0] - 1;
- int nlayer2m1 = nlayers[1] - 1;
- int* periodicity = domain->periodicity;
-
- if (periodicity[idim] || periodicity[jdim]) {
- if (scaleflag == REDUCED) {
- boxlo = domain->boxlo_lamda;
- boxhi = domain->boxhi_lamda;
- prd = domain->prd_lamda;
- } else {
- boxlo = domain->boxlo;
- boxhi = domain->boxhi;
- prd = domain->prd;
- }
- }
-
- // remap each atom's relevant coord back into box via PBC if necessary
- // apply discard rule
- // if scaleflag = REDUCED, box coords -> lamda coords
-
- if (!regionflag) {
- if (scaleflag == REDUCED) domain->x2lamda(nlocal);
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit) {
- bin[i] = -1;
-
- xremap = x[i][idim];
- if (periodicity[idim]) {
- if (xremap < boxlo[idim]) xremap += prd[idim];
- if (xremap >= boxhi[idim]) xremap -= prd[idim];
- }
-
- i1bin = static_cast ((xremap - offset[0]) * invdelta[0]);
- if (xremap < offset[0]) i1bin--;
-
- if (discard == MIXED) {
- if (!minflag[idim]) i1bin = MAX(i1bin,0);
- else if (i1bin < 0) continue;
- if (!maxflag[idim]) i1bin = MIN(i1bin,nlayer1m1);
- else if (i1bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i1bin = MAX(i1bin,0);
- i1bin = MIN(i1bin,nlayer1m1);
- } else {
- if (i1bin < 0 || i1bin > nlayer1m1) continue;
- }
-
- yremap = x[i][jdim];
- if (periodicity[jdim]) {
- if (yremap < boxlo[jdim]) yremap += prd[jdim];
- if (yremap >= boxhi[jdim]) yremap -= prd[jdim];
- }
-
- i2bin = static_cast ((yremap - offset[1]) * invdelta[1]);
- if (yremap < offset[1]) i2bin--;
-
- if (discard == MIXED) {
- if (!minflag[jdim]) i2bin = MAX(i2bin,0);
- else if (i2bin < 0) continue;
- if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1);
- else if (i2bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i2bin = MAX(i2bin,0);
- i2bin = MIN(i2bin,nlayer2m1);
- } else {
- if (i2bin < 0 || i2bin > nlayer2m1) continue;
- }
-
- ibin = i1bin*nlayers[1] + i2bin;
- bin[i] = ibin;
- count_one[ibin] += 1.0;
- }
- if (scaleflag == REDUCED) domain->lamda2x(nlocal);
-
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
- bin[i] = -1;
-
- if (scaleflag == REDUCED) {
- domain->x2lamda(x[i],lamda);
- xremap = lamda[idim];
- yremap = lamda[jdim];
- } else {
- xremap = x[i][idim];
- yremap = x[i][jdim];
- }
-
- if (periodicity[idim]) {
- if (xremap < boxlo[idim]) xremap += prd[idim];
- if (xremap >= boxhi[idim]) xremap -= prd[idim];
- }
-
- i1bin = static_cast ((xremap - offset[0]) * invdelta[0]);
- if (xremap < offset[0]) i1bin--;
-
- if (discard == MIXED) {
- if (!minflag[idim]) i1bin = MAX(i1bin,0);
- else if (i1bin < 0) continue;
- if (!maxflag[idim]) i1bin = MIN(i1bin,nlayer1m1);
- else if (i1bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i1bin = MAX(i1bin,0);
- i1bin = MIN(i1bin,nlayer1m1);
- } else {
- if (i1bin < 0 || i1bin > nlayer1m1) continue;
- }
-
- if (periodicity[jdim]) {
- if (yremap < boxlo[jdim]) yremap += prd[jdim];
- if (yremap >= boxhi[jdim]) yremap -= prd[jdim];
- }
-
- i2bin = static_cast ((yremap - offset[1]) * invdelta[1]);
- if (yremap < offset[1]) i2bin--;
-
- if (discard == MIXED) {
- if (!minflag[jdim]) i2bin = MAX(i2bin,0);
- else if (i2bin < 0) continue;
- if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1);
- else if (i2bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i2bin = MAX(i2bin,0);
- i2bin = MIN(i2bin,nlayer2m1);
- } else {
- if (i2bin < 0 || i2bin > nlayer2m1) continue;
- }
-
- ibin = i1bin*nlayers[1] + i2bin;
- bin[i] = ibin;
- count_one[ibin] += 1.0;
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- assign each atom to a 3d bin
-------------------------------------------------------------------------- */
-
-void FixAveSpatial::atom2bin3d()
-{
- int i,ibin,i1bin,i2bin,i3bin;
- double *boxlo,*boxhi,*prd;
- double xremap,yremap,zremap;
- double lamda[3];
-
- double **x = atom->x;
- int *mask = atom->mask;
- int nlocal = atom->nlocal;
-
- int idim = dim[0];
- int jdim = dim[1];
- int kdim = dim[2];
- int nlayer1m1 = nlayers[0] - 1;
- int nlayer2m1 = nlayers[1] - 1;
- int nlayer3m1 = nlayers[2] - 1;
- int* periodicity = domain->periodicity;
-
- if (periodicity[idim] || periodicity[jdim] || periodicity[kdim]) {
- if (scaleflag == REDUCED) {
- boxlo = domain->boxlo_lamda;
- boxhi = domain->boxhi_lamda;
- prd = domain->prd_lamda;
- } else {
- boxlo = domain->boxlo;
- boxhi = domain->boxhi;
- prd = domain->prd;
- }
- }
-
- // remap each atom's relevant coord back into box via PBC if necessary
- // apply discard rule
- // if scaleflag = REDUCED, box coords -> lamda coords
-
- if (!regionflag) {
- if (scaleflag == REDUCED) domain->x2lamda(nlocal);
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit) {
- bin[i] = -1;
-
- xremap = x[i][idim];
- if (periodicity[idim]) {
- if (xremap < boxlo[idim]) xremap += prd[idim];
- if (xremap >= boxhi[idim]) xremap -= prd[idim];
- }
-
- i1bin = static_cast ((xremap - offset[0]) * invdelta[0]);
- if (xremap < offset[0]) i1bin--;
-
- if (discard == MIXED) {
- if (!minflag[idim]) i1bin = MAX(i1bin,0);
- else if (i1bin < 0) continue;
- if (!maxflag[idim]) i1bin = MIN(i1bin,nlayer1m1);
- else if (i1bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i1bin = MAX(i1bin,0);
- i1bin = MIN(i1bin,nlayer1m1);
- } else {
- if (i1bin < 0 || i1bin > nlayer1m1) continue;
- }
-
- yremap = x[i][jdim];
- if (periodicity[jdim]) {
- if (yremap < boxlo[jdim]) yremap += prd[jdim];
- if (yremap >= boxhi[jdim]) yremap -= prd[jdim];
- }
-
- i2bin = static_cast ((yremap - offset[1]) * invdelta[1]);
- if (yremap < offset[1]) i2bin--;
-
- if (discard == MIXED) {
- if (!minflag[jdim]) i2bin = MAX(i2bin,0);
- else if (i2bin < 0) continue;
- if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1);
- else if (i2bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i2bin = MAX(i2bin,0);
- i2bin = MIN(i2bin,nlayer2m1);
- } else {
- if (i2bin < 0 || i2bin > nlayer2m1) continue;
- }
-
- zremap = x[i][kdim];
- if (periodicity[kdim]) {
- if (zremap < boxlo[kdim]) zremap += prd[kdim];
- if (zremap >= boxhi[kdim]) zremap -= prd[kdim];
- }
-
- i3bin = static_cast ((zremap - offset[2]) * invdelta[2]);
- if (zremap < offset[2]) i3bin--;
-
- if (discard == MIXED) {
- if (!minflag[kdim]) i3bin = MAX(i3bin,0);
- else if (i3bin < 0) continue;
- if (!maxflag[kdim]) i3bin = MIN(i3bin,nlayer3m1);
- else if (i3bin > nlayer3m1) continue;
- } else if (discard == NODISCARD) {
- i3bin = MAX(i3bin,0);
- i3bin = MIN(i3bin,nlayer3m1);
- } else {
- if (i3bin < 0 || i3bin > nlayer3m1) continue;
- }
-
- ibin = i1bin*nlayers[1]*nlayers[2] + i2bin*nlayers[2] + i3bin;
- bin[i] = ibin;
- count_one[ibin] += 1.0;
- }
- if (scaleflag == REDUCED) domain->lamda2x(nlocal);
-
- } else {
- for (i = 0; i < nlocal; i++)
- if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
- bin[i] = -1;
-
- if (scaleflag == REDUCED) {
- domain->x2lamda(x[i],lamda);
- xremap = lamda[idim];
- yremap = lamda[jdim];
- zremap = lamda[kdim];
- } else {
- xremap = x[i][idim];
- yremap = x[i][jdim];
- zremap = x[i][kdim];
- }
-
- if (periodicity[idim]) {
- if (xremap < boxlo[idim]) xremap += prd[idim];
- if (xremap >= boxhi[idim]) xremap -= prd[idim];
- }
-
- i1bin = static_cast ((xremap - offset[0]) * invdelta[0]);
- if (xremap < offset[0]) i1bin--;
-
- if (discard == MIXED) {
- if (!minflag[idim]) i1bin = MAX(i1bin,0);
- else if (i1bin < 0) continue;
- if (!maxflag[idim]) i1bin = MIN(i1bin,nlayer1m1);
- else if (i1bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i1bin = MAX(i1bin,0);
- i1bin = MIN(i1bin,nlayer1m1);
- } else {
- if (i1bin < 0 || i1bin > nlayer1m1) continue;
- }
-
- if (periodicity[jdim]) {
- if (yremap < boxlo[jdim]) yremap += prd[jdim];
- if (yremap >= boxhi[jdim]) yremap -= prd[jdim];
- }
-
- i2bin = static_cast ((yremap - offset[1]) * invdelta[1]);
- if (yremap < offset[1]) i2bin--;
-
- if (discard == MIXED) {
- if (!minflag[jdim]) i2bin = MAX(i2bin,0);
- else if (i2bin < 0) continue;
- if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1);
- else if (i2bin > nlayer1m1) continue;
- } else if (discard == NODISCARD) {
- i2bin = MAX(i2bin,0);
- i2bin = MIN(i2bin,nlayer2m1);
- } else {
- if (i2bin < 0 || i2bin > nlayer2m1) continue;
- }
-
- if (periodicity[kdim]) {
- if (zremap < boxlo[kdim]) zremap += prd[kdim];
- if (zremap >= boxhi[kdim]) zremap -= prd[kdim];
- }
-
- i3bin = static_cast ((zremap - offset[2]) * invdelta[2]);
- if (zremap < offset[2]) i3bin--;
-
- if (discard == MIXED) {
- if (!minflag[kdim]) i3bin = MAX(i3bin,0);
- else if (i3bin < 0) continue;
- if (!maxflag[kdim]) i3bin = MIN(i3bin,nlayer3m1);
- else if (i3bin > nlayer3m1) continue;
- } else if (discard == NODISCARD) {
- i3bin = MAX(i3bin,0);
- i3bin = MIN(i3bin,nlayer3m1);
- } else {
- if (i3bin < 0 || i3bin > nlayer3m1) continue;
- }
-
- ibin = i1bin*nlayers[1]*nlayers[2] + i2bin*nlayers[2] + i3bin;
- bin[i] = ibin;
- count_one[ibin] += 1.0;
- }
- }
-}
-
-/* ----------------------------------------------------------------------
- return I,J array value
- if I exceeds current nbins, return 0.0 instead of generating an error
- column 1,2,3 = bin coords, next column = count, remaining columns = Nvalues
-------------------------------------------------------------------------- */
-
-double FixAveSpatial::compute_array(int i, int j)
-{
- if (values_total == NULL) return 0.0;
- if (i >= nbins) return 0.0;
- if (j < ndim) return coord[i][j];
- j -= ndim+1;
- if (!norm) return 0.0;
- if (j < 0) return count_total[i]/norm;
- return values_total[i][j]/norm;
-}
-
-/* ----------------------------------------------------------------------
- calculate nvalid = next step on which end_of_step does something
- can be this timestep if multiple of nfreq and nrepeat = 1
- else backup from next multiple of nfreq
-------------------------------------------------------------------------- */
-
-bigint FixAveSpatial::nextvalid()
-{
- bigint nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
- if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
- nvalid = update->ntimestep;
- else
- nvalid -= (nrepeat-1)*nevery;
- if (nvalid < update->ntimestep) nvalid += nfreq;
- return nvalid;
-}
-
-/* ----------------------------------------------------------------------
- memory usage of varatom and bins
-------------------------------------------------------------------------- */
-
-double FixAveSpatial::memory_usage()
-{
- double bytes = maxvar * sizeof(double); // varatom
- bytes += maxatom * sizeof(int); // bin
- bytes += 4*nbins * sizeof(double); // count one,many,sum,total
- bytes += ndim*nbins * sizeof(double); // coord
- bytes += nvalues*nbins * sizeof(double); // values one,many,sum,total
- bytes += nwindow*nbins * sizeof(double); // count_list
- bytes += nwindow*nbins*nvalues * sizeof(double); // values_list
- return bytes;
+ error->all(FLERR,"The fix ave/spatial command has been removed from LAMMPS");
}
diff --git a/src/fix_ave_spatial.h b/src/fix_ave_spatial.h
index 1df4c363b2..de592cbc95 100644
--- a/src/fix_ave_spatial.h
+++ b/src/fix_ave_spatial.h
@@ -28,56 +28,9 @@ namespace LAMMPS_NS {
class FixAveSpatial : public Fix {
public:
FixAveSpatial(class LAMMPS *, int, char **);
- ~FixAveSpatial();
- int setmask();
- void init();
- void setup(int);
- void end_of_step();
- double compute_array(int,int);
- double memory_usage();
-
- private:
- int me,nvalues;
- int nrepeat,nfreq,irepeat;
- bigint nvalid,nvalid_last;
- int ndim,normflag,regionflag,overwrite,discard;
- char *tstring,*sstring,*idregion;
- int *which,*argindex,*value2index;
- char **ids;
- FILE *fp;
- class Region *region;
-
- int ave,nwindow,scaleflag;
- int norm,iwindow,window_limit;
- double xscale,yscale,zscale;
- double bin_volume;
-
- long filepos;
- int dim[3],originflag[3],nlayers[3];
- double origin[3],delta[3];
- double offset[3],invdelta[3];
-
- int maxvar;
- double *varatom;
-
- int maxatom;
- int *bin;
-
- int nbins,maxbin;
- double **coord;
- double *count_one,*count_many,*count_sum;
- double **values_one,**values_many,**values_sum;
- double *count_total,**count_list;
- double **values_total,***values_list;
-
- int minflag[3],maxflag[3];
- double minvalue[3],maxvalue[3];
-
- void setup_bins();
- void atom2bin1d();
- void atom2bin2d();
- void atom2bin3d();
- bigint nextvalid();
+ ~FixAveSpatial() {}
+ int setmask() {}
+ void init() {}
};
}
@@ -87,106 +40,10 @@ class FixAveSpatial : public Fix {
/* ERROR/WARNING messages:
-W: The fix ave/spatial command has been replaced by the more flexible fix ave/chunk and compute chunk/atom commands -- fix ave/spatial will be removed in the summer of 2015
+E: The fix ave/spatial command has been removed from LAMMPS
-Self-explanatory.
-
-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: Cannot use fix ave/spatial z for 2 dimensional model
-
-Self-explanatory.
-
-E: Same dimension twice in fix ave/spatial
-
-Self-explanatory.
-
-E: No input values for fix ave/spatial
-
-Self-explanatory.
-
-E: Region ID for fix ave/spatial does not exist
-
-Self-explanatory.
-
-E: Cannot open fix ave/spatial file %s
-
-The specified file cannot be opened. Check that the path and name are
-correct.
-
-E: Compute ID for fix ave/spatial does not exist
-
-Self-explanatory.
-
-E: Fix ave/spatial compute does not calculate per-atom values
-
-A compute used by fix ave/spatial must generate per-atom values.
-
-E: Fix ave/spatial compute does not calculate a per-atom vector
-
-A compute used by fix ave/spatial must generate per-atom values.
-
-E: Fix ave/spatial compute does not calculate a per-atom array
-
-Self-explanatory.
-
-E: Fix ave/spatial compute vector is accessed out-of-range
-
-The index for the vector is out of bounds.
-
-E: Fix ID for fix ave/spatial does not exist
-
-Self-explanatory.
-
-E: Fix ave/spatial fix does not calculate per-atom values
-
-A fix used by fix ave/spatial must generate per-atom values.
-
-E: Fix ave/spatial fix does not calculate a per-atom vector
-
-A fix used by fix ave/spatial must generate per-atom values.
-
-E: Fix ave/spatial fix does not calculate a per-atom array
-
-Self-explanatory.
-
-E: Fix ave/spatial fix vector is accessed out-of-range
-
-The index for the vector is out of bounds.
-
-E: Variable name for fix ave/spatial does not exist
-
-Self-explanatory.
-
-E: Fix ave/spatial variable is not atom-style variable
-
-A variable used by fix ave/spatial must generate per-atom values.
-
-E: Fix ave/spatial for triclinic boxes requires units reduced
-
-Self-explanatory.
-
-E: Fix ave/spatial settings invalid with changing box size
-
-If the box size changes, only the units reduced option can be
-used.
-
-E: Fix for fix ave/spatial not computed at compatible time
-
-Fixes generate their values on specific timesteps. Fix ave/spatial is
-requesting a value on a non-allowed timestep.
-
-E: Invalid timestep reset for fix ave/spatial
-
-Resetting the timestep has invalidated the sequence of timesteps this
-fix needs to process.
-
-E: Invalid bin bounds in fix ave/spatial
-
-The lo/hi values are inconsistent.
+It has been replaced by the more flexible fix ave/chunk and compute
+chunk/atom commands. All the fix ave/spatial keywords and options are
+available in those two newer commands.
*/
diff --git a/src/pair_table.cpp b/src/pair_table.cpp
index 71b4d49b5f..06afdff78f 100644
--- a/src/pair_table.cpp
+++ b/src/pair_table.cpp
@@ -63,6 +63,7 @@ void PairTable::compute(int eflag, int vflag)
int i,j,ii,jj,inum,jnum,itype,jtype,itable;
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
double rsq,factor_lj,fraction,value,a,b;
+ char estr[128];
int *ilist,*jlist,*numneigh,**firstneigh;
Table *tb;
@@ -109,25 +110,37 @@ void PairTable::compute(int eflag, int vflag)
if (rsq < cutsq[itype][jtype]) {
tb = &tables[tabindex[itype][jtype]];
- if (rsq < tb->innersq)
- error->one(FLERR,"Pair distance < table inner cutoff");
+ if (rsq < tb->innersq) {
+ sprintf(estr,"Pair distance < table inner cutoff: "
+ "ijtype %d %d dist %g",itype,jtype,sqrt(rsq));
+ error->one(FLERR,estr);
+ }
if (tabstyle == LOOKUP) {
itable = static_cast ((rsq - tb->innersq) * tb->invdelta);
- if (itable >= tlm1)
- error->one(FLERR,"Pair distance > table outer cutoff");
+ if (itable >= tlm1) {
+ sprintf(estr,"Pair distance > table outer cutoff: "
+ "ijtype %d %d dist %g",itype,jtype,sqrt(rsq));
+ error->one(FLERR,estr);
+ }
fpair = factor_lj * tb->f[itable];
} else if (tabstyle == LINEAR) {
itable = static_cast ((rsq - tb->innersq) * tb->invdelta);
- if (itable >= tlm1)
- error->one(FLERR,"Pair distance > table outer cutoff");
+ if (itable >= tlm1) {
+ sprintf(estr,"Pair distance > table outer cutoff: "
+ "ijtype %d %d dist %g",itype,jtype,sqrt(rsq));
+ error->one(FLERR,estr);
+ }
fraction = (rsq - tb->rsq[itable]) * tb->invdelta;
value = tb->f[itable] + fraction*tb->df[itable];
fpair = factor_lj * value;
} else if (tabstyle == SPLINE) {
itable = static_cast ((rsq - tb->innersq) * tb->invdelta);
- if (itable >= tlm1)
- error->one(FLERR,"Pair distance > table outer cutoff");
+ if (itable >= tlm1) {
+ sprintf(estr,"Pair distance > table outer cutoff: "
+ "ijtype %d %d dist %g",itype,jtype,sqrt(rsq));
+ error->one(FLERR,estr);
+ }
b = (rsq - tb->rsq[itable]) * tb->invdelta;
a = 1.0 - b;
value = a * tb->f[itable] + b * tb->f[itable+1] +
From 402b7a7231750b794b8ef178b19244ef730b088d Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 31 May 2016 14:53:34 +0000
Subject: [PATCH 005/111] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@15072
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
doc/html/_sources/fix_ave_spatial.txt | 447 ---------------
doc/html/_sources/fix_ave_spatial_sphere.txt | 349 ------------
doc/html/fix_ave_spatial.html | 567 -------------------
doc/html/fix_ave_spatial_sphere.html | 478 ----------------
doc/lammps.book | 2 -
5 files changed, 1843 deletions(-)
delete mode 100644 doc/html/_sources/fix_ave_spatial.txt
delete mode 100644 doc/html/_sources/fix_ave_spatial_sphere.txt
delete mode 100644 doc/html/fix_ave_spatial.html
delete mode 100644 doc/html/fix_ave_spatial_sphere.html
diff --git a/doc/html/_sources/fix_ave_spatial.txt b/doc/html/_sources/fix_ave_spatial.txt
deleted file mode 100644
index 1c7c368503..0000000000
--- a/doc/html/_sources/fix_ave_spatial.txt
+++ /dev/null
@@ -1,447 +0,0 @@
-.. index:: fix ave/spatial
-
-fix ave/spatial command
-=======================
-
-Syntax
-""""""
-
-.. parsed-literal::
-
- fix ID group-ID ave/spatial Nevery Nrepeat Nfreq dim origin delta ... value1 value2 ... keyword args ...
-
-* ID, group-ID are documented in :doc:`fix ` command
-* ave/spatial = style name of this fix command
-* Nevery = use input values every this many timesteps
-* Nrepeat = # of times to use input values for calculating averages
-* Nfreq = calculate averages every this many timesteps
-* dim, origin, delta can be repeated 1, 2, or 3 times for 1d, 2d, or 3d bins
-.. parsed-literal::
-
- dim = *x* or *y* or *z*
- origin = *lower* or *center* or *upper* or coordinate value (distance units)
- delta = thickness of spatial bins in dim (distance units)
-
-* one or more input values can be listed
-* value = vx, vy, vz, fx, fy, fz, density/mass, density/number, c_ID, c_ID[I], f_ID, f_ID[I], v_name
-.. parsed-literal::
-
- vx,vy,vz,fx,fy,fz = atom attribute (velocity, force component)
- density/number, density/mass = number or mass density
- c_ID = per-atom vector calculated by a compute with ID
- c_ID[I] = Ith column of per-atom array calculated by a compute with ID
- f_ID = per-atom vector calculated by a fix with ID
- f_ID[I] = Ith column of per-atom array calculated by a fix with ID
- v_name = per-atom vector calculated by an atom-style variable with name
-
-* zero or more keyword/arg pairs may be appended
-* keyword = *region* or *bound* or *discard* or *norm* or *ave* or *units* or *file* or *overwrite* or *title1* or *title2* or *title3*
-.. parsed-literal::
-
- *region* arg = region-ID
- *bound* args = x/y/z lo hi
- x/y/z = *x* or *y* or *z* to bound bins in this dimension
- lo = *lower* or coordinate value (distance units)
- hi = *upper* or coordinate value (distance units)
- *discard* arg = *mixed* or *no* or *yes*
- mixed = discard atoms outside bins only if bin bounds are explicitly set
- no = always keep out-of-bounds atoms
- yes = always discard out-of-bounds atoms
- *norm* arg = *all* or *sample*
- region-ID = ID of region atoms must be in to contribute to spatial averaging
- *ave* args = *one* or *running* or *window M*
- one = output new average value every Nfreq steps
- running = output cumulative average of all previous Nfreq steps
- window M = output average of M most recent Nfreq steps
- *units* arg = *box* or *lattice* or *reduced*
- *file* arg = filename
- filename = file to write results to
- *overwrite* arg = none = overwrite output file with only latest output
- *title1* arg = string
- string = text to print as 1st line of output file
- *title2* arg = string
- string = text to print as 2nd line of output file
- *title3* arg = string
- string = text to print as 3rd line of output file
-
-
-
-Examples
-""""""""
-
-.. parsed-literal::
-
- fix 1 all ave/spatial 10000 1 10000 z lower 0.02 c_myCentro units reduced &
- title1 "My output values"
- fix 1 flow ave/spatial 100 10 1000 y 0.0 1.0 vx vz norm sample file vel.profile
- fix 1 flow ave/spatial 100 5 1000 z lower 1.0 y 0.0 2.5 density/mass ave running
- fix 1 flow ave/spatial 100 5 1000 z lower 1.0 y 0.0 2.5 density/mass bound y 5.0 20.0 discard yes ave running
-
-**NOTE:**
-
-The fix ave/spatial command has been replaced by the more flexible
-:doc:`fix ave/chunk ` and :doc:`compute chunk/atom ` commands. The fix ave/spatial
-command will be removed from LAMMPS sometime in the summer of 2015.
-
-Any fix ave/spatial command can be replaced by the two new commands.
-You simply need to split the fix ave/spatial arguments across the two
-new commands. For example, this command:
-
-.. parsed-literal::
-
- fix 1 flow ave/spatial 100 10 1000 y 0.0 1.0 vx vz norm sample file vel.profile
-
-could be replaced by:
-
-.. parsed-literal::
-
- compute cc1 flow chunk/atom bin/1d y 0.0 1.0
- fix 1 flow ave/chunk 100 10 1000 cc1 vx vz norm sample file vel.profile
-
-Description
-"""""""""""
-
-Use one or more per-atom vectors as inputs every few timesteps, bin
-their values spatially into 1d, 2d, or 3d bins based on current atom
-coordinates, and average the bin values over longer timescales. The
-resulting bin averages can be used by other :ref:`output commands ` such as :doc:`thermo_style custom `, and can also be written to a file.
-
-The group specified with the command means only atoms within the group
-contribute to bin averages. If the *region* keyword is used, the atom
-must be in both the specified group and the specified geometric
-:doc:`region ` in order to contribute to bin averages.
-
-Each listed value can be an atom attribute (position, velocity, force
-component), a mass or number density, or the result of a
-:doc:`compute ` or :doc:`fix ` or the evaluation of an
-atom-style :doc:`variable `. In the latter cases, the
-compute, fix, or variable must produce a per-atom quantity, not a
-global quantity. If you wish to time-average global quantities from a
-compute, fix, or variable, then see the :doc:`fix ave/time ` command.
-
-:doc:`Computes ` that produce per-atom quantities are those
-which have the word *atom* in their style name. See the doc pages for
-individual :doc:`fixes ` to determine which ones produce per-atom
-quantities. :doc:`Variables ` of style *atom* are the only
-ones that can be used with this fix since all other styles of variable
-produce global quantities.
-
-The per-atom values of each input vector are binned and averaged
-independently of the per-atom values in other input vectors.
-
-The size and dimensionality of the bins (1d = layers or slabs, 2d =
-pencils, 3d = boxes) are determined by the *dim*\ , *origin*\ , and
-*delta* settings and how many times they are specified (1, 2, or 3).
-See details below.
-
-.. note::
-
- This fix works by creating an array of size Nbins by Nvalues on
- each processor. Nbins is the total number of bins; Nvalues is the
- number of input values specified. Each processor loops over its
- atoms, tallying its values to the appropriate bin. Then the entire
- array is summed across all processors. This means that using a large
- number of bins (easy to do for 2d or 3d bins) will incur an overhead
- in memory and computational cost (summing across processors), so be
- careful to use reasonable numbers of bins.
-
-
-----------
-
-
-The *Nevery*\ , *Nrepeat*\ , and *Nfreq* arguments specify on what
-timesteps the input values will be used to bin them and contribute to
-the average. The final averaged quantities are generated on timesteps
-that are a multiples of *Nfreq*\ . The average is over *Nrepeat*
-quantities, computed in the preceding portion of the simulation every
-*Nevery* timesteps. *Nfreq* must be a multiple of *Nevery* and
-*Nevery* must be non-zero even if *Nrepeat* is 1. Also, the timesteps
-contributing to the average value cannot overlap,
-i.e. Nrepeat*Nevery can not exceed Nfreq.
-
-For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
-timesteps 90,92,94,96,98,100 will be used to compute the final average
-on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
-timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
-averaging is done; values are simply generated on timesteps
-100,200,etc.
-
-
-----------
-
-
-Each per-atom property is also averaged over atoms in each bin. The
-way the averaging is one across the *Nrepeat* timesteps to produce
-output on the *Nfreq* timesteps, and across multiple *Nfreq* outputs,
-is determined by the *norm* and *av* keyword settings, as discussed
-below.
-
-Bins can be 1d layers or slabs, 2d pencils, or 3d boxes. This depends
-on how many times (1, 2, or 3) the *dim*\ , *origin*\ , and *delta*
-settings are specified in the fix ave/spatial command. For 2d or 3d
-bins, there is no restriction on specifying dim = x before dim = y, or
-dim = y before dim = z. Bins in a particular *dim* have a bin size in
-that dimension given by *delta*\ . Every Nfreq steps, when averaging is
-being performed and the per-atom property is calculated for the first
-time, the number of bins and the bin sizes and boundaries are
-computed. Thus if the simulation box changes size during a
-simulation, the number of bins and their boundaries may also change.
-In each dimension, bins are defined relative to a specified *origin*\ ,
-which may be the lower/upper edge of the simulation box in that
-dimension, or its center point, or a specified coordinate value.
-Starting at the origin, sufficient bins are created in both directions
-to completely span the bin extent in that dimension. By default the
-bin extent is the entire simulation box.
-
-The *bound* keyword can be used one or more times to limit the extent
-of bin coverage in specified dimensions, i.e. to only bin a portion of
-the box. If the *lo* setting is *lower* or the *hi* setting is
-*upper*\ , the bin extent in that direction extends to the box boundary.
-If a numeric value is used for *lo* and/or *hi*\ , then the bin extent
-in the *lo* or *hi* direction extends only to that value, which is
-assumed to be inside (or at least near) the simulation box boundaries,
-though LAMMPS does not check for this.
-
-On each sampling timestep, each atom is mapped to the bin it currently
-belongs to, based on its current position. Note that the group-ID and
-region keyword can exclude specific atoms from this operation, as
-discussed above. Note that between reneighboring timesteps, atoms can
-move outside the current simulation box. If the box is periodic (in
-that dimension) the atom is remapping into the periodic box for
-purposes of binning. If the box in not periodic, the atom may have
-moved outside the bounds of any bin.
-
-The *discard* keyword determines what is done with any atom which is
-outside the bounds of any bin. If *discard* is set to *yes*\ , the atom
-will be ignored and not contribute to any bin averages. If *discard*
-is set to *no*\ , the atom will be counted as if it were in the first or
-last bin in that dimension. If (discard* is set to *mixed*\ , which is
-the default, it will only be counted in the first or last bin if bins
-extend to the box boundary in that dimension. This is the case if the
-*bound* keyword settings are *lower* and *upper*\ , which is the
-default. If the *bound* keyword settings are numeric values, then the
-atom will be ignored if it is outside the bounds of any bin. Note
-that in this case, it is possible that the first or last bin extends
-beyond the numeric *bounds* settings, depending on the specified
-*origin*\ . If this is the case, the atom is only ignored if it is
-outside the first or last bin, not if it is simply outside the numeric
-*bounds* setting.
-
-For orthogonal simulation boxes, the bins are also layers, pencils, or
-boxes aligned with the xyz coordinate axes. For triclinic
-(non-orthogonal) simulation boxes, the bins are so that they are
-parallel to the tilted faces of the simulation box. See :ref:`this section ` of the manual for a discussion of
-the geometry of triclinic boxes in LAMMPS. As described there, a
-tilted simulation box has edge vectors a,b,c. In that nomenclature,
-bins in the x dimension have faces with normals in the "b" cross "c"
-direction. Bins in y have faces normal to the "a" cross "c"
-direction. And bins in z have faces normal to the "a" cross "b"
-direction. Note that in order to define the size and position of
-these bins in an unambiguous fashion, the *units* option must be set
-to *reduced* when using a triclinic simulation box, as noted below.
-
-
-----------
-
-
-The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory.
-Note that other atom attributes (including atom postitions x,y,z) can
-be used as inputs to this fix by using the :doc:`compute property/atom ` command and then specifying
-an input value from that compute.
-
-The *density/number* value means the number density is computed in
-each bin, i.e. a weighting of 1 for each atom. The *density/mass*
-value means the mass density is computed in each bind, i.e. each atom
-is weighted by its mass. The resulting density is normalized by the
-volume of the bin so that units of number/volume or density are
-output. See the :doc:`units ` command doc page for the
-definition of density for each choice of units, e.g. gram/cm^3.
-
-If a value begins with "c_", a compute ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the compute is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the compute is used. Users can also write code for
-their own compute styles and :doc:`add them to LAMMPS `.
-
-If a value begins with "f_", a fix ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the fix is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the fix is used. Note that some fixes only produce
-their values on certain timesteps, which must be compatible with
-*Nevery*\ , else an error results. Users can also write code for their
-own fix styles and :doc:`add them to LAMMPS `.
-
-If a value begins with "v_", a variable name must follow which has
-been previously defined in the input script. Variables of style
-*atom* can reference thermodynamic keywords and various per-atom
-attributes, or invoke other computes, fixes, or variables when they
-are evaluated, so this is a very general means of generating per-atom
-quantities to spatially average.
-
-
-----------
-
-
-Additional optional keywords also affect the operation of this fix.
-The *region*\ , *bound*\ , and *discard* keywords were discussed above.
-
-The *norm* keyword affects how averaging is done for the output
-produced every *Nfreq* timesteps. For an *all* setting, a bin
-quantity is summed over all atoms in all *Nrepeat* samples, as is the
-count of atoms in the bin. The printed value for the bin is
-Total-quantity / Total-count. In other words it is an average over
-the entire *Nfreq* timescale.
-
-For a *sample* setting, the bin quantity is summed over atoms for only
-a single sample, as is the count, and a "average sample value" is
-computed, i.e. Sample-quantity / Sample-count. The printed value for
-the bin is the average of the *Nrepeat* "average sample values", In
-other words it is an average of an average.
-
-The *ave* keyword determines how the bin values produced every *Nfreq*
-steps are averaged with bin values produced on previous steps that
-were multiples of *Nfreq*\ , before they are accessed by another output
-command or written to a file.
-
-If the *ave* setting is *one*\ , then the bin values produced on
-timesteps that are multiples of *Nfreq* are independent of each other;
-they are output as-is without further averaging.
-
-If the *ave* setting is *running*\ , then the bin values produced on
-timesteps that are multiples of *Nfreq* are summed and averaged in a
-cumulative sense before being output. Each output bin value is thus
-the average of the bin value produced on that timestep with all
-preceding values for the same bin. This running average begins when
-the fix is defined; it can only be restarted by deleting the fix via
-the :doc:`unfix ` command, or re-defining the fix by
-re-specifying it.
-
-If the *ave* setting is *window*\ , then the bin values produced on
-timesteps that are multiples of *Nfreq* are summed and averaged within
-a moving "window" of time, so that the last M values for the same bin
-are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then
-the output on step 10000 will be the average of the individual bin
-values on steps 8000,9000,10000. Outputs on early steps will average
-over less than M values if they are not available.
-
-The *units* keyword determines the meaning of the distance units used
-for the bin size *delta* and for *origin* and *bounds* values if they
-are coordinate value. For orthogonal simulation boxes, any of the 3
-options may be used. For non-orthogonal (triclinic) simulation boxes,
-only the *reduced* option may be used.
-
-A *box* value selects standard distance units as defined by the
-:doc:`units ` command, e.g. Angstroms for units = real or metal.
-A *lattice* value means the distance units are in lattice spacings.
-The :doc:`lattice ` command must have been previously used to
-define the lattice spacing. A *reduced* value means normalized
-unitless values between 0 and 1, which represent the lower and upper
-faces of the simulation box respectively. Thus an *origin* value of
-0.5 means the center of the box in any dimension. A *delta* value of
-0.1 means 10 bins span the box in that dimension.
-
-Consider a non-orthogonal box, with bins that are 1d layers or slabs
-in the x dimension. No matter how the box is tilted, an *origin* of
-0.0 means start layers at the lower "b" cross "c" plane of the
-simulation box and an *origin* of 1.0 means to start layers at the
-upper "b" cross "c" face of the box. A *delta* value of 0.1 means
-there will be 10 layers from 0.0 to 1.0, regardless of the current
-size or shape of the simulation box.
-
-The *file* keyword allows a filename to be specified. Every *Nfreq*
-timesteps, a section of bin info will be written to a text file in the
-following format. A line with the timestep and number of bin is
-written. Then one line per bin is written, containing the bin ID
-(1-N), the coordinate of the center of the bin, the number of atoms
-in the bin, and one or more calculated values. The number of values
-in each line corresponds to the number of values specified in the fix
-ave/spatial command. The number of atoms and the value(s) are average
-quantities. If the value of the *units* keyword is *box* or
-*lattice*\ , the "coord" is printed in box units. If the value of the
-*units* keyword is *reduced*\ , the "coord" is printed in reduced units
-(0-1).
-
-The *overwrite* keyword will continuously overwrite the output file
-with the latest output, so that it only contains one timestep worth of
-output. This option can only be used with the *ave running* setting.
-
-The *title1* and *title2* and *title3* keywords allow specification of
-the strings that will be printed as the first 3 lines of the output
-file, assuming the *file* keyword was used. LAMMPS uses default
-values for each of these, so they do not need to be specified.
-
-By default, these header lines are as follows:
-
-.. parsed-literal::
-
- # Spatial-averaged data for fix ID and group name
- # Timestep Number-of-bins
- # Bin Coord1 Coord2 Coord3 Count value1 value2 ...
-
-In the first line, ID and name are replaced with the fix-ID and group
-name. The second line describes the two values that are printed at
-the first of each section of output. In the third line the values are
-replaced with the appropriate fields from the fix ave/spatial command.
-The Coord2 and Coord3 entries in the third line only appear for 2d and
-3d bins respectively. For 1d bins, the word Coord1 is replaced by
-just Coord.
-
-
-----------
-
-
-Restart, fix_modify, output, run start/stop, minimize info
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options
-are relevant to this fix.
-
-This fix computes a global array of values which can be accessed by
-various :ref:`output commands `. The values can
-only be accessed on timesteps that are multiples of *Nfreq* since that
-is when averaging is performed. The global array has # of rows =
-Nbins and # of columns = Ndim+1+Nvalues, where Ndim = 1,2,3 for
-1d,2d,3d bins. The first 1 or 2 or 3 columns have the bin coordinates
-(center of the bin) in the appropriate dimensions, the next column has
-the count of atoms in that bin, and the remaining columns are the
-Nvalue quantities. When the array is accessed with an I that exceeds
-the current number of bins, than a 0.0 is returned by the fix instead
-of an error, since the number of bins can vary as a simulation runs,
-depending on the simulation box size. 2d or 3d bins are ordered so
-that the last dimension(s) vary fastest. The array values calculated
-by this fix are "intensive", since they are already normalized by the
-count of atoms in each bin.
-
-No parameter of this fix can be used with the *start/stop* keywords of
-the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `.
-
-Restrictions
-""""""""""""
-
-
-When the *ave* keyword is set to *running* or *window* then the number
-of bins must remain the same during the simulation, so that the
-appropriate averaging can be done. This will be the case if the
-simulation box size doesn't change or if the *units* keyword is set to
-*reduced*\ .
-
-Related commands
-""""""""""""""""
-
-:doc:`compute `, :doc:`fix ave/atom `, :doc:`fix ave/histo `, :doc:`fix ave/time `,
-:doc:`variable `, :doc:`fix ave/correlate `,
-:doc:`fix ave/spatial/sphere `
-
-Default
-"""""""
-
-The option defaults are bound = lower and upper in all dimensions,
-discard = mixed, norm = all, ave = one, units = lattice, no file
-output, and title 1,2,3 = strings as described above.
-
-
-.. _lws: http://lammps.sandia.gov
-.. _ld: Manual.html
-.. _lc: Section_commands.html#comm
diff --git a/doc/html/_sources/fix_ave_spatial_sphere.txt b/doc/html/_sources/fix_ave_spatial_sphere.txt
deleted file mode 100644
index 17da5e45a8..0000000000
--- a/doc/html/_sources/fix_ave_spatial_sphere.txt
+++ /dev/null
@@ -1,349 +0,0 @@
-.. index:: fix ave/spatial/sphere
-
-fix ave/spatial/sphere command
-==============================
-
-Syntax
-""""""
-
-.. parsed-literal::
-
- fix ID group-ID ave/spatial/sphere Nevery Nrepeat Nfreq origin_x origin_y origin_z r_min r_max nbins value1 value2 ... keyword args ...
-
-* ID, group-ID are documented in :doc:`fix ` command
-* ave/spatial = style name of this fix command
-* Nevery = use input values every this many timesteps
-* Nrepeat = # of times to use input values for calculating averages
-* Nfreq = calculate averages every this many timesteps
-* origin_x, origin_y, origin_z = center of the sphere. can be the result of variables or computes (see below)
-* r_min = radial distance at which binning begins
-* r_max = radial distance at which binning ends
-* nbins = number of spherical shells to create between r_min and r_max
-* one or more input values can be listed
-* value = vx, vy, vz, fx, fy, fz, density/mass, density/number, c_ID, c_ID[I], f_ID, f_ID[I], v_name
-.. parsed-literal::
-
- vx,vy,vz,fx,fy,fz = atom attribute (velocity, force component)
- density/number, density/mass = number or mass density
- c_ID = per-atom vector calculated by a compute with ID
- c_ID[I] = Ith column of per-atom array calculated by a compute with ID
- f_ID = per-atom vector calculated by a fix with ID
- f_ID[I] = Ith column of per-atom array calculated by a fix with ID
- v_name = per-atom vector calculated by an atom-style variable with name
-
-* zero or more keyword/arg pairs may be appended
-* keyword = *region* or *norm* or *units* or *ave* or *file* or *overwrite* or *title1* or *title2* or *title3*
-.. parsed-literal::
-
- *region* arg = region-ID
- region-ID = ID of region atoms must be in to contribute to spatial averaging
- *norm* arg = *all* or *sample*
- *units* arg = *box* or *lattice* or *reduced*
- *ave* args = *one* or *running* or *window M*
- one = output new average value every Nfreq steps
- running = output cumulative average of all previous Nfreq steps
- window M = output average of M most recent Nfreq steps
- *file* arg = filename
- filename = file to write results to
- *overwrite* arg = none = overwrite output file with only latest output
- *title1* arg = string
- string = text to print as 1st line of output file
- *title2* arg = string
- string = text to print as 2nd line of output file
- *title3* arg = string
- string = text to print as 3rd line of output file
-
-
-
-Examples
-""""""""
-
-.. parsed-literal::
-
- fix 1 all ave/spatial/sphere 10000 1 10000 0.5 0.5 0.5 0.1 0.5 5 density/number vx vy vz units reduced title1 "My output values"
- fix 1 flow ave/spatial/sphere 100 10 1000 20.0 20.0 20.0 0.0 20.0 20 vx vz norm sample file vel.profile
-
-Description
-"""""""""""
-
-Use one or more per-atom vectors as inputs every few timesteps, bin
-their values spatially into spherical shells based on current atom
-coordinates, and average the bin values over longer timescales. The
-resulting bin averages can be used by other :ref:`output commands ` such as :doc:`thermo_style custom `, and can also be written to a file.
-
-The group specified with the command means only atoms within the group
-contribute to bin averages. If the *region* keyword is used, the atom
-must be in both the group and the specified geometric
-:doc:`region ` in order to contribute to bin averages.
-
-Each listed value can be an atom attribute (position, velocity, force
-component), a mass or number density, or the result of a
-:doc:`compute ` or :doc:`fix ` or the evaluation of an
-atom-style :doc:`variable `. In the latter cases, the
-compute, fix, or variable must produce a per-atom quantity, not a
-global quantity. If you wish to time-average global quantities from a
-compute, fix, or variable, then see the :doc:`fix ave/time ` command.
-
-:doc:`Computes ` that produce per-atom quantities are those
-which have the word *atom* in their style name. See the doc pages for
-individual :doc:`fixes ` to determine which ones produce per-atom
-quantities. :doc:`Variables ` of style *atom* are the only
-ones that can be used with this fix since all other styles of variable
-produce global quantities.
-
-The per-atom values of each input vector are binned and averaged
-independently of the per-atom values in other input vectors.
-
-*Nbins* specifies the number of spherical shells which will be created
-between r_min and r_max centered at (origin_x, origin_y, origin_z).
-
-.. note::
-
- This fix works by creating an array of size Nbins by Nvalues on
- each processor. Nbins is the total number of bins; Nvalues is the
- number of input values specified. Each processor loops over its
- atoms, tallying its values to the appropriate bin. Then the entire
- array is summed across all processors. This means that using a large
- number of bins will incur an overhead in memory and computational cost
- (summing across processors), so be careful to use reasonable numbers
- of bins.
-
-
-----------
-
-
-The *Nevery*\ , *Nrepeat*\ , and *Nfreq* arguments specify on what
-timesteps the input values will be used to bin them and contribute to
-the average. The final averaged quantities are generated on timesteps
-that are a multiples of *Nfreq*\ . The average is over *Nrepeat*
-quantities, computed in the preceding portion of the simulation every
-*Nevery* timesteps. *Nfreq* must be a multiple of *Nevery* and
-*Nevery* must be non-zero even if *Nrepeat* is 1.
-Also, the timesteps
-contributing to the average value cannot overlap,
-i.e. Nrepeat*Nevery can not exceed Nfreq.
-
-For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
-timesteps 90,92,94,96,98,100 will be used to compute the final average
-on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
-timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
-averaging is done; values are simply generated on timesteps
-100,200,etc.
-
-
-----------
-
-
-The *origin_x*\ , *origin_y*\ , and *origin_z* parameters may be specified
-by either a compute or a variable. This allows, for example, the
-center of the spherical bins to be attached to the center of mass of a
-group of atoms. If a variable origin is used and periodic boundary
-conditions are in effect, then the origin will be wrapped across
-periodic boundaries whenever it changes so that it is always inside
-the simulation box.
-
-
-----------
-
-
-The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory.
-Note that other atom attributes (including atom postitions x,y,z) can
-be used as inputs to this fix by using the :doc:`compute property/atom ` command and then specifying
-an input value from that compute.
-
-The *density/number* value means the number density is computed in
-each bin, i.e. a weighting of 1 for each atom. The *density/mass*
-value means the mass density is computed in each bin, i.e. each atom
-is weighted by its mass. The resulting density is normalized by the
-volume of the bin so that units of number/volume or density are
-output. See the :doc:`units ` command doc page for the
-definition of density for each choice of units, e.g. gram/cm^3.
-The bin volume will always be calculated in box units, independent
-of the use of the *units* keyword in this command.
-
-If a value begins with "c_", a compute ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the compute is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the compute is used. Users can also write code for
-their own compute styles and :doc:`add them to LAMMPS `.
-
-If a value begins with "f_", a fix ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the fix is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the fix is used. Note that some fixes only produce
-their values on certain timesteps, which must be compatible with
-*Nevery*\ , else an error results. Users can also write code for their
-own fix styles and :doc:`add them to LAMMPS `.
-
-If a value begins with "v_", a variable name must follow which has
-been previously defined in the input script. Variables of style
-*atom* can reference thermodynamic keywords and various per-atom
-attributes, or invoke other computes, fixes, or variables when they
-are evaluated, so this is a very general means of generating per-atom
-quantities to spatially average.
-
-
-----------
-
-
-Additional optional keywords also affect the operation of this fix.
-The *region* keyword was discussed above.
-
-The *norm* keyword affects how averaging is done for the output
-produced every *Nfreq* timesteps. For an *all* setting, a bin
-quantity is summed over all atoms in all *Nrepeat* samples, as is the
-count of atoms in the bin. The printed value for the bin is
-Total-quantity / Total-count. In other words it is an average over
-the entire *Nfreq* timescale.
-
-For a *sample* setting, the bin quantity is summed over atoms for only
-a single sample, as is the count, and a "average sample value" is
-computed, i.e. Sample-quantity / Sample-count. The printed value for
-the bin is the average of the *Nrepeat* "average sample values", In
-other words it is an average of an average.
-
-The *ave* keyword determines how the bin values produced every *Nfreq*
-steps are averaged with bin values produced on previous steps that
-were multiples of *Nfreq*\ , before they are accessed by another output
-command or written to a file.
-
-If the *ave* setting is *one*\ , then the bin values produced on
-timesteps that are multiples of *Nfreq* are independent of each other;
-they are output as-is without further averaging.
-
-If the *ave* setting is *running*\ , then the bin values produced on
-timesteps that are multiples of *Nfreq* are summed and averaged in a
-cumulative sense before being output. Each output bin value is thus
-the average of the bin value produced on that timestep with all
-preceding values for the same bin. This running average begins when
-the fix is defined; it can only be restarted by deleting the fix via
-the :doc:`unfix ` command, or re-defining the fix by
-re-specifying it.
-
-If the *ave* setting is *window*\ , then the bin values produced on
-timesteps that are multiples of *Nfreq* are summed and averaged within
-a moving "window" of time, so that the last M values for the same bin
-are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then
-the output on step 10000 will be the average of the individual bin
-values on steps 8000,9000,10000. Outputs on early steps will average
-over less than M values if they are not available.
-
-The *units* keyword determines the meaning of the distance units used
-for the sphere origin and the two radial lengths. For orthogonal
-simulation boxes, any of the 3 options may be used. For
-non-orthogonal (triclinic) simulation boxes, only the *reduced* option
-may be used.
-
-A *box* value selects standard distance units as defined by the
-:doc:`units ` command, e.g. Angstroms for units = real or metal.
-A *lattice* value means the distance units are in lattice spacings.
-The :doc:`lattice ` command must have been previously used to
-define the lattice spacing.
-
-.. note::
-
- The *lattice* style may only be used if the lattice spacing is
- the same in each direction.
-
-A *reduced* value means normalized unitless values between 0 and 1,
-which represent the lower and upper faces of the simulation box
-respectively. Thus an *origin* value of 0.5 means the center of the
-box in any dimension.
-
-The *file* keyword allows a filename to be specified. Every *Nfreq*
-timesteps, a section of bin info will be written to a text file in the
-following format. A line with the timestep and number of bin is
-written. Then one line per bin is written, containing the bin ID
-(1-N), the coordinate of the center of the bin, the number of atoms in
-the bin, and one or more calculated values. The number of values in
-each line corresponds to the number of values specified in the fix
-ave/spatial command. The number of atoms and the value(s) are average
-quantities. If the value of the *units* keyword is *box* or
-*lattice*\ , the "coord" is printed in box units. If the value of the
-*units* keyword is *reduced*\ , the "coord" is printed in reduced units
-(0-1).
-
-The *overwrite* keyword will continuously overwrite the output file
-with the latest output, so that it only contains one timestep worth of
-output. This option can only be used with the *ave running* setting.
-
-The *title1* and *title2* and *title3* keywords allow specification of
-the strings that will be printed as the first 3 lines of the output
-file, assuming the *file* keyword was used. LAMMPS uses default
-values for each of these, so they do not need to be specified.
-
-By default, these header lines are as follows:
-
-.. parsed-literal::
-
- # Spatial-averaged data for fix ID and group name
- # Timestep Number-of-bins
- # Bin r Count value1 value2 ...
-
-In the first line, ID and name are replaced with the fix-ID and group
-name. The second line describes the two values that are printed at
-the first of each section of output. In the third line the values are
-replaced with the appropriate fields from the fix ave/spatial command.
-The Coord2 and Coord3 entries in the third line only appear for 2d and
-3d bins respectively. For 1d bins, the word Coord1 is replaced by
-just Coord.
-
-
-----------
-
-
-Restart, fix_modify, output, run start/stop, minimize info
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options
-are relevant to this fix.
-
-This fix computes a global array of values which can be accessed by
-various :ref:`output commands `. The values can
-only be accessed on timesteps that are multiples of *Nfreq* since that
-is when averaging is performed. The global array has # of rows =
-Nbins and # of columns = 2+Nvalues. The first column contains the
-radius at the center of the shell. For units *reduced*\ , this is in
-reduced units, while for units *box* and *lattice* this is in box
-units. The next column has the count of atoms in that bin, and the
-remaining columns are the Nvalue quantities. When the array is
-accessed with an I that exceeds the current number of bins, than a 0.0
-is returned by the fix instead of an error. The array values
-calculated by this fix are "intensive", since they are already
-normalized by the count of atoms in each bin.
-
-No parameter of this fix can be used with the *start/stop* keywords of
-the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `.
-
-Restrictions
-""""""""""""
-
-
-When the *ave* keyword is set to *running* or *window* then the number
-of bins must remain the same during the simulation, so that the
-appropriate averaging can be done. This will be the case if the
-simulation box size doesn't change or if the *units* keyword is set to
-*reduced*\ .
-
-This style is part of the USER-MISC package. It is only enabled if
-LAMMPS is build with that package. See the :ref:`Making of LAMMPS <3>` section for more info.
-
-Related commands
-""""""""""""""""
-
-:doc:`compute `, :doc:`fix ave/atom `, :doc:`fix ave/histo `, :doc:`fix ave/time `,
-:doc:`variable `, :doc:`fix ave/correlate `,
-:doc:`fix ave/spatial `,
-
-Default
-"""""""
-
-The option defaults are norm = all, ave = one, units = lattice, no
-file output, and title 1,2,3 = strings as described above.
-
-
-.. _lws: http://lammps.sandia.gov
-.. _ld: Manual.html
-.. _lc: Section_commands.html#comm
diff --git a/doc/html/fix_ave_spatial.html b/doc/html/fix_ave_spatial.html
deleted file mode 100644
index a435667770..0000000000
--- a/doc/html/fix_ave_spatial.html
+++ /dev/null
@@ -1,567 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- fix ave/spatial command — LAMMPS documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Nevery = use input values every this many timesteps
-
Nrepeat = # of times to use input values for calculating averages
-
Nfreq = calculate averages every this many timesteps
-
dim, origin, delta can be repeated 1, 2, or 3 times for 1d, 2d, or 3d bins
-
-
-dim = x or y or z
-origin = lower or center or upper or coordinate value (distance units)
-delta = thickness of spatial bins in dim (distance units)
-
keyword = region or bound or discard or norm or ave or units or file or overwrite or title1 or title2 or title3
-
-
-region arg = region-ID
-bound args = x/y/z lo hi
- x/y/z = x or y or z to bound bins in this dimension
- lo = lower or coordinate value (distance units)
- hi = upper or coordinate value (distance units)
-discard arg = mixed or no or yes
- mixed = discard atoms outside bins only if bin bounds are explicitly set
- no = always keep out-of-bounds atoms
- yes = always discard out-of-bounds atoms
-norm arg = all or sample
- region-ID = ID of region atoms must be in to contribute to spatial averaging
-ave args = one or running or window M
- one = output new average value every Nfreq steps
- running = output cumulative average of all previous Nfreq steps
- window M = output average of M most recent Nfreq steps
-units arg = box or lattice or reduced
-file arg = filename
- filename = file to write results to
-overwrite arg = none = overwrite output file with only latest output
-title1 arg = string
- string = text to print as 1st line of output file
-title2 arg = string
- string = text to print as 2nd line of output file
-title3 arg = string
- string = text to print as 3rd line of output file
-
The fix ave/spatial command has been replaced by the more flexible
-fix ave/chunk and compute chunk/atom commands. The fix ave/spatial
-command will be removed from LAMMPS sometime in the summer of 2015.
-
Any fix ave/spatial command can be replaced by the two new commands.
-You simply need to split the fix ave/spatial arguments across the two
-new commands. For example, this command:
Use one or more per-atom vectors as inputs every few timesteps, bin
-their values spatially into 1d, 2d, or 3d bins based on current atom
-coordinates, and average the bin values over longer timescales. The
-resulting bin averages can be used by other output commands such as thermo_style custom, and can also be written to a file.
-
The group specified with the command means only atoms within the group
-contribute to bin averages. If the region keyword is used, the atom
-must be in both the specified group and the specified geometric
-region in order to contribute to bin averages.
-
Each listed value can be an atom attribute (position, velocity, force
-component), a mass or number density, or the result of a
-compute or fix or the evaluation of an
-atom-style variable. In the latter cases, the
-compute, fix, or variable must produce a per-atom quantity, not a
-global quantity. If you wish to time-average global quantities from a
-compute, fix, or variable, then see the fix ave/time command.
-
Computes that produce per-atom quantities are those
-which have the word atom in their style name. See the doc pages for
-individual fixes to determine which ones produce per-atom
-quantities. Variables of style atom are the only
-ones that can be used with this fix since all other styles of variable
-produce global quantities.
-
The per-atom values of each input vector are binned and averaged
-independently of the per-atom values in other input vectors.
-
The size and dimensionality of the bins (1d = layers or slabs, 2d =
-pencils, 3d = boxes) are determined by the dim, origin, and
-delta settings and how many times they are specified (1, 2, or 3).
-See details below.
-
-
Note
-
This fix works by creating an array of size Nbins by Nvalues on
-each processor. Nbins is the total number of bins; Nvalues is the
-number of input values specified. Each processor loops over its
-atoms, tallying its values to the appropriate bin. Then the entire
-array is summed across all processors. This means that using a large
-number of bins (easy to do for 2d or 3d bins) will incur an overhead
-in memory and computational cost (summing across processors), so be
-careful to use reasonable numbers of bins.
-
-
-
The Nevery, Nrepeat, and Nfreq arguments specify on what
-timesteps the input values will be used to bin them and contribute to
-the average. The final averaged quantities are generated on timesteps
-that are a multiples of Nfreq. The average is over Nrepeat
-quantities, computed in the preceding portion of the simulation every
-Nevery timesteps. Nfreq must be a multiple of Nevery and
-Nevery must be non-zero even if Nrepeat is 1. Also, the timesteps
-contributing to the average value cannot overlap,
-i.e. Nrepeat*Nevery can not exceed Nfreq.
-
For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
-timesteps 90,92,94,96,98,100 will be used to compute the final average
-on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
-timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
-averaging is done; values are simply generated on timesteps
-100,200,etc.
-
-
Each per-atom property is also averaged over atoms in each bin. The
-way the averaging is one across the Nrepeat timesteps to produce
-output on the Nfreq timesteps, and across multiple Nfreq outputs,
-is determined by the norm and av keyword settings, as discussed
-below.
-
Bins can be 1d layers or slabs, 2d pencils, or 3d boxes. This depends
-on how many times (1, 2, or 3) the dim, origin, and delta
-settings are specified in the fix ave/spatial command. For 2d or 3d
-bins, there is no restriction on specifying dim = x before dim = y, or
-dim = y before dim = z. Bins in a particular dim have a bin size in
-that dimension given by delta. Every Nfreq steps, when averaging is
-being performed and the per-atom property is calculated for the first
-time, the number of bins and the bin sizes and boundaries are
-computed. Thus if the simulation box changes size during a
-simulation, the number of bins and their boundaries may also change.
-In each dimension, bins are defined relative to a specified origin,
-which may be the lower/upper edge of the simulation box in that
-dimension, or its center point, or a specified coordinate value.
-Starting at the origin, sufficient bins are created in both directions
-to completely span the bin extent in that dimension. By default the
-bin extent is the entire simulation box.
-
The bound keyword can be used one or more times to limit the extent
-of bin coverage in specified dimensions, i.e. to only bin a portion of
-the box. If the lo setting is lower or the hi setting is
-upper, the bin extent in that direction extends to the box boundary.
-If a numeric value is used for lo and/or hi, then the bin extent
-in the lo or hi direction extends only to that value, which is
-assumed to be inside (or at least near) the simulation box boundaries,
-though LAMMPS does not check for this.
-
On each sampling timestep, each atom is mapped to the bin it currently
-belongs to, based on its current position. Note that the group-ID and
-region keyword can exclude specific atoms from this operation, as
-discussed above. Note that between reneighboring timesteps, atoms can
-move outside the current simulation box. If the box is periodic (in
-that dimension) the atom is remapping into the periodic box for
-purposes of binning. If the box in not periodic, the atom may have
-moved outside the bounds of any bin.
-
The discard keyword determines what is done with any atom which is
-outside the bounds of any bin. If discard is set to yes, the atom
-will be ignored and not contribute to any bin averages. If discard
-is set to no, the atom will be counted as if it were in the first or
-last bin in that dimension. If (discard* is set to mixed, which is
-the default, it will only be counted in the first or last bin if bins
-extend to the box boundary in that dimension. This is the case if the
-bound keyword settings are lower and upper, which is the
-default. If the bound keyword settings are numeric values, then the
-atom will be ignored if it is outside the bounds of any bin. Note
-that in this case, it is possible that the first or last bin extends
-beyond the numeric bounds settings, depending on the specified
-origin. If this is the case, the atom is only ignored if it is
-outside the first or last bin, not if it is simply outside the numeric
-bounds setting.
-
For orthogonal simulation boxes, the bins are also layers, pencils, or
-boxes aligned with the xyz coordinate axes. For triclinic
-(non-orthogonal) simulation boxes, the bins are so that they are
-parallel to the tilted faces of the simulation box. See this section of the manual for a discussion of
-the geometry of triclinic boxes in LAMMPS. As described there, a
-tilted simulation box has edge vectors a,b,c. In that nomenclature,
-bins in the x dimension have faces with normals in the “b” cross “c”
-direction. Bins in y have faces normal to the “a” cross “c”
-direction. And bins in z have faces normal to the “a” cross “b”
-direction. Note that in order to define the size and position of
-these bins in an unambiguous fashion, the units option must be set
-to reduced when using a triclinic simulation box, as noted below.
-
-
The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory.
-Note that other atom attributes (including atom postitions x,y,z) can
-be used as inputs to this fix by using the compute property/atom command and then specifying
-an input value from that compute.
-
The density/number value means the number density is computed in
-each bin, i.e. a weighting of 1 for each atom. The density/mass
-value means the mass density is computed in each bind, i.e. each atom
-is weighted by its mass. The resulting density is normalized by the
-volume of the bin so that units of number/volume or density are
-output. See the units command doc page for the
-definition of density for each choice of units, e.g. gram/cm^3.
-
If a value begins with “c_”, a compute ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the compute is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the compute is used. Users can also write code for
-their own compute styles and add them to LAMMPS.
-
If a value begins with “f_”, a fix ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the fix is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the fix is used. Note that some fixes only produce
-their values on certain timesteps, which must be compatible with
-Nevery, else an error results. Users can also write code for their
-own fix styles and add them to LAMMPS.
-
If a value begins with “v_”, a variable name must follow which has
-been previously defined in the input script. Variables of style
-atom can reference thermodynamic keywords and various per-atom
-attributes, or invoke other computes, fixes, or variables when they
-are evaluated, so this is a very general means of generating per-atom
-quantities to spatially average.
-
-
Additional optional keywords also affect the operation of this fix.
-The region, bound, and discard keywords were discussed above.
-
The norm keyword affects how averaging is done for the output
-produced every Nfreq timesteps. For an all setting, a bin
-quantity is summed over all atoms in all Nrepeat samples, as is the
-count of atoms in the bin. The printed value for the bin is
-Total-quantity / Total-count. In other words it is an average over
-the entire Nfreq timescale.
-
For a sample setting, the bin quantity is summed over atoms for only
-a single sample, as is the count, and a “average sample value” is
-computed, i.e. Sample-quantity / Sample-count. The printed value for
-the bin is the average of the Nrepeat “average sample values”, In
-other words it is an average of an average.
-
The ave keyword determines how the bin values produced every Nfreq
-steps are averaged with bin values produced on previous steps that
-were multiples of Nfreq, before they are accessed by another output
-command or written to a file.
-
If the ave setting is one, then the bin values produced on
-timesteps that are multiples of Nfreq are independent of each other;
-they are output as-is without further averaging.
-
If the ave setting is running, then the bin values produced on
-timesteps that are multiples of Nfreq are summed and averaged in a
-cumulative sense before being output. Each output bin value is thus
-the average of the bin value produced on that timestep with all
-preceding values for the same bin. This running average begins when
-the fix is defined; it can only be restarted by deleting the fix via
-the unfix command, or re-defining the fix by
-re-specifying it.
-
If the ave setting is window, then the bin values produced on
-timesteps that are multiples of Nfreq are summed and averaged within
-a moving “window” of time, so that the last M values for the same bin
-are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then
-the output on step 10000 will be the average of the individual bin
-values on steps 8000,9000,10000. Outputs on early steps will average
-over less than M values if they are not available.
-
The units keyword determines the meaning of the distance units used
-for the bin size delta and for origin and bounds values if they
-are coordinate value. For orthogonal simulation boxes, any of the 3
-options may be used. For non-orthogonal (triclinic) simulation boxes,
-only the reduced option may be used.
-
A box value selects standard distance units as defined by the
-units command, e.g. Angstroms for units = real or metal.
-A lattice value means the distance units are in lattice spacings.
-The lattice command must have been previously used to
-define the lattice spacing. A reduced value means normalized
-unitless values between 0 and 1, which represent the lower and upper
-faces of the simulation box respectively. Thus an origin value of
-0.5 means the center of the box in any dimension. A delta value of
-0.1 means 10 bins span the box in that dimension.
-
Consider a non-orthogonal box, with bins that are 1d layers or slabs
-in the x dimension. No matter how the box is tilted, an origin of
-0.0 means start layers at the lower “b” cross “c” plane of the
-simulation box and an origin of 1.0 means to start layers at the
-upper “b” cross “c” face of the box. A delta value of 0.1 means
-there will be 10 layers from 0.0 to 1.0, regardless of the current
-size or shape of the simulation box.
-
The file keyword allows a filename to be specified. Every Nfreq
-timesteps, a section of bin info will be written to a text file in the
-following format. A line with the timestep and number of bin is
-written. Then one line per bin is written, containing the bin ID
-(1-N), the coordinate of the center of the bin, the number of atoms
-in the bin, and one or more calculated values. The number of values
-in each line corresponds to the number of values specified in the fix
-ave/spatial command. The number of atoms and the value(s) are average
-quantities. If the value of the units keyword is box or
-lattice, the “coord” is printed in box units. If the value of the
-units keyword is reduced, the “coord” is printed in reduced units
-(0-1).
-
The overwrite keyword will continuously overwrite the output file
-with the latest output, so that it only contains one timestep worth of
-output. This option can only be used with the ave running setting.
-
The title1 and title2 and title3 keywords allow specification of
-the strings that will be printed as the first 3 lines of the output
-file, assuming the file keyword was used. LAMMPS uses default
-values for each of these, so they do not need to be specified.
-
By default, these header lines are as follows:
-
# Spatial-averaged data for fix ID and group name
-# Timestep Number-of-bins
-# Bin Coord1 Coord2 Coord3 Count value1 value2 ...
-
-
-
In the first line, ID and name are replaced with the fix-ID and group
-name. The second line describes the two values that are printed at
-the first of each section of output. In the third line the values are
-replaced with the appropriate fields from the fix ave/spatial command.
-The Coord2 and Coord3 entries in the third line only appear for 2d and
-3d bins respectively. For 1d bins, the word Coord1 is replaced by
-just Coord.
-
-
-
-
Restart, fix_modify, output, run start/stop, minimize info
-
No information about this fix is written to binary restart files. None of the fix_modify options
-are relevant to this fix.
-
This fix computes a global array of values which can be accessed by
-various output commands. The values can
-only be accessed on timesteps that are multiples of Nfreq since that
-is when averaging is performed. The global array has # of rows =
-Nbins and # of columns = Ndim+1+Nvalues, where Ndim = 1,2,3 for
-1d,2d,3d bins. The first 1 or 2 or 3 columns have the bin coordinates
-(center of the bin) in the appropriate dimensions, the next column has
-the count of atoms in that bin, and the remaining columns are the
-Nvalue quantities. When the array is accessed with an I that exceeds
-the current number of bins, than a 0.0 is returned by the fix instead
-of an error, since the number of bins can vary as a simulation runs,
-depending on the simulation box size. 2d or 3d bins are ordered so
-that the last dimension(s) vary fastest. The array values calculated
-by this fix are “intensive”, since they are already normalized by the
-count of atoms in each bin.
-
No parameter of this fix can be used with the start/stop keywords of
-the run command. This fix is not invoked during energy minimization.
-
-
-
Restrictions
-
When the ave keyword is set to running or window then the number
-of bins must remain the same during the simulation, so that the
-appropriate averaging can be done. This will be the case if the
-simulation box size doesn’t change or if the units keyword is set to
-reduced.
The option defaults are bound = lower and upper in all dimensions,
-discard = mixed, norm = all, ave = one, units = lattice, no file
-output, and title 1,2,3 = strings as described above.
keyword = region or norm or units or ave or file or overwrite or title1 or title2 or title3
-
-
-region arg = region-ID
- region-ID = ID of region atoms must be in to contribute to spatial averaging
-norm arg = all or sample
-units arg = box or lattice or reduced
-ave args = one or running or window M
- one = output new average value every Nfreq steps
- running = output cumulative average of all previous Nfreq steps
- window M = output average of M most recent Nfreq steps
-file arg = filename
- filename = file to write results to
-overwrite arg = none = overwrite output file with only latest output
-title1 arg = string
- string = text to print as 1st line of output file
-title2 arg = string
- string = text to print as 2nd line of output file
-title3 arg = string
- string = text to print as 3rd line of output file
-
Use one or more per-atom vectors as inputs every few timesteps, bin
-their values spatially into spherical shells based on current atom
-coordinates, and average the bin values over longer timescales. The
-resulting bin averages can be used by other output commands such as thermo_style custom, and can also be written to a file.
-
The group specified with the command means only atoms within the group
-contribute to bin averages. If the region keyword is used, the atom
-must be in both the group and the specified geometric
-region in order to contribute to bin averages.
-
Each listed value can be an atom attribute (position, velocity, force
-component), a mass or number density, or the result of a
-compute or fix or the evaluation of an
-atom-style variable. In the latter cases, the
-compute, fix, or variable must produce a per-atom quantity, not a
-global quantity. If you wish to time-average global quantities from a
-compute, fix, or variable, then see the fix ave/time command.
-
Computes that produce per-atom quantities are those
-which have the word atom in their style name. See the doc pages for
-individual fixes to determine which ones produce per-atom
-quantities. Variables of style atom are the only
-ones that can be used with this fix since all other styles of variable
-produce global quantities.
-
The per-atom values of each input vector are binned and averaged
-independently of the per-atom values in other input vectors.
-
Nbins specifies the number of spherical shells which will be created
-between r_min and r_max centered at (origin_x, origin_y, origin_z).
-
-
Note
-
This fix works by creating an array of size Nbins by Nvalues on
-each processor. Nbins is the total number of bins; Nvalues is the
-number of input values specified. Each processor loops over its
-atoms, tallying its values to the appropriate bin. Then the entire
-array is summed across all processors. This means that using a large
-number of bins will incur an overhead in memory and computational cost
-(summing across processors), so be careful to use reasonable numbers
-of bins.
-
-
-
The Nevery, Nrepeat, and Nfreq arguments specify on what
-timesteps the input values will be used to bin them and contribute to
-the average. The final averaged quantities are generated on timesteps
-that are a multiples of Nfreq. The average is over Nrepeat
-quantities, computed in the preceding portion of the simulation every
-Nevery timesteps. Nfreq must be a multiple of Nevery and
-Nevery must be non-zero even if Nrepeat is 1.
-Also, the timesteps
-contributing to the average value cannot overlap,
-i.e. Nrepeat*Nevery can not exceed Nfreq.
-
For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
-timesteps 90,92,94,96,98,100 will be used to compute the final average
-on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
-timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
-averaging is done; values are simply generated on timesteps
-100,200,etc.
-
-
The origin_x, origin_y, and origin_z parameters may be specified
-by either a compute or a variable. This allows, for example, the
-center of the spherical bins to be attached to the center of mass of a
-group of atoms. If a variable origin is used and periodic boundary
-conditions are in effect, then the origin will be wrapped across
-periodic boundaries whenever it changes so that it is always inside
-the simulation box.
-
-
The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory.
-Note that other atom attributes (including atom postitions x,y,z) can
-be used as inputs to this fix by using the compute property/atom command and then specifying
-an input value from that compute.
-
The density/number value means the number density is computed in
-each bin, i.e. a weighting of 1 for each atom. The density/mass
-value means the mass density is computed in each bin, i.e. each atom
-is weighted by its mass. The resulting density is normalized by the
-volume of the bin so that units of number/volume or density are
-output. See the units command doc page for the
-definition of density for each choice of units, e.g. gram/cm^3.
-The bin volume will always be calculated in box units, independent
-of the use of the units keyword in this command.
-
If a value begins with “c_”, a compute ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the compute is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the compute is used. Users can also write code for
-their own compute styles and add them to LAMMPS.
-
If a value begins with “f_”, a fix ID must follow which has been
-previously defined in the input script. If no bracketed integer is
-appended, the per-atom vector calculated by the fix is used. If a
-bracketed integer is appended, the Ith column of the per-atom array
-calculated by the fix is used. Note that some fixes only produce
-their values on certain timesteps, which must be compatible with
-Nevery, else an error results. Users can also write code for their
-own fix styles and add them to LAMMPS.
-
If a value begins with “v_”, a variable name must follow which has
-been previously defined in the input script. Variables of style
-atom can reference thermodynamic keywords and various per-atom
-attributes, or invoke other computes, fixes, or variables when they
-are evaluated, so this is a very general means of generating per-atom
-quantities to spatially average.
-
-
Additional optional keywords also affect the operation of this fix.
-The region keyword was discussed above.
-
The norm keyword affects how averaging is done for the output
-produced every Nfreq timesteps. For an all setting, a bin
-quantity is summed over all atoms in all Nrepeat samples, as is the
-count of atoms in the bin. The printed value for the bin is
-Total-quantity / Total-count. In other words it is an average over
-the entire Nfreq timescale.
-
For a sample setting, the bin quantity is summed over atoms for only
-a single sample, as is the count, and a “average sample value” is
-computed, i.e. Sample-quantity / Sample-count. The printed value for
-the bin is the average of the Nrepeat “average sample values”, In
-other words it is an average of an average.
-
The ave keyword determines how the bin values produced every Nfreq
-steps are averaged with bin values produced on previous steps that
-were multiples of Nfreq, before they are accessed by another output
-command or written to a file.
-
If the ave setting is one, then the bin values produced on
-timesteps that are multiples of Nfreq are independent of each other;
-they are output as-is without further averaging.
-
If the ave setting is running, then the bin values produced on
-timesteps that are multiples of Nfreq are summed and averaged in a
-cumulative sense before being output. Each output bin value is thus
-the average of the bin value produced on that timestep with all
-preceding values for the same bin. This running average begins when
-the fix is defined; it can only be restarted by deleting the fix via
-the unfix command, or re-defining the fix by
-re-specifying it.
-
If the ave setting is window, then the bin values produced on
-timesteps that are multiples of Nfreq are summed and averaged within
-a moving “window” of time, so that the last M values for the same bin
-are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then
-the output on step 10000 will be the average of the individual bin
-values on steps 8000,9000,10000. Outputs on early steps will average
-over less than M values if they are not available.
-
The units keyword determines the meaning of the distance units used
-for the sphere origin and the two radial lengths. For orthogonal
-simulation boxes, any of the 3 options may be used. For
-non-orthogonal (triclinic) simulation boxes, only the reduced option
-may be used.
-
A box value selects standard distance units as defined by the
-units command, e.g. Angstroms for units = real or metal.
-A lattice value means the distance units are in lattice spacings.
-The lattice command must have been previously used to
-define the lattice spacing.
-
-
Note
-
The lattice style may only be used if the lattice spacing is
-the same in each direction.
-
-
A reduced value means normalized unitless values between 0 and 1,
-which represent the lower and upper faces of the simulation box
-respectively. Thus an origin value of 0.5 means the center of the
-box in any dimension.
-
The file keyword allows a filename to be specified. Every Nfreq
-timesteps, a section of bin info will be written to a text file in the
-following format. A line with the timestep and number of bin is
-written. Then one line per bin is written, containing the bin ID
-(1-N), the coordinate of the center of the bin, the number of atoms in
-the bin, and one or more calculated values. The number of values in
-each line corresponds to the number of values specified in the fix
-ave/spatial command. The number of atoms and the value(s) are average
-quantities. If the value of the units keyword is box or
-lattice, the “coord” is printed in box units. If the value of the
-units keyword is reduced, the “coord” is printed in reduced units
-(0-1).
-
The overwrite keyword will continuously overwrite the output file
-with the latest output, so that it only contains one timestep worth of
-output. This option can only be used with the ave running setting.
-
The title1 and title2 and title3 keywords allow specification of
-the strings that will be printed as the first 3 lines of the output
-file, assuming the file keyword was used. LAMMPS uses default
-values for each of these, so they do not need to be specified.
-
By default, these header lines are as follows:
-
# Spatial-averaged data for fix ID and group name
-# Timestep Number-of-bins
-# Bin r Count value1 value2 ...
-
-
-
In the first line, ID and name are replaced with the fix-ID and group
-name. The second line describes the two values that are printed at
-the first of each section of output. In the third line the values are
-replaced with the appropriate fields from the fix ave/spatial command.
-The Coord2 and Coord3 entries in the third line only appear for 2d and
-3d bins respectively. For 1d bins, the word Coord1 is replaced by
-just Coord.
-
-
-
-
Restart, fix_modify, output, run start/stop, minimize info
-
No information about this fix is written to binary restart files. None of the fix_modify options
-are relevant to this fix.
-
This fix computes a global array of values which can be accessed by
-various output commands. The values can
-only be accessed on timesteps that are multiples of Nfreq since that
-is when averaging is performed. The global array has # of rows =
-Nbins and # of columns = 2+Nvalues. The first column contains the
-radius at the center of the shell. For units reduced, this is in
-reduced units, while for units box and lattice this is in box
-units. The next column has the count of atoms in that bin, and the
-remaining columns are the Nvalue quantities. When the array is
-accessed with an I that exceeds the current number of bins, than a 0.0
-is returned by the fix instead of an error. The array values
-calculated by this fix are “intensive”, since they are already
-normalized by the count of atoms in each bin.
-
No parameter of this fix can be used with the start/stop keywords of
-the run command. This fix is not invoked during energy minimization.
-
-
-
Restrictions
-
When the ave keyword is set to running or window then the number
-of bins must remain the same during the simulation, so that the
-appropriate averaging can be done. This will be the case if the
-simulation box size doesn’t change or if the units keyword is set to
-reduced.
-
This style is part of the USER-MISC package. It is only enabled if
-LAMMPS is build with that package. See the Making of LAMMPS section for more info.
diff --git a/doc/html/Section_howto.html b/doc/html/Section_howto.html
index 1fe9224652..307539d233 100644
--- a/doc/html/Section_howto.html
+++ b/doc/html/Section_howto.html
@@ -1086,7 +1086,7 @@ the sheared fluid and integrate the SLLOD equations of motion for the
system. Fix nvt/sllod uses compute temp/deform to compute a thermal temperature
by subtracting out the streaming velocity of the shearing atoms. The
velocity profile or other properties of the fluid can be monitored via
-the fix ave/spatial command.
+the fix ave/spatial command.
As discussed in the previous section on non-orthogonal simulation
boxes, the amount of tilt or skew that can be applied is limited by
LAMMPS for computational efficiency to be 1/2 of the parallel box
@@ -2011,13 +2011,13 @@ on each of two regions to add/subtract specified amounts of energy to
both regions. In both cases, the resulting temperatures of the two
regions can be monitored with the “compute temp/region” command and
the temperature profile of the intermediate region can be monitored
-with the fix ave/spatial and compute ke/atom commands.
The third method is to perform a reverse non-equilibrium MD simulation
using the fix thermal/conductivity
command which implements the rNEMD algorithm of Muller-Plathe.
Kinetic energy is swapped between atoms in two different layers of the
simulation box. This induces a temperature gradient between the two
-layers which can be monitored with the fix ave/spatial and compute ke/atom commands. The fix tallies the
+layers which can be monitored with the fix ave/spatial and compute ke/atom commands. The fix tallies the
cumulative energy transfer that it performs. See the fix thermal/conductivity command for
details.
The fourth method is based on the Green-Kubo (GK) formula which
@@ -2060,7 +2060,7 @@ used to shear the fluid in between them, again with some kind of
thermostat that modifies only the thermal (non-shearing) components of
velocity to prevent the fluid from heating up.
In both cases, the velocity profile setup in the fluid by this
-procedure can be monitored by the fix ave/spatial command, which determines
+procedure can be monitored by the fix ave/spatial command, which determines
grad(Vstream) in the equation above. E.g. the derivative in the
y-direction of the Vx component of fluid motion or grad(Vstream) =
dVx/dy. The Pxy off-diagonal component of the pressure or stress
@@ -2073,7 +2073,7 @@ using the fix ave/spatial command.
+monitored with the fix ave/spatial command.
The fix tallies the cummulative momentum transfer that it performs.
See the fix viscosity command for details.