Commit da569a69 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5068 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 61c9d2db
Loading
Loading
Loading
Loading
+61 −115
Original line number Diff line number Diff line
@@ -33,136 +33,82 @@
</UL>
<P><B>Examples:</B>
</P>
<P>compute 1 all atom/molecule sum c_force
compute 1 all reduce/region subbox sum c_force
</P>
<PRE>compute 1 all atom/molecule c_ke c_pe 
</PRE>
<PRE>compute 1 top atom/molecule v_myFormula c_stress<B>3</B> 
</PRE>
<P><B>Description:</B>
</P>
<P>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, <A HREF = "compute.html">computes</A> and <A HREF = "fix.html">fixes</A>
may generate any of the three kinds of quantities, and <A HREF = "variable.html">atom-style
variables</A> generate per-atom quantities.  See the
<A HREF = "variable">variable</A> command and its special functions which can
perform the same operations as the compute reduce command on global
vectors.
</P>
<P>The reduction operation is specified by the <I>mode</I> setting.  The <I>sum</I>
option adds the values in the vector into a global total.  The <I>min</I>
or <I>max</I> options find the minimum or maximum value across all vector
values.  The <I>ave</I> setting adds the vector values into a global total,
then divides by the number of values in the vector.
</P>
<P>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.
</P>
<P>Each listed input can be an atom attribute (position, velocity, force
component) or can be the result of a <A HREF = "compute.html">compute</A> or
<A HREF = "fix.html">fix</A> or the evaluation of an atom-style
<A HREF = "variable.html">variable</A>.
</P>
<P>The atom attribute values (x,y,z,vx,vy,vz,fx,fy,fz) are
self-explanatory.  Note that other atom attributes can be used as
inputs to this fix by using the <A HREF = "compute_property_atom.html">compute
property/atom</A> command and then specifying
an input value from that compute.
</P>
<P>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
<A HREF = "compute.html">compute</A> 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 <A HREF = "Section_modify.html">add them to LAMMPS</A>.
</P>
<P>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 <A HREF = "fix.html">fix</A> 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
<P>Define a calculation that sums per-atom values on a per-molecule
basis, one per listed input.  The inputs can <A HREF = "compute.html">computes</A>,
<A HREF = "fix.html">fixes</A>, or <A HREF = "variable.html">variables</A> that generate per-atom
quantities.  Note that attributes stored by atoms, such as mass or
force, can also be summed on a per-molecule basis, by accessing these
quantities via the <A HREF = "compute_property_atom.html">compute property/atom</A>
command.
</P>
<P>Each listed input is operated on independently.  Only atoms within the
specified group contribute to the per-molecule sum.  Note that compute
or fix inputs define their own group which may affect the quantities
they return.  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.
</P>
<P>The ordering of per-molecule quantities produced by this compute are
consistent with the ordering produced by other compute commands that
generate per-molecule datums.  Let Nmolecules be the number of
molecules for which a result is calculated.  If not all molecules have
atoms in the group, then the molecule with the lowest ID is the first
of the Nmolecules.  The next lowest ID is the second, etc, up to
Nmolecules.
</P>
<P>If an input begins with "c_", a compute ID must follow which has been
previously defined in the input script and which generates per-atom
quantities.  See the individual <A HREF = "compute.html">compute</A> 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 <A HREF = "Section_modify.html">add them to
LAMMPS</A>.
</P>
<P>If an input begins with "f_", a fix ID must follow which has been
previously defined in the input script and which generates per-atom
quantities.  See the individual <A HREF = "fix.html">fix</A> doc page for details.
Note that some fixes only produce their values on certain timesteps,
which must be compatible with when compute atom/molecule 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 <A HREF = "Section_modify.html">add
them to LAMMPS</A>.
</P>
<P>If a value begins with "v_", a variable name must follow which has
<P>If an input begins with "v_", a variable name must follow which has
been previously defined in the input script.  It must be an
<A HREF = "variable.html">atom-style variable</A>.  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.
</P>
<HR>

<P>If the <I>replace</I> keyword is used, two indices <I>vec1</I> and <I>vec2</I> are
specified, where each index ranges from 1 to the # of input values.
The replace keyword can only be used if the <I>mode</I> is <I>min</I> or <I>max</I>.
It works as follows.  A min/max is computed as usual on the <I>vec2</I>
input vector.  The index N of that value within <I>vec2</I> is also stored.
Then, instead of performing a min/max on the <I>vec1</I> input vector, the
stored index is used to select the Nth element of the <I>vec1</I> vector.
</P>
<P>Thus, for example, if you wish to use this compute to find the bond
with maximum stretch, you can do it as follows:
</P>
<PRE>compute 1 all property/local batom1 batom2
compute	2 all bond/local dist
compute	3 all reduce max c_1[1] c_1[2] c_2 replace 1 3 replace 2 3
thermo_style custom step temp c_3[1] c_3[2] c_3[3] 
</PRE>
<P>The first two input values in the compute reduce command are vectors
with the IDs of the 2 atoms in each bond, using the <A HREF = "compute_property_local.html">compute
property/local</A> command.  The last input
value is bond distance, using the <A HREF = "compute_bond_local.html">compute
bond/local</A> command.  Instead of taking the
max of the two atom ID vectors, which does not yield useful
information in this context, the <I>replace</I> 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.
</P>
<HR>

