cleanup, clarification and re-wrap of doc file sections

This commit is contained in:
Axel Kohlmeyer
2024-10-13 18:56:41 -04:00
parent 03d10e6bbc
commit b3b9d032fa
4 changed files with 93 additions and 79 deletions

View File

@ -58,28 +58,30 @@ chunk ID for an individual atom can also be static (e.g. a molecule
ID), or dynamic (e.g. what spatial bin an atom is in as it moves). ID), or dynamic (e.g. what spatial bin an atom is in as it moves).
Note that this compute allows the per-atom output of other Note that this compute allows the per-atom output of other
:doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`variables
:doc:`variables <variable>` to be used to define chunk IDs for each <variable>` to be used to define chunk IDs for each atom. This means
atom. This means you can write your own compute or fix to output a you can write your own compute or fix to output a per-atom quantity to
per-atom quantity to use as chunk ID. See the :doc:`Modify <Modify>` use as chunk ID. See the :doc:`Modify <Modify>` doc pages for info on
doc pages for info on how to do this. You can also define a :doc:`per-atom variable <variable>` in the input script that uses a formula to how to do this. You can also define a :doc:`per-atom variable
generate a chunk ID for each atom. <variable>` in the input script that uses a formula to generate a chunk
ID for each atom.
Fix ave/chunk command: Fix ave/chunk command:
---------------------- ----------------------
This fix takes the ID of a :doc:`compute chunk/atom <compute_chunk_atom>` command as input. For each chunk, This fix takes the ID of a :doc:`compute chunk/atom
it then sums one or more specified per-atom values over the atoms in <compute_chunk_atom>` command as input. For each chunk, it then sums
each chunk. The per-atom values can be any atom property, such as one or more specified per-atom values over the atoms in each chunk. The
velocity, force, charge, potential energy, kinetic energy, stress, per-atom values can be any atom property, such as velocity, force,
etc. Additional keywords are defined for per-chunk properties like charge, potential energy, kinetic energy, stress, etc. Additional
density and temperature. More generally any per-atom value generated keywords are defined for per-chunk properties like density and
by other :doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`per-atom variables <variable>`, can be summed over atoms in each chunk. temperature. More generally any per-atom value generated by other
:doc:`computes <compute>`, :doc:`fixes <fix>`, and :doc:`per-atom
variables <variable>`, can be summed over atoms in each chunk.
Similar to other averaging fixes, this fix allows the summed per-chunk Similar to other averaging fixes, this fix allows the summed per-chunk
values to be time-averaged in various ways, and output to a file. The values to be time-averaged in various ways, and output to a file. The
fix produces a global array as output with one row of values per fix produces a global array as output with one row of values per chunk.
chunk.
Compute \*/chunk commands: Compute \*/chunk commands:
-------------------------- --------------------------
@ -97,17 +99,20 @@ category:
* :doc:`compute torque/chunk <compute_vcm_chunk>` * :doc:`compute torque/chunk <compute_vcm_chunk>`
* :doc:`compute vcm/chunk <compute_vcm_chunk>` * :doc:`compute vcm/chunk <compute_vcm_chunk>`
They each take the ID of a :doc:`compute chunk/atom <compute_chunk_atom>` command as input. As their names They each take the ID of a :doc:`compute chunk/atom
indicate, they calculate the center-of-mass, radius of gyration, <compute_chunk_atom>` command as input. As their names indicate, they
moments of inertia, mean-squared displacement, temperature, torque, calculate the center-of-mass, radius of gyration, moments of inertia,
and velocity of center-of-mass for each chunk of atoms. The :doc:`compute property/chunk <compute_property_chunk>` command can tally the mean-squared displacement, temperature, torque, and velocity of
count of atoms in each chunk and extract other per-chunk properties. center-of-mass for each chunk of atoms. The :doc:`compute
property/chunk <compute_property_chunk>` command can tally the count of
atoms in each chunk and extract other per-chunk properties.
The reason these various calculations are not part of the :doc:`fix ave/chunk command <fix_ave_chunk>`, is that each requires a more The reason these various calculations are not part of the :doc:`fix
ave/chunk command <fix_ave_chunk>`, is that each requires a more
complicated operation than simply summing and averaging over per-atom complicated operation than simply summing and averaging over per-atom
values in each chunk. For example, many of them require calculation values in each chunk. For example, many of them require calculation of
of a center of mass, which requires summing mass\*position over the a center of mass, which requires summing mass\*position over the atoms
atoms and then dividing by summed mass. and then dividing by summed mass.
All of these computes produce a global vector or global array as All of these computes produce a global vector or global array as
output, with one or more values per chunk. The output can be used in output, with one or more values per chunk. The output can be used in
@ -118,9 +123,10 @@ various ways:
* As input to the :doc:`fix ave/histo <fix_ave_histo>` command to * As input to the :doc:`fix ave/histo <fix_ave_histo>` command to
histogram values across chunks. E.g. a histogram of cluster sizes or histogram values across chunks. E.g. a histogram of cluster sizes or
molecule diffusion rates. molecule diffusion rates.
* As input to special functions of :doc:`equal-style variables <variable>`, like sum() and max() and ave(). E.g. to * As input to special functions of :doc:`equal-style variables
find the largest cluster or fastest diffusing molecule or average <variable>`, like sum() and max() and ave(). E.g. to find the largest
radius-of-gyration of a set of molecules (chunks). cluster or fastest diffusing molecule or average radius-of-gyration of
a set of molecules (chunks).
Other chunk commands: Other chunk commands:
--------------------- ---------------------
@ -138,9 +144,10 @@ spatially average per-chunk values calculated by a per-chunk compute.
The :doc:`compute reduce/chunk <compute_reduce_chunk>` command reduces a The :doc:`compute reduce/chunk <compute_reduce_chunk>` command reduces a
peratom value across the atoms in each chunk to produce a value per peratom value across the atoms in each chunk to produce a value per
chunk. When used with the :doc:`compute chunk/spread/atom <compute_chunk_spread_atom>` command it can chunk. When used with the :doc:`compute chunk/spread/atom
create peratom values that induce a new set of chunks with a second <compute_chunk_spread_atom>` command it can create peratom values that
:doc:`compute chunk/atom <compute_chunk_atom>` command. induce a new set of chunks with a second :doc:`compute chunk/atom
<compute_chunk_atom>` command.
Example calculations with chunks Example calculations with chunks
-------------------------------- --------------------------------

