diff --git a/doc/src/Howto_amoeba.rst b/doc/src/Howto_amoeba.rst index 44458fcfdc..94856ca787 100644 --- a/doc/src/Howto_amoeba.rst +++ b/doc/src/Howto_amoeba.rst @@ -2,9 +2,9 @@ AMOEBA and HIPPO force fields ============================= The AMOEBA and HIPPO polarizable force fields were developed by Jay -Ponder's group at the U Washington at St Louis. Their implementation -in LAMMPS was done using F90 code provided by the Ponder group from -their `Tinker MD code `_. +Ponder's group at the U Washington at St Louis. The LAMMPS +implementation was done using F90 code provided by the Ponder group +from their `Tinker MD code `_. The current implementation (July 2022) of AMOEBA in LAMMPS matches the version discussed in :ref:`(Ponder) `, :ref:`(Ren) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 7a16637cf0..a8d7b05846 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -157,14 +157,28 @@ AMOEBA package **Contents:** -TODO +Implementation of the AMOEBA and HIPPO polarized force fields +orginally developed by Jay Ponder's group at the U Washington at St +Louis. The LAMMPS implementation was done using F90 code provided by +the Ponder group from their `Tinker MD code +`_. + +**Authors:** Josh Rackers and Steve Plimpton (Sandia), Trung Nguyen (U + Chicago) **Supporting info:** * src/AMOEBA: filenames -> commands * :doc:`AMOEBA and HIPPO howto ` +* :doc:`pair_style amoeba ` +* :doc:`pair_style hippo ` +* :doc:`atom_style amoeba ` +* :doc:`angle_style amoeba ` +* :doc:`improper_style amoeba ` +* :doc:`fix amoeba/bitorsion ` +* :doc:`fix amoeba/pitorsion ` +* tools/tinker/tinker2lmp.py * examples/amoeba -* TODO ---------- @@ -200,9 +214,10 @@ ATC package **Contents:** -ATC stands for atoms-to-continuum. This package implements a :doc:`fix atc ` command to either couple molecular dynamics with -continuum finite element equations or perform on-the-fly conversion of -atomic information to continuum fields. +ATC stands for atoms-to-continuum. This package implements a +:doc:`fix atc ` command to either couple molecular dynamics +with continuum finite element equations or perform on-the-fly +conversion of atomic information to continuum fields. **Authors:** Reese Jones, Jeremy Templeton, Jon Zimmerman (Sandia). diff --git a/doc/src/fix_ave_chunk.rst b/doc/src/fix_ave_chunk.rst index 6d5e0b0380..cda706a217 100644 --- a/doc/src/fix_ave_chunk.rst +++ b/doc/src/fix_ave_chunk.rst @@ -17,12 +17,12 @@ Syntax * Nfreq = calculate averages every this many timesteps * chunkID = ID of :doc:`compute chunk/atom ` command * one or more input values can be listed -* value = vx, vy, vz, fx, fy, fz, density/mass, density/number, temp, c_ID, c_ID[I], f_ID, f_ID[I], v_name +* value = vx, vy, vz, fx, fy, fz, density/mass, density/number, mass, temp, c_ID, c_ID[I], f_ID, f_ID[I], v_name .. parsed-literal:: - vx,vy,vz,fx,fy,fz = atom attribute (velocity, force component) - density/number, density/mass = number or mass density + vx,vy,vz,fx,fy,fz,mass = atom attribute (velocity, force component, mass) + density/number, density/mass = number or mass density (per volume) temp = temperature c_ID = per-atom vector calculated by a compute with ID c_ID[I] = Ith column of per-atom array calculated by a compute with ID, I can include wildcard (see below) @@ -99,29 +99,33 @@ averages can be used by other :doc:`output commands ` such as :doc:`thermo_style custom `, and can also be written to a file. -In LAMMPS, chunks are collections of atoms defined by a :doc:`compute chunk/atom ` command, which assigns each atom -to a single chunk (or no chunk). The ID for this command is specified -as chunkID. For example, a single chunk could be the atoms in a -molecule or atoms in a spatial bin. See the :doc:`compute chunk/atom ` page and the :doc:`Howto chunk ` page for details of how chunks can be -defined and examples of how they can be used to measure properties of -a system. +In LAMMPS, chunks are collections of atoms defined by a :doc:`compute +chunk/atom ` command, which assigns each atom to a +single chunk (or no chunk). The ID for this command is specified as +chunkID. For example, a single chunk could be the atoms in a molecule +or atoms in a spatial bin. See the :doc:`compute chunk/atom +` page and the :doc:`Howto chunk ` +page for details of how chunks can be defined and examples of how they +can be used to measure properties of a system. Note that only atoms in the specified group contribute to the summing -and averaging calculations. The :doc:`compute chunk/atom ` command defines its own group as -well as an optional region. Atoms will have a chunk ID = 0, meaning -they belong to no chunk, if they are not in that group or region. -Thus you can specify the "all" group for this command if you simply -want to use the chunk definitions provided by chunkID. +and averaging calculations. The :doc:`compute chunk/atom +` command defines its own group as well as an +optional region. Atoms will have a chunk ID = 0, meaning they belong +to no chunk, if they are not in that group or region. Thus you can +specify the "all" group for this command if you simply want to use the +chunk definitions provided by chunkID. Each specified per-atom value can be an atom attribute (position, -velocity, force component), a mass or number density, or the result of -a :doc:`compute ` or :doc:`fix ` or the evaluation of an -atom-style :doc:`variable `. In the latter cases, the -compute, fix, or variable must produce a per-atom quantity, not a -global quantity. Note that the :doc:`compute property/atom ` command provides access to -any attribute defined and stored by atoms. If you wish to -time-average global quantities from a compute, fix, or variable, then -see the :doc:`fix ave/time ` command. +velocity, force component), a number or mass density, a mass or +temperature, or the result of a :doc:`compute ` or :doc:`fix +` or the evaluation of an atom-style :doc:`variable `. +In the latter cases, the compute, fix, or variable must produce a +per-atom quantity, not a global quantity. Note that the :doc:`compute +property/atom ` command provides access to any +attribute defined and stored by atoms. If you wish to time-average +global quantities from a compute, fix, or variable, then see the +:doc:`fix ave/time ` command. The per-atom values of each input vector are summed and averaged independently of the per-atom values in other input vectors. @@ -145,8 +149,9 @@ means all indices from m to n (inclusive). Using a wildcard is the same as if the individual columns of the array had been listed one by one. E.g. these 2 fix ave/chunk commands are -equivalent, since the :doc:`compute property/atom ` command creates, in this -case, a per-atom array with 3 columns: +equivalent, since the :doc:`compute property/atom +` command creates, in this case, a per-atom +array with 3 columns: .. code-block:: LAMMPS @@ -194,28 +199,31 @@ discussed below. .. note:: To perform per-chunk averaging within a *Nfreq* time window, the - number of chunks *Nchunk* defined by the :doc:`compute chunk/atom ` command must remain constant. If - the *ave* keyword is set to *running* or *window* then *Nchunk* must - remain constant for the duration of the simulation. This fix forces - the chunk/atom compute specified by chunkID to hold *Nchunk* constant - for the appropriate time windows, by not allowing it to re-calculate - *Nchunk*, which can also affect how it assigns chunk IDs to atoms. - This is particularly important to understand if the chunks defined by - the :doc:`compute chunk/atom ` command are spatial - bins. If its *units* keyword is set to *box* or *lattice*, then the - number of bins *Nchunk* and size of each bin will be fixed over the - *Nfreq* time window, which can affect which atoms are discarded if the + number of chunks *Nchunk* defined by the :doc:`compute chunk/atom + ` command must remain constant. If the *ave* + keyword is set to *running* or *window* then *Nchunk* must remain + constant for the duration of the simulation. This fix forces the + chunk/atom compute specified by chunkID to hold *Nchunk* constant + for the appropriate time windows, by not allowing it to + re-calculate *Nchunk*, which can also affect how it assigns chunk + IDs to atoms. This is particularly important to understand if the + chunks defined by the :doc:`compute chunk/atom + ` command are spatial bins. If its *units* + keyword is set to *box* or *lattice*, then the number of bins + *Nchunk* and size of each bin will be fixed over the *Nfreq* time + window, which can affect which atoms are discarded if the simulation box size changes. If its *units* keyword is set to - *reduced*, then the number of bins *Nchunk* will still be fixed, but - the size of each bin can vary at each timestep if the simulation box - size changes, e.g. for an NPT simulation. + *reduced*, then the number of bins *Nchunk* will still be fixed, + but the size of each bin can vary at each timestep if the + simulation box size changes, e.g. for an NPT simulation. ---------- -The atom attribute values (vx,vy,vz,fx,fy,fz) are self-explanatory. -As noted above, any other atom attributes can be used as input values -to this fix by using the :doc:`compute property/atom ` command and then specifying -an input value from that compute. +The atom attribute values (vx,vy,vz,fx,fy,fz,mass) are +self-explanatory. As noted above, any other atom attributes can be +used as input values to this fix by using the :doc:`compute +property/atom ` command and then specifying an +input value from that compute. The *density/number* value means the number density is computed for each chunk, i.e. number/volume. The *density/mass* value means the @@ -243,12 +251,13 @@ Note that currently this temperature only includes translational degrees of freedom for each atom. No rotational degrees of freedom are included for finite-size particles. Also no degrees of freedom are subtracted for any velocity bias or constraints that are applied, -such as :doc:`compute temp/partial `, or :doc:`fix shake ` or :doc:`fix rigid `. This is because -those degrees of freedom (e.g. a constrained bond) could apply to sets -of atoms that are both included and excluded from a specific chunk, -and hence the concept is somewhat ill-defined. In some cases, you can -use the *adof* and *cdof* keywords to adjust the calculated degrees of -freedom appropriately, as explained below. +such as :doc:`compute temp/partial `, or +:doc:`fix shake ` or :doc:`fix rigid `. This is +because those degrees of freedom (e.g. a constrained bond) could apply +to sets of atoms that are both included and excluded from a specific +chunk, and hence the concept is somewhat ill-defined. In some cases, +you can use the *adof* and *cdof* keywords to adjust the calculated +degrees of freedom appropriately, as explained below. Also note that a bias can be subtracted from atom velocities before they are used in the above formula for KE, by using the *bias* @@ -256,22 +265,22 @@ keyword. This allows, for example, a thermal temperature to be computed after removal of a flow velocity profile. Note that the per-chunk temperature calculated by this fix and the -:doc:`compute temp/chunk ` command can be different. -The compute calculates the temperature for each chunk for a single -snapshot. This fix can do that but can also time average those values -over many snapshots, or it can compute a temperature as if the atoms -in the chunk on different timesteps were collected together as one set -of atoms to calculate their temperature. The compute allows the -center-of-mass velocity of each chunk to be subtracted before -calculating the temperature; this fix does not. +:doc:`compute temp/chunk ` command can be +different. The compute calculates the temperature for each chunk for +a single snapshot. This fix can do that but can also time average +those values over many snapshots, or it can compute a temperature as +if the atoms in the chunk on different timesteps were collected +together as one set of atoms to calculate their temperature. The +compute allows the center-of-mass velocity of each chunk to be +subtracted before calculating the temperature; this fix does not. If a value begins with "c\_", a compute ID must follow which has been previously defined in the input script. If no bracketed integer is appended, the per-atom vector calculated by the compute is used. If a bracketed integer is appended, the Ith column of the per-atom array calculated by the compute is used. Users can also write code for -their own compute styles and :doc:`add them to LAMMPS `. -See the discussion above for how I can be specified with a wildcard +their own compute styles and :doc:`add them to LAMMPS `. See +the discussion above for how 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 @@ -307,9 +316,10 @@ atoms in the chunk. The averaged output value for the chunk on the average over atoms across the entire *Nfreq* timescale. For the *density/number* and *density/mass* values, the volume (bin volume or system volume) used in the final normalization will be the volume at -the final *Nfreq* timestep. For the *temp* values, degrees of freedom and -kinetic energy are summed separately across the entire *Nfreq* timescale, and -the output value is calculated by dividing those two sums. +the final *Nfreq* timestep. For the *temp* values, degrees of freedom +and kinetic energy are summed separately across the entire *Nfreq* +timescale, and the output value is calculated by dividing those two +sums. If the *norm* setting is *sample*, the chunk value is summed over atoms for each sample, as is the count, and an "average sample value" @@ -431,44 +441,50 @@ the first of each section of output. In the third line the values are replaced with the appropriate value names, e.g. fx or c_myCompute[2]. The words in parenthesis only appear with corresponding columns if the -chunk style specified for the :doc:`compute chunk/atom ` command supports them. The OrigID -column is only used if the *compress* keyword was set to *yes* for the -:doc:`compute chunk/atom ` command. This means that -the original chunk IDs (e.g. molecule IDs) will have been compressed -to remove chunk IDs with no atoms assigned to them. Thus a compressed -chunk ID of 3 may correspond to an original chunk ID or molecule ID of +chunk style specified for the :doc:`compute chunk/atom +` command supports them. The OrigID column is +only used if the *compress* keyword was set to *yes* for the +:doc:`compute chunk/atom ` command. This means +that the original chunk IDs (e.g. molecule IDs) will have been +compressed to remove chunk IDs with no atoms assigned to them. Thus a +compressed chunk ID of 3 may correspond to an original chunk ID or +molecule ID of 415. The OrigID column will list 415 for the third chunk. The CoordN columns only appear if a *binning* style was used in the :doc:`compute chunk/atom ` command. For *bin/1d*, *bin/2d*, and *bin/3d* styles the column values are the center point of the bin in the corresponding dimension. Just Coord1 is used for -*bin/1d*, Coord2 is added for *bin/2d*, Coord3 is added for *bin/3d*\ . -For *bin/sphere*, just Coord1 is used, and it is the radial +*bin/1d*, Coord2 is added for *bin/2d*, Coord3 is added for *bin/3d*\ +. For *bin/sphere*, just Coord1 is used, and it is the radial coordinate. For *bin/cylinder*, Coord1 and Coord2 are used. Coord1 is the radial coordinate (away from the cylinder axis), and coord2 is the coordinate along the cylinder axis. -Note that if the value of the *units* keyword used in the :doc:`compute chunk/atom command ` is *box* or *lattice*, the -coordinate values will be in distance :doc:`units `. If the -value of the *units* keyword is *reduced*, the coordinate values will -be in unitless reduced units (0-1). This is not true for the Coord1 value -of style *bin/sphere* or *bin/cylinder* which both represent radial -dimensions. Those values are always in distance :doc:`units `. +Note that if the value of the *units* keyword used in the +:doc:`compute chunk/atom command ` is *box* or +*lattice*, the coordinate values will be in distance :doc:`units +`. If the value of the *units* keyword is *reduced*, the +coordinate values will be in unitless reduced units (0-1). This is +not true for the Coord1 value of style *bin/sphere* or *bin/cylinder* +which both represent radial dimensions. Those values are always in +distance :doc:`units `. ---------- Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options -are relevant to this fix. +No information about this fix is written to :doc:`binary restart files +`. None of the :doc:`fix_modify ` options are +relevant to this fix. This fix computes a global array of values which can be accessed by various :doc:`output commands `. The values can only be accessed on timesteps that are multiples of *Nfreq* since that is when averaging is performed. The global array has # of rows = the number -of chunks *Nchunk* as calculated by the specified :doc:`compute chunk/atom ` command. The # of columns = +of chunks *Nchunk* as calculated by the specified :doc:`compute +chunk/atom ` command. The # of columns = M+1+Nvalues, where M = 1 to 4, depending on whether the optional columns for OrigID and CoordN are used, as explained above. Following the optional columns, the next column contains the count of atoms in @@ -483,7 +499,8 @@ since they are typically already normalized by the count of atoms in each chunk. No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +the :doc:`run ` command. This fix is not invoked during +:doc:`energy minimization `. Restrictions """""""""""" diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 46c0abfc8f..ca53c1e8a9 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -107,6 +107,9 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : which[nvalues] = ArgInfo::F; argindex[nvalues++] = 2; + } else if (strcmp(arg[iarg],"mass") == 0) { + which[nvalues] = ArgInfo::MASS; + argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"density/number") == 0) { densityflag = 1; which[nvalues] = ArgInfo::DENSITY_NUMBER; @@ -115,9 +118,6 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : densityflag = 1; which[nvalues] = ArgInfo::DENSITY_MASS; argindex[nvalues++] = 0; - } else if (strcmp(arg[iarg],"mass") == 0) { - which[nvalues] = ArgInfo::MASS; - argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"temp") == 0) { which[nvalues] = ArgInfo::TEMPERATURE; argindex[nvalues++] = 0; @@ -632,7 +632,12 @@ void FixAveChunk::end_of_step() if (which[m] == ArgInfo::V) attribute = atom->v; else attribute = atom->f; - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocalThe *temp* value means the temperature is computed for each chunk, by +the formula KE = DOF/2 k T, where KE = total kinetic energy of the +chunk of atoms (sum of 1/2 m v\^2), DOF = the total number of degrees +of freedom for all atoms in the chunk, k = Boltzmann constant, and T = +temperature. +; i++) if (mask[i] & groupbit && ichunk[i] > 0) { index = ichunk[i]-1; values_one[index][m] += attribute[i][j];