lammps/doc/fix_ave_spatial.txt

183 lines
8.7 KiB
Plaintext

"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 Nfreq dim origin delta file style args keyword value ... :pre
ID, group-ID are documented in "fix"_fix.html command :ulb,l
ave/spatial = style name of this fix command :l
Nevery = calculate property every this many timesteps :l
Nfreq = write average property to file every this many steps :l
dim = {x} or {y} or {z} :l
origin = {lower} or {center} or {upper} or coordinate value (distance units) :l
delta = thickness of spatial layers in dim (distance units) :l
file = filename to write results to :l
style = {density} or {atom} or {compute} :l
{density} arg = {mass} or {number}
{mass} = compute mass density
{number} = compute number density
{atom} arg = {vx} or {vy} or {vz} or {fx} or {fy} or {fz}
{compute} arg = compute-ID that calculates per-atom quantities :pre
zero or more keyword/value pairs may be appended :l
keyword = {norm} or {units}
{norm} value = {all} or {sample}
{units} value = {box} or {lattice} or {reduced} :pre
:ule
[Examples:]
fix 1 all ave/spatial 10000 10000 z lower 2.0 centro.profile compute myCentro
fix 1 flow ave/spatial 100 1000 y 0.0 1.0 vel.profile atom vx norm sample
fix 1 flow ave/spatial 100 1000 y 0.0 2.5 dens.profile density mass :pre
[Description:]
Calculate one or more instantaneous per-atom quantities every few
timesteps, average them by layer in a chosen dimension and over a
longer timescale, and print the results to a file. This can be used
to spatially average per-atom properties such as velocity or energy or
a quantity calculated by an equation you define; see the "variable
atom"_variable.html command.
The {density} styles means to simply count the number of atoms in each
layer, either by mass or number. The {atom} style allows an atom
property such as x-velocity to be specified. The {compute} style
allows specification of a "compute"_compute.html which will be invoked
to calculate the desired property. The compute can be previously
defined in the input script. Note that the "compute variable/atom"
style allows you to calculate any quantity for an atom that can be
specified by a "variable atom"_variable.html equation. Users can also
write code for their own compute styles and "add them to
LAMMPS"_Section_modify.html. Note that the "dump custom"_dump.html
command can also be used to output per-atom quantities calculated by a
compute.
For the {compute} style, the fix ave/spatial style uses the per-atom
scalar or vector calculated by the compute. See the "fix
ave/time"_fix_ave_time.html command if you wish to time-average a
global quantity, e.g. via a compute that temperature or pressure.
In all cases, the calculated property is averaged over atoms in each
layer, where the layers are in a particular {dim} and have a thickness
given by {delta}. Every Nfreq steps, when a property is calculated
for the first time (after a previous write), the number of layers and
the layer boundaries are computed. Thus if the simlation box changes
size during a simulation, the number of layers and their boundaries
may also change. Layers are defined relative to a specified {origin},
which may be the lower/upper edge of the box (in {dim}) or its center
point, or a specified coordinate value. Starting at the origin,
sufficient layers are created in both directions to completely cover
the box. On subsequent timesteps every atom is mapped to one of the
layers. Atoms beyond the lowermost/uppermost layer are counted in the
first/last layer.
For orthogonal simulation boxes, the layers are "slices" aligned with
the xyz coordinate axes. For non-orthogonal (triclinic) simulation
boxes, the layers are "tilted slices" that align with the tilted faces
of the box. See the "region prism"_region.html command for a
discussion of the geometry of tilted boxes in LAMMPS. As described
there, a tilted simulation box has edge vectors a,b,c. In that
nomenclature, layers in the x dimension have faces with normals in the
"b" cross "c" direction. Layers in y have faces normal to the "a"
cross "c" direction. And layers in z have faces normal to the "a"
cross "b" direction. Note that in order to define the thickness and
position of these tilted layers in an unambiguous fashion, the {units}
option must be set to {reduced}.
The {units} keyword determines the meaning of the distance units used
for the layer thickness {delta} and for {origin} if it is a coordinate
value. For orthogonal simulation boxes, any of the 3 options may be
used. For non-orthongal (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 layers span the box in any dimension.
Consider a non-orthogonal box, with layers 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 {Nevery} and {Nfreq} arguments specify how the property calculated
for each layer is time-averaged. The property is calculated once each
Nevery timesteps. It is averaged and output every Nfreq timesteps.
Nfreq must be a multiple of Nevery. In the 2nd example above, the
property is calculated every 100 steps. After 10 calculations, the
average result is written to the file, once every 1000 steps.
The {norm} keyword also affects how time-averaging is done. For an
{all} setting, a layer quantity is summed over all atoms in all
Nfreq/Nevery samples, as is the count of atoms in the layer. The
printed value for the layer is Total-quantity / Total-count.
In other words it is an average over the entire Nfreq timescale.
For a {sample} setting, the 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 layer is the average of the M "average sample values", where M =
Nfreq/Nevery. In other words it is an average of an average.
Each time info is written to the file, it is in the following format.
A line with the timestep and number of layers is written. Then one
line per layer is written, containing the layer ID (1-N), the
coordinate of the center of the layer, the number of atoms in the
layer, and one or more calculated values. 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).
If the {density} or {atom} keyword is used, or the {compute} keyword
with a compute that calculates a single quantity per atom, then a
single value will be printed for each layer. If the {compute} keyword
is used with a compute that calculates N quantities per atom, then N
values per line will be written, each of them averaged independently.
For the {compute} keyword, the calculation performed by the compute in
on the group defined by the compute. However, only atoms in the fix
group are included in the layer averaging. LAMMPS prints a warning if
the fix group and compute group do not match.
Note that some computes perform costly calculations, involving use of
or creation of neighbor lists. If the compute is invoked too often by
fix ave/spatial, it can slow down a simulation.
[Restart, fix_modify, thermo 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. No quantities calculated by this fix can be
output by the "thermo_style custom"_thermo_style.html command. 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:] none
[Related commands:]
"compute"_compute.html, "fix ave/time"_fix_ave_time.html
[Default:]
The option defaults are norm = all and units = lattice.