diff --git a/doc/Section_howto.html b/doc/Section_howto.html index 710f8075a4..49ae77aada 100644 --- a/doc/Section_howto.html +++ b/doc/Section_howto.html @@ -34,7 +34,8 @@ 6.19 Library interface to LAMMPS
6.20 Calculating thermal conductivity
6.21 Calculating viscosity
-6.22 Calculating a diffusion coefficient
+6.22 Calculating a diffusion coefficient
+6.23 Using chunks to calculate system properties

The example input scripts included in the LAMMPS distribution and highlighted in Section_example also show how to @@ -2146,6 +2147,160 @@ and thus extract D.


+

6.23 Using chunks to calculate system properties +

+

In LAMMPS, chunks are collections of atoms defined by a compute +chunk/atom command, which assigns each atom +to a chunk (or to no chunk at all). The per-atom chunk assignments +can be used as input to two other kinds of commands, to calculate +various properties of a system: +

+ +

Here, each of the 3 kinds of chunk-related commands is briefly +overviewed, and some examples given of how to compute +different properties with chunk commands. +

+
Compute chunk/atom command +
+

This compute assigns atoms to chunks of various styles. Only atoms in +the specified group and optional specified region are assigned to a +chunk. Here is a list of possible chunk definitions: +

+
+ + + + + + +
atoms in same molecule chunk ID = molecule ID
atoms with same atom type - chunk ID = atom type
all atoms with same atom property (charge, radius, etc) chunk ID = output of compute property/atom
atoms in same cluster chunk ID = output of compute cluster/atom command
atoms in same spatial bin chunk ID = bin ID
atoms in same rigid body chunk ID = ID of an atom in the body
all atoms with same local defect structure chunk ID = output of compute centro/atom or coord/atom command +
+ +

Spatial bins can be of various kinds, e.g. 1d bins = slabs, 2d bins = +pencils, 3d bins = boxes, spherical bins, cylindrical bins. +

+

This compute also calculates the number of chunks Nchunk which is +used by other commands to tally per-chunk data. Nchunk can be a +static value or change over time (e.g. the number of clusters). The +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). +

+

Note that this compute allows the per-atom output of other +computes, fixes, and +variables to be used to define chunk IDs for each +atom. This means you can write your own compute or fix to output a +per-atom quantity to use as chunk ID; See +Section_modify of the documentation for how to +do this. You can also define a per-atom variable in +the input script that uses a formula to generate a chunk ID for each +atom. +

+
Fix ave/chunk command +
+

This fix takes the ID of a compute +chunk/atom command as input. For each chunk +it then sums one or more specified per-atom values over the atoms in +each chunk. The per-atom values can be any atom property, such as +force, charge, potential energy, kinetic energy, stress. Additional +keywords are allowed for per-chunk properties like density and +temperature. More generally any per-atom value generated by other +computes, fixes, and per-atom +variables, can be summed over atoms in each 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 +fix produces a global array as output with one row of values per +chunk. Global arrays or columns thereof can be used as input for +other commands, as described in the following section. +

+
Compute */chunk commands +
+

Currently the following computes operate on chunks: +

+ +

They each take the ID of a compute +chunk/atom command as input. As their names +indicate, they calculate the center-of-mass, radius of gyration, +moments of inertia, mean-squared displacement, and velocity of +center-of-mass for each chunk of atoms. The compute +property/chunk command can be tally the +count of atoms in each chunk and extract other per-chunk properties. +

+

The reason these various calculations are not part of the fix +ave/chunk command, is that each requires a more +complicated operation than simply summing and averaging over per-atom +values in each chunk. Most of them require calculation of a center of +mass, which requires summing mass*position over the atoms and dividing +by summed mass. +

+

All of these computes produce a global vector or global array as +output, wih one or more values per chunk. Global vectors or arrays +can be used as input for other commands, e.g. +

+ +
Example calculations with chunks +
+

Here are chunk commands that can be used to calculate various +properties: +

