From 3c11fa39b63e9ffcbed2784028b4e21704ed374f Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Tue, 4 Oct 2022 18:49:35 -0500 Subject: [PATCH 01/27] Doc edits for mdi.rst --- doc/src/mdi.rst | 18 +++++++++--------- doc/utils/sphinx-config/LAMMPSLexer.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/src/mdi.rst b/doc/src/mdi.rst index d2b8ff185d..2f7fc65852 100644 --- a/doc/src/mdi.rst +++ b/doc/src/mdi.rst @@ -6,7 +6,7 @@ mdi command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS mdi option args @@ -19,7 +19,7 @@ Syntax *elements* args = N_1 N_2 ... N_ntypes N_1,N_2,...N_ntypes = atomic number for each of ntypes LAMMPS atom types *plugin* args = name keyword value keyword value ... - name = name of plugin library, e.g. lammps means a liblammps.so library will be loaded + name = name of plugin library (e.g., *lammps* means a liblammps.so library will be loaded) keyword/value pairs in any order, some are required, some are optional keywords = *mdi* or *infile* or *extra* or *command* *mdi* value = args passed to MDI for driver to operate with plugins (required) @@ -173,8 +173,8 @@ commands, which are described further below. atom type values are consistent in both codes, then the >TYPES command can be used. If not, the optional *elements* keyword can be used to specify what element each LAMMPS atom type corresponds - to. This is specified by the atomic number of the element, e.g. 13 - for Al. An atomic number must be specified for each of the ntypes + to. This is specified by the atomic number of the element (e.g., 13 + for Al). An atomic number must be specified for each of the ntypes LAMMPS atom types. Ntypes is typically specified via the create_box command or in the data file read by the read_data command. In this has been done, the MDI driver can send an @@ -325,15 +325,15 @@ able to initiate and terminate the connection to the engine code. The only current MDI driver command in LAMMPS is the :doc:`fix mdi/qm ` command. If it is only used once in an input script -then it can initiate and terminate the connection. But if it is being -issued multiple times, e.g. in a loop that issues a :doc:`clear -` command, then it cannot initiate or terminate the connection +then it can initiate and terminate the connection, but if it is being +issued multiple times (e.g., in a loop that issues a :doc:`clear +` command), then it cannot initiate or terminate the connection multiple times. Instead, the *mdi connect* and *mdi exit* commands should be used outside the loop to initiate or terminate the connection. See the examples/mdi/in.series.driver script for an example of how this is done. The LOOP in that script is reading a series of data -file configurations and passing them to an MDI engine (e.g. quantum +file configurations and passing them to an MDI engine (e.g., quantum code) for energy and force evaluation. A *clear* command inside the loop wipes out the current system so a new one can be defined. This operation also destroys all fixes. So the :doc:`fix mdi/qm @@ -356,7 +356,7 @@ LAMMPS and MDI units, which the other codes will also perform in their preferred units. LAMMPS can also be used as an MDI engine in other unit choices it -supports, e.g. *lj*, but then no unit conversion is performed. +supports (e.g., *lj*), but then no unit conversion is performed. Related commands """""""""""""""" diff --git a/doc/utils/sphinx-config/LAMMPSLexer.py b/doc/utils/sphinx-config/LAMMPSLexer.py index 116cdb7388..524d7bf1fa 100644 --- a/doc/utils/sphinx-config/LAMMPSLexer.py +++ b/doc/utils/sphinx-config/LAMMPSLexer.py @@ -9,8 +9,8 @@ LAMMPS_COMMANDS = ("angle_coeff", "angle_style", "atom_modify", "atom_style", "displace_atoms", "dump_modify", "dynamical_matrix", "echo", "elif", "else", "fix_modify", "group2ndx", "hyper", "if", "improper_coeff", "improper_style", "include", "info", "jump", "kim", -"kspace_modify", "kspace_style", "label", "lattice", -"log", "mass", "message", "minimize", "min_modify", "min_style", "molecule", +"kspace_modify", "kspace_style", "label", "labelmap", "lattice", "log", +"mass", "mdi", "message", "minimize", "min_modify", "min_style", "molecule", "ndx2group", "neb", "neb/spin", "neighbor", "neigh_modify", "newton", "next", "package", "pair_coeff", "pair_modify", "pair_style", "pair_write", "partition", "prd", "print", "processors", "python", "quit", "read_data", From f279b5d04269fab95f675e13a460f21ec68a460e Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Tue, 4 Oct 2022 22:36:30 -0500 Subject: [PATCH 02/27] Math fixes and other edits for fix_brownian.rst --- doc/src/fix_brownian.rst | 67 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/doc/src/fix_brownian.rst b/doc/src/fix_brownian.rst index fe57ecc8e0..6b65100375 100644 --- a/doc/src/fix_brownian.rst +++ b/doc/src/fix_brownian.rst @@ -14,7 +14,7 @@ fix brownian/asphere command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID style_name temp seed keyword args @@ -27,23 +27,23 @@ Syntax .. parsed-literal:: - *rng* value = *uniform* or *gaussian* or *none* - *uniform* = use uniform random number generator - *gaussian* = use gaussian random number generator - *none* = turn off noise - *dipole* value = *mux* and *muy* and *muz* for *brownian/asphere* - *mux*, *muy*, and *muz* = update orientation of dipole having direction (*mux*,*muy*,*muz*) in body frame of rigid body - *gamma_r_eigen* values = *gr1* and *gr2* and *gr3* for *brownian/asphere* - *gr1*, *gr2*, and *gr3* = diagonal entries of body frame rotational friction tensor - *gamma_r* values = *gr* for *brownian/sphere* - *gr* = magnitude of the (isotropic) rotational friction tensor - *gamma_t_eigen* values = *gt1* and *gt2* and *gt3* for *brownian/asphere* - *gt1*, *gt2*, and *gt3* = diagonal entries of body frame translational friction tensor - *gamma_t* values = *gt* for *brownian* and *brownian/sphere* - *gt* = magnitude of the (isotropic) translational friction tensor - *rotation_temp* values = *T* for *brownian/sphere* and *brownian/asphere* - *T* = rotation temperature, which can be different then *temp* when out of equilibrium - *planar_rotation* values = None (constrains rotational diffusion to be in xy plane if in 3D) + *rng* value = *uniform* or *gaussian* or *none* + *uniform* = use uniform random number generator + *gaussian* = use gaussian random number generator + *none* = turn off noise + *dipole* value = *mux* and *muy* and *muz* for *brownian/asphere* + *mux*, *muy*, and *muz* = update orientation of dipole having direction (*mux*,*muy*,*muz*) in body frame of rigid body + *gamma_r_eigen* values = *gr1* and *gr2* and *gr3* for *brownian/asphere* + *gr1*, *gr2*, and *gr3* = diagonal entries of body frame rotational friction tensor + *gamma_r* values = *gr* for *brownian/sphere* + *gr* = magnitude of the (isotropic) rotational friction tensor + *gamma_t_eigen* values = *gt1* and *gt2* and *gt3* for *brownian/asphere* + *gt1*, *gt2*, and *gt3* = diagonal entries of body frame translational friction tensor + *gamma_t* values = *gt* for *brownian* and *brownian/sphere* + *gt* = magnitude of the (isotropic) translational friction tensor + *rotation_temp* values = *T* for *brownian/sphere* and *brownian/asphere* + *T* = rotation temperature, which can be different then *temp* when out of equilibrium + *planar_rotation* values = none (constrains rotational diffusion to be in xy plane if in 3D) Examples """""""" @@ -71,9 +71,10 @@ positions is .. math:: - d\mathbf{r} = \mathbf{\gamma}_t^{-1}\mathbf{F}dt+\sqrt{2k_BT}\mathbf{\gamma}_t^{-1/2}d\mathbf{W}_t, + d\mathbf{r} = \boldsymbol{\gamma}_t^{-1}\mathbf{F}dt + + \sqrt{2k_B T}\boldsymbol{\gamma}_t^{-1/2}d\mathbf{W}_t, -in the lab-frame (i.e. :math:`\mathbf{\gamma}_t` is not diagonal, but +in the lab-frame (i.e., :math:`\boldsymbol{\gamma}_t` is not diagonal, but only depends on orientation and so the noise is still additive). The rotational motion for the spherical and ellipsoidal particles is not @@ -114,19 +115,20 @@ the quaternion .. math:: - \mathbf{q}(t+dt) = \frac{\mathbf{q}(t) + d\mathbf{q}}{|\mathbf{q}(t) + d\mathbf{q}|} + \mathbf{q}(t+dt) = \frac{\mathbf{q}(t) + d\mathbf{q}}{\lVert\mathbf{q}(t) + d\mathbf{q}\rVert} which correctly reproduces a Boltzmann distribution of orientations and rotational -diffusion moments (see :ref:`(Ilie) `) when the quaternion step given by +diffusion moments [see :ref:`(Ilie) `] when the quaternion step given by .. math:: d\mathbf{q} = \mathbf{\Psi}\mathbf{\omega}dt -where :math:`\mathbf{Psi}` has rows :math:`(-q_1,-q_2,-q_3)`, :math:`(q_0,-q_3,q_2)`, -:math:`(q_3,q_0,-q_1)`, and :math:`(-q_2,q_1,q_0)`. :math:`\mathbf{\omega}` is -evaluated in the body frame of reference where the friction tensor is diagonal. -See :ref:`(Delong) ` for more details of a similar algorithm. +where :math:`\boldsymbol{\Psi}` has rows :math:`(-q_1,-q_2,-q_3)`, +:math:`(q_0,-q_3,q_2)`, :math:`(q_3,q_0,-q_1)`, and :math:`(-q_2,q_1,q_0)`. +:math:`\mathbf{\omega}` is evaluated in the body frame of reference where the +friction tensor is diagonal. See :ref:`(Delong) ` for more details of +a similar algorithm. --------- @@ -136,11 +138,11 @@ See :ref:`(Delong) ` for more details of a similar algorithm. This integrator does not by default assume a relationship between the rotational and translational friction tensors, though such a relationship should exist in the case of no-slip boundary conditions - between the particles and the surrounding (implicit) solvent. E.g. in - the case of spherical particles, the condition + between the particles and the surrounding (implicit) solvent. For example, + in the case of spherical particles, the condition :math:`\gamma_t=3\gamma_r/\sigma^2` must be explicitly accounted for by setting *gamma_t* to 3x and *gamma_r* to x (where :math:`\sigma` - is the spherical diameter). A similar (though more complex) + is the sphere's diameter). A similar (though more complex) relationship holds for ellipsoids and rod-like particles. The translational diffusion and rotational diffusion are given by *temp/gamma_t* and *rotation_temp/gamma_r*. @@ -150,7 +152,7 @@ See :ref:`(Delong) ` for more details of a similar algorithm. .. note:: Temperature computation using the :doc:`compute temp ` - will not correctly compute temperature of these overdamped dynamics + will not correctly compute the temperature of these overdamped dynamics since we are explicitly neglecting inertial effects. Furthermore, this time integrator does not add the stochastic terms or viscous terms to the force and/or torques. Rather, they are just added in to @@ -165,7 +167,7 @@ is generated from a uniform distribution (see of noise generation as used in :doc:`fix_langevin `. If the *rng* keyword is used with the *gaussian* value, then the noise -is generated from a gaussian distribution. Typically this added +is generated from a Gaussian distribution. Typically this added complexity is unnecessary, and one should be fine using the *uniform* value for reasons argued in :ref:`(Dunweg) `. @@ -202,7 +204,7 @@ to the xy plane in a 3D simulation. Only compatible with ---------- .. note:: - For style *brownian/asphere*, the components *gamma_t_eigen* =(x,x,x) and + For style *brownian/asphere*, the components *gamma_t_eigen* = (x,x,x) and *gamma_r_eigen* = (y,y,y), the dynamics will replicate those of the *brownian/sphere* style with *gamma_t* = x and *gamma_r* = y. @@ -215,7 +217,6 @@ No information about this fix is written to :doc:`binary restart files `. No global or per-atom quantities are stored by this fix for access by various :doc:`output commands `. - 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 `. From 281a05277bc5a6165fe7161f06e713dce68c1d13 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 10 Oct 2022 15:04:35 -0400 Subject: [PATCH 03/27] use updated pace library and update include statements accordingly --- cmake/Modules/Packages/ML-PACE.cmake | 5 ++--- src/KOKKOS/pair_pace_kokkos.cpp | 10 +++++----- src/KOKKOS/pair_pace_kokkos.h | 2 +- src/ML-PACE/pair_pace.cpp | 8 ++++---- src/ML-PACE/pair_pace_extrapolation.cpp | 8 ++++---- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index 70378fcccb..15b09c88fb 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,5 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2022.09.27.tar.gz" CACHE STRING "URL for PACE evaluator library sources") - -set(PACELIB_MD5 "ad6c8597076479bd55059f5947d51acc" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_URL "https://github.com/akohlmey/lammps-user-pace/archive/refs/heads/refactor-includes.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_MD5 "fa8488211d89dc8c78ee0931bc76dce5" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) diff --git a/src/KOKKOS/pair_pace_kokkos.cpp b/src/KOKKOS/pair_pace_kokkos.cpp index 4ffc971cea..8cd62e5a14 100644 --- a/src/KOKKOS/pair_pace_kokkos.cpp +++ b/src/KOKKOS/pair_pace_kokkos.cpp @@ -29,11 +29,11 @@ #include "neighbor_kokkos.h" #include "neigh_request.h" -#include "ace_c_basis.h" -#include "ace_evaluator.h" -#include "ace_recursive.h" -#include "ace_version.h" -#include "ace_radial.h" +#include "ace-evaluator/ace_c_basis.h" +#include "ace-evaluator/ace_evaluator.h" +#include "ace-evaluator/ace_recursive.h" +#include "ace-evaluator/ace_version.h" +#include "ace-evaluator/ace_radial.h" #include namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_pace_kokkos.h b/src/KOKKOS/pair_pace_kokkos.h index bb476dc8bb..6cab23b8dc 100644 --- a/src/KOKKOS/pair_pace_kokkos.h +++ b/src/KOKKOS/pair_pace_kokkos.h @@ -24,7 +24,7 @@ PairStyle(pace/kk/host,PairPACEKokkos); #define LMP_PAIR_PACE_KOKKOS_H #include "pair_pace.h" -#include "ace_radial.h" +#include "ace-evaluator/ace_radial.h" #include "kokkos_type.h" #include "pair_kokkos.h" diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index a08d6d9cdc..2520f5c0a4 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -41,10 +41,10 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, #include #include -#include "ace_c_basis.h" -#include "ace_evaluator.h" -#include "ace_recursive.h" -#include "ace_version.h" +#include "ace-evaluator/ace_c_basis.h" +#include "ace-evaluator/ace_evaluator.h" +#include "ace-evaluator/ace_recursive.h" +#include "ace-evaluator/ace_version.h" namespace LAMMPS_NS { struct ACEImpl { diff --git a/src/ML-PACE/pair_pace_extrapolation.cpp b/src/ML-PACE/pair_pace_extrapolation.cpp index 92fc8a7812..b9a673eb25 100644 --- a/src/ML-PACE/pair_pace_extrapolation.cpp +++ b/src/ML-PACE/pair_pace_extrapolation.cpp @@ -39,10 +39,10 @@ Copyright 2022 Yury Lysogorskiy^1, Anton Bochkarev^1, Matous Mrovec^1, Ralf Drau #include #include -#include "ace_b_basis.h" -#include "ace_b_evaluator.h" -#include "ace_recursive.h" -#include "ace_version.h" +#include "ace/ace_b_basis.h" +#include "ace/ace_b_evaluator.h" +#include "ace-evaluator/ace_recursive.h" +#include "ace-evaluator/ace_version.h" namespace LAMMPS_NS { struct ACEALImpl { From 3607fd766b15550fa18f70d0a2c2c6664a8c03e6 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Thu, 13 Oct 2022 14:42:10 -0500 Subject: [PATCH 04/27] Missing key word in fix/ave/chunk docs, edits to bond_coeff docs --- doc/src/bond_coeff.rst | 2 +- doc/src/fix_ave_chunk.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/bond_coeff.rst b/doc/src/bond_coeff.rst index f5b7f01e38..86e2fa63e1 100644 --- a/doc/src/bond_coeff.rst +++ b/doc/src/bond_coeff.rst @@ -21,7 +21,7 @@ Examples bond_coeff 5 80.0 1.2 bond_coeff * 30.0 1.5 1.0 1.0 bond_coeff 1*4 30.0 1.5 1.0 1.0 - bond_coeff 1 harmonic 200.0 1.0 (for bond_style hybrid) + bond_coeff 1 harmonic 200.0 1.0 # (for bond_style hybrid) labelmap bond 5 carbonyl bond_coeff carbonyl 80.0 1.2 diff --git a/doc/src/fix_ave_chunk.rst b/doc/src/fix_ave_chunk.rst index 354c8d8e8b..4988064766 100644 --- a/doc/src/fix_ave_chunk.rst +++ b/doc/src/fix_ave_chunk.rst @@ -31,7 +31,7 @@ Syntax v_name = per-atom vector calculated by an atom-style variable with name * zero or more keyword/arg pairs may be appended -* keyword = *norm* or *ave* or *bias* or *adof* or *cdof* or *file* or *overwrite* or *title1* or *title2* or *title3* +* keyword = *norm* or *ave* or *bias* or *adof* or *cdof* or *file* or *overwrite* or *format* or *title1* or *title2* or *title3* .. parsed-literal:: From 3703af988781bf1880c15f8a58d5663fc49f9821 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Thu, 13 Oct 2022 14:48:26 -0500 Subject: [PATCH 05/27] Missing keyword in fix_ave_histo doc --- doc/src/fix_ave_histo.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_ave_histo.rst b/doc/src/fix_ave_histo.rst index e915526aa7..8bb66f0615 100644 --- a/doc/src/fix_ave_histo.rst +++ b/doc/src/fix_ave_histo.rst @@ -35,7 +35,7 @@ Syntax v_name[I] = value calculated by a vector-style variable with name, I can include wildcard (see below) * zero or more keyword/arg pairs may be appended -* keyword = *mode* or *file* or *ave* or *start* or *beyond* or *overwrite* or *title1* or *title2* or *title3* +* keyword = *mode* or *kind* or *file* or *ave* or *start* or *beyond* or *overwrite* or *title1* or *title2* or *title3* .. parsed-literal:: From 70fd789b4ce0cb558d1fcd5b7600bd459072bd89 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Thu, 13 Oct 2022 14:51:30 -0500 Subject: [PATCH 06/27] missing format keyword in fix ave/time doc --- doc/src/fix_ave_time.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_ave_time.rst b/doc/src/fix_ave_time.rst index 0308ecc92a..aa82e676ea 100644 --- a/doc/src/fix_ave_time.rst +++ b/doc/src/fix_ave_time.rst @@ -28,7 +28,7 @@ Syntax v_name[I] = value calculated by a vector-style variable with name, I can include wildcard (see below) * zero or more keyword/arg pairs may be appended -* keyword = *mode* or *file* or *ave* or *start* or *off* or *overwrite* or *title1* or *title2* or *title3* +* keyword = *mode* or *file* or *ave* or *start* or *off* or *overwrite* or *format* or *title1* or *title2* or *title3* .. parsed-literal:: From edcdedc5747461099a56e667650ceef7c249da25 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Thu, 13 Oct 2022 19:20:08 -0500 Subject: [PATCH 07/27] made keyword lists and descriptions consistent for all fix styles --- doc/src/fix_brownian.rst | 4 ++-- doc/src/fix_colvars.rst | 2 +- doc/src/fix_deposit.rst | 2 +- doc/src/fix_imd.rst | 2 +- doc/src/fix_langevin.rst | 2 +- doc/src/fix_lb_fluid.rst | 3 ++- doc/src/fix_modify.rst | 2 +- doc/src/fix_npt_cauchy.rst | 2 +- doc/src/fix_pour.rst | 2 +- doc/src/fix_rigid.rst | 7 ++++++- doc/src/fix_viscosity.rst | 2 +- doc/src/fix_wall.rst | 2 +- doc/src/fix_wall_piston.rst | 6 +++++- 13 files changed, 24 insertions(+), 14 deletions(-) diff --git a/doc/src/fix_brownian.rst b/doc/src/fix_brownian.rst index 6b65100375..c3b97446d2 100644 --- a/doc/src/fix_brownian.rst +++ b/doc/src/fix_brownian.rst @@ -40,9 +40,9 @@ Syntax *gamma_t_eigen* values = *gt1* and *gt2* and *gt3* for *brownian/asphere* *gt1*, *gt2*, and *gt3* = diagonal entries of body frame translational friction tensor *gamma_t* values = *gt* for *brownian* and *brownian/sphere* - *gt* = magnitude of the (isotropic) translational friction tensor + *gt* = magnitude of the (isotropic) translational friction tensor *rotation_temp* values = *T* for *brownian/sphere* and *brownian/asphere* - *T* = rotation temperature, which can be different then *temp* when out of equilibrium + *T* = rotation temperature, which can be different then *temp* when out of equilibrium *planar_rotation* values = none (constrains rotational diffusion to be in xy plane if in 3D) Examples diff --git a/doc/src/fix_colvars.rst b/doc/src/fix_colvars.rst index 21b235cb6b..ec7b33ce51 100644 --- a/doc/src/fix_colvars.rst +++ b/doc/src/fix_colvars.rst @@ -13,7 +13,7 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * colvars = style name of this fix command * configfile = the configuration file for the colvars module -* keyword = *input* or *output* or *seed* or *tstat* +* keyword = *input* or *output* or *seed* or *unwrap* or *tstat* .. parsed-literal:: diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index ad3c37b24c..cf28509f5e 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -17,7 +17,7 @@ Syntax * M = insert a single atom or molecule every M steps * seed = random # seed (positive integer) * one or more keyword/value pairs may be appended to args -* keyword = *region* or *id* or *global* or *local* or *near* or *gaussian* or *attempt* or *rate* or *vx* or *vy* or *vz* or *mol* or *rigid* or *shake* or *units* +* keyword = *region* or *id* or *global* or *local* or *near* or *gaussian* or *attempt* or *rate* or *vx* or *vy* or *vz* or *target* or *mol* or *molfrac* or *rigid* or *shake* or *orient* or *units* .. parsed-literal:: diff --git a/doc/src/fix_imd.rst b/doc/src/fix_imd.rst index e29da08c4c..cb1831d174 100644 --- a/doc/src/fix_imd.rst +++ b/doc/src/fix_imd.rst @@ -13,7 +13,7 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * imd = style name of this fix command * port = port number on which the fix listens for an IMD client -* keyword = *unwrap* or *fscale* or *trate* +* keyword = *unwrap* or *fscale* or *trate* or *nowait* .. parsed-literal:: diff --git a/doc/src/fix_langevin.rst b/doc/src/fix_langevin.rst index 50c1489d7c..396df2b926 100644 --- a/doc/src/fix_langevin.rst +++ b/doc/src/fix_langevin.rst @@ -20,7 +20,7 @@ Syntax * damp = damping parameter (time units) * seed = random number seed to use for white noise (positive integer) * zero or more keyword/value pairs may be appended -* keyword = *angmom* or *omega* or *scale* or *tally* or *zero* +* keyword = *angmom* or *gjf* or *omega* or *scale* or *tally* or *zero* .. parsed-literal:: diff --git a/doc/src/fix_lb_fluid.rst b/doc/src/fix_lb_fluid.rst index 0191f14b1c..5f20bb10b1 100644 --- a/doc/src/fix_lb_fluid.rst +++ b/doc/src/fix_lb_fluid.rst @@ -16,7 +16,7 @@ Syntax * viscosity = the fluid viscosity (units of mass/(time\*length)). * density = the fluid density. * zero or more keyword/value pairs may be appended -* keyword = *dx* or *dm* or *noise* or *stencil* or *read_restart* or *write_restart* or *zwall_velocity* or *pressurebcx* or *bodyforce* or *D3Q19* or *dumpxdmf* or *dof* or *scaleGamma* or *a0* or *npits* or *wp* or *sw* +* keyword = *dx* or *dm* or *noise* or *stencil* or *read_restart* or *write_restart* or *zwall_velocity* or *pressurebcx* or *bodyforce* or *D3Q19* or *dumpxdmf* or *linearInit* or *dof* or *scaleGamma* or *a0* or *npits* or *wp* or *sw* .. parsed-literal:: @@ -36,6 +36,7 @@ Syntax N = output the force and torque every N timesteps file = output file name timeI = 1 (use simulation time to index xdmf file), 0 (use output frame number to index xdmf file) + *linearInit* values = none = initialize density and velocity using linear interpolation (default is uniform density, no velocities) *dof* values = dof = specify the number of degrees of freedom for temperature calculation *scaleGamma* values = type gammaFactor type = atom type (1-N) diff --git a/doc/src/fix_modify.rst b/doc/src/fix_modify.rst index e0cf3a34c7..f4c5be6b12 100644 --- a/doc/src/fix_modify.rst +++ b/doc/src/fix_modify.rst @@ -12,7 +12,7 @@ Syntax * fix-ID = ID of the fix to modify * one or more keyword/value pairs may be appended -* keyword = *bodyforces* or *colname* or *dynamic/dof* or *energy* or *press* or *respa* or *temp* or *virial* +* keyword = *bodyforces* or *colname* or *dynamic/dof* or *energy* or *press* or *respa* or *temp* or *virial* .. parsed-literal:: diff --git a/doc/src/fix_npt_cauchy.rst b/doc/src/fix_npt_cauchy.rst index 6ff3dffba3..6bff29f9dd 100644 --- a/doc/src/fix_npt_cauchy.rst +++ b/doc/src/fix_npt_cauchy.rst @@ -13,7 +13,7 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * style_name = *npt/cauchy* * one or more keyword/value pairs may be appended -* keyword = *temp* or *iso* or *aniso* or *tri* or *x* or *y* or *z* or *xy* or *yz* or *xz* or *couple* or *tchain* or *pchain* or *mtk* or *tloop* or *ploop* or *nreset* or *drag* or *dilate* or *scalexy* or *scaleyz* or *scalexz* or *flip* or *fixedpoint* +* keyword = *temp* or *iso* or *aniso* or *tri* or *x* or *y* or *z* or *xy* or *yz* or *xz* or *couple* or *tchain* or *pchain* or *mtk* or *tloop* or *ploop* or *nreset* or *drag* or *dilate* or *scalexy* or *scaleyz* or *scalexz* or *flip* or *alpha* or *continue* or *fixedpoint* .. parsed-literal:: diff --git a/doc/src/fix_pour.rst b/doc/src/fix_pour.rst index 742648ac76..6ef18ea800 100644 --- a/doc/src/fix_pour.rst +++ b/doc/src/fix_pour.rst @@ -16,7 +16,7 @@ Syntax * type = atom type to assign to inserted particles (offset for molecule insertion) * seed = random # seed (positive integer) * one or more keyword/value pairs may be appended to args -* keyword = *region* or *diam* or *vol* or *rate* or *dens* or *vel* or *mol* or *rigid* or *shake* or *ignore* +* keyword = *region* or *diam* or *id* or *vol* or *rate* or *dens* or *vel* or *mol* or *molfrac* or *rigid* or *shake* or *ignore* .. parsed-literal:: diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index 445b86466c..9a3b6e4da3 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -80,7 +80,7 @@ Syntax groupID1, groupID2, ... = list of N group IDs * zero or more keyword/value pairs may be appended -* keyword = *langevin* or *reinit* or *temp* or *iso* or *aniso* or *x* or *y* or *z* or *couple* or *tparam* or *pchain* or *dilate* or *force* or *torque* or *infile* +* keyword = *langevin* or *reinit* or *temp* or *iso* or *aniso* or *x* or *y* or *z* or *couple* or *tparam* or *pchain* or *dilate* or *force* or *torque* or *infile* or *gravity* .. parsed-literal:: @@ -115,6 +115,11 @@ Syntax xflag,yflag,zflag = off/on if component of center-of-mass torque is active *infile* filename filename = file with per-body values of mass, center-of-mass, moments of inertia + *gravity* values = gravity-ID + gravity-ID = ID of fix gravity command to add gravitational forces + +.. + FIXME These don't seem to be included in the source code *mol* value = template-ID template-ID = ID of molecule template specified in a separate :doc:`molecule ` command diff --git a/doc/src/fix_viscosity.rst b/doc/src/fix_viscosity.rst index 204e435d6e..c99196e09b 100644 --- a/doc/src/fix_viscosity.rst +++ b/doc/src/fix_viscosity.rst @@ -17,7 +17,7 @@ Syntax * pdim = *x* or *y* or *z* = direction of momentum transfer * Nbin = # of layers in pdim direction (must be even number) * zero or more keyword/value pairs may be appended -* keyword = *swap* or *target* +* keyword = *swap* or *vtarget* .. parsed-literal:: diff --git a/doc/src/fix_wall.rst b/doc/src/fix_wall.rst index 3028588505..014c89cfd5 100644 --- a/doc/src/fix_wall.rst +++ b/doc/src/fix_wall.rst @@ -70,7 +70,7 @@ Syntax cutoff = distance from wall at which wall-particle interaction is cut off (distance units) * zero or more keyword/value pairs may be appended -* keyword = *units* or *fld* +* keyword = *units* or *fld* or *pbc* .. parsed-literal:: diff --git a/doc/src/fix_wall_piston.rst b/doc/src/fix_wall_piston.rst index af3dece2f5..1237d1ac7c 100644 --- a/doc/src/fix_wall_piston.rst +++ b/doc/src/fix_wall_piston.rst @@ -14,7 +14,7 @@ Syntax * wall/piston = style name of this fix command * face = *zlo* * zero or more keyword/value pairs may be appended -* keyword = *pos* or *vel* or *ramp* or *units* +* keyword = *pos* or *vel* or *ramp* or *temp* or *units* .. parsed-literal:: @@ -32,6 +32,10 @@ Syntax *lattice* = the wall position is defined in lattice units *box* = the wall position is defined in simulation box units +.. + FIXME: There are several "undocumented" key words for this fix: *rough*, + *rampNL1*, *rampNL2*, *rampNL3*, *rampNL4*, and *rampNL5*. + Examples """""""" From e3c78b70ed02f41171ff68d593f79f85b1e8dd00 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Thu, 13 Oct 2022 23:00:13 -0500 Subject: [PATCH 08/27] Fixed remaining discrepancies between lists of keywords and doc of them --- doc/src/compute_displace_atom.rst | 2 +- doc/src/compute_voronoi_atom.rst | 2 +- doc/src/create_atoms.rst | 2 +- doc/src/delete_bonds.rst | 11 +++++++++-- doc/src/kspace_modify.rst | 2 +- doc/src/prd.rst | 2 +- doc/src/processors.rst | 9 ++++----- doc/src/tad.rst | 2 +- doc/src/velocity.rst | 2 +- 9 files changed, 20 insertions(+), 14 deletions(-) diff --git a/doc/src/compute_displace_atom.rst b/doc/src/compute_displace_atom.rst index 5d52ab947d..a2b1d946ae 100644 --- a/doc/src/compute_displace_atom.rst +++ b/doc/src/compute_displace_atom.rst @@ -17,7 +17,7 @@ Syntax .. parsed-literal:: - *replace* arg = name of per-atom variable + *refresh* arg = name of per-atom variable Examples """""""" diff --git a/doc/src/compute_voronoi_atom.rst b/doc/src/compute_voronoi_atom.rst index 19914997a3..274be1b702 100644 --- a/doc/src/compute_voronoi_atom.rst +++ b/doc/src/compute_voronoi_atom.rst @@ -13,7 +13,7 @@ Syntax * ID, group-ID are documented in :doc:`compute ` command * voronoi/atom = style name of this compute command * zero or more keyword/value pairs may be appended -* keyword = *only_group* or *surface* or *radius* or *edge_histo* or *edge_threshold* or *face_threshold* or *neighbors* or *peratom* +* keyword = *only_group* or *occupation* or *surface* or *radius* or *edge_histo* or *edge_threshold* or *face_threshold* or *neighbors* or *peratom* .. parsed-literal:: diff --git a/doc/src/create_atoms.rst b/doc/src/create_atoms.rst index 95d0abd240..8a0cc8812f 100644 --- a/doc/src/create_atoms.rst +++ b/doc/src/create_atoms.rst @@ -28,7 +28,7 @@ Syntax region-ID = create atoms within this region, use NULL for entire simulation box * zero or more keyword/value pairs may be appended -* keyword = *mol* or *basis* or *ratio* or *subset* or *remap* or *var* or *set* or *rotate* or *overlap* or *maxtry* or *units* +* keyword = *mol* or *basis* or *ratio* or *subset* or *remap* or *var* or *set* or *radscale* or *meshmode* or *rotate* or *overlap* or *maxtry* or *units* .. parsed-literal:: diff --git a/doc/src/delete_bonds.rst b/doc/src/delete_bonds.rst index ac2ffb3452..0b30ae5588 100644 --- a/doc/src/delete_bonds.rst +++ b/doc/src/delete_bonds.rst @@ -26,6 +26,13 @@ Syntax * zero or more keywords may be appended * keyword = *any* or *undo* or *remove* or *special* + .. parsed-literal:: + + *any* arg = none = turn off interactions if any atoms are in the group (or on if *undo* is also used) + *undo* arg = none = turn specified bonds on instead of off + *remove* arg = permanently remove bonds that have been turned off + *special* arg = recompute pairwise 1-2, 1-3, and 1-4 lists + Examples """""""" @@ -101,13 +108,13 @@ Several keywords can be appended to the argument list to alter the default behaviors. The *any* keyword changes the requirement that all atoms in the bond -(angle, etc) must be in the specified group in order to turn off the +(angle, etc.) must be in the specified group in order to turn off the interaction. Instead, if any of the atoms in the interaction are in the specified group, it will be turned off (or on if the *undo* keyword is used). The *undo* keyword inverts the delete_bonds command so that the -specified bonds, angles, etc are turned on if they are currently +specified bonds, angles, etc. are turned on if they are currently turned off. This means a negative value is toggled to positive. For example, for style *angle*, if *type* is specified as 2, then all angles with current type = :math:`-2` are reset to type = :math:`2`. diff --git a/doc/src/kspace_modify.rst b/doc/src/kspace_modify.rst index b1d6efa86c..3c6fccc285 100644 --- a/doc/src/kspace_modify.rst +++ b/doc/src/kspace_modify.rst @@ -11,7 +11,7 @@ Syntax kspace_modify keyword value ... * one or more keyword/value pairs may be listed -* keyword = *collective* or *compute* or *cutoff/adjust* or *diff* or *disp/auto* or *fftbench* or *force/disp/kspace* or *force/disp/real* or *force* or *gewald/disp* or *gewald* or *kmax/ewald* or *mesh* or *minorder* or *mix/disp* or *order/disp* or *order* or *overlap* or *scafacos* or *slab* or *splittol* +* keyword = *collective* or *compute* or *cutoff/adjust* or *diff* or *disp/auto* or *fftbench* or *force/disp/kspace* or *force/disp/real* or *force* or *gewald/disp* or *gewald* or *kmax/ewald* or *mesh* or *minorder* or *mix/disp* or *order/disp* or *order* or *overlap* or *scafacos* or *slab* or *splittol* or *wire* .. parsed-literal:: diff --git a/doc/src/prd.rst b/doc/src/prd.rst index 758aa4f570..0f6e9e481f 100644 --- a/doc/src/prd.rst +++ b/doc/src/prd.rst @@ -18,7 +18,7 @@ Syntax * compute-ID = ID of the compute used for event detection * random_seed = random # seed (positive integer) * zero or more keyword/value pairs may be appended -* keyword = *min* or *temp* or *vel* +* keyword = *min* or *temp* or *vel* or *time* .. parsed-literal:: diff --git a/doc/src/processors.rst b/doc/src/processors.rst index d717fa9b73..e4279c00ea 100644 --- a/doc/src/processors.rst +++ b/doc/src/processors.rst @@ -18,18 +18,17 @@ Syntax *grid* arg = gstyle params ... gstyle = *onelevel* or *twolevel* or *numa* or *custom* - onelevel params = none - twolevel params = Nc Cx Cy Cz + *onelevel* params = none + *twolevel* params = Nc Cx Cy Cz Nc = number of cores per node Cx,Cy,Cz = # of cores in each dimension of 3d sub-grid assigned to each node - numa params = none - custom params = infile + *numa* params = none + *custom* params = infile infile = file containing grid layout *map* arg = *cart* or *cart/reorder* or *xyz* or *xzy* or *yxz* or *yzx* or *zxy* or *zyx* cart = use MPI_Cart() methods to map processors to 3d grid with reorder = 0 cart/reorder = use MPI_Cart() methods to map processors to 3d grid with reorder = 1 xyz,xzy,yxz,yzx,zxy,zyx = map processors to 3d grid in IJK ordering - *numa* arg = none *part* args = Psend Precv cstyle Psend = partition # (1 to Np) which will send its processor layout Precv = partition # (1 to Np) which will recv the processor layout diff --git a/doc/src/tad.rst b/doc/src/tad.rst index b36ad2e431..cc6d52d415 100644 --- a/doc/src/tad.rst +++ b/doc/src/tad.rst @@ -18,7 +18,7 @@ Syntax * tmax = reciprocal of lowest expected pre-exponential factor (time units) * compute-ID = ID of the compute used for event detection * zero or more keyword/value pairs may be appended -* keyword = *min* or *neb* or *min_style* or *neb_style* or *neb_log* +* keyword = *min* or *neb* or *neb_style* or *neb_step* or *neb_log* .. parsed-literal:: diff --git a/doc/src/velocity.rst b/doc/src/velocity.rst index cd283de399..c1afaf2edc 100644 --- a/doc/src/velocity.rst +++ b/doc/src/velocity.rst @@ -33,7 +33,7 @@ Syntax *angular* = zero the angular momentum * zero or more keyword/value pairs may be appended -* keyword = *dist* or *sum* or *mom* or *rot* or *temp* or *bias* or *loop* or *units* +* keyword = *dist* or *sum* or *mom* or *rot* or *temp* or *bias* or *loop* or *rigid* or *units* .. parsed-literal:: From e37672e7de846cd739f9647fc587a81b58b61d31 Mon Sep 17 00:00:00 2001 From: Evan Weinberg Date: Fri, 14 Oct 2022 10:45:59 -0400 Subject: [PATCH 09/27] Abstracted Tersoff potential calculation into a stand-alone function; used it to create MDRangePolicy and TeamPolicy versions of Tersoff with more tunable -> higher performance --- src/KOKKOS/pair_tersoff_kokkos.cpp | 80 ++++++++++++++++++++++++++++-- src/KOKKOS/pair_tersoff_kokkos.h | 29 +++++++++++ 2 files changed, 105 insertions(+), 4 deletions(-) diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 0e78fa785c..05b2d2c48a 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -49,6 +49,19 @@ using namespace MathConst; #define KOKKOS_CUDA_MAX_THREADS 256 #define KOKKOS_CUDA_MIN_BLOCKS 8 +// A point of optimization with the pairwise force calculation is to hand-tune +// the number of atoms per team, which cannot be done (yet?) with the standard +// 1-d RangePolicy. A more intuitive way to do this is with team parallelism, +// where you specify the team size, but this currently leads to a regression +// on CUDA due to the way Kokkos handles cache carveout preferences. This is +// being worked on in https://github.com/kokkos/kokkos/pull/4295 . Until that is +// worked out/merged, the workaround is using a Rank 2 MDRangePolicy, where the +// second dimension is trivially of length 1, because "team" == block sizes can +// be explicitly set with MDRangePolicies. It has been confirmed that the performance +// regression from using a TeamPolicy goes away after addressing the cache carveout. +// This is a convenience flag to make it easy to toggle team parallelism later. +#define KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + /* ---------------------------------------------------------------------- */ template @@ -232,8 +245,17 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) } else if (neighflag == HALFTHREAD) { if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + else { +#ifdef KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + Kokkos::parallel_for(Kokkos::MDRangePolicy, Kokkos::LaunchBounds, + TagPairTersoffCompute >({0,0},{inum,1},{block_size_compute_tersoff_force,1}),*this); +#else + int team_count = (inum + block_size_compute_tersoff_force - 1) / block_size_compute_tersoff_force; + Kokkos::TeamPolicy, + TagPairTersoffCompute> team_policy(team_count, block_size_compute_tersoff_force); + Kokkos::parallel_for(team_policy, *this); +#endif + } ev_all += ev; } @@ -311,7 +333,7 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeShortNeigh, template template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii, EV_FLOAT& ev) const { +void PairTersoffKokkos::tersoff_compute(const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -477,14 +499,64 @@ void PairTersoffKokkos::operator()(TagPairTersoffCompute +template +KOKKOS_INLINE_FUNCTION +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii, EV_FLOAT& ev) const { + this->template tersoff_compute(ii, ev); +} + template template KOKKOS_INLINE_FUNCTION void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairTersoffCompute(), ii, ev); + this->template tersoff_compute(ii, ev); } +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii, const int&, EV_FLOAT& ev) const { + this->template tersoff_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii, const int&) const { + EV_FLOAT ev; + this->template tersoff_compute(ii, ev); +} + +// TeamPolicy versions +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const typename Kokkos::TeamPolicy >::member_type &team, EV_FLOAT& ev) const { + + const int ii = team.league_rank() * block_size_compute_tersoff_energy + team.team_rank(); + + if (ii < inum) + this->template tersoff_compute(ii, ev); + +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const typename Kokkos::TeamPolicy >::member_type &team) const { + + const int ii = team.league_rank() * block_size_compute_tersoff_force + team.team_rank(); + + if (ii < inum) { + EV_FLOAT ev; + this->template tersoff_compute(ii, ev); + } + +} + + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_tersoff_kokkos.h b/src/KOKKOS/pair_tersoff_kokkos.h index ecd54a77fa..70a656b0a8 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.h +++ b/src/KOKKOS/pair_tersoff_kokkos.h @@ -43,12 +43,19 @@ class PairTersoffKokkos : public PairTersoff { typedef ArrayTypes AT; typedef EV_FLOAT value_type; + // Static blocking size for PairTersoffCompute, EVFLAG == 0 + static constexpr int block_size_compute_tersoff_force = 128; + // EVFLAG == 1, intentionally different due to how Kokkos implements + // reductions vs simple parallel for + static constexpr int block_size_compute_tersoff_energy = 256; + PairTersoffKokkos(class LAMMPS *); ~PairTersoffKokkos() override; void compute(int, int) override; void coeff(int, char **) override; void init_style() override; + // Range Policy versions template KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffCompute, const int&, EV_FLOAT&) const; @@ -57,9 +64,31 @@ class PairTersoffKokkos : public PairTersoff { KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffCompute, const int&) const; + // MDRangePolicy versions + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffCompute, const int&, const int&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffCompute, const int&, const int&) const; + + // TeamPolicy versions + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffCompute, const typename Kokkos::TeamPolicy >::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffCompute, const typename Kokkos::TeamPolicy >::member_type&) const; + KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffComputeShortNeigh, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void tersoff_compute(const int&, EV_FLOAT&) const; + KOKKOS_INLINE_FUNCTION double ters_fc_k(const Param& param, const F_FLOAT &r) const; From 7550fdc86226d0a994239ba5e32af2ca4c00d387 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Fri, 14 Oct 2022 15:28:55 -0500 Subject: [PATCH 10/27] Sphinx conf edit so PDF ToC entries w/ subsections >= 100 work --- doc/utils/sphinx-config/conf.py.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/utils/sphinx-config/conf.py.in b/doc/utils/sphinx-config/conf.py.in index c94fcaf1d2..501799608e 100644 --- a/doc/utils/sphinx-config/conf.py.in +++ b/doc/utils/sphinx-config/conf.py.in @@ -288,6 +288,14 @@ latex_elements = { 'preamble': r''' \setcounter{tocdepth}{2} \renewcommand{\AA}{\mbox{\textrm{\r{A}}}} +% Make ToC number fields wider to accommodate sections with >= 100 subsections +% or >= 10 subsections with >= 10 subsubsections +\makeatletter +\renewcommand*{\sphinxtableofcontentshook}{% + \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{3.1em}} + \renewcommand*\l@subsection{\@dottedtocline{2}{4.6em}{4.5em}} +} +\makeatother ''' } From 3d0a7d774a00132d7a0315aefcafcbc0a5ca7ffc Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Fri, 14 Oct 2022 16:04:07 -0500 Subject: [PATCH 11/27] Updated docs for fix bocs to match source code and include math --- doc/src/fix_bocs.rst | 55 ++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/doc/src/fix_bocs.rst b/doc/src/fix_bocs.rst index 018418c538..c4e9a04fb3 100644 --- a/doc/src/fix_bocs.rst +++ b/doc/src/fix_bocs.rst @@ -6,17 +6,28 @@ fix bocs command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS - fix ID group-ID bocs keyword values ... + fix ID group-ID bocs keyword values ... + +* ID, group-ID are documented in :doc:`fix ` command +* bocs = style name of this fix command +* two or more keyword/value pairs may be appended +* keyword = *temp* or *cgiso* or *tchain* or *pchain* or *mtk* or *tloop* or *ploop* + + .. parsed-literal:: - keyword = *temp* or *cgiso* or *analytic* or *linear_spline* or *cubic_spline* *temp* values = Tstart Tstop Tdamp - *cgiso* values = Pstart Pstop Pdamp - *basis set* - *analytic* values = V_avg N_particles N_coeff Coeff_1 Coeff_2 ... Coeff_N - *linear_spline* values = input_filename - *cubic_spline* values = input_filename + *cgiso* values = Pstart Pstop Pdamp basis_set args + basis_set = *analytic* or *linear_spline* or *cubic_spline* + *analytic* args = V_avg N_particles N_coeff Coeff_1 Coeff_2 ... Coeff_N + *linear_spline* args = input_filename + *cubic_spline* args = input_filename + *tchain* value = N = length of thermostat chain (1 = single thermostat) + *pchain* value = N = length of thermostat on barostat (0 = no thermostat) + *mtk* value = *yes* or *no* = add MTK adjustment term or not + *tloop* value = M = number of sub-cycles to perform on thermostat + *ploop* value = M = number of sub-cycles to perform on barostat Examples """""""" @@ -24,25 +35,24 @@ Examples .. code-block:: LAMMPS fix 1 all bocs temp 300.0 300.0 100.0 cgiso 0.986 0.986 1000.0 analytic 66476.015 968 2 245030.10 8962.20 - fix 1 all bocs temp 300.0 300.0 100.0 cgiso 0.986 0.986 1000.0 cubic_spline input_Fv.dat - thermo_modify press 1_press Description """"""""""" These commands incorporate a pressure correction as described by -Dunn and Noid in :ref:`(Dunn1) ` to the standard MTTK -barostat by Martyna et. al. in :ref:`(Martyna) ` . -The first half of the command mimics a standard fix npt command: +Dunn and Noid :ref:`(Dunn1) ` to the standard MTK +barostat by Martyna et al. :ref:`(Martyna) ` . +The first half of the command mimics a standard :doc:`fix npt ` +command: .. code-block:: LAMMPS fix 1 all bocs temp Tstart Tstop Tcoupl cgiso Pstart Pstop Pdamp The two differences are replacing *npt* with *bocs*, and replacing -*iso*\ /\ *aniso*\ /\ *etc* with *cgiso*\ . +*iso*\ /\ *aniso*\ /\ etc. with *cgiso*\ . The rest of the command details what form you would like to use for the pressure correction equation. The choices are: *analytic*, *linear_spline*, or *cubic_spline*. @@ -58,9 +68,9 @@ as a function of volume. The file must be formatted so each line has: Note both the COMMA and the SPACE separating the volume's value and its corresponding pressure correction. The volumes in the file must be uniformly spaced. Both the volumes and the pressure corrections -should be provided in the proper units, e.g. if you are using *units real*, -the volumes should all be in cubic Angstroms, and the pressure corrections -should all be in atmospheres. Furthermore, the table should start/end at a +should be provided in the proper units (e.g., if you are using *units real*, +the volumes should all be in :math:`\mathrm{\mathring{A}}^3` and the pressure +corrections should all be in atm). Furthermore, the table should start/end at a volume considerably smaller/larger than you expect your system to sample during the simulation. If the system ever reaches a volume outside of the range provided, the simulation will stop. @@ -71,9 +81,10 @@ With the *analytic* option, the arguments are as follows: ... analytic V_avg N_particles N_coeff Coeff_1 Coeff_2 ... Coeff_N -Note that *V_avg* and *Coeff_i* should all be in the proper units, e.g. if you -are using *units real*, *V_avg* should be in cubic Angstroms, and the -coefficients should all be in atmospheres \* cubic Angstroms. +Note that *V_avg* and *Coeff_i* should all be in the proper units (e.g., if you +are using *units real*, *V_avg* should be in :math:`\mathrm{\mathring{A}^3}` +and the coefficients should all be in +:math:`\mathrm{atm}\cdot\mathrm{\mathring{A}^3}`\ ). ---------- @@ -122,7 +133,7 @@ are written to a file every so often. In order to have LAMMPS report the modified pressure, you must include the *thermo_modify* command given in the examples. For the last argument in the command, you should put XXXX_press, where XXXX is the ID given to the fix bocs command (in the -example, the ID of the fix bocs command is 1 ). +example, the ID of the fix bocs command is 1). This fix is part of the BOCS package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. @@ -132,7 +143,7 @@ Further information For more details about the pressure correction and the entire BOCS software package, visit the `BOCS package on GitHub `_ and read the release -paper by Dunn et. al. :ref:`(Dunn2) ` . +paper by Dunn et al. :ref:`(Dunn2) ` . .. _bocsgithub: https://github.com/noid-group/BOCS From e346151271c65c56a34d32f52ff5281d538e57ae Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Fri, 14 Oct 2022 17:40:22 -0500 Subject: [PATCH 12/27] Updated docs for fixes bond/break, bond/create, and bond/react for math/etc. --- doc/src/fix_bond_break.rst | 64 ++++----- doc/src/fix_bond_create.rst | 126 ++++++++-------- doc/src/fix_bond_react.rst | 280 +++++++++++++++++++----------------- 3 files changed, 241 insertions(+), 229 deletions(-) diff --git a/doc/src/fix_bond_break.rst b/doc/src/fix_bond_break.rst index ba12e154c5..7aa620a8f6 100644 --- a/doc/src/fix_bond_break.rst +++ b/doc/src/fix_bond_break.rst @@ -6,7 +6,7 @@ fix bond/break command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID bond/break Nevery bondtype Rmax keyword values ... @@ -15,7 +15,7 @@ Syntax * Nevery = attempt bond breaking every this many steps * bondtype = type of bonds to break * Rmax = bond longer than Rmax can break (distance units) -* zero or more keyword/value pairs may be appended to args +* zero or more keyword/value pairs may be appended * keyword = *prob* .. parsed-literal:: @@ -43,42 +43,42 @@ pair of atoms computed by the :doc:`bond_style ` command. Once the bond is broken it will be permanently deleted, as will all angle, dihedral, and improper interactions that bond is part of. -This is different than a :doc:`pairwise ` bond-order +This is different than a :doc:`pair-wise ` bond-order potential such as Tersoff or AIREBO which infers bonds and many-body interactions based on the current geometry of a small cluster of atoms and effectively creates and destroys bonds and higher-order many-body interactions from timestep to timestep as atoms move. A check for possible bond breakage is performed every *Nevery* -timesteps. If two bonded atoms I,J are further than a distance *Rmax* -of each other, if the bond is of type *bondtype*, and if both I and J -are in the specified fix group, then I,J is labeled as a "possible" -bond to break. +timesteps. If two bonded atoms :math:`i` and :math:`j` are farther than the +distance *Rmax* from each other, the bond is of type *bondtype*, and both +:math:`i` and :math:`j` are in the specified fix group, then the bond between +:math:`i` and :math:`j` is labeled as a "possible" bond to break. If several bonds involving an atom are stretched, it may have multiple possible bonds to break. Every atom checks its list of possible bonds to break and labels the longest such bond as its "sole" bond to break. -After this is done, if atom I is bonded to atom J in its sole bond, -and atom J is bonded to atom I in its sole bond, then the I,J bond is -"eligible" to be broken. +After this is done, if atom :math:`i` is bonded to atom :math:`j` in its sole +bond, and atom :math:`j` is bonded to atom :math:`j` in its sole bond, then the +bond between :math:`i` and :math:`j` is "eligible" to be broken. Note that these rules mean an atom will only be part of at most one -broken bond on a given timestep. It also means that if atom I chooses -atom J as its sole partner, but atom J chooses atom K is its sole -partner (due to Rjk > Rij), then this means atom I will not be part of -a broken bond on this timestep, even if it has other possible bond -partners. +broken bond on a given time step. It also means that if atom :math:`i` chooses +atom :math:`j` as its sole partner, but atom :math:`j` chooses atom :math:`k` +as its sole partner (because :math:`R_{jk} > R_{ij}`), then this means atom +:math:`I` will not be part of a broken bond on this time step, even if it has +other possible bond partners. The *prob* keyword can effect whether an eligible bond is actually broken. The *fraction* setting must be a value between 0.0 and 1.0. A uniform random number between 0.0 and 1.0 is generated and the -eligible bond is only broken if the random number < fraction. +eligible bond is only broken if the random number is less than *fraction*. When a bond is broken, data structures within LAMMPS that store bond -topology are updated to reflect the breakage. Likewise, if the bond +topologies are updated to reflect the breakage. Likewise, if the bond is part of a 3-body (angle) or 4-body (dihedral, improper) interaction, that interaction is removed as well. These changes -typically affect pairwise interactions between atoms that used to be +typically affect pair-wise interactions between atoms that used to be part of bonds, angles, etc. .. note:: @@ -88,17 +88,17 @@ part of bonds, angles, etc. becomes two molecules due to the broken bond, all atoms in both new molecules retain their original molecule IDs. -Computationally, each timestep this fix operates, it loops over all +Computationally, each time step this fix is invoked, it loops over all the bonds in the system and computes distances between pairs of bonded atoms. It also communicates between neighboring processors to coordinate which bonds are broken. Moreover, if any bonds are broken, -neighbor lists must be immediately updated on the same timestep. This -is to insure that any pairwise interactions that should be turned "on" +neighbor lists must be immediately updated on the same time step. This +is to ensure that any pair-wise interactions that should be turned "on" due to a bond breaking, because they are no longer excluded by the presence of the bond and the settings of the :doc:`special_bonds ` command, will be immediately -recognized. All of these operations increase the cost of a timestep. -Thus you should be cautious about invoking this fix too frequently. +recognized. All of these operations increase the cost of a time step. +Thus, you should be cautious about invoking this fix too frequently. You can dump out snapshots of the current bond topology via the :doc:`dump local ` command. @@ -107,11 +107,11 @@ You can dump out snapshots of the current bond topology via the :doc:`dump local Breaking a bond typically alters the energy of a system. You should be careful not to choose bond breaking criteria that induce a dramatic change in energy. For example, if you define a very stiff - harmonic bond and break it when 2 atoms are separated by a distance - far from the equilibrium bond length, then the 2 atoms will be + harmonic bond and break it when two atoms are separated by a distance + far from the equilibrium bond length, then the two atoms will be dramatically released when the bond is broken. More generally, you may need to thermostat your system to compensate for energy changes - resulting from broken bonds (and angles, dihedrals, impropers). + resulting from broken bonds (as well as angles, dihedrals, and impropers). See the :doc:`Howto ` page on broken bonds for more information on related features in LAMMPS. @@ -124,14 +124,14 @@ 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. -This fix computes two statistics which it stores in a global vector of -length 2, which can be accessed by various :doc:`output commands `. The vector values calculated by this fix -are "intensive". +This fix computes two statistics, which it stores in a global vector of +length 2. This vector can be accessed by various :doc:`output commands +`. The vector values calculated by this fix are "intensive". -These are the 2 quantities: +The two quantities in the global vector are -* (1) # of bonds broken on the most recent breakage timestep -* (2) cumulative # of bonds broken + (1) number of bonds broken on the most recent breakage time step + (2) cumulative number of bonds broken 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 `. diff --git a/doc/src/fix_bond_create.rst b/doc/src/fix_bond_create.rst index c286482f81..bc5e1b83f8 100644 --- a/doc/src/fix_bond_create.rst +++ b/doc/src/fix_bond_create.rst @@ -10,7 +10,7 @@ fix bond/create/angle command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS fix ID group-ID bond/create Nevery itype jtype Rmin bondtype keyword values ... @@ -58,83 +58,84 @@ Description """"""""""" Create bonds between pairs of atoms as a simulation runs according to -specified criteria. This can be used to model cross-linking of +specified criteria. This can be used to model the cross-linking of polymers, the formation of a percolation network, etc. In this context, a bond means an interaction between a pair of atoms computed by the :doc:`bond_style ` command. Once the bond is created it will be permanently in place. Optionally, the creation of a bond -can also create angle, dihedral, and improper interactions that bond +can also create angle, dihedral, and improper interactions that the bond is part of. See the discussion of the *atype*, *dtype*, and *itype* keywords below. -This is different than a :doc:`pairwise ` bond-order -potential such as Tersoff or AIREBO which infers bonds and many-body +This process is different than a :doc:`pair-wise ` bond-order +potential such as Tersoff or AIREBO, which infer bonds and many-body interactions based on the current geometry of a small cluster of atoms -and effectively creates and destroys bonds and higher-order many-body -interactions from timestep to timestep as atoms move. +and effectively create and destroy bonds and higher-order many-body +interactions from time step to time step as the atoms move. -A check for possible new bonds is performed every *Nevery* timesteps. -If two atoms I,J are within a distance *Rmin* of each other, if I is -of atom type *itype*, if J is of atom type *jtype*, if both I and J -are in the specified fix group, if a bond does not already exist -between I and J, and if both I and J meet their respective *maxbond* -requirement (explained below), then I,J is labeled as a "possible" -bond pair. +A check for possible new bonds is performed every *Nevery* time steps. +If two atoms :math:`i` and :math:`j` are within a distance *Rmin* of each +other, atom :math:`i` is of type *itype*, atom :math:`j` is of type *jtype*, +and both :math:`i` and :math:`j` are in the specified fix group, then if a bond +does not already exist between atoms :math:`i` and :math:`j`, and if both +:math:`i` and :math:`j` meet their respective *maxbond* requirements (explained +below), then :math:`i` and :math:`j` are labeled as a "possible" bond pair. If several atoms are close to an atom, it may have multiple possible bond partners. Every atom checks its list of possible bond partners and labels the closest such partner as its "sole" bond partner. After -this is done, if atom I has atom J as its sole partner, and atom J has -atom I as its sole partner, then the I,J bond is "eligible" to be -formed. +this is done, if atom :math:`i` has atom :math:`j` as its sole partner and +atom :math:`j` has atom :math:`i` as its sole partner, then the +:math:`i,j` bond is "eligible" to be formed. -Note that these rules mean an atom will only be part of at most one -created bond on a given timestep. It also means that if atom I -chooses atom J as its sole partner, but atom J chooses atom K is its -sole partner (due to Rjk < Rij), then this means atom I will not form -a bond on this timestep, even if it has other possible bond partners. +Note that these rules mean that an atom will only be part of at most one +created bond on a given time step. It also means that if atom :math:`i` +chooses atom :math:`j` as its sole partner, but atom :math:`j` chooses atom +:math:`k` as its sole partner (because :math:`R_{jk} < R_{ij}`), then atom +:math:`i` will not form a bond on this time step, even if it has other possible +bond partners. -It is permissible to have *itype* = *jtype*\ . *Rmin* must be <= the -pairwise cutoff distance between *itype* and *jtype* atoms, as defined +It is permissible to have *itype* = *jtype*\ . *Rmin* must be :math:`\leq` the +pair-wise cutoff distance between *itype* and *jtype* atoms, as defined by the :doc:`pair_style ` command. The *iparam* and *jparam* keywords can be used to limit the bonding functionality of the participating atoms. Each atom keeps track of -how many bonds of *bondtype* it already has. If atom I of -itype already has *maxbond* bonds (as set by the *iparam* -keyword), then it will not form any more. Likewise for atom J. If -*maxbond* is set to 0, then there is no limit on the number of bonds +how many bonds of *bondtype* it already has. If atom :math:`i` of type +*itype* already has *maxbond* bonds (as set by the *iparam* +keyword), then it will not form any more, and likewise for atom :math:`j`. +If *maxbond* is set to 0, then there is no limit on the number of bonds that can be formed with that atom. The *newtype* value for *iparam* and *jparam* can be used to change -the atom type of atom I or J when it reaches *maxbond* number of bonds -of type *bondtype*\ . This means it can now interact in a pairwise +the atom type of atom :math:`i` or :math:`j` when it reaches *maxbond* number +of bonds of type *bondtype*\ . This means it can now interact in a pair-wise fashion with other atoms in a different way by specifying different :doc:`pair_coeff ` coefficients. If you do not wish the atom type to change, simply specify *newtype* as *itype* or *jtype*\ . -The *prob* keyword can also effect whether an eligible bond is +The *prob* keyword can also affect whether an eligible bond is actually created. The *fraction* setting must be a value between 0.0 and 1.0. A uniform random number between 0.0 and 1.0 is generated and -the eligible bond is only created if the random number < fraction. +the eligible bond is only created if the random number is less than *fraction*. The *aconstrain* keyword is only available with the fix -bond/create/angle command. It allows to specify a minimal and maximal -angle *amin* and *amax* between the two prospective bonding partners and -a third particle that is already bonded to one of the two partners. -Such a criterion can be important when new angles are defined together -with the formation of a new bond. Without a restriction on the +bond/create/angle command. It allows one to specify minimum and maximum +angles *amin* and *amax*, respectively, between the two prospective bonding +partners and a third particle that is already bonded to one of the two +partners. Such a criterion can be important when new angles are defined +together with the formation of a new bond. Without a restriction on the permissible angle, and for stiffer angle potentials, very large energies -can arise and lead to uncontrolled behavior. +can arise and lead to unphysical behavior. Any bond that is created is assigned a bond type of *bondtype*. When a bond is created, data structures within LAMMPS that store bond -topology are updated to reflect the creation. If the bond is part of +topologies are updated to reflect the creation. If the bond is part of new 3-body (angle) or 4-body (dihedral, improper) interactions, you -can choose to create new angles, dihedrals, impropers as well, using +can choose to create new angles, dihedrals, and impropers as well using the *atype*, *dtype*, and *itype* keywords. All of these changes -typically affect pairwise interactions between atoms that are now part +typically affect pair-wise interactions between atoms that are now part of new bonds, angles, etc. .. note:: @@ -165,19 +166,19 @@ of type *angletype*, with parameters assigned by the corresponding when bonds are created. See the :doc:`read_data ` or :doc:`create_box ` command for more details. Note that a data file with no atoms can be used if you wish to add non-bonded - atoms via the :doc:`create atoms ` command, e.g. for a - percolation simulation. + atoms via the :doc:`create atoms ` command (e.g., for a + percolation simulation). .. note:: LAMMPS stores and maintains a data structure with a list of the first, second, and third neighbors of each atom (within the bond topology of - the system) for use in weighting pairwise interactions for bonded + the system) for use in weighting pair-wise interactions for bonded atoms. Note that adding a single bond always adds a new first neighbor - but may also induce \*many\* new second and third neighbors, depending on the + but may also induce **many** new second and third neighbors, depending on the molecular topology of your system. The "extra special per atom" parameter must typically be set to allow for the new maximum total - size (first + second + third neighbors) of this per-atom list. There are 2 + size (first + second + third neighbors) of this per-atom list. There are two ways to do this. See the :doc:`read_data ` or :doc:`create_box ` commands for details. @@ -186,15 +187,16 @@ of type *angletype*, with parameters assigned by the corresponding Even if you do not use the *atype*, *dtype*, or *itype* keywords, the list of topological neighbors is updated for atoms affected by the new bond. This in turn affects which neighbors are - considered for pairwise interactions, using the weighting rules set by + considered for pair-wise interactions, using the weighting rules set by the :doc:`special_bonds ` command. Consider a new bond - created between atoms I,J. If J has a bonded neighbor K, then K - becomes a second neighbor of I. Even if the *atype* keyword is not used - to create angle I-J-K, the pairwise interaction between I and K will - be potentially turned off or weighted by the 1-3 weighting specified + created between atoms :math:`i` and :math:`j`. If :math:`j` has a bonded + neighbor :math:`k`, then :math:`k` becomes a second neighbor of :math:`i`. + Even if the *atype* keyword is not used to create angle :math:`\angle ijk`, + the pair-wise interaction between :math:`i` and :math:`k` could potentially + be turned off or weighted by the 1--3 weighting specified by the :doc:`special_bonds ` command. This is the case even if the "angle yes" option was used with that command. The same - is true for third neighbors (1-4 interactions), the *dtype* keyword, and + is true for third neighbors (1--4 interactions), the *dtype* keyword, and the "dihedral yes" option used with the :doc:`special_bonds ` command. @@ -203,20 +205,20 @@ define a :doc:`bond_style ` and use the :doc:`bond_coeff ` command to specify coefficients for the *bondtype*\ . Similarly, if new atom types are specified by the *iparam* or *jparam* keywords, they must be within the range of atom -types allowed by the simulation and pairwise coefficients must be +types allowed by the simulation and pair-wise coefficients must be specified for the new types. -Computationally, each timestep this fix operates, it loops over +Computationally, each time step this fix is invoked, it loops over neighbor lists and computes distances between pairs of atoms in the list. It also communicates between neighboring processors to coordinate which bonds are created. Moreover, if any bonds are created, neighbor lists must be immediately updated on the same -timestep. This is to insure that any pairwise interactions that +time step. This is to ensure that any pair-wise interactions that should be turned "off" due to a bond creation, because they are now excluded by the presence of the bond and the settings of the :doc:`special_bonds ` command, will be immediately -recognized. All of these operations increase the cost of a timestep. -Thus you should be cautious about invoking this fix too frequently. +recognized. All of these operations increase the cost of a time step. +Thus, you should be cautious about invoking this fix too frequently. You can dump out snapshots of the current bond topology via the :doc:`dump local ` command. @@ -225,8 +227,8 @@ You can dump out snapshots of the current bond topology via the :doc:`dump local Creating a bond typically alters the energy of a system. You should be careful not to choose bond creation criteria that induce a dramatic change in energy. For example, if you define a very stiff - harmonic bond and create it when 2 atoms are separated by a distance - far from the equilibrium bond length, then the 2 atoms will oscillate + harmonic bond and create it when two atoms are separated by a distance + far from the equilibrium bond length, then the two atoms will oscillate dramatically when the bond is formed. More generally, you may need to thermostat your system to compensate for energy changes resulting from created bonds (and angles, dihedrals, impropers). @@ -245,10 +247,10 @@ length 2, which can be accessed by various :doc:`output commands `. The vector values calculated by this fix are "intensive". -These are the 2 quantities: +The two quantities in the global vector are -* (1) # of bonds created on the most recent creation timestep -* (2) cumulative # of bonds created + (1) number of bonds created on the most recent creation time step + (2) cumulative number of bonds created 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 `. diff --git a/doc/src/fix_bond_react.rst b/doc/src/fix_bond_react.rst index a48675dcf2..85683f0ddd 100644 --- a/doc/src/fix_bond_react.rst +++ b/doc/src/fix_bond_react.rst @@ -6,12 +6,12 @@ fix bond/react command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS - fix ID group-ID bond/react common_keyword values ... - react react-ID react-group-ID Nevery Rmin Rmax template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values ... - react react-ID react-group-ID Nevery Rmin Rmax template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values ... - react react-ID react-group-ID Nevery Rmin Rmax template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values ... + fix ID group-ID bond/react common_keyword values & + react react-ID react-group-ID Nevery Rmin Rmax template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values & + react react-ID react-group-ID Nevery Rmin Rmax template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values & + react react-ID react-group-ID Nevery Rmin Rmax template-ID(pre-reacted) template-ID(post-reacted) map_file individual_keyword values & ... * ID, group-ID are documented in :doc:`fix ` command. @@ -22,11 +22,12 @@ Syntax .. parsed-literal:: - *stabilization* values = *no* or *yes* *group-ID* *xmax* - *no* = no reaction site stabilization (default) - *yes* = perform reaction site stabilization - *group-ID* = user-assigned prefix for the dynamic group of atoms not currently involved in a reaction - *xmax* = xmax value that is used by an internally-created :doc:`nve/limit ` integrator + *stabilization* values = stabilize group_prefix xmax + stabilize = *yes* or *no* + *yes* = perform reaction site stabilization + *no* = no reaction site stabilization (default) + group_prefix = user-assigned prefix for the dynamic group of atoms not currently involved in a reaction + xmax = value that is used by an internally-created :doc:`nve/limit ` integrator *reset_mol_ids* values = *yes* or *no* *yes* = update molecule IDs based on new global topology (default) *no* = do not update molecule IDs @@ -51,18 +52,18 @@ Syntax *max_rxn* value = N N = maximum number of reactions allowed to occur *stabilize_steps* value = timesteps - timesteps = number of timesteps to apply the internally-created :doc:`nve/limit ` fix to reacting atoms - *custom_charges* value = *no* or *fragmentID* - no = update all atomic charges (default) - fragmentID = ID of molecule fragment whose charges are updated + timesteps = number of time steps to apply the internally-created :doc:`nve/limit ` fix to reacting atoms + *custom_charges* value = *no* or fragment-ID + *no* = update all atomic charges (default) + fragment-ID = ID of molecule fragment whose charges are updated *molecule* value = *off* or *inter* or *intra* - off = allow both inter- and intramolecular reactions (default) - inter = search for reactions between molecules with different IDs - intra = search for reactions within the same molecule - *modify_create* keyword values - *fit* value = *all* or *fragmentID* - all = use all eligible atoms for create-atoms fit (default) - fragmentID = ID of molecule fragment used for create-atoms fit + *off* = allow both inter- and intramolecular reactions (default) + *inter* = search for reactions between molecules with different IDs + *intra* = search for reactions within the same molecule + *modify_create* values = keyword arg + *fit* arg = *all* or fragment-ID + *all* = use all eligible atoms for create-atoms fit (default) + fragment-ID = ID of molecule fragment used for create-atoms fit *overlap* value = R R = only insert atom/molecule if further than R from existing particles (distance units) @@ -99,31 +100,32 @@ other molecules can be identified and deleted. Finally, atoms can be created and inserted at specific positions relative to the reaction site. -Fix bond/react does not use quantum mechanical (eg. fix qmmm) or -pairwise bond-order potential (eg. Tersoff or AIREBO) methods to +Fix bond/react does not use quantum mechanical (e.g., :doc:`fix qmmm `) or +pairwise bond-order potential (e.g., :doc:`Tersoff ` or +:doc:`AIREBO `) methods to determine bonding changes a priori. Rather, it uses a distance-based probabilistic criteria to effect predetermined topology changes in simulations using standard force fields. This fix was created to facilitate the dynamic creation of polymeric, amorphous or highly cross-linked systems. A suggested workflow for -using this fix is: 1) identify a reaction to be simulated 2) build a -molecule template of the reaction site before the reaction has -occurred 3) build a molecule template of the reaction site after the -reaction has occurred 4) create a map that relates the -template-atom-IDs of each atom between pre- and post-reaction molecule -templates 5) fill a simulation box with molecules and run a simulation -with fix bond/react. +using this fix is + + (1) identify a reaction to be simulated + (2) build a molecule template of the reaction site before the reaction has occurred + (3) build a molecule template of the reaction site after the reaction has occurred + (4) create a map that relates the template-atom-IDs of each atom between pre- and post-reaction molecule templates + (5) fill a simulation box with molecules and run a simulation with fix bond/react. Only one 'fix bond/react' command can be used at a time. Multiple reactions can be simultaneously applied by specifying multiple *react* arguments to a single 'fix bond/react' command. This syntax is -necessary because the 'common keywords' are applied to all reactions. +necessary because the "common" keywords are applied to all reactions. The *stabilization* keyword enables reaction site stabilization. Reaction site stabilization is performed by including reacting atoms in an internally-created fix :doc:`nve/limit ` time -integrator for a set number of timesteps given by the +integrator for a set number of time steps given by the *stabilize_steps* keyword. While reacting atoms are being time integrated by the internal nve/limit, they are prevented from being involved in any new reactions. The *xmax* value keyword should @@ -133,53 +135,54 @@ during the simulation. Fix bond/react creates and maintains two important dynamic groups of atoms when using the *stabilization* keyword. The first group contains all atoms currently involved in a reaction; this group is -automatically thermostatted by an internally-created +automatically time-integrated by an internally-created :doc:`nve/limit ` integrator. The second group contains all atoms currently not involved in a reaction. This group should be -used by a thermostat in order to time integrate the system. The name +controlled by a thermostat in order to time integrate the system. The name of this group of non-reacting atoms is created by appending '_REACT' to the group-ID argument of the *stabilization* keyword, as shown in the second example above. .. note:: - When using reaction stabilization, you should generally not have - a separate thermostat which acts on the 'all' group. + When using reaction stabilization, you should generally **not** have + a separate thermostat that acts on the "all" group. The group-ID set using the *stabilization* keyword can be an existing static group or a previously-unused group-ID. It cannot be specified -as 'all'. If the group-ID is previously unused, the fix bond/react +as "all". If the group-ID is previously unused, the fix bond/react command creates a :doc:`dynamic group ` that is initialized to include all atoms. If the group-ID is that of an existing static group, the group is used as the parent group of new, internally-created dynamic group. In both cases, this new dynamic -group is named by appending '_REACT' to the group-ID, e.g. -nvt_grp_REACT. By specifying an existing group, you may thermostat +group is named by appending '_REACT' to the group-ID (e.g., +nvt_grp_REACT). By specifying an existing group, you may thermostat constant-topology parts of your system separately. The dynamic group -contains only atoms not involved in a reaction at a given timestep, +contains only atoms not involved in a reaction at a given time step, and therefore should be used by a subsequent system-wide time -integrator such as nvt, npt, or nve, as shown in the second example -above (full examples can be found at examples/PACKAGES/reaction). The time +integrator such as :doc:`fix nvt `, :doc:`fix npt `, or +:doc:`fix nve `, as shown in the second example +above (full examples can be found in examples/PACKAGES/reaction). The time integration command should be placed after the fix bond/react command due to the internal dynamic grouping performed by fix bond/react. .. note:: If the group-ID is an existing static group, react-group-IDs - should also be specified as this static group, or a subset. + should also be specified as this static group or a subset. The *reset_mol_ids* keyword invokes the :doc:`reset_mol_ids ` command after a reaction occurs, to ensure that molecule IDs are consistent with the new bond topology. The group-ID used for :doc:`reset_mol_ids ` is the group-ID for this fix. -Resetting molecule IDs is necessarily a global operation, and so can +Resetting molecule IDs is necessarily a global operation, so it can be slow for very large systems. The following comments pertain to each *react* argument (in other -words, can be customized for each reaction, or reaction step): +words, they can be customized for each reaction, or reaction step): A check for possible new reaction sites is performed every *Nevery* -timesteps. *Nevery* can be specified with an equal-style +time steps. *Nevery* can be specified with an equal-style :doc:`variable `, whose value is rounded up to the nearest integer. @@ -194,11 +197,11 @@ reaction site is eligible to be modified to match the post-reaction template. An initiator atom pair will be identified if several conditions are -met. First, a pair of atoms I,J within the specified react-group-ID of -type itype and jtype must be separated by a distance between *Rmin* -and *Rmax*\ . *Rmin* and *Rmax* can be specified with equal-style -:doc:`variables `. For example, these reaction cutoffs can -be a function of the reaction conversion using the following commands: +met. First, a pair of atoms :math:`i` and :math:`j` within the specified +react-group-ID of type *itype* and *jtype* must be separated by a distance +between *Rmin* and *Rmax*\ . *Rmin* and *Rmax* can be specified with +equal-style :doc:`variables `. For example, these reaction cutoffs +can be functions of the reaction conversion using the following commands: .. code-block:: LAMMPS @@ -207,23 +210,28 @@ be a function of the reaction conversion using the following commands: variable rmax equal 3+f_myrxn[1]/100 # arbitrary function of reaction count The following criteria are used if multiple candidate initiator atom -pairs are identified within the cutoff distance: 1) If the initiator -atoms in the pre-reaction template are not 1-2 neighbors (i.e. not -directly bonded) the closest potential partner is chosen. 2) -Otherwise, if the initiator atoms in the pre-reaction template are 1-2 -neighbors (i.e. directly bonded) the farthest potential partner is -chosen. 3) Then, if both an atom I and atom J have each other as their -initiator partners, these two atoms are identified as the initiator -atom pair of the reaction site. Note that it can be helpful to select +pairs are identified within the cutoff distance: + + (1) If the initiator atoms in the pre-reaction template are not 1--2 + neighbors (i.e., not directly bonded) the closest potential partner is + chosen. + (2) Otherwise, if the initiator atoms in the pre-reaction template are 1--2 + neighbors (i.e. directly bonded) the farthest potential partner is + chosen. + (3) Then, if both an atom :math:`i` and atom :math:`j` have each other as + initiator partners, these two atoms are identified as the initiator atom + pair of the reaction site. + +Note that it can be helpful to select unique atom types for the initiator atoms: if an initiator atom pair -is identified, as described in the previous steps, but does not +is identified, as described in the previous steps, but it does not correspond to the same pair specified in the pre-reaction template, an otherwise eligible reaction could be prevented from occurring. Once this unique initiator atom pair is identified for each reaction, there could be two or more reactions that involve the same atom on the same -timestep. If this is the case, only one such reaction is permitted to +time step. If this is the case, only one such reaction is permitted to occur. This reaction is chosen randomly from all potential reactions -involving the overlapping atom. This capability allows e.g. for +involving the overlapping atom. This capability allows, for example, different reaction pathways to proceed from identical reaction sites with user-specified probabilities. @@ -247,19 +255,19 @@ pre-reaction template atoms should be linked to an initiator atom, via at least one path that does not involve edge atoms. When the pre-reaction template contains edge atoms, not all atoms, bonds, charges, etc. specified in the reaction templates will be updated. -Specifically, topology that involves only atoms that are 'too near' to -template edges will not be updated. The definition of 'too near the -edge' depends on which interactions are defined in the simulation. If +Specifically, topology that involves only atoms that are "too near" to +template edges will not be updated. The definition of "too near the +edge" depends on which interactions are defined in the simulation. If the simulation has defined dihedrals, atoms within two bonds of edge -atoms are considered 'too near the edge.' If the simulation defines +atoms are considered "too near the edge." If the simulation defines angles, but not dihedrals, atoms within one bond of edge atoms are -considered 'too near the edge.' If just bonds are defined, only edge -atoms are considered 'too near the edge.' +considered "too near the edge." If just bonds are defined, only edge +atoms are considered "too near the edge." .. note:: - Small molecules, i.e. ones that have all their atoms contained - within the reaction templates, never have edge atoms. + Small molecules (i.e., ones that have all their atoms contained + within the reaction templates) never have edge atoms. Note that some care must be taken when a building a molecule template for a given simulation. All atom types in the pre-reacted template @@ -282,7 +290,7 @@ provided on the :doc:`molecule ` command page. .. note:: When a reaction occurs, it is possible that the resulting - topology/atom (e.g. special bonds, dihedrals, etc.) exceeds that of + topology/atom (e.g., special bonds, dihedrals) exceeds that of the existing system and reaction templates. As when inserting molecules, enough space for this increased topology/atom must be reserved by using the relevant "extra" keywords to the @@ -292,14 +300,14 @@ The map file is a text document with the following format: A map file has a header and a body. The header of map file the contains one mandatory keyword and five optional keywords. The -mandatory keyword is 'equivalences': +mandatory keyword is *equivalences*\ : .. parsed-literal:: N *equivalences* = # of atoms N in the reaction molecule templates -The optional keywords are 'edgeIDs', 'deleteIDs', 'chiralIDs' and -'constraints': +The optional keywords are *edgeIDs*\ , *deleteIDs*\ , *chiralIDs*\ , and +*constraints*\ : .. parsed-literal:: @@ -311,25 +319,25 @@ The optional keywords are 'edgeIDs', 'deleteIDs', 'chiralIDs' and The body of the map file contains two mandatory sections and five optional sections. The first mandatory section begins with the keyword -'InitiatorIDs' and lists the two atom IDs of the initiator atom pair +"InitiatorIDs" and lists the two atom IDs of the initiator atom pair in the pre-reacted molecule template. The second mandatory section -begins with the keyword 'Equivalences' and lists a one-to-one +begins with the keyword "Equivalences" and lists a one-to-one correspondence between atom IDs of the pre- and post-reacted templates. The first column is an atom ID of the pre-reacted molecule template, and the second column is the corresponding atom ID of the post-reacted molecule template. The first optional section begins with -the keyword 'EdgeIDs' and lists the atom IDs of edge atoms in the +the keyword "EdgeIDs" and lists the atom IDs of edge atoms in the pre-reacted molecule template. The second optional section begins with -the keyword 'DeleteIDs' and lists the atom IDs of pre-reaction +the keyword "DeleteIDs" and lists the atom IDs of pre-reaction template atoms to delete. The third optional section begins with the -keyword 'CreateIDs' and lists the atom IDs of the post-reaction +keyword "CreateIDs" and lists the atom IDs of the post-reaction template atoms to create. The fourth optional section begins with the -keyword 'ChiralIDs' lists the atom IDs of chiral atoms whose +keyword "ChiralIDs" lists the atom IDs of chiral atoms whose handedness should be enforced. The fifth optional section begins with -the keyword 'Constraints' and lists additional criteria that must be +the keyword "Constraints" and lists additional criteria that must be satisfied in order for the reaction to occur. Currently, there are -six types of constraints available, as discussed below: 'distance', -'angle', 'dihedral', 'arrhenius', 'rmsd', and 'custom'. +six types of constraints available, as discussed below: "distance", +"angle", "dihedral", "arrhenius", "rmsd", and "custom". A sample map file is given below: @@ -384,13 +392,13 @@ two sub-keywords, *fit* and *overlap*. One or more of the sub-keywords may be used after the *modify_create* keyword. The *fit* sub-keyword can be used to specify which post-reaction atoms are used for the optimal translation and rotation of the post-reaction template. The -*fragmentID* value of the *fit* sub-keyword must be the name of a +fragment-ID value of the *fit* sub-keyword must be the name of a molecule fragment defined in the post-reaction :doc:`molecule ` template, and only atoms in this fragment are used for the fit. Atoms are created only if no current atom in the simulation is -within a distance R of any created atom, including the effect of -periodic boundary conditions if applicable. R is defined by the -*overlap* sub-keyword. Note that the default value for R is 0.0, which +within a distance :math:`R` of any created atom, including the effect of +periodic boundary conditions if applicable. :math:`R` is defined by the +*overlap* sub-keyword. Note that the default value for :math:`R` is 0.0, which will allow atoms to strongly overlap if you are inserting where other atoms are present. The velocity of each created atom is initialized in a random direction with a magnitude calculated from the instantaneous @@ -406,40 +414,40 @@ and the relative position of the fourth bonded atom determines the chiral center's handedness. Any number of additional constraints may be specified in the -Constraints section of the map file. The constraint of type 'distance' +Constraints section of the map file. The constraint of type "distance" has syntax as follows: .. parsed-literal:: distance *ID1* *ID2* *rmin* *rmax* -where 'distance' is the required keyword, *ID1* and *ID2* are +where "distance" is the required keyword, *ID1* and *ID2* are pre-reaction atom IDs (or molecule-fragment IDs, see below), and these two atoms must be separated by a distance between *rmin* and *rmax* for the reaction to occur. -The constraint of type 'angle' has the following syntax: +The constraint of type "angle" has the following syntax: .. parsed-literal:: angle *ID1* *ID2* *ID3* *amin* *amax* -where 'angle' is the required keyword, *ID1*, *ID2* and *ID3* are +where "angle" is the required keyword, *ID1*, *ID2* and *ID3* are pre-reaction atom IDs (or molecule-fragment IDs, see below), and these three atoms must form an angle between *amin* and *amax* for the reaction to occur (where *ID2* is the central atom). Angles must be specified in degrees. This constraint can be used to enforce a certain orientation between reacting molecules. -The constraint of type 'dihedral' has the following syntax: +The constraint of type "dihedral" has the following syntax: .. parsed-literal:: dihedral *ID1* *ID2* *ID3* *ID4* *amin* *amax* *amin2* *amax2* -where 'dihedral' is the required keyword, and *ID1*, *ID2*, *ID3* +where "dihedral" is the required keyword, and *ID1*, *ID2*, *ID3* and *ID4* are pre-reaction atom IDs (or molecule-fragment IDs, see -below). Dihedral angles are calculated in the interval (-180,180]. +below). Dihedral angles are calculated in the interval :math:`(-180^\circ,180^\circ]`. Refer to the :doc:`dihedral style ` documentation for further details on convention. If *amin* is less than *amax*, these four atoms must form a dihedral angle greater than *amin* **and** less @@ -447,7 +455,7 @@ than *amax* for the reaction to occur. If *amin* is greater than *amax*, these four atoms must form a dihedral angle greater than *amin* **or** less than *amax* for the reaction to occur. Angles must be specified in degrees. Optionally, a second range of permissible -angles *amin2*-*amax2* can be specified. +angles *amin2* to *amax2* can be specified. For the 'distance', 'angle', and 'dihedral' constraints (explained above), atom IDs can be replaced by pre-reaction molecule-fragment @@ -457,11 +465,11 @@ fragment. The molecule fragment must have been defined in the :doc:`molecule ` command for the pre-reaction template. The constraint of type 'arrhenius' imposes an additional reaction -probability according to the temperature-dependent Arrhenius equation: +probability according to the modified Arrhenius equation, .. math:: - k = AT^{n}e^{\frac{-E_{a}}{k_{B}T}} + k = AT^{n}e^{-E_{a}/k_{B}T}. The Arrhenius constraint has the following syntax: @@ -469,11 +477,11 @@ The Arrhenius constraint has the following syntax: arrhenius *A* *n* *E_a* *seed* -where 'arrhenius' is the required keyword, *A* is the pre-exponential +where "arrhenius" is the required keyword, *A* is the pre-exponential factor, *n* is the exponent of the temperature dependence, :math:`E_a` is the activation energy (:doc:`units ` of energy), and *seed* is a random number seed. The temperature is defined as the instantaneous -temperature averaged over all atoms in the reaction site, and is +temperature averaged over all atoms in the reaction site and is calculated in the same manner as for example :doc:`compute temp/chunk `. Currently, there are no options for additional temperature averaging or velocity-biased @@ -487,7 +495,7 @@ The constraint of type 'rmsd' has the following syntax: rmsd *RMSDmax* *molfragment* -where 'rmsd' is the required keyword, and *RMSDmax* is the maximum +where "rmsd" is the required keyword, and *RMSDmax* is the maximum root-mean-square deviation between atom positions of the pre-reaction template and the local reaction site (distance units), after optimal translation and rotation of the pre-reaction template. Optionally, the @@ -500,26 +508,26 @@ example, the molecule fragment could consist of only the backbone atoms of a polymer chain. This constraint can be used to enforce a specific relative position and orientation between reacting molecules. -The constraint of type 'custom' has the following syntax: +The constraint of type "custom" has the following syntax: .. parsed-literal:: custom *varstring* -where 'custom' is the required keyword, and *varstring* is a +where "custom" is the required keyword, and *varstring* is a variable expression. The expression must be a valid equal-style variable formula that can be read by the :doc:`variable ` command, after any special reaction functions are evaluated. If the resulting expression is zero, the reaction is prevented from occurring; otherwise, it is permitted to occur. There are two special reaction -functions available, 'rxnsum' and 'rxnave'. These functions operate +functions available, "rxnsum" and "rxnave". These functions operate over the atoms in a given reaction site, and have one mandatory argument and one optional argument. The mandatory argument is the identifier for an atom-style variable. The second, optional argument is the name of a molecule fragment in the pre-reaction template, and can be used to operate over a subset of atoms in the reaction site. -The 'rxnsum' function sums the atom-style variable over the reaction -site, while the 'rxnave' returns the average value. For example, a +The "rxnsum" function sums the atom-style variable over the reaction +site, while the "rxnave" returns the average value. For example, a constraint on the total potential energy of atoms involved in the reaction can be imposed as follows: @@ -535,8 +543,8 @@ reaction can be imposed as follows: The above example prevents the reaction from occurring unless the total potential energy of the reaction site is above 100. The variable expression can be interpreted as the probability of the reaction -occurring by using an inequality and the 'random(x,y,z)' function -available as an equal-style variable input, similar to the 'arrhenius' +occurring by using an inequality and the :doc:`random(x,y,z) ` +function available for equal-style variables, similar to the 'arrhenius' constraint above. By default, all constraints must be satisfied for the reaction to @@ -561,40 +569,42 @@ within LAMMPS that store bond topology are updated to reflect the post-reacted molecule template. All force fields with fixed bonds, angles, dihedrals or impropers are supported. -A few capabilities to note: 1) You may specify as many *react* -arguments as desired. For example, you could break down a complicated -reaction mechanism into several reaction steps, each defined by its -own *react* argument. 2) While typically a bond is formed or removed -between the initiator atoms specified in the pre-reacted molecule -template, this is not required. 3) By reversing the order of the pre- -and post- reacted molecule templates in another *react* argument, you -can allow for the possibility of one or more reverse reactions. +A few capabilities to note: + + (1) You may specify as many *react* arguments as desired. For example, you + could break down a complicated reaction mechanism into several reaction + steps, each defined by its own *react* argument. + (2) While typically a bond is formed or removed between the initiator atoms + specified in the pre-reacted molecule template, this is not required. + (3) By reversing the order of the pre- and post-reacted molecule templates in + another *react* argument, you can allow for the possibility of one or + more reverse reactions. The optional keywords deal with the probability of a given reaction occurring as well as the stable equilibration of each reaction site as -it occurs: +it occurs. The *prob* keyword can affect whether or not an eligible reaction actually occurs. The fraction setting must be a value between 0.0 and 1.0, and can be specified with an equal-style :doc:`variable `. A uniform random number between 0.0 and 1.0 is generated and the eligible reaction only occurs if the random number is less than the -fraction. Up to N reactions are permitted to occur, as optionally +fraction. Up to :math:`N` reactions are permitted to occur, as optionally specified by the *max_rxn* keyword. The *stabilize_steps* keyword allows for the specification of how many -timesteps a reaction site is stabilized before being returned to the +time steps a reaction site is stabilized before being returned to the overall system thermostat. In order to produce the most physical -behavior, this 'reaction site equilibration time' should be tuned to +behavior, this "reaction site equilibration time" should be tuned to be as small as possible while retaining stability for a given system or reaction step. After a limited number of case studies, this number -has been set to a default of 60 timesteps. Ideally, it should be +has been set to a default of 60 time steps. Ideally, it should be individually tuned for each fix reaction step. Note that in some situations, decreasing rather than increasing this parameter will result in an increase in stability. The *custom_charges* keyword can be used to specify which atoms' -atomic charges are updated. When the value is set to 'no', all atomic +atomic charges are updated. When the value is set to *no*\ , all atomic charges are updated to those specified by the post-reaction template (default). Otherwise, the value should be the name of a molecule fragment defined in the pre-reaction molecule template. In this case, @@ -602,10 +612,10 @@ only the atomic charges of atoms in the molecule fragment are updated. The *molecule* keyword can be used to force the reaction to be intermolecular, intramolecular or either. When the value is set to -'off', molecule IDs are not considered when searching for reactions -(default). When the value is set to 'inter', the initiator atoms must +*off*\ , molecule IDs are not considered when searching for reactions +(default). When the value is set to *inter*\ , the initiator atoms must have different molecule IDs in order to be considered for the -reaction. When the value is set to 'intra', only initiator atoms with +reaction. When the value is set to *intra*\ , only initiator atoms with the same molecule ID are considered for the reaction. A few other considerations: @@ -627,15 +637,15 @@ all currently-reacting atoms: This command must be added after the fix bond/react command, and will apply to all reactions. -Computationally, each timestep this fix operates, it loops over +Computationally, each time step this fix is invoked, it loops over neighbor lists (for bond-forming reactions) and computes distances between pairs of atoms in the list. It also communicates between neighboring processors to coordinate which bonds are created and/or -removed. All of these operations increase the cost of a timestep. Thus +removed. All of these operations increase the cost of a time step. Thus, you should be cautious about invoking this fix too frequently. -You can dump out snapshots of the current bond topology via the dump -local command. +You can dump out snapshots of the current bond topology via the +:doc:`dump local ` command. ---------- @@ -649,20 +659,20 @@ allow for smooth restarts. None of the :doc:`fix_modify ` options are relevant to this fix. This fix computes one statistic for each *react* argument that it -stores in a global vector, of length 'number of react arguments', that +stores in a global vector, of length (number of react arguments), that can be accessed by various :doc:`output commands `. The vector values calculated by this fix are "intensive". -These is 1 quantity for each react argument: +There is one quantity in the global vector for each *react* argument: -* (1) cumulative # of reactions occurred + (1) cumulative number of reactions that occurred 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 `. -When fix bond/react is 'unfixed', all internally-created groups are -deleted. Therefore, fix bond/react can only be unfixed after unfixing -all other fixes that use any group created by fix bond/react. +When fix bond/react is ":doc:`unfixed `", all internally-created +groups are deleted. Therefore, fix bond/react can only be unfixed after +unfixing all other fixes that use any group created by fix bond/react. Restrictions """""""""""" @@ -683,7 +693,7 @@ Default """"""" The option defaults are stabilization = no, prob = 1.0, stabilize_steps = 60, -reset_mol_ids = yes, custom_charges = no, molecule = off, modify_create = no +reset_mol_ids = yes, custom_charges = no, molecule = off, modify_create = *fit all* ---------- From 77958b5ef1f80b062a20b04592176a64cd4ab903 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Fri, 14 Oct 2022 18:04:49 -0500 Subject: [PATCH 13/27] Missed one I->i edit --- doc/src/fix_bond_break.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_bond_break.rst b/doc/src/fix_bond_break.rst index 7aa620a8f6..a0f7fad581 100644 --- a/doc/src/fix_bond_break.rst +++ b/doc/src/fix_bond_break.rst @@ -66,7 +66,7 @@ Note that these rules mean an atom will only be part of at most one broken bond on a given time step. It also means that if atom :math:`i` chooses atom :math:`j` as its sole partner, but atom :math:`j` chooses atom :math:`k` as its sole partner (because :math:`R_{jk} > R_{ij}`), then this means atom -:math:`I` will not be part of a broken bond on this time step, even if it has +:math:`i` will not be part of a broken bond on this time step, even if it has other possible bond partners. The *prob* keyword can effect whether an eligible bond is actually From b586b72ddd01634938c6e0a8e2c4f619d3437b32 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Fri, 14 Oct 2022 18:27:21 -0500 Subject: [PATCH 14/27] removed an extra space --- doc/src/fix_bocs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_bocs.rst b/doc/src/fix_bocs.rst index c4e9a04fb3..bb50cd1761 100644 --- a/doc/src/fix_bocs.rst +++ b/doc/src/fix_bocs.rst @@ -43,7 +43,7 @@ Description These commands incorporate a pressure correction as described by Dunn and Noid :ref:`(Dunn1) ` to the standard MTK -barostat by Martyna et al. :ref:`(Martyna) ` . +barostat by Martyna et al. :ref:`(Martyna) `. The first half of the command mimics a standard :doc:`fix npt ` command: From 2b18f6a3d35c01999d0c2d930fa0cb7f0df2a8a7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 Oct 2022 21:27:00 -0400 Subject: [PATCH 15/27] replace tab --- doc/src/pair_pace.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_pace.rst b/doc/src/pair_pace.rst index b54e585f69..f8762ee9ca 100644 --- a/doc/src/pair_pace.rst +++ b/doc/src/pair_pace.rst @@ -104,7 +104,7 @@ requests to compute `gamma`, as shown in example below: .. code-block:: LAMMPS - pair_style pace/extrapolation + pair_style pace/extrapolation pair_coeff * * Cu.yaml Cu.asi Cu fix pace_gamma all pair 10 pace/extrapolation gamma 1 From 09a14d558d934292496ccb9833333c103024a04e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 14 Oct 2022 21:27:55 -0400 Subject: [PATCH 16/27] explicitly select Times New Roman for \textrm, Helvetica for \textsf and Times New Roman for math as well --- doc/utils/sphinx-config/conf.py.in | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/utils/sphinx-config/conf.py.in b/doc/utils/sphinx-config/conf.py.in index 501799608e..722e678d17 100644 --- a/doc/utils/sphinx-config/conf.py.in +++ b/doc/utils/sphinx-config/conf.py.in @@ -287,6 +287,39 @@ latex_elements = { # Additional stuff for the LaTeX preamble. 'preamble': r''' \setcounter{tocdepth}{2} +\renewcommand{\sfdefault}{ptm} % Use Times New Roman font for \textrm +\renewcommand{\sfdefault}{phv} % Use Helvetica font for \textsf +% Set up math fonts to match text fonts +\DeclareSymbolFont{operators} {OT1}{ptm}{m}{n} +\DeclareSymbolFont{bold} {OT1}{ptm}{bx}{n} +\DeclareSymbolFont{italic} {OT1}{ptm}{m}{it} +\DeclareSymbolFont{extraops} {OT1}{ztmcm}{m}{n} +\DeclareSymbolFont{letters} {OML}{ztmcm}{m}{it} +\DeclareSymbolFont{largesymbols}{OMX}{ztmcm}{m}{n} +% symbols (and \mathcal) are taken from computer modern. +% setup mappings +\DeclareSymbolFontAlphabet{\mathrm} {operators} +\DeclareSymbolFontAlphabet{\mathnormal}{letters} +\DeclareMathAlphabet{\mathnormal}{OT1}{ptm}{m}{n} +\DeclareMathAlphabet{\mathrm}{OT1}{ptm}{m}{n} +\DeclareMathAlphabet{\mathbf}{OT1}{ptm}{bx}{n} +\DeclareMathAlphabet{\mathit}{OT1}{ptm}{m}{it} +\DeclareMathAlphabet{\mathtt}{OT1}{pcr}{m}{n} +\SetMathAlphabet\mathit{bold}{OT1}{ptm}{bx}{it} +% declare missing operators +\DeclareMathSymbol{\omicron}{0}{operators}{`\o} +\DeclareMathSymbol{\Gamma}{\mathalpha}{extraops}{"00} +\DeclareMathSymbol{\Delta}{\mathalpha}{extraops}{"01} +\DeclareMathSymbol{\Theta}{\mathalpha}{extraops}{"02} +\DeclareMathSymbol{\Lambda}{\mathalpha}{extraops}{"03} +\DeclareMathSymbol{\Xi}{\mathalpha}{extraops}{"04} +\DeclareMathSymbol{\Pi}{\mathalpha}{extraops}{"05} +\DeclareMathSymbol{\Sigma}{\mathalpha}{extraops}{"06} +\DeclareMathSymbol{\Upsilon}{\mathalpha}{extraops}{"07} +\DeclareMathSymbol{\Phi}{\mathalpha}{extraops}{"08} +\DeclareMathSymbol{\Psi}{\mathalpha}{extraops}{"09} +\DeclareMathSymbol{\Omega}{\mathalpha}{extraops}{"0A} + \renewcommand{\AA}{\mbox{\textrm{\r{A}}}} % Make ToC number fields wider to accommodate sections with >= 100 subsections % or >= 10 subsections with >= 10 subsubsections From 9e43e9792ca39c666cf31836b763cf2e3540f2b6 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 15 Oct 2022 10:47:33 -0500 Subject: [PATCH 17/27] Fixed a couple more mathbf->boldsymbol errors in fix brownian doc --- doc/src/fix_brownian.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/src/fix_brownian.rst b/doc/src/fix_brownian.rst index c3b97446d2..cf3f773550 100644 --- a/doc/src/fix_brownian.rst +++ b/doc/src/fix_brownian.rst @@ -93,15 +93,15 @@ updated. This style therefore requires the hybrid atom style .. math:: - \mathbf{\mu}(t+dt) = \frac{\mathbf{\mu}(t) + \mathbf{\omega} \times \mathbf{\mu}dt - }{|\mathbf{\mu}(t) + \mathbf{\omega} \times \mathbf{\mu}|} + \boldsymbol{\mu}(t+dt) = \frac{\boldsymbol{\mu}(t) + \boldsymbol{\omega} \times \boldsymbol{\mu}dt + }{|\boldsymbol{\mu}(t) + \boldsymbol{\omega} \times \boldsymbol{\mu}|} which correctly reproduces a Boltzmann distribution of orientations and rotational diffusion moments (see :ref:`(Ilie) `) when .. math:: - \mathbf{\omega} = \frac{\mathbf{T}}{\gamma_r} + \sqrt{\frac{2 k_B T_{rot}}{\gamma_r}\frac{d\mathbf{W}}{dt}}, + \boldsymbol{\omega} = \frac{\mathbf{T}}{\gamma_r} + \sqrt{\frac{2 k_B T_{rot}}{\gamma_r}\frac{d\mathbf{W}}{dt}}, with :math:`d\mathbf{W}` being a random number with zero mean and variance :math:`dt` and :math:`T_{rot}` is *rotation_temp*. @@ -118,15 +118,15 @@ the quaternion \mathbf{q}(t+dt) = \frac{\mathbf{q}(t) + d\mathbf{q}}{\lVert\mathbf{q}(t) + d\mathbf{q}\rVert} which correctly reproduces a Boltzmann distribution of orientations and rotational -diffusion moments [see :ref:`(Ilie) `] when the quaternion step given by +diffusion moments [see :ref:`(Ilie) `] when the quaternion step is given by .. math:: - d\mathbf{q} = \mathbf{\Psi}\mathbf{\omega}dt + d\mathbf{q} = \boldsymbol{\Psi}\boldsymbol{\omega}dt where :math:`\boldsymbol{\Psi}` has rows :math:`(-q_1,-q_2,-q_3)`, :math:`(q_0,-q_3,q_2)`, :math:`(q_3,q_0,-q_1)`, and :math:`(-q_2,q_1,q_0)`. -:math:`\mathbf{\omega}` is evaluated in the body frame of reference where the +:math:`\boldsymbol{\omega}` is evaluated in the body frame of reference where the friction tensor is diagonal. See :ref:`(Delong) ` for more details of a similar algorithm. @@ -186,8 +186,8 @@ The *gamma_r_eigen*, and *gamma_t_eigen* keywords are the eigenvalues of the rotational and viscous damping tensors (having the same units as their isotropic counterparts). Required for (and only compatible with) *brownian/asphere*. For a 2D system, the first two values of -*gamma_r_eigen* must be inf (only rotation in xy plane), and the third -value of *gamma_t_eigen* must be inf (only diffusion in xy plane). +*gamma_r_eigen* must be *inf* (only rotation in *x*\ --\ *y* plane), and the third +value of *gamma_t_eigen* must be *inf* (only diffusion in the *x*\ --\ *y* plane). If the *dipole* keyword is used, then the dipole moments of the particles are updated as described above. Only compatible with *brownian/asphere* @@ -198,7 +198,7 @@ will be occur at this prescribed temperature instead of *temp*. Only compatible with *brownian/sphere* and *brownian/asphere*. If the *planar_rotation* keyword is used, then rotation is constrained -to the xy plane in a 3D simulation. Only compatible with +to the *x*\ -- *y* plane in a 3D simulation. Only compatible with *brownian/sphere* and *brownian/asphere* in 3D. ---------- From 33681b5d84a1ae2f741aaca9df88ea515f464c33 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Sat, 15 Oct 2022 18:06:07 +0200 Subject: [PATCH 18/27] WIP: update ML-PACE.cmake --- cmake/Modules/Packages/ML-PACE.cmake | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/cmake/Modules/Packages/ML-PACE.cmake b/cmake/Modules/Packages/ML-PACE.cmake index c553809ff1..ac421a049f 100644 --- a/cmake/Modules/Packages/ML-PACE.cmake +++ b/cmake/Modules/Packages/ML-PACE.cmake @@ -1,6 +1,6 @@ -set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2021.10.25.fix2.tar.gz" CACHE STRING "URL for PACE evaluator library sources") +set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2022.10.15.tar.gz" CACHE STRING "URL for PACE evaluator library sources") -set(PACELIB_MD5 "32394d799bc282bb57696c78c456e64f" CACHE STRING "MD5 checksum of PACE evaluator library tarball") +set(PACELIB_MD5 "848ad6a6cc79fa82745927001fb1c9b5" CACHE STRING "MD5 checksum of PACE evaluator library tarball") mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_MD5) @@ -19,19 +19,20 @@ get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace) set(YAML_BUILD_SHARED_LIBS OFF) set(YAML_CPP_BUILD_CONTRIB OFF) set(YAML_CPP_BUILD_TOOLS OFF) -add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) -set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) +#add_subdirectory(${lib-pace}/yaml-cpp build-yaml-cpp) +#set(YAML_CPP_INCLUDE_DIR ${lib-pace}/yaml-cpp/include) -file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE) -file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*.cpp) -list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) +#file(GLOB PACE_EVALUATOR_INCLUDE_DIR ${lib-pace}/ML-PACE) +#file(GLOB PACE_EVALUATOR_SOURCES ${lib-pace}/ML-PACE/*/*.cpp) +#list(FILTER PACE_EVALUATOR_SOURCES EXCLUDE REGEX pair_pace.cpp) +# +#add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) +#set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) +#target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR} +# ${WIGNER_INCLUDE_DIR} ${CNPY_INCLUDE_DIR}) +add_subdirectory(${lib-pace} build-ML-PACE) -add_library(pace STATIC ${PACE_EVALUATOR_SOURCES}) -set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) -target_include_directories(pace PUBLIC ${PACE_EVALUATOR_INCLUDE_DIR} ${YAML_CPP_INCLUDE_DIR}) - - -target_link_libraries(pace PRIVATE yaml-cpp-pace) +#target_link_libraries(pace PRIVATE yaml-cpp-pace) if(CMAKE_PROJECT_NAME STREQUAL "lammps") target_link_libraries(lammps PRIVATE pace) endif() From 4bf1339950929e33aa9795979c273e35a1613406 Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Sat, 15 Oct 2022 18:23:59 +0200 Subject: [PATCH 19/27] update pair_pace.cpp / pair_pace_extrapolation.cpp --- src/ML-PACE/pair_pace.cpp | 8 ++++---- src/ML-PACE/pair_pace_extrapolation.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index a08d6d9cdc..2520f5c0a4 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -41,10 +41,10 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1, #include #include -#include "ace_c_basis.h" -#include "ace_evaluator.h" -#include "ace_recursive.h" -#include "ace_version.h" +#include "ace-evaluator/ace_c_basis.h" +#include "ace-evaluator/ace_evaluator.h" +#include "ace-evaluator/ace_recursive.h" +#include "ace-evaluator/ace_version.h" namespace LAMMPS_NS { struct ACEImpl { diff --git a/src/ML-PACE/pair_pace_extrapolation.cpp b/src/ML-PACE/pair_pace_extrapolation.cpp index 92fc8a7812..b9a673eb25 100644 --- a/src/ML-PACE/pair_pace_extrapolation.cpp +++ b/src/ML-PACE/pair_pace_extrapolation.cpp @@ -39,10 +39,10 @@ Copyright 2022 Yury Lysogorskiy^1, Anton Bochkarev^1, Matous Mrovec^1, Ralf Drau #include #include -#include "ace_b_basis.h" -#include "ace_b_evaluator.h" -#include "ace_recursive.h" -#include "ace_version.h" +#include "ace/ace_b_basis.h" +#include "ace/ace_b_evaluator.h" +#include "ace-evaluator/ace_recursive.h" +#include "ace-evaluator/ace_version.h" namespace LAMMPS_NS { struct ACEALImpl { From 9f203473759753eac8decfb6f579f9b62af5cc1c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 15 Oct 2022 15:10:01 -0400 Subject: [PATCH 20/27] update PACE library for conventional build --- lib/pace/Install.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/pace/Install.py b/lib/pace/Install.py index c48888f159..9f132a9580 100644 --- a/lib/pace/Install.py +++ b/lib/pace/Install.py @@ -18,15 +18,14 @@ from install_helpers import fullpath, geturl, checkmd5sum # settings thisdir = fullpath('.') -version ='v.2022.09.27.fix10Oct' +version ='v.2022.10.15' # known checksums for different PACE versions. used to validate the download. checksums = { \ - 'v.2022.09.27.fix10Oct': '766cebcc0e5c4b8430c2f3cd202d9905' + 'v.2022.10.15': '848ad6a6cc79fa82745927001fb1c9b5' } -parser = ArgumentParser(prog='Install.py', - description="LAMMPS library build wrapper script") +parser = ArgumentParser(prog='Install.py', description="LAMMPS library build wrapper script") # help message From 677997699d0fdabc32ff83b2174b19faf58e2aee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 15 Oct 2022 15:35:29 -0400 Subject: [PATCH 21/27] more consistency --- doc/src/pair_granular.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 6f84b0d9c7..0b8f3e11ae 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -97,7 +97,7 @@ on particle *i* due to contact with particle *j* is given by: Where :math:`\delta_{ij} = R_i + R_j - \|\mathbf{r}_{ij}\|` is the particle overlap, :math:`R_i, R_j` are the particle radii, :math:`\mathbf{r}_{ij} = \mathbf{r}_i - \mathbf{r}_j` is the vector separating the two -particle centers (note the i-j ordering so that :math:`F_{ne}` is +particle centers (note the i-j ordering so that :math:`\mathbf{F}_{ne}` is positive for repulsion), and :math:`\mathbf{n} = \frac{\mathbf{r}_{ij}}{\|\mathbf{r}_{ij}\|}`. Therefore, for *hooke*, the units of the spring constant :math:`k_n` are *force*\ /\ *distance*, or equivalently *mass*\ /*time\^2*. From a9818436864fb47fa84e4e6a1c99f5ce2052b2bc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Oct 2022 11:51:50 -0400 Subject: [PATCH 22/27] forgot updated Makefile --- lib/pace/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pace/Makefile b/lib/pace/Makefile index 43e5287ecc..5a1588ef93 100644 --- a/lib/pace/Makefile +++ b/lib/pace/Makefile @@ -5,10 +5,10 @@ SHELL = /bin/sh YAML_CPP_PATH = src/yaml-cpp YAML_CPP_INC = $(YAML_CPP_PATH)/include -WIGNER_CPP_INC = src/wigner-cpp/include/wigner +WIGNER_CPP_INC = src/wigner-cpp/include CNPY_CPP_PATH = src/cnpy -CNPY_CPP_INC = $(CNPY_CPP_PATH) +CNPY_CPP_INC = src CNPY_SRC_FILES = $(CNPY_CPP_PATH)/cnpy.cpp SRC_FILES = $(wildcard src/ML-PACE/ace/*.cpp) $(wildcard src/ML-PACE/ace-evaluator/*.cpp) @@ -21,7 +21,7 @@ OBJ = $(SRC:.cpp=.o) # ------ SETTINGS ------ -CXXFLAGS = -O3 -fPIC -Isrc/ML-PACE/ace -Isrc/ML-PACE/ace-evaluator -I$(YAML_CPP_INC) -I$(WIGNER_CPP_INC) -I$(CNPY_CPP_INC) -DEXTRA_C_PROJECTIONS +CXXFLAGS = -O3 -fPIC -Isrc/ML-PACE -I$(YAML_CPP_INC) -I$(WIGNER_CPP_INC) -I$(CNPY_CPP_INC) -DEXTRA_C_PROJECTIONS ARCHIVE = ar ARCHFLAG = -rc From fc8d9207c6d798fc4f7469e362e65bd9755dd685 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Oct 2022 12:22:28 -0400 Subject: [PATCH 23/27] update Makefile.lammps, too. --- lib/pace/Makefile.lammps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pace/Makefile.lammps b/lib/pace/Makefile.lammps index e925f86089..6411e49a07 100644 --- a/lib/pace/Makefile.lammps +++ b/lib/pace/Makefile.lammps @@ -1,3 +1,3 @@ -pace_SYSINC =-I../../lib/pace/src/ML-PACE/ace -I../../lib/pace/src/ML-PACE/ace-evaluator -I../../lib/pace/src/yaml-cpp/include -I../../lib/pace/src/wigner-cpp/include/wigner -DEXTRA_C_PROJECTIONS +pace_SYSINC =-I../../lib/pace/src/ML-PACE -I../../lib/pace/src/yaml-cpp/include -I../../lib/pace/src/wigner-cpp/include -DEXTRA_C_PROJECTIONS pace_SYSLIB = -L../../lib/pace/ -lpace -L../../lib/pace/src/yaml-cpp/ -lyaml-cpp pace_SYSPATH = From 57dad8dc398fc6c1c5a64dd386288909004c83d1 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 17 Oct 2022 11:25:01 -0600 Subject: [PATCH 24/27] Host path needs RangePolicy --- src/KOKKOS/pair_tersoff_kokkos.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 05b2d2c48a..0b457b3113 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -46,9 +46,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - // A point of optimization with the pairwise force calculation is to hand-tune // the number of atoms per team, which cannot be done (yet?) with the standard // 1-d RangePolicy. A more intuitive way to do this is with team parallelism, @@ -60,7 +57,7 @@ using namespace MathConst; // be explicitly set with MDRangePolicies. It has been confirmed that the performance // regression from using a TeamPolicy goes away after addressing the cache carveout. // This is a convenience flag to make it easy to toggle team parallelism later. -#define KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND +#define LMP_KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND /* ---------------------------------------------------------------------- */ @@ -246,15 +243,19 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else { -#ifdef KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND - Kokkos::parallel_for(Kokkos::MDRangePolicy, Kokkos::LaunchBounds, - TagPairTersoffCompute >({0,0},{inum,1},{block_size_compute_tersoff_force,1}),*this); + if (ExecutionSpaceFromDevice::space == Host) { + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + } else { +#ifdef LMP_KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + Kokkos::parallel_for(Kokkos::MDRangePolicy, Kokkos::LaunchBounds, + TagPairTersoffCompute >({0,0},{inum,1},{block_size_compute_tersoff_force,1}),*this); #else - int team_count = (inum + block_size_compute_tersoff_force - 1) / block_size_compute_tersoff_force; - Kokkos::TeamPolicy, - TagPairTersoffCompute> team_policy(team_count, block_size_compute_tersoff_force); - Kokkos::parallel_for(team_policy, *this); + int team_count = (inum + block_size_compute_tersoff_force - 1) / block_size_compute_tersoff_force; + Kokkos::TeamPolicy, + TagPairTersoffCompute> team_policy(team_count, block_size_compute_tersoff_force); + Kokkos::parallel_for(team_policy, *this); #endif + } } ev_all += ev; } From 637810515a89a09d0fcf1ba081e42444bfb4514e Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Mon, 17 Oct 2022 14:51:10 -0500 Subject: [PATCH 25/27] make compute rigid/local consistent with other "possible attributes" docs --- doc/src/compute_rigid_local.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/src/compute_rigid_local.rst b/doc/src/compute_rigid_local.rst index 91e0dc0acf..bf0f402f06 100644 --- a/doc/src/compute_rigid_local.rst +++ b/doc/src/compute_rigid_local.rst @@ -6,7 +6,7 @@ compute rigid/local command Syntax """""" -.. parsed-literal:: +.. code-block:: LAMMPS compute ID group-ID rigid/local rigidID input1 input2 ... @@ -25,6 +25,9 @@ Syntax quatw, quati, quatj, quatk, tqx, tqy, tqz, inertiax, inertiay, inertiaz + + .. parsed-literal:: + id = atom ID of atom within body which owns body properties mol = molecule ID used to define body in :doc:`fix rigid/small ` command mass = total mass of body @@ -69,8 +72,8 @@ the atoms owned on a processor. If the atom is not in the specified the atom within a body that is assigned to store the body information it is skipped (only one atom per body is so assigned). If it is the assigned atom, then the info for that body is output. This means that -information for N bodies is generated. N may be less than the # of -bodies defined by the fix rigid command, if the atoms in some bodies +information for :math:`N` bodies is generated. :math:`N` may be less than the +number of bodies defined by the fix rigid command, if the atoms in some bodies are not in the *group-ID*\ . .. note:: @@ -119,7 +122,7 @@ The image flags for the body can be generated directly using the *ix*, *iy*, *iz* attributes. For periodic dimensions, they specify which image of the simulation box the COM is considered to be in. An image of 0 means it is inside the box as defined. A value of 2 means add 2 -box lengths to get the true value. A value of -1 means subtract 1 box +box lengths to get the true value. A value of :math:`-1` means subtract 1 box length to get the true value. LAMMPS updates these flags as the rigid body COMs cross periodic boundaries during the simulation. @@ -141,8 +144,8 @@ The *tqx*, *tqy*, *tqz* attributes are components of the torque acting on the body around its COM. The *inertiax*, *inertiay*, *inertiaz* attributes are components of -diagonalized inertia tensor for the body, i.e the 3 moments of inertia -for the body around its principal axes, as computed internally by +diagonalized inertia tensor for the body (i.e., the three moments of inertia +for the body around its principal axes), as computed internally by LAMMPS. ---------- @@ -169,10 +172,10 @@ corresponding attribute is in: * vx,vy,vz = velocity units * fx,fy,fz = force units * omegax,omegay,omegaz = radians/time units -* angmomx,angmomy,angmomz = mass\*distance\^2/time units +* angmomx,angmomy,angmomz = mass\*distance\ :math:`^2`\ /time units * quatw,quati,quatj,quatk = unitless * tqx,tqy,tqz = torque units -* inertiax,inertiay,inertiaz = mass\*distance\^2 units +* inertiax,inertiay,inertiaz = mass\*distance\ :math:`^2` units Restrictions """""""""""" From ad048a20d7ae6a68d79722387cf4ed46f92a3d41 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 17 Oct 2022 14:42:09 -0600 Subject: [PATCH 26/27] Remove unused variables --- src/KOKKOS/pair_buck_coul_cut_kokkos.cpp | 3 --- src/KOKKOS/pair_buck_coul_long_kokkos.cpp | 3 --- src/KOKKOS/pair_buck_kokkos.cpp | 3 --- src/KOKKOS/pair_coul_cut_kokkos.cpp | 3 --- src/KOKKOS/pair_coul_debye_kokkos.cpp | 3 --- src/KOKKOS/pair_coul_long_kokkos.cpp | 3 --- src/KOKKOS/pair_coul_wolf_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_class2_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_cut_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_expand_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_gromacs_kokkos.cpp | 3 --- src/KOKKOS/pair_lj_spica_kokkos.cpp | 3 --- src/KOKKOS/pair_morse_kokkos.cpp | 3 --- src/KOKKOS/pair_tersoff_mod_kokkos.cpp | 3 --- src/KOKKOS/pair_tersoff_zbl_kokkos.cpp | 3 --- src/KOKKOS/pair_yukawa_kokkos.cpp | 3 --- 26 files changed, 78 deletions(-) diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index 78d3a9e78e..9b19cbcc7a 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -37,9 +37,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index ab0476a28b..5200db8356 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index dc375dddf7..8e0156331b 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 0532644579..77dfd6b607 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -28,9 +28,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index ff98885e3e..3f17f0bb64 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index 3f5ad0a6d5..7f749a1e8a 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.cpp b/src/KOKKOS/pair_coul_wolf_kokkos.cpp index 79186d8951..48491b4894 100644 --- a/src/KOKKOS/pair_coul_wolf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_wolf_kokkos.cpp @@ -34,9 +34,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index 1b0b426aa7..37697a91fb 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -34,9 +34,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index 501b80fe85..4414116f1a 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index 2b846c0a85..6f3449afd1 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index 0f8e426521..fc6b1758b5 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -32,9 +32,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index 64ab396824..afa0ac6925 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -31,9 +31,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index b5866066d3..a29a2d46cc 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index c8379107f4..18c537ce9b 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -31,9 +31,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index ed1b2c05d5..fc4febf575 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index d04e66057a..f24ddcc90f 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -37,9 +37,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 #define A1 0.254829592 diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index d3bb7e8819..5c0584cd8c 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -33,9 +33,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - #define EWALD_F 1.12837917 #define EWALD_P 0.3275911 diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 487c43cef6..eeb9f44c81 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -30,9 +30,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index 25a562d5a6..ca5d7c5233 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index 4114c8f5a6..b956c50758 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index ee038c9c17..79ee36f8c7 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -35,9 +35,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_spica_kokkos.cpp b/src/KOKKOS/pair_lj_spica_kokkos.cpp index 4e77edb200..60640c8715 100644 --- a/src/KOKKOS/pair_lj_spica_kokkos.cpp +++ b/src/KOKKOS/pair_lj_spica_kokkos.cpp @@ -34,9 +34,6 @@ using namespace LAMMPS_NS; using namespace LJSPICAParms; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index 7619883047..a6b346673b 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -37,9 +37,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 203cfba134..06990d86c2 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -36,9 +36,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 4068f14f6d..529ba19922 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -38,9 +38,6 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 7672385dfb..486c5598e5 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -34,9 +34,6 @@ using namespace LAMMPS_NS; -#define KOKKOS_CUDA_MAX_THREADS 256 -#define KOKKOS_CUDA_MIN_BLOCKS 8 - /* ---------------------------------------------------------------------- */ template From 598e8cc48853a4f559e9ce0f1b93e0c6f470d50f Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Mon, 17 Oct 2022 15:31:34 -0600 Subject: [PATCH 27/27] Port changes to other Tersoff styles --- src/KOKKOS/pair_tersoff_kokkos.cpp | 3 - src/KOKKOS/pair_tersoff_kokkos.h | 4 +- src/KOKKOS/pair_tersoff_mod_kokkos.cpp | 81 ++++++++++++++++++++++++-- src/KOKKOS/pair_tersoff_mod_kokkos.h | 29 +++++++++ src/KOKKOS/pair_tersoff_zbl_kokkos.cpp | 81 ++++++++++++++++++++++++-- src/KOKKOS/pair_tersoff_zbl_kokkos.h | 29 +++++++++ 6 files changed, 214 insertions(+), 13 deletions(-) diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 0b457b3113..cde22ce63c 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -540,7 +540,6 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputetemplate tersoff_compute(ii, ev); - } template @@ -554,10 +553,8 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputetemplate tersoff_compute(ii, ev); } - } - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_tersoff_kokkos.h b/src/KOKKOS/pair_tersoff_kokkos.h index 70a656b0a8..6679920bbe 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.h +++ b/src/KOKKOS/pair_tersoff_kokkos.h @@ -46,7 +46,7 @@ class PairTersoffKokkos : public PairTersoff { // Static blocking size for PairTersoffCompute, EVFLAG == 0 static constexpr int block_size_compute_tersoff_force = 128; // EVFLAG == 1, intentionally different due to how Kokkos implements - // reductions vs simple parallel for + // reductions vs simple parallel_for static constexpr int block_size_compute_tersoff_energy = 256; PairTersoffKokkos(class LAMMPS *); @@ -55,7 +55,7 @@ class PairTersoffKokkos : public PairTersoff { void coeff(int, char **) override; void init_style() override; - // Range Policy versions + // RangePolicy versions template KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffCompute, const int&, EV_FLOAT&) const; diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 06990d86c2..711bf41e2b 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -36,6 +36,19 @@ using namespace LAMMPS_NS; using namespace MathConst; +// A point of optimization with the pairwise force calculation is to hand-tune +// the number of atoms per team, which cannot be done (yet?) with the standard +// 1-d RangePolicy. A more intuitive way to do this is with team parallelism, +// where you specify the team size, but this currently leads to a regression +// on CUDA due to the way Kokkos handles cache carveout preferences. This is +// being worked on in https://github.com/kokkos/kokkos/pull/4295 . Until that is +// worked out/merged, the workaround is using a Rank 2 MDRangePolicy, where the +// second dimension is trivially of length 1, because "team" == block sizes can +// be explicitly set with MDRangePolicies. It has been confirmed that the performance +// regression from using a TeamPolicy goes away after addressing the cache carveout. +// This is a convenience flag to make it easy to toggle team parallelism later. +#define LMP_KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + /* ---------------------------------------------------------------------- */ template @@ -219,8 +232,21 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) } else if (neighflag == HALFTHREAD) { if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + else { + if (ExecutionSpaceFromDevice::space == Host) { + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + } else { +#ifdef LMP_KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + Kokkos::parallel_for(Kokkos::MDRangePolicy, Kokkos::LaunchBounds, + TagPairTersoffMODCompute >({0,0},{inum,1},{block_size_compute_tersoff_force,1}),*this); +#else + int team_count = (inum + block_size_compute_tersoff_force - 1) / block_size_compute_tersoff_force; + Kokkos::TeamPolicy, + TagPairTersoffMODCompute> team_policy(team_count, block_size_compute_tersoff_force); + Kokkos::parallel_for(team_policy, *this); +#endif + } + } ev_all += ev; } @@ -298,7 +324,7 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeShortN template template KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii, EV_FLOAT& ev) const { +void PairTersoffMODKokkos::tersoff_mod_compute(const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -471,12 +497,59 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute +template +KOKKOS_INLINE_FUNCTION +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii, EV_FLOAT& ev) const { + this->template tersoff_mod_compute(ii, ev); +} + template template KOKKOS_INLINE_FUNCTION void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairTersoffMODCompute(), ii, ev); + this->template tersoff_mod_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii, const int&, EV_FLOAT& ev) const { + this->template tersoff_mod_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii, const int&) const { + EV_FLOAT ev; + this->template tersoff_mod_compute(ii, ev); +} + +// TeamPolicy versions +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const typename Kokkos::TeamPolicy >::member_type &team, EV_FLOAT& ev) const { + + const int ii = team.league_rank() * block_size_compute_tersoff_energy + team.team_rank(); + + if (ii < inum) + this->template tersoff_mod_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const typename Kokkos::TeamPolicy >::member_type &team) const { + + const int ii = team.league_rank() * block_size_compute_tersoff_force + team.team_rank(); + + if (ii < inum) { + EV_FLOAT ev; + this->template tersoff_mod_compute(ii, ev); + } } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.h b/src/KOKKOS/pair_tersoff_mod_kokkos.h index d0c2f61648..6bcbc66386 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.h +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.h @@ -43,12 +43,19 @@ class PairTersoffMODKokkos : public PairTersoffMOD { typedef ArrayTypes AT; typedef EV_FLOAT value_type; + // Static blocking size for PairTersoffCompute, EVFLAG == 0 + static constexpr int block_size_compute_tersoff_force = 128; + // EVFLAG == 1, intentionally different due to how Kokkos implements + // reductions vs simple parallel_for + static constexpr int block_size_compute_tersoff_energy = 256; + PairTersoffMODKokkos(class LAMMPS *); ~PairTersoffMODKokkos() override; void compute(int, int) override; void coeff(int, char **) override; void init_style() override; + // RangePolicy versions template KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffMODCompute, const int&, EV_FLOAT&) const; @@ -57,9 +64,31 @@ class PairTersoffMODKokkos : public PairTersoffMOD { KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffMODCompute, const int&) const; + // MDRangePolicy versions + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffMODCompute, const int&, const int&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffMODCompute, const int&, const int&) const; + + // TeamPolicy versions + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffMODCompute, const typename Kokkos::TeamPolicy >::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffMODCompute, const typename Kokkos::TeamPolicy >::member_type&) const; + KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffMODComputeShortNeigh, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void tersoff_mod_compute(const int&, EV_FLOAT&) const; + KOKKOS_INLINE_FUNCTION double ters_fc_k(const Param& param, const F_FLOAT &r) const; diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 529ba19922..c628ee5ddf 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -38,6 +38,19 @@ using namespace LAMMPS_NS; using namespace MathConst; +// A point of optimization with the pairwise force calculation is to hand-tune +// the number of atoms per team, which cannot be done (yet?) with the standard +// 1-d RangePolicy. A more intuitive way to do this is with team parallelism, +// where you specify the team size, but this currently leads to a regression +// on CUDA due to the way Kokkos handles cache carveout preferences. This is +// being worked on in https://github.com/kokkos/kokkos/pull/4295 . Until that is +// worked out/merged, the workaround is using a Rank 2 MDRangePolicy, where the +// second dimension is trivially of length 1, because "team" == block sizes can +// be explicitly set with MDRangePolicies. It has been confirmed that the performance +// regression from using a TeamPolicy goes away after addressing the cache carveout. +// This is a convenience flag to make it easy to toggle team parallelism later. +#define LMP_KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + /* ---------------------------------------------------------------------- */ template @@ -232,8 +245,21 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) } else if (neighflag == HALFTHREAD) { if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + else { + if (ExecutionSpaceFromDevice::space == Host) { + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + } else { +#ifdef LMP_KOKKOS_TERSOFF_MDRANGEPOLICY_WORKAROUND + Kokkos::parallel_for(Kokkos::MDRangePolicy, Kokkos::LaunchBounds, + TagPairTersoffZBLCompute >({0,0},{inum,1},{block_size_compute_tersoff_force,1}),*this); +#else + int team_count = (inum + block_size_compute_tersoff_force - 1) / block_size_compute_tersoff_force; + Kokkos::TeamPolicy, + TagPairTersoffZBLCompute> team_policy(team_count, block_size_compute_tersoff_force); + Kokkos::parallel_for(team_policy, *this); +#endif + } + } ev_all += ev; } @@ -311,7 +337,7 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeShortN template template KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii, EV_FLOAT& ev) const { +void PairTersoffZBLKokkos::tersoff_zbl_compute(const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -514,12 +540,59 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute +template +KOKKOS_INLINE_FUNCTION +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii, EV_FLOAT& ev) const { + this->template tersoff_zbl_compute(ii, ev); +} + template template KOKKOS_INLINE_FUNCTION void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairTersoffZBLCompute(), ii, ev); + this->template tersoff_zbl_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii, const int&, EV_FLOAT& ev) const { + this->template tersoff_zbl_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii, const int&) const { + EV_FLOAT ev; + this->template tersoff_zbl_compute(ii, ev); +} + +// TeamPolicy versions +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const typename Kokkos::TeamPolicy >::member_type &team, EV_FLOAT& ev) const { + + const int ii = team.league_rank() * block_size_compute_tersoff_energy + team.team_rank(); + + if (ii < inum) + this->template tersoff_zbl_compute(ii, ev); +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const typename Kokkos::TeamPolicy >::member_type &team) const { + + const int ii = team.league_rank() * block_size_compute_tersoff_force + team.team_rank(); + + if (ii < inum) { + EV_FLOAT ev; + this->template tersoff_zbl_compute(ii, ev); + } } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.h b/src/KOKKOS/pair_tersoff_zbl_kokkos.h index bafdbc6023..6cf7f8175a 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.h +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.h @@ -43,12 +43,19 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { typedef ArrayTypes AT; typedef EV_FLOAT value_type; + // Static blocking size for PairTersoffCompute, EVFLAG == 0 + static constexpr int block_size_compute_tersoff_force = 128; + // EVFLAG == 1, intentionally different due to how Kokkos implements + // reductions vs simple parallel_for + static constexpr int block_size_compute_tersoff_energy = 256; + PairTersoffZBLKokkos(class LAMMPS *); ~PairTersoffZBLKokkos() override; void compute(int, int) override; void coeff(int, char **) override; void init_style() override; + // RangePolicy versions template KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffZBLCompute, const int&, EV_FLOAT&) const; @@ -57,9 +64,31 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffZBLCompute, const int&) const; + // MDRangePolicy versions + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffZBLCompute, const int&, const int&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffZBLCompute, const int&, const int&) const; + + // TeamPolicy versions + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffZBLCompute, const typename Kokkos::TeamPolicy >::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairTersoffZBLCompute, const typename Kokkos::TeamPolicy >::member_type&) const; + KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffZBLComputeShortNeigh, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void tersoff_zbl_compute(const int&, EV_FLOAT&) const; + KOKKOS_INLINE_FUNCTION double ters_fc_k(const Param& param, const F_FLOAT &r) const;