From 1c15ba88f32011c8e655626740b00954b2b5d1e5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 20 Apr 2020 15:27:30 -0400 Subject: [PATCH 1/9] need to copy maxspecial and "extra" data to do a proper recreation --- src/replicate.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/replicate.cpp b/src/replicate.cpp index b3baf47c16..96125d4fe2 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -196,6 +196,12 @@ void Replicate::command(int narg, char **arg) atom->dihedral_per_atom = old->dihedral_per_atom; atom->improper_per_atom = old->improper_per_atom; + atom->extra_bond_per_atom = old->extra_bond_per_atom; + atom->extra_angle_per_atom = old->extra_angle_per_atom; + atom->extra_dihedral_per_atom = old->extra_dihedral_per_atom; + atom->extra_improper_per_atom = old->extra_improper_per_atom; + atom->maxspecial = old->maxspecial; + // store old simulation box int triclinic = domain->triclinic; From 0dfb1329bea08965cbd1032a371476f45f6943ae Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 20 Apr 2020 16:56:09 -0400 Subject: [PATCH 2/9] we must not write out per-type pair cutoff when long-range LJ is enabled --- src/KSPACE/pair_buck_long_coul_long.cpp | 15 +++++++++++---- src/KSPACE/pair_lj_long_coul_long.cpp | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index 6c731b73b3..db01cb8509 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -430,10 +430,17 @@ void PairBuckLongCoulLong::write_data(FILE *fp) void PairBuckLongCoulLong::write_data_all(FILE *fp) { - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) - fprintf(fp,"%d %d %g %g %g\n",i,j, - buck_a_read[i][j],buck_rho_read[i][j],buck_c_read[i][j]); + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = i; j <= atom->ntypes; j++) { + if (ewald_order & (1<<6)) { + fprintf(fp,"%d %d %g %g\n",i,j, + buck_a_read[i][j],buck_rho_read[i][j]); + } else { + fprintf(fp,"%d %d %g %g %g\n",i,j, + buck_a_read[i][j],buck_rho_read[i][j],buck_c_read[i][j]); + } + } + } } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 94955d2d6d..ce6b6f57a2 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -427,10 +427,17 @@ void PairLJLongCoulLong::write_data(FILE *fp) void PairLJLongCoulLong::write_data_all(FILE *fp) { - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) - fprintf(fp,"%d %d %g %g %g\n",i,j, - epsilon_read[i][j],sigma_read[i][j],cut_lj_read[i][j]); + for (int i = 1; i <= atom->ntypes; i++) { + for (int j = i; j <= atom->ntypes; j++) { + if (ewald_order & (1<<6)) { + fprintf(fp,"%d %d %g %g\n",i,j, + epsilon_read[i][j],sigma_read[i][j]); + } else { + fprintf(fp,"%d %d %g %g %g\n",i,j, + epsilon_read[i][j],sigma_read[i][j],cut_lj_read[i][j]); + } + } + } } /* ---------------------------------------------------------------------- From 9f923c51f8f0cd416c08a43a1c249df0ac906386 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 21 Apr 2020 12:07:34 -0400 Subject: [PATCH 3/9] update singularity definition files for ubuntu variants to enable more LAMMPS build options and features --- tools/singularity/ubuntu16.04.def | 2 +- tools/singularity/ubuntu18.04.def | 4 ++++ tools/singularity/ubuntu18.04_amd_rocm.def | 10 ++++++++++ tools/singularity/ubuntu18.04_intel_opencl.def | 10 ++++++++++ tools/singularity/ubuntu18.04_nvidia.def | 10 ++++++++++ tools/singularity/ubuntu20.04.def | 5 ++++- 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/tools/singularity/ubuntu16.04.def b/tools/singularity/ubuntu16.04.def index b6833707a2..ea661cf083 100644 --- a/tools/singularity/ubuntu16.04.def +++ b/tools/singularity/ubuntu16.04.def @@ -8,7 +8,7 @@ From: ubuntu:16.04 apt-get install --no-install-recommends -y \ bc build-essential curl doxygen vim-nox wget \ make cmake cmake-curses-gui ninja-build git \ - rsync ssh \ + rsync ssh less \ ccache gcc g++ gfortran \ mpi-default-bin mpi-default-dev \ libfftw3-dev libjpeg-dev libpng12-dev libblas-dev liblapack-dev \ diff --git a/tools/singularity/ubuntu18.04.def b/tools/singularity/ubuntu18.04.def index 4285f8d3a4..31c14f6830 100644 --- a/tools/singularity/ubuntu18.04.def +++ b/tools/singularity/ubuntu18.04.def @@ -20,15 +20,19 @@ From: ubuntu:18.04 gfortran \ git \ hdf5-tools \ + less \ libblas-dev \ libeigen3-dev \ libenchant-dev \ libfftw3-dev \ libgsl-dev \ libhdf5-serial-dev \ + libhwloc-dev \ libjpeg-dev \ liblapack-dev \ + libomp-dev \ libopenblas-dev \ + libnuma-dev \ libpng-dev \ libproj-dev \ libvtk6-dev \ diff --git a/tools/singularity/ubuntu18.04_amd_rocm.def b/tools/singularity/ubuntu18.04_amd_rocm.def index f653e65130..0338ff3c45 100644 --- a/tools/singularity/ubuntu18.04_amd_rocm.def +++ b/tools/singularity/ubuntu18.04_amd_rocm.def @@ -24,14 +24,18 @@ From: rocm/dev-ubuntu-18.04 gfortran \ git \ hdf5-tools \ + kmod \ + less \ libblas-dev \ libeigen3-dev \ libenchant-dev \ libfftw3-dev \ libgsl-dev \ libhdf5-serial-dev \ + libhwloc-dev \ libjpeg-dev \ liblapack-dev \ + libomp-dev \ libopenblas-dev \ libnuma-dev \ libpng-dev \ @@ -53,6 +57,12 @@ From: rocm/dev-ubuntu-18.04 rocm-libs \ rsync \ ssh \ + texlive \ + texlive-latex-recommended \ + texlive-pictures \ + texlive-publishers \ + texlive-science \ + dvipng \ vim-nox \ virtualenv \ voro++-dev \ diff --git a/tools/singularity/ubuntu18.04_intel_opencl.def b/tools/singularity/ubuntu18.04_intel_opencl.def index 389c75699c..6dabb94cb1 100644 --- a/tools/singularity/ubuntu18.04_intel_opencl.def +++ b/tools/singularity/ubuntu18.04_intel_opencl.def @@ -22,15 +22,19 @@ From: ubuntu:18.04 gfortran \ git \ hdf5-tools \ + less \ libblas-dev \ libeigen3-dev \ libenchant-dev \ libfftw3-dev \ libgsl-dev \ libhdf5-serial-dev \ + libhwloc-dev \ libjpeg-dev \ liblapack-dev \ + libomp-dev \ libopenblas-dev \ + libnuma-dev \ libpng-dev \ libproj-dev \ libvtk6-dev \ @@ -51,6 +55,12 @@ From: ubuntu:18.04 python3-virtualenv \ rsync \ ssh \ + texlive \ + texlive-latex-recommended \ + texlive-pictures \ + texlive-publishers \ + texlive-science \ + dvipng \ vim-nox \ virtualenv \ voro++-dev \ diff --git a/tools/singularity/ubuntu18.04_nvidia.def b/tools/singularity/ubuntu18.04_nvidia.def index 9392821d7e..bec17adf7f 100644 --- a/tools/singularity/ubuntu18.04_nvidia.def +++ b/tools/singularity/ubuntu18.04_nvidia.def @@ -22,15 +22,19 @@ From: nvidia/cuda:10.2-devel-ubuntu18.04 gfortran \ git \ hdf5-tools \ + less \ libblas-dev \ libeigen3-dev \ libenchant-dev \ libfftw3-dev \ libgsl-dev \ libhdf5-serial-dev \ + libhwloc-dev \ libjpeg-dev \ liblapack-dev \ + libomp-dev \ libopenblas-dev \ + libnuma-dev \ libpng-dev \ libproj-dev \ libvtk6-dev \ @@ -51,6 +55,12 @@ From: nvidia/cuda:10.2-devel-ubuntu18.04 python3-virtualenv \ rsync \ ssh \ + texlive \ + texlive-latex-recommended \ + texlive-pictures \ + texlive-publishers \ + texlive-science \ + dvipng \ vim-nox \ virtualenv \ voro++-dev \ diff --git a/tools/singularity/ubuntu20.04.def b/tools/singularity/ubuntu20.04.def index 37c67b9373..028f5a09c7 100644 --- a/tools/singularity/ubuntu20.04.def +++ b/tools/singularity/ubuntu20.04.def @@ -20,16 +20,19 @@ From: ubuntu:20.04 gfortran \ git \ hdf5-tools \ + less \ libblas-dev \ libeigen3-dev \ libenchant-dev \ libfftw3-dev \ libgsl-dev \ libhdf5-serial-dev \ + libhwloc-dev \ libjpeg-dev \ liblapack-dev \ - libopenblas-dev \ libomp-dev \ + libopenblas-dev \ + libnuma-dev \ libpng-dev \ libproj-dev \ libvtk6-dev \ From ea31fc11a61e9aa39d526eba8e74d4b9e897a0e1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 21 Apr 2020 12:44:13 -0400 Subject: [PATCH 4/9] add more explicit note about lack of support for pair styles in compute centroid/stress/atom --- doc/src/compute_stress_atom.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/src/compute_stress_atom.rst b/doc/src/compute_stress_atom.rst index 48e8b9c69c..b8b3cb0ea1 100644 --- a/doc/src/compute_stress_atom.rst +++ b/doc/src/compute_stress_atom.rst @@ -2,6 +2,7 @@ compute stress/atom command =========================== + compute centroid/stress/atom command ==================================== @@ -223,15 +224,14 @@ The per-atom array values will be in pressure\*volume Restrictions """""""""""" -Currently, compute *centroid/stress/atom* does not support -pair styles with many-body interactions, -such as :doc:`Tersoff `, -and LAMMPS will generate an error in such cases. -In principal, equivalent formulation -to that of angle, dihedral and improper contributions -in the virial :math:`W_{ab}` formula -can also be applied to the many-body pair styles, -and is planned in the future. + +Currently (Spring 2020), compute *centroid/stress/atom* does not support +pair styles with many-body interactions, such as :doc:`Tersoff +`, or pair styles with long-range Coulomb interactions. +LAMMPS will generate an error in such cases. In principal, equivalent +formulation to that of angle, dihedral and improper contributions in the +virial :math:`W_{ab}` formula can also be applied to the many-body pair +styles, and is planned in the future. Related commands """""""""""""""" From db4c6e4056027e6346e24b3829ef0f8895c868d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 21 Apr 2020 19:31:18 -0400 Subject: [PATCH 5/9] update include file conventions since we no longer require C++98 for LAMMPS core files --- doc/include-file-conventions.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/include-file-conventions.md b/doc/include-file-conventions.md index 132f2ec4eb..1b8e79d71e 100644 --- a/doc/include-file-conventions.md +++ b/doc/include-file-conventions.md @@ -49,22 +49,15 @@ include files provided with LAMMPS are included with double quotes For headers declaring functions of the C-library, the corresponding C++ versions should be included (examples: `#include ` or -`#include `). However, these includes are limited to those defined -in the C++98 standard. Some files thus must use the older style until -the minimum C++ standard requirement of LAMMPS is lifted to C++11 or -even beyond (examples: `#include ` versus `#include ` -or `#include ` versus `#include `). +`#include ` instead of `#include ` or +`#include` ). ### C++ Standard Compliance -LAMMPS core files currently correspond to the C++98 standard. Files -requiring C++11 or later are only permitted in (optional) packages -and particularly packages that are not part of the list of commonly -used packages such as MOLECULE, KSPACE, MANYBODY, or RIGID. - -Also, LAMMPS uses the C-style stdio library for I/O instead of iostreams. -Since using both at the same time can cause problems, iostreams should -be avoided where possible. +LAMMPS core files use standard conforming C++ compatible with the +C++11 standard, unless explicitly noted. Also, LAMMPS uses the C-style +stdio library for I/O instead of iostreams. Since using both at the +same time can cause problems, iostreams should be avoided where possible. ### Lean Header Files From 5eccaecf9b59fba1fae6408a87a896b5a9ba6cac Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 21 Apr 2020 19:31:57 -0400 Subject: [PATCH 6/9] use #include now that we require C++11 --- src/hashlittle.h | 2 +- src/info.cpp | 2 +- src/math_special.cpp | 2 +- src/timer.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hashlittle.h b/src/hashlittle.h index 75380d366b..aafde922b7 100644 --- a/src/hashlittle.h +++ b/src/hashlittle.h @@ -6,7 +6,7 @@ #define LMP_HASHLITTLE_H #include -#include +#include namespace LAMMPS_NS { uint32_t hashlittle(const void *key, size_t length, uint32_t); diff --git a/src/info.cpp b/src/info.cpp index c02a0499fc..9cb6528f7d 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -53,7 +53,7 @@ #ifdef _WIN32 #define PSAPI_VERSION 1 #include -#include // requires C++-11 +#include #include #else #include diff --git a/src/math_special.cpp b/src/math_special.cpp index d4abc36f25..c8aa248910 100644 --- a/src/math_special.cpp +++ b/src/math_special.cpp @@ -1,6 +1,6 @@ #include "math_special.h" #include -#include // IWYU pragma: keep +#include // IWYU pragma: keep using namespace LAMMPS_NS; diff --git a/src/timer.cpp b/src/timer.cpp index 0a5e56ab35..41a0166a89 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -21,7 +21,7 @@ #ifdef _WIN32 #include -#include // requires C++-11 +#include #else #include #include From 48ab70f9eefe9748330e6888cc2ced70c6d92475 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 22 Apr 2020 07:30:06 -0400 Subject: [PATCH 7/9] avoid segfault when using compute_scalar() on the initial step and no scaling has yet been done. --- src/fix_heat.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index 67d445df92..65ca47c46d 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -300,6 +300,7 @@ double FixHeat::compute_scalar() { double average_scale = scale; if (hstyle == ATOM) { + if (!vscale) return 1.0; double scale_sum = 0.0; int ncount = 0; int *mask = atom->mask; From 73bf1874c5f8f284da7658c06b4d40460395e02b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 22 Apr 2020 08:12:56 -0400 Subject: [PATCH 8/9] update code owner entry for fix bond/react --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d44b3dfb4d..87f3dd1f22 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -45,7 +45,7 @@ src/GPU/pair_vashishta_gpu.* @andeplane src/KOKKOS/pair_vashishta_kokkos.* @andeplane src/MANYBODY/pair_vashishta_table.* @andeplane src/MANYBODY/pair_atm.* @sergeylishchuk -src/USER-MISC/fix_bond_react.* @jrgissing +src/USER-REACTION/fix_bond_react.* @jrgissing src/USER-MISC/*_grem.* @dstelter92 src/USER-MISC/compute_stress_mop*.* @RomainVermorel From fc10e885b20888bec0077ab9a0391f7f3d014d74 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 22 Apr 2020 08:13:27 -0400 Subject: [PATCH 9/9] make description of eflux as a variable less convoluted --- doc/src/fix_heat.rst | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/src/fix_heat.rst b/doc/src/fix_heat.rst index 82a2b6e7f8..5bb6402d46 100644 --- a/doc/src/fix_heat.rst +++ b/doc/src/fix_heat.rst @@ -47,16 +47,22 @@ and the specified geometric :doc:`region ` in order to have energy added or subtracted to it. If not specified, then the atoms in the group are affected wherever they may move to. -Heat addition/subtraction is performed every N timesteps. The *eflux* -parameter can be specified as a numeric constant or as a variable (see -below). If it is a numeric constant or equal-style variable which -evaluates to a scalar value, then the *eflux* determines the change in -aggregate energy of the entire group of atoms per unit time, e.g. in -eV/psec for :doc:`metal units `. In this case it is an -"extensive" quantity, meaning its magnitude should be scaled with the -number of atoms in the group. Note that since *eflux* has per-time -units (i.e. it is a flux), this means that a larger value of N will -add/subtract a larger amount of energy each time the fix is invoked. +Heat addition/subtraction is performed every N timesteps. + +The *eflux* parameter can be specified as a numeric constant or as an +equal- or atom-style :doc:`variable `. If the value is a +variable, it should be specified as v_name, where *name* is the variable +name. In this case, the variable will be evaluated each timestep, and +its current value(s) used to determine the flux. + +If *eflux* is a numeric constant or equal-style variable which evaluates +to a scalar value, then *eflux* determines the change in aggregate energy +of the entire group of atoms per unit time, e.g. in eV/psec for +:doc:`metal units `. In this case it is an "extensive" quantity, +meaning its magnitude should be scaled with the number of atoms in the +group. Note that since *eflux* also has per-time units (i.e. it is a +flux), this means that a larger value of N will add/subtract a larger +amount of energy each time the fix is invoked. .. note:: @@ -71,12 +77,6 @@ the energy flux for a single atom, again in units of energy per unit time. In this case, each value is an "intensive" quantity, which need not be scaled with the number of atoms in the group. -As mentioned above, the *eflux* parameter can be specified as an -equal-style or atom_style :doc:`variable `. If the value is a -variable, it should be specified as v_name, where name is the variable -name. In this case, the variable will be evaluated each timestep, and -its value(s) used to determine the flux. - Equal-style variables can specify formulas with various mathematical functions, and include :doc:`thermo_style ` command keywords for the simulation box parameters and timestep and elapsed