diff --git a/doc/Section_commands.html b/doc/Section_commands.html index df055aeddd..8955246e6a 100644 --- a/doc/Section_commands.html +++ b/doc/Section_commands.html @@ -334,9 +334,9 @@ description:
These are compute styles contributed by users, which can be used if diff --git a/doc/Section_commands.txt b/doc/Section_commands.txt index 390d97eefc..db4578bf83 100644 --- a/doc/Section_commands.txt +++ b/doc/Section_commands.txt @@ -448,6 +448,7 @@ description: "rotate/dipole"_compute_rotate_dipole.html, "rotate/gran"_compute_rotate_gran.html, "stress/atom"_compute_stress_atom.html, +"sum"_compute_sum.html, "sum/atom"_compute_sum_atom.html, "temp"_compute_temp.html, "temp/asphere"_compute_temp_asphere.html, diff --git a/doc/Section_howto.html b/doc/Section_howto.html index 29460afe22..0e8dbfc392 100644 --- a/doc/Section_howto.html +++ b/doc/Section_howto.html @@ -827,12 +827,15 @@ these are described in turn.
In LAMMPS, a compute comes in two flavors: ones that compute one or more global values (e.g. temperature, kinetic energy -tensor) and ones that compute one or more per-atom values. Only the -former can be used for thermodynamic output. The user-defined ID of -the compute is used along with an optional subscript as part of the -thermo_style command. E.g. c_myTemp outputs the -single scalar value generated by the compute; c_myTemp[2] would -output the 2nd vector value. +tensor) and ones that compute one or more per-atom values. There is a +compute sum command which sums per-atom quantities +into a global scalar or vector. +
+Only global quantities from a compute can be used for thermodynamic +output. The user-defined ID of the compute is used along with an +optional subscript as part of the thermo_style +command. E.g. c_myTemp outputs the single scalar value generated by +the compute; c_myTemp[2] would output the 2nd vector value.
Fixes can also generate global scalar or vector values which can be output with thermodynamic output, e.g. the energy of an @@ -896,13 +899,14 @@ and fix print.
The fix ave/time command enables time-averaging of global quantities like temperature or pressure. The global quantities are calculated by a compute or a fix. The -compute or fix must generate global scalar or vector quantities. The -time-averaged values generated by fix ave/time can -be written directly to a file and/or accessed by any output command -that uses fixes as a source of input, e.g. the thermo_style -custom command. Fix ave/time options allow for -running cummulative averages or moving time-windowed averages to be -output. +compute or fix must generate global scalar or vector quantities. Note +that this includes the "compute sum" command which computes global +values by summing per-atom quantities. The time-averaged values +generated by fix ave/time can be written directly +to a file and/or accessed by any output command that uses fixes as a +source of input, e.g. the thermo_style custom +command. Fix ave/time options allow for running cummulative averages +or moving time-windowed averages to be output.
The fix ave/spatial command enables spatial-averaging of per-atom quantities like per-atom energy or diff --git a/doc/Section_howto.txt b/doc/Section_howto.txt index 26c6d4ee2a..35b69c95f3 100644 --- a/doc/Section_howto.txt +++ b/doc/Section_howto.txt @@ -820,12 +820,15 @@ these are described in turn. In LAMMPS, a "compute"_compute.html comes in two flavors: ones that compute one or more global values (e.g. temperature, kinetic energy -tensor) and ones that compute one or more per-atom values. Only the -former can be used for thermodynamic output. The user-defined ID of -the compute is used along with an optional subscript as part of the -"thermo_style"_thermo_style.html command. E.g. c_myTemp outputs the -single scalar value generated by the compute; c_myTemp\[2\] would -output the 2nd vector value. +tensor) and ones that compute one or more per-atom values. There is a +"compute sum"_compute_sum.html command which sums per-atom quantities +into a global scalar or vector. + +Only global quantities from a compute can be used for thermodynamic +output. The user-defined ID of the compute is used along with an +optional subscript as part of the "thermo_style"_thermo_style.html +command. E.g. c_myTemp outputs the single scalar value generated by +the compute; c_myTemp\[2\] would output the 2nd vector value. "Fixes"_fix.html can also generate global scalar or vector values which can be output with thermodynamic output, e.g. the energy of an @@ -889,13 +892,14 @@ and "fix print"_fix_print.html. The "fix ave/time"_fix_ave_time.html command enables time-averaging of global quantities like temperature or pressure. The global quantities are calculated by a "compute"_compute.html or a "fix"_fix.html. The -compute or fix must generate global scalar or vector quantities. The -time-averaged values generated by "fix ave/time"_fix_ave_time.html can -be written directly to a file and/or accessed by any output command -that uses fixes as a source of input, e.g. the "thermo_style -custom"_thermo_style.html command. Fix ave/time options allow for -running cummulative averages or moving time-windowed averages to be -output. +compute or fix must generate global scalar or vector quantities. Note +that this includes the "compute sum" command which computes global +values by summing per-atom quantities. The time-averaged values +generated by "fix ave/time"_fix_ave_time.html can be written directly +to a file and/or accessed by any output command that uses fixes as a +source of input, e.g. the "thermo_style custom"_thermo_style.html +command. Fix ave/time options allow for running cummulative averages +or moving time-windowed averages to be output. The "fix ave/spatial"_fix_ave_spatial.html command enables spatial-averaging of per-atom quantities like per-atom energy or diff --git a/doc/compute.html b/doc/compute.html index 3c2b969228..8453388b5c 100644 --- a/doc/compute.html +++ b/doc/compute.html @@ -96,7 +96,8 @@ defined in LAMMPS:
Related commands:
-uncompute, compute_modify, fix +ave/atom, fix ave/spatial, +fix ave/time
Default: none
diff --git a/doc/compute.txt b/doc/compute.txt index 2f6b1c2367..01092a0876 100644 --- a/doc/compute.txt +++ b/doc/compute.txt @@ -93,7 +93,8 @@ defined in LAMMPS: "rotate/dipole"_compute_rotate_dipole.html - rotational energy of dipolar atoms "rotate/gran"_compute_rotate_gran.html - rotational energy of granular atoms "stress/atom"_compute_stress_atom.html - stress tensor for each atom -"sum/atom"_compute_sum_atom.html - sum 2 or more quantities for each atom +"sum"_compute_sum.html - sum per-atom quantities to a global value +"sum/atom"_compute_sum_atom.html - sum per-atom quantities to per-atom values "temp"_compute_temp.html - temperature of group of atoms "temp/asphere"_compute_temp_asphere.html - temperature of aspherical particles "temp/deform"_compute_temp_deform.html - temperature excluding box deformation velocity @@ -113,6 +114,8 @@ page"_Section_commands.html#3_5. [Related commands:] -"uncompute"_uncompute.html, "compute_modify"_compute_modify.html +"uncompute"_uncompute.html, "compute_modify"_compute_modify.html, "fix +ave/atom"_fix_ave_atom.html, "fix ave/spatial"_fix_ave_spatial.html, +"fix ave/time"_fix_ave_time.html [Default:] none diff --git a/doc/compute_sum.html b/doc/compute_sum.html new file mode 100644 index 0000000000..16be9ba768 --- /dev/null +++ b/doc/compute_sum.html @@ -0,0 +1,53 @@ + +Syntax: +
+compute ID group-ID sum compute-ID1 compute-ID2 ... ++
Examples: +
+compute 1 all sum c_force +compute 1 all sum atomKE atomEpair atomEbond ++
Description: +
+Define a computation that sums the results of one or more per-atom +computes across all atoms in the group to yield a global scalar or +vector quantity. For example, the forces on a group of atoms could be +summed to yield a net force on the group. The resulting value(s) can +be accessed by any command that uses global computes, e.g. the thermo +custom command or fix ave/time +command or by a variable command. +
+Unlike the "compute sum/atom" command, the result of this is not a +per-atom quantity, but a global scalar or vector. If the other +computes each generate a scalar value per atom, this compute will +generate a single scalar value. If the other computes each generate a +vector of values per atom, this compute will generate a vector of +values. In the latter case, all the other computes must generate +vectors of the same size. +
+Restrictions: none +
+Related commands: +
+ +Default: none +
+ diff --git a/doc/compute_sum.txt b/doc/compute_sum.txt new file mode 100644 index 0000000000..a0d199bdcb --- /dev/null +++ b/doc/compute_sum.txt @@ -0,0 +1,48 @@ +"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 sum command :h3 + +[Syntax:] + +compute ID group-ID sum compute-ID1 compute-ID2 ... :pre + +ID, group-ID are documented in "compute"_compute.html command +sum/ = style name of this compute command +compute-ID1, 2, ... = IDs of computes that calculate per-atom quantities :ul + +[Examples:] + +compute 1 all sum c_force +compute 1 all sum atomKE atomEpair atomEbond :pre + +[Description:] + +Define a computation that sums the results of one or more per-atom +computes across all atoms in the group to yield a global scalar or +vector quantity. For example, the forces on a group of atoms could be +summed to yield a net force on the group. The resulting value(s) can +be accessed by any command that uses global computes, e.g. the "thermo +custom"_therml_style.html command or "fix ave/time"_fix_ave_time.html +command or by a "variable"_variable.html command. + +Unlike the "compute sum/atom" command, the result of this is not a +per-atom quantity, but a global scalar or vector. If the other +computes each generate a scalar value per atom, this compute will +generate a single scalar value. If the other computes each generate a +vector of values per atom, this compute will generate a vector of +values. In the latter case, all the other computes must generate +vectors of the same size. + +[Restrictions:] none + +[Related commands:] + +"compute sum/atom"_compute_sum_atom.html + +[Default:] none diff --git a/doc/compute_sum_atom.html b/doc/compute_sum_atom.html index 517a0e6000..f1783f62da 100644 --- a/doc/compute_sum_atom.html +++ b/doc/compute_sum_atom.html @@ -42,7 +42,9 @@ vectors of the same size.Restrictions: none
-Related commands: none +
Related commands: +
+Default: none
diff --git a/doc/compute_sum_atom.txt b/doc/compute_sum_atom.txt index 9caf64cf5b..d94f7daf13 100644 --- a/doc/compute_sum_atom.txt +++ b/doc/compute_sum_atom.txt @@ -39,6 +39,8 @@ vectors of the same size. [Restrictions:] none -[Related commands:] none +[Related commands:] + +"compute sum"_compute_sum.html [Default:] none diff --git a/doc/fix.html b/doc/fix.html index 17ed8ccdc5..952b2cb4fb 100644 --- a/doc/fix.html +++ b/doc/fix.html @@ -97,7 +97,7 @@ for individual fixes for info on which ones can be restarted.For style compute the ID specifies a compute which calculates the desired property. The compute must be a "global" compute that calculates one or more global properties rather than a -"per-atom" compute. The compute must be previously defined in the -input script. Or it can be a compute defined by thermodynamic -output or other fixes such as fix -nvt or fix temp/rescale. Users -can write code for their own compute styles and add them to -LAMMPS. +"per-atom" compute. However, there is a compute +sum command which sums per-atom quantities into a +global scalar or vector which can be accessed by fix ave/time. +
+The compute must be previously defined in the input script. Or it can +be a compute defined by thermodynamic output or +other fixes such as fix nvt or fix +temp/rescale. Users can write code for their +own compute styles and add them to LAMMPS.
For style fix the ID specifies a fix which calculates the desired property. The fix must calculate a global scalar or diff --git a/doc/fix_ave_time.txt b/doc/fix_ave_time.txt index 61dd38a934..1b99b83dea 100644 --- a/doc/fix_ave_time.txt +++ b/doc/fix_ave_time.txt @@ -59,12 +59,15 @@ ave/time command is ignored. For style {compute} the {ID} specifies a "compute"_compute.html which calculates the desired property. The compute must be a "global" compute that calculates one or more global properties rather than a -"per-atom" compute. The compute must be previously defined in the -input script. Or it can be a compute defined by "thermodynamic -output"_thermo_style.html or other fixes such as "fix -nvt"_fix_nvt.html or "fix temp/rescale"_fix_temp_rescale.html. Users -can write code for their own compute styles and "add them to -LAMMPS"_Section_modify.html. +"per-atom" compute. However, there is a "compute +sum"_compute_sum.html command which sums per-atom quantities into a +global scalar or vector which can be accessed by fix ave/time. + +The compute must be previously defined in the input script. Or it can +be a compute defined by "thermodynamic output"_thermo_style.html or +other fixes such as "fix nvt"_fix_nvt.html or "fix +temp/rescale"_fix_temp_rescale.html. Users can write code for their +own compute styles and "add them to LAMMPS"_Section_modify.html. For style {fix} the {ID} specifies a "fix"_fix.html which calculates the desired property. The fix must calculate a global scalar or diff --git a/doc/thermo_style.html b/doc/thermo_style.html index 8946a248ad..542d12bb92 100644 --- a/doc/thermo_style.html +++ b/doc/thermo_style.html @@ -204,9 +204,12 @@ quantities calculated by a compute to be output. The ID in the keyword should be replaced by the actual ID of the compute that has been defined elsewhere in the input script. See the compute command for details. Note that only global -scalar or vector quantites calculated by a compute can be output as +scalar or vector quantities calculated by a compute can be output as thermodynamic data; per-atom quantities calcalated by a compute are -output by the dump custom command. +output by the dump custom command. However, there is a +compute sum command which sums per-atom quantities +into a global scalar or vector which can be output by thermo_style +custom.
Note that some computes calculate "intensive" global quantities like temperature; others calculate "extensive" global quantities like diff --git a/doc/thermo_style.txt b/doc/thermo_style.txt index b39ddad24e..fefecdd4e6 100644 --- a/doc/thermo_style.txt +++ b/doc/thermo_style.txt @@ -198,9 +198,12 @@ quantities calculated by a compute to be output. The ID in the keyword should be replaced by the actual ID of the compute that has been defined elsewhere in the input script. See the "compute"_compute.html command for details. Note that only global -scalar or vector quantites calculated by a compute can be output as +scalar or vector quantities calculated by a compute can be output as thermodynamic data; per-atom quantities calcalated by a compute are -output by the "dump custom"_dump.html command. +output by the "dump custom"_dump.html command. However, there is a +"compute sum"_compute_sum.html command which sums per-atom quantities +into a global scalar or vector which can be output by thermo_style +custom. Note that some computes calculate "intensive" global quantities like temperature; others calculate "extensive" global quantities like diff --git a/doc/variable.html b/doc/variable.html index 42582fd3f4..6e0630db73 100644 --- a/doc/variable.html +++ b/doc/variable.html @@ -251,7 +251,9 @@ variable. the actual ID of the compute defined elsewhere in the input script. See the compute command for details. Note that per-atom quantities calculated by a compute cannot be accessed this -way, but only global scalar or vector quantities. +way, but only global scalar or vector quantities. However, there is a +compute sum command which sums per-atom quantities +into a global scalar or vector which can be accessed by a variable.
If c_ID[0] is used as a keyword, then the scalar quantity calculated by the compute is used. If c_ID[N] is used, then one diff --git a/doc/variable.txt b/doc/variable.txt index 3ed55a90dc..7f77942d7e 100644 --- a/doc/variable.txt +++ b/doc/variable.txt @@ -249,7 +249,9 @@ Compute references access scalar or vector quantities calculated by a the actual ID of the compute defined elsewhere in the input script. See the "compute"_compute.html command for details. Note that per-atom quantities calculated by a compute cannot be accessed this -way, but only global scalar or vector quantities. +way, but only global scalar or vector quantities. However, there is a +"compute sum"_compute_sum.html command which sums per-atom quantities +into a global scalar or vector which can be accessed by a variable. If {c_ID\[0\]} is used as a keyword, then the scalar quantity calculated by the compute is used. If {c_ID\[N\]} is used, then one