have compute_reduce require either peratom or local inputs
This commit is contained in:
@ -37,13 +37,16 @@ Syntax
|
||||
v_name = per-atom vector calculated by an atom-style variable with name
|
||||
|
||||
* zero or more keyword/args pairs may be appended
|
||||
* keyword = *replace*
|
||||
* keyword = *replace* or *inputs*
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*replace* args = vec1 vec2
|
||||
vec1 = reduced value from this input vector will be replaced
|
||||
vec2 = replace it with vec1[N] where N is index of max/min value from vec2
|
||||
*inputs* arg = peratom or local
|
||||
peratom = all inputs are per-atom quantities (default)
|
||||
local = all input are local quantities
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -61,26 +64,30 @@ Description
|
||||
|
||||
Define a calculation that "reduces" one or more vector inputs into
|
||||
scalar values, one per listed input. The inputs can be per-atom or
|
||||
local quantities; they cannot be global quantities. Atom attributes
|
||||
are per-atom quantities, :doc:`computes <compute>` and :doc:`fixes <fix>`
|
||||
may generate any of the three kinds of quantities, and :doc:`atom-style variables <variable>` generate per-atom quantities. See the
|
||||
:doc:`variable <variable>` command and its special functions which can
|
||||
perform the same operations as the compute reduce command on global
|
||||
vectors.
|
||||
local quantities and must all be the same kind (per-atom or local);
|
||||
see discussion of the optional *inputs* keyword below.
|
||||
|
||||
Atom attributes are per-atom quantities, :doc:`computes <compute>` and
|
||||
:doc:`fixes <fix>` can generate either per-atom or local quantities,
|
||||
and :doc:`atom-style variables <variable>` generate per-atom
|
||||
quantities. See the :doc:`variable <variable>` command and its
|
||||
special functions which can perform the same reduction operations as
|
||||
the compute reduce command on global vectors.
|
||||
|
||||
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 *minabs* or *maxabs* options find the minimum or maximum
|
||||
value across all absolute vector values. The *ave* setting adds the
|
||||
vector values into a global total, then divides by the number of values
|
||||
in the vector. The *sumsq* option sums the square of the values in the
|
||||
vector into a global total. The *avesq* setting does the same as *sumsq*,
|
||||
then divides the sum of squares by the number of values. The last two options
|
||||
can be useful for calculating the variance of some quantity (e.g., variance =
|
||||
sumsq :math:`-` ave\ :math:`^2`). The *sumabs* option sums the absolute
|
||||
values in the vector into a global total. The *aveabs* setting does the same
|
||||
as *sumabs*, then divides the sum of absolute values by the number of
|
||||
vector values into a global total, then divides by the number of
|
||||
values in the vector. The *sumsq* option sums the square of the
|
||||
values in the vector into a global total. The *avesq* setting does
|
||||
the same as *sumsq*, then divides the sum of squares by the number of
|
||||
values. The last two options can be useful for calculating the
|
||||
variance of some quantity (e.g., variance = sumsq :math:`-` ave\
|
||||
:math:`^2`). The *sumabs* option sums the absolute values in the
|
||||
vector into a global total. The *aveabs* setting does the same as
|
||||
*sumabs*, then divides the sum of absolute values by the number of
|
||||
values.
|
||||
|
||||
Each listed input is operated on independently. For per-atom inputs,
|
||||
@ -123,52 +130,54 @@ array with six columns:
|
||||
|
||||
----------
|
||||
|
||||
The atom attribute values (*x*, *y*, *z*, *vx*, *vy*, *vz*, *fx*, *fy*, and
|
||||
*fz*) are self-explanatory. Note that other atom attributes can be used as
|
||||
inputs to this fix by using the
|
||||
:doc:`compute property/atom <compute_property_atom>` command and then specifying
|
||||
an input value from that compute.
|
||||
The atom attribute values (*x*, *y*, *z*, *vx*, *vy*, *vz*, *fx*,
|
||||
*fy*, and *fz*) are self-explanatory. Note that other atom attributes
|
||||
can be used as inputs to this fix by using the :doc:`compute
|
||||
property/atom <compute_property_atom>` command and then specifying an
|
||||
input value from that compute.
|
||||
|
||||
If a value begins with "c\_", a compute ID must follow which has been
|
||||
previously defined in the input script. Computes can generate
|
||||
per-atom or local quantities. See the individual
|
||||
:doc:`compute <compute>` page for details. If no bracketed integer
|
||||
is appended, the vector calculated by the compute is used. If a
|
||||
bracketed integer 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 :doc:`add them to LAMMPS <Modify>`. See the
|
||||
discussion above for how :math:`I` can be specified with a wildcard asterisk
|
||||
to effectively specify multiple values.
|
||||
previously defined in the input script. Valid computes can generate
|
||||
per-atom or local quantities. See the individual :doc:`compute
|
||||
<compute>` page for details. If no bracketed integer is appended, the
|
||||
vector calculated by the compute is used. If a bracketed integer 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
|
||||
:doc:`add them to LAMMPS <Modify>`. See the discussion above for how
|
||||
:math:`I` can be specified with a wildcard asterisk to effectively
|
||||
specify multiple values.
|
||||
|
||||
If a value begins with "f\_", a fix ID must follow which has been
|
||||
previously defined in the input script. Fixes can generate per-atom
|
||||
or local quantities. See the individual :doc:`fix <fix>` page for
|
||||
details. Note that some fixes only produce their values on certain
|
||||
timesteps, which must be compatible with when compute reduce
|
||||
previously defined in the input script. Valid fixes can generate
|
||||
per-atom or local quantities. See the individual :doc:`fix <fix>`
|
||||
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
|
||||
:doc:`add them to LAMMPS <Modify>`. See the discussion above for how
|
||||
:math:`I` can be specified with a wildcard asterisk to effectively specify
|
||||
multiple values.
|
||||
:math:`I` can be specified with a wildcard asterisk to effectively
|
||||
specify multiple values.
|
||||
|
||||
If a value begins with "v\_", a variable name must follow which has
|
||||
been previously defined in the input script. It must be an
|
||||
:doc:`atom-style variable <variable>`. 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.
|
||||
this is a very general means of generating per-atom quantities to
|
||||
reduce.
|
||||
|
||||
----------
|
||||
|
||||
If the *replace* keyword is used, two indices *vec1* and *vec2* are
|
||||
specified, where each index ranges from 1 to the number of input values.
|
||||
The replace keyword can only be used if the *mode* is *min* or *max*\ .
|
||||
It works as follows. A min/max is computed as usual on the *vec2*
|
||||
input vector. The index :math:`N` of that value within *vec2* is also stored.
|
||||
Then, instead of performing a min/max on the *vec1* input vector, the
|
||||
stored index is used to select the :math:`N`\ th element of the *vec1* vector.
|
||||
specified, where each index ranges from 1 to the number of input
|
||||
values. The replace keyword can only be used if the *mode* is *min*
|
||||
or *max*\ . It works as follows. A min/max is computed as usual on
|
||||
the *vec2* input vector. The index :math:`N` of that value within
|
||||
*vec2* is also stored. Then, instead of performing a min/max on the
|
||||
*vec1* input vector, the stored index is used to select the :math:`N`\
|
||||
th element of the *vec1* vector.
|
||||
|
||||
Thus, for example, if you wish to use this compute to find the bond
|
||||
with maximum stretch, you can do it as follows:
|
||||
@ -190,6 +199,14 @@ information in this context, the *replace* keywords will extract the
|
||||
atom IDs for the two atoms in the bond of maximum stretch. These atom
|
||||
IDs and the bond stretch will be printed with thermodynamic output.
|
||||
|
||||
The *inputs* keyword allows selection of whether all the inputs are
|
||||
per-atom or local quantities. As noted above, all the inputs must be
|
||||
the same kind (per-atom or local). Per-atom is the default setting.
|
||||
If a compute or fix is specified as an input, it must produce per-atom
|
||||
or local data to match this setting. If it produces both, e.g. for
|
||||
the :doc:`compute voronoi/atom <compute_voronoi_atom>` command, then
|
||||
this keyword selects between them.
|
||||
|
||||
----------
|
||||
|
||||
If a single input is specified this compute produces a global scalar
|
||||
@ -197,34 +214,35 @@ value. If multiple inputs are specified, this compute produces a
|
||||
global vector of values, the length of which is equal to the number of
|
||||
inputs specified.
|
||||
|
||||
As discussed below, for the *sum*, *sumabs*, and *sumsq* modes, 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
|
||||
As discussed below, for the *sum*, *sumabs*, and *sumsq* modes, 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
|
||||
:doc:`thermo_style custom <thermo_style>` command with
|
||||
:doc:`thermo_modify norm yes <thermo_modify>` set as an option.
|
||||
Or it can be accessed by a
|
||||
:doc:`variable <variable>` that divides by the appropriate atom count.
|
||||
:doc:`thermo_modify norm yes <thermo_modify>` set as an option. Or it
|
||||
can be accessed by a :doc:`variable <variable>` that divides by the
|
||||
appropriate atom count.
|
||||
|
||||
----------
|
||||
|
||||
Output info
|
||||
"""""""""""
|
||||
|
||||
This compute calculates a global scalar if a single input value is specified
|
||||
or a global vector of length :math:`N`, where :math:`N` is the number of
|
||||
inputs, and which can be accessed by indices 1 to :math:`N`. These values can
|
||||
be used by any command that uses global scalar or vector values from a
|
||||
compute as input. See the :doc:`Howto output <Howto_output>` doc page
|
||||
for an overview of LAMMPS output options.
|
||||
This compute calculates a global scalar if a single input value is
|
||||
specified or a global vector of length :math:`N`, where :math:`N` is
|
||||
the number of inputs, and which can be accessed by indices 1 to
|
||||
:math:`N`. These values can be used by any command that uses global
|
||||
scalar or vector values from a compute as input. See the :doc:`Howto
|
||||
output <Howto_output>` doc page for an overview of LAMMPS output
|
||||
options.
|
||||
|
||||
All the scalar or vector values calculated by this compute are
|
||||
"intensive", except when the *sum*, *sumabs*, or *sumsq* modes are used on
|
||||
per-atom or local vectors, in which case the calculated values are
|
||||
"extensive".
|
||||
|
||||
The scalar or vector values will be in whatever :doc:`units <units>` the
|
||||
quantities being reduced are in.
|
||||
The scalar or vector values will be in whatever :doc:`units <units>`
|
||||
the quantities being reduced are in.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
@ -238,4 +256,4 @@ Related commands
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
The default value for the *inputs* keyword is peratom.
|
||||
|
||||
@ -843,7 +843,7 @@ stress/atom <compute_stress_atom>` commands. The former can be
|
||||
accessed by :doc:`thermodynamic output <thermo_style>`. The default
|
||||
setting for this fix is :doc:`fix_modify virial yes <fix_modify>`.
|
||||
|
||||
All of the *rigid* styles (not the *rigid/small* styles) compute a
|
||||
All of the *rigid* styles (but not the *rigid/small* styles) compute a
|
||||
global array of values which can be accessed by various :doc:`output
|
||||
commands <Howto_output>`. Similar information about the bodies
|
||||
defined by the *rigid/small* styles can be accessed via the
|
||||
@ -887,7 +887,8 @@ Restrictions
|
||||
""""""""""""
|
||||
|
||||
These fixes are all part of the RIGID package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
|
||||
LAMMPS was built with that package. See the :doc:`Build package
|
||||
<Build_package>` page for more info.
|
||||
|
||||
Assigning a temperature via the :doc:`velocity create <velocity>`
|
||||
command to a system with :doc:`rigid bodies <fix_rigid>` may not have
|
||||
|
||||
Reference in New Issue
Block a user