+

(1) Mimic the deprecated fix ave/spatial command, to average atom +velocity in each spatial bin: +

+

Old command: +

+

fix ave/spatial +

+

New commands: +

+

compute chunk/atom +fix ave/chunk +

+

(2) Mimincing the deprecated compute msd/molecule command +to compute the mean-squared displacement of each molecule: +

+

Old commands: +

+

compute molecule/msd +fix ave/time file msd.molecule +

+

New commands: +

+

compute chunk/atom style +compute molecule/chunk +fix ave/time file msd.molecule +

+

(3) print or time ave total force per molecule + average across molecules (variable special functions) +

+

(4) histogram of cluster sizes (use fix ave/histo) +

+

(5) count of # of atoms with each coord # + don't need chunking, just fix ave/histo on coord/atom +

+

(6) ave temperature per bin +

+
+
diff --git a/doc/Section_howto.txt b/doc/Section_howto.txt index cbbf92334a..99b0bba89d 100644 --- a/doc/Section_howto.txt +++ b/doc/Section_howto.txt @@ -31,7 +31,8 @@ This section describes how to perform common tasks using LAMMPS. 6.19 "Library interface to LAMMPS"_#howto_19 6.20 "Calculating thermal conductivity"_#howto_20 6.21 "Calculating viscosity"_#howto_21 -6.22 "Calculating a diffusion coefficient"_#howto_22 :all(b) +6.22 "Calculating a diffusion coefficient"_#howto_22 +6.23 "Using chunks to calculate system properties"_#howto_23 :all(b) The example input scripts included in the LAMMPS distribution and highlighted in "Section_example"_Section_example.html also show how to @@ -2131,6 +2132,158 @@ accumulated in a vector via the "fix vector"_fix_vector.html command, and time integrated via the "variable trap"_variable.html function, and thus extract D. +:line + +6.23 Using chunks to calculate system properties :link(howto_23),h4 + +In LAMMPS, chunks are collections of atoms defined by a "compute +chunk/atom"_compute_chunk_atom.html command, which assigns each atom +to a chunk (or to no chunk at all). The per-atom chunk assignments +can be used as input to two other kinds of commands, to calculate +various properties of a system: + +"fix ave/chunk"_fix_ave_chunk.html +a variety of "compute */chunk"_compute.html commands :ul + +Here, each of the 3 kinds of chunk-related commands is briefly +overviewed, and some examples given of how to compute +different properties with chunk commands. + +"Compute chunk/atom"_compute_chunk_atom.html command :h5 + +This compute assigns atoms to chunks of various styles. Only atoms in +the specified group and optional specified region are assigned to a +chunk. Here is a list of possible chunk definitions: + +atoms in same molecule | chunk ID = molecule ID | +atoms with same atom type -| chunk ID = atom type | +all atoms with same atom property (charge, radius, etc) | chunk ID = output of compute property/atom | +atoms in same cluster | chunk ID = output of compute cluster/atom command | +atoms in same spatial bin | chunk ID = bin ID | +atoms in same rigid body | chunk ID = ID of an atom in the body | +all atoms with same local defect structure | chunk ID = output of compute centro/atom or coord/atom command :tb(s=|,c=2) + +Spatial bins can be of various kinds, e.g. 1d bins = slabs, 2d bins = +pencils, 3d bins = boxes, spherical bins, cylindrical bins. + +This compute also calculates the number of chunks {Nchunk} which is +used by other commands to tally per-chunk data. {Nchunk} can be a +static value or change over time (e.g. the number of clusters). The +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). + +Note that this compute allows the per-atom output of other +"computes"_compute.html, "fixes"_fix.html, and +"variables"_variable.html to be used to define chunk IDs for each +atom. This means you can write your own compute or fix to output a +per-atom quantity to use as chunk ID; See +"Section_modify"_Section_modify.html of the documentation for how to +do this. You can also define a "per-atom variable"_variable.html in +the input script that uses a formula to generate a chunk ID for each +atom. + +"Fix ave/chunk"_fix_ave_chunk_atom.html command :h5 + +This fix takes the ID of a "compute +chunk/atom"_compute_chunk_atom.html command as input. For each chunk +it then sums one or more specified per-atom values over the atoms in +each chunk. The per-atom values can be any atom property, such as +force, charge, potential energy, kinetic energy, stress. Additional +keywords are allowed for per-chunk properties like density and +temperature. More generally any per-atom value generated by other +"computes"_compute.html, "fixes"_fix.html, and "per-atom +variables"_variable.html, can be summed over atoms in each 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 +fix produces a global array as output with one row of values per +chunk. Global arrays or columns thereof can be used as input for +other commands, as described in the following section. + +Compute */chunk commands :h5 + +Currently the following computes operate on chunks: + +"compute com/chunk"_compute_com_chunk.html +"compute gyration/chunk"_compute_gyration_chunk.html +"compute inertia/chunk"_compute_inertia_chunk.html +"compute msd/chunk"_compute_msd_chunk.html +"compute property/chunk"_compute_property_chunk.html +"compute vcm/chunk"_compute_vcm_chunk.html :ul + +They each take the ID of a "compute +chunk/atom"_compute_chunk_atom.html command as input. As their names +indicate, they calculate the center-of-mass, radius of gyration, +moments of inertia, mean-squared displacement, and velocity of +center-of-mass for each chunk of atoms. The "compute +property/chunk"_compute_property_chunk.html command can be tally the +count of atoms in each chunk and extract other per-chunk properties. + +The reason these various calculations are not part of the "fix +ave/chunk command"_fix_ave_chunk.html, is that each requires a more +complicated operation than simply summing and averaging over per-atom +values in each chunk. Most of them require calculation of a center of +mass, which requires summing mass*position over the atoms and dividing +by summed mass. + +All of these computes produce a global vector or global array as +output, wih one or more values per chunk. Global vectors or arrays +can be used as input for other commands, e.g. + +As input to the "fix ave/time"_fix_ave_time.html command, so the +per-chunk values output to a file it creates. The "fix +ave/time"_fix_ave_time.html command can also average the values for +each chunk over time if desired. :ulb,l + +As input to the "fix ave/histo"_fix_ave_histo.html command to +histogram values across chunks. E.g. a histogram of cluster sizes or +molecule diffusion rates. :l + +As input to special functions of "equal-style +variables"_variable.html, like sum() and max(). E.g. to find the +largest cluster or fastest diffusing molecule. :l,ule + +Example calculations with chunks :h5 + +Here are chunk commands that can be used to calculate various +properties: + +(1) Mimic the deprecated fix ave/spatial command, to average atom +velocity in each spatial bin: + +Old command: + +fix ave/spatial + +New commands: + +compute chunk/atom +fix ave/chunk + +(2) Mimincing the deprecated compute msd/molecule command +to compute the mean-squared displacement of each molecule: + +Old commands: + +compute molecule/msd +fix ave/time file msd.molecule + +New commands: + +compute chunk/atom style +compute molecule/chunk +fix ave/time file msd.molecule + +(3) print or time ave total force per molecule + average across molecules (variable special functions) + +(4) histogram of cluster sizes (use fix ave/histo) + +(5) count of # of atoms with each coord # + don't need chunking, just fix ave/histo on coord/atom + +(6) ave temperature per bin + :line :line diff --git a/doc/compute_temp_asphere.html b/doc/compute_temp_asphere.html index 7c70a62924..2c6241da99 100644 --- a/doc/compute_temp_asphere.html +++ b/doc/compute_temp_asphere.html @@ -23,7 +23,7 @@
  • keyword = bias or dof -
      bias value = bias-IDuniform or gaussian
    +
      bias value = bias-ID
         bias-ID = ID of a temperature compute that removes a velocity bias
       dof value = all or rotate
         all = compute temperature of translational and rotational degrees of freedom
    @@ -113,10 +113,10 @@ thermostatting.
     compute that removes a "bias" velocity from each atom.  This allows
     compute temp/sphere to compute its thermal temperature after the
     translational kinetic energy components have been altered in a
    -prescribed way, e.g. to remove a velocity profile.  Thermostats that
    -use this compute will work with this bias term.  See the doc pages for
    -individual computes that calculate a temperature and the doc pages for
    -fixes that perform thermostatting for more details.
    +prescribed way, e.g. to remove a flow velocity profile.  Thermostats
    +that use this compute will work with this bias term.  See the doc
    +pages for individual computes that calculate a temperature and the doc
    +pages for fixes that perform thermostatting for more details.
     

    For the dof keyword, a setting of all calculates a temperature that includes both translational and rotational degrees of freedom. A diff --git a/doc/compute_temp_asphere.txt b/doc/compute_temp_asphere.txt index ff4a90c610..ce0ba19532 100755 --- a/doc/compute_temp_asphere.txt +++ b/doc/compute_temp_asphere.txt @@ -16,7 +16,7 @@ ID, group-ID are documented in "compute"_compute.html command :ulb,l temp/asphere = style name of this compute command :l zero or more keyword/value pairs may be appended :l keyword = {bias} or {dof} :l - {bias} value = bias-ID{uniform} or {gaussian} + {bias} value = bias-ID bias-ID = ID of a temperature compute that removes a velocity bias {dof} value = {all} or {rotate} all = compute temperature of translational and rotational degrees of freedom @@ -105,10 +105,10 @@ For the {bias} keyword, {bias-ID} refers to the ID of a temperature compute that removes a "bias" velocity from each atom. This allows compute temp/sphere to compute its thermal temperature after the translational kinetic energy components have been altered in a -prescribed way, e.g. to remove a velocity profile. Thermostats that -use this compute will work with this bias term. See the doc pages for -individual computes that calculate a temperature and the doc pages for -fixes that perform thermostatting for more details. +prescribed way, e.g. to remove a flow velocity profile. Thermostats +that use this compute will work with this bias term. See the doc +pages for individual computes that calculate a temperature and the doc +pages for fixes that perform thermostatting for more details. For the {dof} keyword, a setting of {all} calculates a temperature that includes both translational and rotational degrees of freedom. A diff --git a/doc/compute_temp_region.html b/doc/compute_temp_region.html index 21dbdf7b53..c2e2d86c8f 100644 --- a/doc/compute_temp_region.html +++ b/doc/compute_temp_region.html @@ -74,12 +74,13 @@ compute.

    Unlike other compute styles that calculate temperature, this compute does not subtract out degrees-of-freedom due to fixes that constrain -molecular motion, such as fix shake and fix +motion, such as fix shake and fix rigid. This is because those degrees of freedom -(e.g. a constrained bond) can straddle the region boundary, and hence -the concept is somewhat ill-defined. If needed the number of -subtracted degrees-of-freedom can be set explicitly using the extra -option of the compute_modify command. +(e.g. a constrained bond) could apply to sets of atoms that straddle +the region boundary, and hence the concept is somewhat ill-defined. +If needed the number of subtracted degrees-of-freedom can be set +explicitly using the extra option of the +compute_modify command.

    See this howto section of the manual for a discussion of different ways to compute temperature and perform diff --git a/doc/compute_temp_region.txt b/doc/compute_temp_region.txt index 0cf713ce12..faf95ab34f 100644 --- a/doc/compute_temp_region.txt +++ b/doc/compute_temp_region.txt @@ -71,12 +71,13 @@ compute. Unlike other compute styles that calculate temperature, this compute does not subtract out degrees-of-freedom due to fixes that constrain -molecular motion, such as "fix shake"_fix_shake.html and "fix +motion, such as "fix shake"_fix_shake.html and "fix rigid"_fix_rigid.html. This is because those degrees of freedom -(e.g. a constrained bond) can straddle the region boundary, and hence -the concept is somewhat ill-defined. If needed the number of -subtracted degrees-of-freedom can be set explicitly using the {extra} -option of the "compute_modify"_compute_modify.html command. +(e.g. a constrained bond) could apply to sets of atoms that straddle +the region boundary, and hence the concept is somewhat ill-defined. +If needed the number of subtracted degrees-of-freedom can be set +explicitly using the {extra} option of the +"compute_modify"_compute_modify.html command. See "this howto section"_Section_howto.html#howto_16 of the manual for a discussion of different ways to compute temperature and perform diff --git a/doc/compute_temp_sphere.html b/doc/compute_temp_sphere.html index 923dab5045..dcbfd9a28a 100644 --- a/doc/compute_temp_sphere.html +++ b/doc/compute_temp_sphere.html @@ -23,7 +23,7 @@

  • keyword = bias or dof -
      bias value = bias-IDuniform or gaussian
    +
      bias value = bias-ID
         bias-ID = ID of a temperature compute that removes a velocity bias
       dof value = all or rotate
         all = compute temperature of translational and rotational degrees of freedom
    @@ -99,10 +99,10 @@ thermostatting.
     compute that removes a "bias" velocity from each atom.  This allows
     compute temp/sphere to compute its thermal temperature after the
     translational kinetic energy components have been altered in a
    -prescribed way, e.g. to remove a velocity profile.  Thermostats that
    -use this compute will work with this bias term.  See the doc pages for
    -individual computes that calculate a temperature and the doc pages for
    -fixes that perform thermostatting for more details.
    +prescribed way, e.g. to remove a flow velocity profile.  Thermostats
    +that use this compute will work with this bias term.  See the doc
    +pages for individual computes that calculate a temperature and the doc
    +pages for fixes that perform thermostatting for more details.
     

    For the dof keyword, a setting of all calculates a temperature that includes both translational and rotational degrees of freedom. A diff --git a/doc/compute_temp_sphere.txt b/doc/compute_temp_sphere.txt index 24885e2378..ca23fca4de 100755 --- a/doc/compute_temp_sphere.txt +++ b/doc/compute_temp_sphere.txt @@ -16,7 +16,7 @@ ID, group-ID are documented in "compute"_compute.html command :ulb,l temp/sphere = style name of this compute command :l zero or more keyword/value pairs may be appended :l keyword = {bias} or {dof} :l - {bias} value = bias-ID{uniform} or {gaussian} + {bias} value = bias-ID bias-ID = ID of a temperature compute that removes a velocity bias {dof} value = {all} or {rotate} all = compute temperature of translational and rotational degrees of freedom @@ -91,10 +91,10 @@ For the {bias} keyword, {bias-ID} refers to the ID of a temperature compute that removes a "bias" velocity from each atom. This allows compute temp/sphere to compute its thermal temperature after the translational kinetic energy components have been altered in a -prescribed way, e.g. to remove a velocity profile. Thermostats that -use this compute will work with this bias term. See the doc pages for -individual computes that calculate a temperature and the doc pages for -fixes that perform thermostatting for more details. +prescribed way, e.g. to remove a flow velocity profile. Thermostats +that use this compute will work with this bias term. See the doc +pages for individual computes that calculate a temperature and the doc +pages for fixes that perform thermostatting for more details. For the {dof} keyword, a setting of {all} calculates a temperature that includes both translational and rotational degrees of freedom. A diff --git a/doc/dump_modify.html b/doc/dump_modify.html index a8ab654d53..90cec61922 100644 --- a/doc/dump_modify.html +++ b/doc/dump_modify.html @@ -44,6 +44,8 @@ precision arg = power-of-10 value from 10 to 1000000 region arg = region-ID or "none" scale arg = yes or no + sfactor arg = coordinate scaling factor (> 0.0) + tfactor arg = time scaling factor (> 0.0) sort arg = off or id or N or -N off = no sorting of per-atom lines within a snapshot id = sort per-atom lines by atom ID @@ -111,7 +113,7 @@

    dump_modify 1 format "%d %d %20.15g %g %g" scale yes
     dump_modify myDump image yes scale no flush yes
     dump_modify 1 region mySphere thresh x < 0.0 thresh epair >= 3.2
    -dump_modify xtcdump precision 10000
    +dump_modify xtcdump precision 10000 sfactor 0.1
     dump_modify 1 every 1000 nfile 20
     dump_modify 1 every v_myVar
     dump_modify 1 amap min max cf 0.0 3 min green 0.5 yellow max blue boxcolor red 
    @@ -364,6 +366,21 @@ nanometer accuracy, e.g. for N = 1000, the coordinates are written to
     


    +

    The sfactor and tfactor keywords only apply to the dump xtc +style. They allow customization of the unit conversion factors used +when writing to XTC files. By default they are initialized for +whatever units style is being used, to write out +coordinates in nanometers and time in picoseconds. I.e. for real +units, LAMMPS defines sfactor = 0.1 and tfactor = 0.001, since the +Angstroms and fmsec used by real units are 0.1 nm and 0.001 psec +respectively. If you are using a units system with distance and time +units far from nm and psec, you may wish to write XTC files with +different units, since the compression algorithm used in XTC files is +most effective when the typical magnitude of position data is between +10.0 and 0.1. +

    +
    +

    The region keyword only applies to the dump custom, cfg, image, and movie styles. If specified, only atoms in the region will be written to the dump file or included in the image/movie. Only diff --git a/doc/dump_modify.txt b/doc/dump_modify.txt index c5cbd2bff6..bb174a7386 100644 --- a/doc/dump_modify.txt +++ b/doc/dump_modify.txt @@ -37,6 +37,8 @@ keyword = {append} or {buffer} or {element} or {every} or {fileper} or {first} o {precision} arg = power-of-10 value from 10 to 1000000 {region} arg = region-ID or "none" {scale} arg = {yes} or {no} + {sfactor} arg = coordinate scaling factor (> 0.0) + {tfactor} arg = time scaling factor (> 0.0) {sort} arg = {off} or {id} or N or -N off = no sorting of per-atom lines within a snapshot id = sort per-atom lines by atom ID @@ -100,7 +102,7 @@ keyword = {acolor} or {adiam} or {amap} or {backcolor} or {bcolor} or {bdiam} or dump_modify 1 format "%d %d %20.15g %g %g" scale yes dump_modify myDump image yes scale no flush yes dump_modify 1 region mySphere thresh x < 0.0 thresh epair >= 3.2 -dump_modify xtcdump precision 10000 +dump_modify xtcdump precision 10000 sfactor 0.1 dump_modify 1 every 1000 nfile 20 dump_modify 1 every v_myVar dump_modify 1 amap min max cf 0.0 3 min green 0.5 yellow max blue boxcolor red :pre @@ -352,6 +354,21 @@ nanometer accuracy, e.g. for N = 1000, the coordinates are written to :line +The {sfactor} and {tfactor} keywords only apply to the dump {xtc} +style. They allow customization of the unit conversion factors used +when writing to XTC files. By default they are initialized for +whatever "units"_units.html style is being used, to write out +coordinates in nanometers and time in picoseconds. I.e. for {real} +units, LAMMPS defines {sfactor} = 0.1 and {tfactor} = 0.001, since the +Angstroms and fmsec used by {real} units are 0.1 nm and 0.001 psec +respectively. If you are using a units system with distance and time +units far from nm and psec, you may wish to write XTC files with +different units, since the compression algorithm used in XTC files is +most effective when the typical magnitude of position data is between +10.0 and 0.1. + +:line + The {region} keyword only applies to the dump {custom}, {cfg}, {image}, and {movie} styles. If specified, only atoms in the region will be written to the dump file or included in the image/movie. Only