<P>If a single input is specified this compute produces a global scalar
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.
</P>
<P>As discussed below, for <I>sum</I> 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 <A HREF = "thermo_style.html">thermo_style custom</A>
command with <A HREF = "thermo_modify.html">thermo_modify norm yes</A> set as an
option.  Or it can be accessed by a <A HREF = "variable.html">variable</A> that
divides by the appropriate atom count.
this is a very general means of generating per-atom quantities to sum
on a per-molecule basis.
</P>
<HR>

<P><B>Output info:</B>
</P>
<P>This compute calculates a global scalar if a single input value is
specified or a global vector of length N where N is the number of
inputs, and which can be accessed by indices 1 to N.  These values can
be used by any command that uses global scalar or vector values from a
compute as input.  See <A HREF = "Section_howto.html#4_15">this section</A> for an
overview of LAMMPS output options.
</P>
<P>All the scalar or vector values calculated by this compute are
"intensive", except when the <I>sum</I> mode is used on per-atom or local
vectors, in which case the calculated values are "extensive".
</P>
<P>The scalar or vector values will be in whatever <A HREF = "units.html">units</A> the
quantities being reduced are in.
<P>This compute calculates a global vector or global array depending on
the number of input values.  The length of the vector or number of
rows in the array is the number of molecules.  If a single input is
specified, a global vector is produced.  If two or more inputs are
specified, a global array is produced where the number of columns =
the number of inputs.  The vector or array can be accessed by any
command that uses global values from a compute as input.  See <A HREF = "Section_howto.html#4_15">this
section</A> for an overview of LAMMPS output
options.
</P>
<P>All the vector or array values calculated by this compute are
"extensive".
</P>
<P>The vector or array values will be in whatever <A HREF = "units.html">units</A> the
input quantities are in.
</P>
<P><B>Restrictions:</B> none
</P>
+59 −114
Original line number Diff line number Diff line
@@ -25,136 +25,81 @@ input = c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l

[Examples:]

compute 1 all atom/molecule sum c_force
compute 1 all reduce/region subbox sum c_force
compute 1 all atom/molecule c_ke c_pe
compute 1 top atom/molecule v_myFormula c_stress[3] :pre

[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, "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.  See the
"variable"_variable command and its special functions which can
perform the same 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 {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.

The atom attribute values (x,y,z,vx,vy,vz,fx,fy,fz) are
self-explanatory.  Note that other atom attributes 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.

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
"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 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
Define a calculation that sums per-atom values on a per-molecule
basis, one per listed input.  The inputs can "computes"_compute.html,
"fixes"_fix.html, or "variables"_variable.html that generate per-atom
quantities.  Note that attributes stored by atoms, such as mass or
force, can also be summed on a per-molecule basis, by accessing these
quantities via the "compute property/atom"_compute_property_atom.html
command.

Each listed input is operated on independently.  Only atoms within the
specified group contribute to the per-molecule sum.  Note that compute
or fix inputs define their own group which may affect the quantities
they return.  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.

The ordering of per-molecule quantities produced by this compute are
consistent with the ordering produced by other compute commands that
generate per-molecule datums.  Let Nmolecules be the number of
molecules for which a result is calculated.  If not all molecules have
atoms in the group, then the molecule with the lowest ID is the first
of the Nmolecules.  The next lowest ID is the second, etc, up to
Nmolecules.

If an input begins with "c_", a compute ID must follow which has been
previously defined in the input script and which generates per-atom
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 an input begins with "f_", a fix ID must follow which has been
previously defined in the input script and which generates per-atom
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 atom/molecule 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
If an input 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.

:line

If the {replace} keyword is used, two indices {vec1} and {vec2} are
specified, where each index ranges from 1 to the # 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 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 Nth 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:

compute 1 all property/local batom1 batom2
compute	2 all bond/local dist
compute	3 all reduce max c_1\[1\] c_1\[2\] c_2 replace 1 3 replace 2 3
thermo_style custom step temp c_3\[1\] c_3\[2\] c_3\[3\] :pre

The first two input values in the compute reduce command are vectors
with the IDs of the 2 atoms in each bond, using the "compute
property/local"_compute_property_local.html command.  The last input
value is bond distance, using the "compute
bond/local"_compute_bond_local.html command.  Instead of taking the
max of the two atom ID vectors, which does not yield useful
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.

:line

If a single input is specified this compute produces a global scalar
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 {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.
this is a very general means of generating per-atom quantities to sum
on a per-molecule basis.

:line

[Output info:]

This compute calculates a global scalar if a single input value is
specified or a global vector of length N where N is the number of
inputs, and which can be accessed by indices 1 to 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.

All the scalar or vector values calculated by this compute are
"intensive", except when the {sum} mode is used on per-atom or local
vectors, in which case the calculated values are "extensive".

The scalar or vector values will be in whatever "units"_units.html the
quantities being reduced are in.
This compute calculates a global vector or global array depending on
the number of input values.  The length of the vector or number of
rows in the array is the number of molecules.  If a single input is
specified, a global vector is produced.  If two or more inputs are
specified, a global array is produced where the number of columns =
the number of inputs.  The vector or array can be accessed by any
command that uses global values from a compute as input.  See "this
section"_Section_howto.html#4_15 for an overview of LAMMPS output
options.

All the vector or array values calculated by this compute are
"extensive".

The vector or array values will be in whatever "units"_units.html the
input quantities are in.

[Restrictions:] none