forked from lijiext/lammps
132 lines
5.6 KiB
Plaintext
132 lines
5.6 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
|
|
|
|
compute reduce command :h3
|
|
compute reduce/region command :h3
|
|
|
|
[Syntax:]
|
|
|
|
compute ID group-ID style arg mode input1 input2 ... :pre
|
|
|
|
ID, group-ID are documented in "compute"_compute.html command :ulb,l
|
|
style = {reduce} or {reduce/region} :l
|
|
{reduce} arg = none
|
|
{reduce/region} arg = region-ID
|
|
region-ID = ID of region to use for choosing atoms :pre
|
|
mode = {sum} or {min} or {max} or {ave} :l
|
|
one or more inputs can be listed :l
|
|
input = x, y, z, vx, vy, vz, fx, fy, fz, c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l
|
|
x,y,z,vx,vy,vz,fx,fy,fz = atom attribute (position, velocity, force component)
|
|
c_ID = vector calculated by a compute with ID
|
|
c_ID\[I\] = Ith column of array calculated by a compute with ID
|
|
f_ID = vector calculated by a fix with ID
|
|
f_ID\[I\] = Ith column of array calculated by a fix with ID
|
|
v_name = per-atom vector calculated by an atom-style variable with name :pre
|
|
:ule
|
|
|
|
[Examples:]
|
|
|
|
compute 1 all reduce sum c_force
|
|
compute 1 all reduce/region subbox sum c_force
|
|
compute 2 all reduce min c_press[2] f_ave v_myKE :pre
|
|
|
|
[Description:]
|
|
|
|
Define a calculation that "reduces" one or more vector inputs into
|
|
scalar values, one per listed input. The inputs can be global,
|
|
per-atom, or local quantities. Atom attributes are per-atom
|
|
quantities, "computes"_compute.html and "fixes"_fix.html may generate
|
|
any of the three kinds of quantities, and "atom-style
|
|
variables"_variable.html generate per-atom quantities.
|
|
|
|
The reduction operation is specified by the {mode} setting. The {sum}
|
|
option adds the values in the vector into a global total. The {min}
|
|
or {max} options find the minimum or maximum value across all vector
|
|
values. The {ave} setting adds the vector values into a global total,
|
|
then divides by the number of values in the vector.
|
|
|
|
Each listed input is operated on independently. For per-atom inputs,
|
|
the group specified with this command means only atoms within the
|
|
group contribute to the result. For per-atom inputs, if the compute
|
|
reduce/region command is used, the atoms must also currently be within
|
|
the region. Note that an input that produces per-atom quantities may
|
|
define its own group which affects the quantities it returns. For
|
|
example, if a compute is used as an input which generates a per-atom
|
|
vector, it will generate values of 0.0 for atoms that are not in the
|
|
group specified for that compute.
|
|
|
|
Each listed input can be an atom attribute (position, velocity, force
|
|
component) or can be the result of a "compute"_compute.html or
|
|
"fix"_fix.html or the evaluation of an atom-style
|
|
"variable"_variable.html.
|
|
|
|
Atom attributes are per-atom inputs.
|
|
|
|
If a value begins with "c_", a compute ID must follow which has been
|
|
previously defined in the input script. Computes can generate global,
|
|
per-atom, or local quantities. See the individual
|
|
"compute"_compute.html doc page for details. If no bracketed integer
|
|
is appended, the vector calculated by the compute is used. If a
|
|
bracketed interger is appended, the Ith column of the 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. Fixes can generate global,
|
|
per-atom, or local quantities. See the individual "fix"_fix.html doc
|
|
page for details. Note that some fixes only produce their values on
|
|
certain timesteps, which must be compatible with when compute reduce
|
|
references the values, else an error results. If no bracketed integer
|
|
is appended, the vector calculated by the fix is used. If a bracketed
|
|
integer is appended, the Ith column of the array calculated by the fix
|
|
is used. Users can also write code for their own fix style 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. It must be an
|
|
"atom-style variable"_variable.html. Atom-style variables 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
|
|
reduce.
|
|
|
|
If a single input is specified this compute produces a global scalar
|
|
value. If multiple inputs are specified, this compute produces a
|
|
vector of global values, the length of which is equal to the number of
|
|
inputs specified.
|
|
|
|
As discussed below, for {sum} mode, the value(s) produced by this
|
|
compute are all "extensive", meaning their value scales linearly with
|
|
the number of atoms involved. If normalized values are desired, this
|
|
compute can be accessed by the "thermo_style custom"_thermo_style.html
|
|
command with "thermo_modify norm yes"_thermo_modify.html set as an
|
|
option. Or it can be accessed by a "variable"_variable.html that
|
|
divides by the appropriate atom count.
|
|
|
|
[Output info:]
|
|
|
|
This compute calculates a global scalar or global vector of length N
|
|
where N is the number of inputs, and which can be accessed by indices
|
|
1-N. These values can be used by any command that uses global scalar
|
|
or vector values from a compute as input. See "this
|
|
section"_Section_howto.html#4_15 for an overview of LAMMPS output
|
|
options.
|
|
|
|
For {sum} mode, the scalar and vector values calculated by this
|
|
compute are "extensive", meaning they scale with the number of atoms
|
|
in the simulation. For {min} or {max} or {ave} modes, the value(s)
|
|
are intensive.
|
|
|
|
[Restrictions:] none
|
|
|
|
[Related commands:]
|
|
|
|
"compute"_compute.html, "fix"_fix.html, "variable"_variable.html
|
|
|
|
[Default:] none
|