View File

@ -206,11 +206,13 @@ IDs and the bond stretch will be printed with thermodynamic output.
The *inputs* keyword allows selection of whether all the inputs are The *inputs* keyword allows selection of whether all the inputs are
per-atom or local quantities. As noted above, all the inputs must be 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. the same kind (per-atom or local). Per-atom is the default setting. If
If a compute or fix is specified as an input, it must produce per-atom a compute or fix is specified as an input, it must produce per-atom or
or local data to match this setting. If it produces both, e.g. for local data to match this setting. If it produces both, like for example
the :doc:`compute voronoi/atom <compute_voronoi_atom>` command, then the :doc:`compute voronoi/atom <compute_voronoi_atom>` command, then
this keyword selects between them. this keyword selects between them. If a compute *only* produces local
data, like for example the :doc:`compute bond/local <compute_bond_local>
command`, the setting "inputs local" is *required*.
---------- ----------

View File

@ -37,55 +37,57 @@ Description
Define a calculation that reduces one or more per-atom vectors into Define a calculation that reduces one or more per-atom vectors into
per-chunk values. This can be useful for diagnostic output. Or when per-chunk values. This can be useful for diagnostic output. Or when
used in conjunction with the :doc:`compute chunk/spread/atom <compute_chunk_spread_atom>` command it can be used in conjunction with the :doc:`compute chunk/spread/atom
used to create per-atom values that induce a new set of chunks with a <compute_chunk_spread_atom>` command it can be used to create per-atom
second :doc:`compute chunk/atom <compute_chunk_atom>` command. An values that induce a new set of chunks with a second :doc:`compute
example is given below. chunk/atom <compute_chunk_atom>` command. An example is given below.
In LAMMPS, chunks are collections of atoms defined by a :doc:`compute chunk/atom <compute_chunk_atom>` command, which assigns each atom In LAMMPS, chunks are collections of atoms defined by a :doc:`compute
to a single chunk (or no chunk). The ID for this command is specified chunk/atom <compute_chunk_atom>` command, which assigns each atom to a
as chunkID. For example, a single chunk could be the atoms in a single chunk (or no chunk). The ID for this command is specified as
molecule or atoms in a spatial bin. See the :doc:`compute chunk/atom <compute_chunk_atom>` and :doc:`Howto chunk <Howto_chunk>` chunkID. For example, a single chunk could be the atoms in a molecule
doc pages for details of how chunks can be defined and examples of how or atoms in a spatial bin. See the :doc:`compute chunk/atom
they can be used to measure properties of a system. <compute_chunk_atom>` and :doc:`Howto chunk <Howto_chunk>` doc pages for
details of how chunks can be defined and examples of how they can be
used to measure properties of a system.
For each atom, this compute accesses its chunk ID from the specified For each atom, this compute accesses its chunk ID from the specified
*chunkID* compute. The per-atom value from an input contributes *chunkID* compute. The per-atom value from an input contributes to a
to a per-chunk value corresponding the the chunk ID. per-chunk value corresponding the the chunk ID.
The reduction operation is specified by the *mode* setting and is The reduction operation is specified by the *mode* setting and is
performed over all the per-atom values from the atoms in each chunk. performed over all the per-atom values from the atoms in each chunk.
The *sum* option adds the pre-atom values to a per-chunk total. The The *sum* option adds the pre-atom values to a per-chunk total. The
*min* or *max* options find the minimum or maximum value of the *min* or *max* options find the minimum or maximum value of the per-atom
per-atom values for each chunk. values for each chunk.
Note that only atoms in the specified group contribute to the Note that only atoms in the specified group contribute to the reduction
reduction operation. If the *chunkID* compute returns a 0 for the operation. If the *chunkID* compute returns a 0 for the chunk ID of an
chunk ID of an atom (i.e., the atom is not in a chunk defined by the atom (i.e., the atom is not in a chunk defined by the :doc:`compute
:doc:`compute chunk/atom <compute_chunk_atom>` command), that atom will chunk/atom <compute_chunk_atom>` command), that atom will also not
also not contribute to the reduction operation. An input that is a contribute to the reduction operation. An input that is a compute or
compute or fix may define its own group which affects the quantities fix may define its own group which affects the quantities it returns.
it returns. For example, a compute with return a zero value for atoms For example, a compute with return a zero value for atoms that are not
that are not in the group specified for that compute. in the group specified for that compute.
Each listed input is operated on independently. Each input can be the Each listed input is operated on independently. Each input can be the
result of a :doc:`compute <compute>` or :doc:`fix <fix>` or the evaluation result of a :doc:`compute <compute>` or :doc:`fix <fix>` or the
of an atom-style :doc:`variable <variable>`. evaluation of an atom-style :doc:`variable <variable>`.
Note that for values from a compute or fix, the bracketed index I can Note that for values from a compute or fix, the bracketed index I can be
be specified using a wildcard asterisk with the index to effectively specified using a wildcard asterisk with the index to effectively
specify multiple values. This takes the form "\*" or "\*n" or "m\*" or specify multiple values. This takes the form "\*" or "\*n" or "m\*" or
"m\*n". If :math:`N` is the size of the vector (for *mode* = scalar) or the "m\*n". If :math:`N` is the size of the vector (for *mode* = scalar) or
number of columns in the array (for *mode* = vector), then an asterisk the number of columns in the array (for *mode* = vector), then an
with no numeric values means all indices from 1 to :math:`N`. A leading asterisk with no numeric values means all indices from 1 to :math:`N`.
asterisk means all indices from 1 to n (inclusive). A trailing A leading asterisk means all indices from 1 to n (inclusive). A
asterisk means all indices from n to :math:`N` (inclusive). A middle asterisk trailing asterisk means all indices from n to :math:`N` (inclusive). A
means all indices from m to n (inclusive). middle asterisk means all indices from m to n (inclusive).
Using a wildcard is the same as if the individual columns of the array Using a wildcard is the same as if the individual columns of the array
had been listed one by one. For example, the following two compute reduce/chunk had been listed one by one. For example, the following two compute
commands are equivalent, since the reduce/chunk commands are equivalent, since the :doc:`compute
:doc:`compute property/chunk <compute_property_chunk>` command creates a per-atom property/chunk <compute_property_chunk>` command creates a per-atom
array with 3 columns: array with 3 columns:
.. code-block:: LAMMPS .. code-block:: LAMMPS
@ -164,13 +166,14 @@ Output info
""""""""""" """""""""""
This compute calculates a global vector if a single input value is This compute calculates a global vector if a single input value is
specified, otherwise a global array is output. The number of columns specified, otherwise a global array is output. The number of columns in
in the array is the number of inputs provided. The length of the the array is the number of inputs provided. The length of the vector or
vector or the number of vector elements or array rows = the number of the number of vector elements or array rows = the number of chunks
chunks *Nchunk* as calculated by the specified :doc:`compute chunk/atom <compute_chunk_atom>` command. The vector or array can *Nchunk* as calculated by the specified :doc:`compute chunk/atom
be accessed by any command that uses global values from a compute as <compute_chunk_atom>` command. The vector or array can be accessed by
input. See the :doc:`Howto output <Howto_output>` page for an any command that uses global values from a compute as input. See the
overview of LAMMPS output options. :doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
The per-atom values for the vector or each column of the array will be The per-atom values for the vector or each column of the array will be
in whatever :doc:`units <units>` the corresponding input value is in. in whatever :doc:`units <units>` the corresponding input value is in.
@ -183,7 +186,9 @@ Restrictions
Related commands Related commands
"""""""""""""""" """"""""""""""""
:doc:`compute chunk/atom <compute_chunk_atom>`, :doc:`compute reduce <compute_reduce>`, :doc:`compute chunk/spread/atom <compute_chunk_spread_atom>` :doc:`compute chunk/atom <compute_chunk_atom>`,
:doc:`compute reduce <compute_reduce>`,
:doc:`compute chunk/spread/atom <compute_chunk_spread_atom>`
Default Default
""""""" """""""

View File

@ -162,7 +162,7 @@ potential energy is above the threshold value :math:`-3.0`.
compute 1 all pe/atom compute 1 all pe/atom
compute 2 all reduce sum c_1 compute 2 all reduce sum c_1
thermo_style custom step temp pe c_2 thermo_style custom step temp pe c_2
run 0 run 0 post no
variable eatom atom "c_1 > -3.0" variable eatom atom "c_1 > -3.0"
group hienergy variable eatom group hienergy variable eatom
@ -173,7 +173,7 @@ Note that these lines
compute 2 all reduce sum c_1 compute 2 all reduce sum c_1
thermo_style custom step temp pe c_2 thermo_style custom step temp pe c_2
run 0 run 0 post no
are necessary to ensure that the "eatom" variable is current when the are necessary to ensure that the "eatom" variable is current when the
group command invokes it. Because the eatom variable computes the group command invokes it. Because the eatom variable computes the