From 6239a579e8ff8f4439ca4013fcf94ef757d6612e Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Tue, 7 Jul 2020 15:19:17 -0600 Subject: [PATCH 01/27] clarify units for energy terms with angles --- doc/src/angle_charmm.rst | 7 +++--- doc/src/angle_class2.rst | 42 +++++++++++++++++++--------------- doc/src/angle_cross.rst | 9 ++++---- doc/src/angle_harmonic.rst | 15 +++++++----- doc/src/angle_mm3.rst | 14 +++++++----- doc/src/angle_quartic.rst | 11 +++++---- doc/src/angle_sdk.rst | 15 +++++++----- doc/src/dihedral_class2.rst | 38 +++++++++++++++--------------- doc/src/dihedral_quadratic.rst | 6 ++++- doc/src/fix_restrain.rst | 8 ++++--- doc/src/improper_class2.rst | 33 ++++++++++++++------------ doc/src/improper_harmonic.rst | 15 +++++++----- 12 files changed, 121 insertions(+), 92 deletions(-) diff --git a/doc/src/angle_charmm.rst b/doc/src/angle_charmm.rst index 98b2f468a8..f0e9200fa0 100644 --- a/doc/src/angle_charmm.rst +++ b/doc/src/angle_charmm.rst @@ -49,13 +49,14 @@ The following coefficients must be defined for each angle type via the the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\theta_0` (degrees) * :math:`K_{ub}` (energy/distance\^2) * :math:`r_{ub}` (distance) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of :math:`K` are in energy/radian\^2. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. ---------- diff --git a/doc/src/angle_class2.rst b/doc/src/angle_class2.rst index afacfb7c1d..0aa5debe37 100644 --- a/doc/src/angle_class2.rst +++ b/doc/src/angle_class2.rst @@ -41,27 +41,29 @@ The *class2* angle style uses the potential E_{bb} & = M (r_{ij} - r_1) (r_{jk} - r_2) \\ E_{ba} & = N_1 (r_{ij} - r_1) (\theta - \theta_0) + N_2(r_{jk} - r_2)(\theta - \theta_0) -where :math:`E_a` is the angle term, :math:`E_{bb}` is a bond-bond term, and :math:`E_{ba}` is a -bond-angle term. :math:`\theta_0` is the equilibrium angle and :math:`r_1` and :math:`r_2` are -the equilibrium bond lengths. +where :math:`E_a` is the angle term, :math:`E_{bb}` is a bond-bond +term, and :math:`E_{ba}` is a bond-angle term. :math:`\theta_0` is +the equilibrium angle and :math:`r_1` and :math:`r_2` are the +equilibrium bond lengths. See :ref:`(Sun) ` for a description of the COMPASS class2 force field. -Coefficients for the :math:`E_a`, :math:`E_{bb}`, and :math:`E_{ba}` formulas must be defined for -each angle type via the :doc:`angle_coeff ` command as in -the example above, or in the data file or restart files read by the -:doc:`read_data ` or :doc:`read_restart ` -commands. +Coefficients for the :math:`E_a`, :math:`E_{bb}`, and :math:`E_{ba}` +formulas must be defined for each angle type via the :doc:`angle_coeff +` command as in the example above, or in the data file or +restart files read by the :doc:`read_data ` or +:doc:`read_restart ` commands. These are the 4 coefficients for the :math:`E_a` formula: * :math:`\theta_0` (degrees) -* :math:`K_2` (energy/radian\^2) -* :math:`K_3` (energy/radian\^3) -* :math:`K_4` (energy/radian\^4) +* :math:`K_2` (energy) +* :math:`K_3` (energy) +* :math:`K_4` (energy) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of the various :math:`K` are in per-radian. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence the various :math:`K` are effectively energy +per radian\^2 or radian\^3 or radian\^4. For the :math:`E_{bb}` formula, each line in a :doc:`angle_coeff ` command in the input script lists 4 coefficients, the first of which @@ -122,11 +124,15 @@ The *class2/p6* angle style uses the *class2* potential expanded to sixth order: In this expanded term 6 coefficients for the :math:`E_a` formula need to be set: * :math:`\theta_0` (degrees) -* :math:`K_2` (energy/radian\^2) -* :math:`K_3` (energy/radian\^3) -* :math:`K_4` (energy/radian\^4) -* :math:`K_5` (energy/radian\^5) -* :math:`K_6` (energy/radian\^6) +* :math:`K_2` (energy) +* :math:`K_3` (energy) +* :math:`K_4` (energy) +* :math:`K_5` (energy) +* :math:`K_6` (energy) + +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence the various :math:`K` are effectively energy +per radian\^2 or radian\^3 or radian\^4 or radian\^5 or radian\^6. The bond-bond and bond-angle terms remain unchanged. diff --git a/doc/src/angle_cross.rst b/doc/src/angle_cross.rst index 4fa95481ac..75fba2632b 100644 --- a/doc/src/angle_cross.rst +++ b/doc/src/angle_cross.rst @@ -40,14 +40,15 @@ the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: * :math:`K_{SS}` (energy/distance\^2) -* :math:`K_{BS0}` (energy/distance/rad) -* :math:`K_{BS1}` (energy/distance/rad) +* :math:`K_{BS0}` (energy/distance) +* :math:`K_{BS1}` (energy/distance) * :math:`r_{12,0}` (distance) * :math:`r_{32,0}` (distance) * :math:`\theta_0` (degrees) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of :math:`K_{BS0}` and :math:`K_{BS1}` are in energy/distance/radian. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence the :math:`K_{BS0}` and :math:`K_{BS1}` are +effectively energy/distance per radian. Restrictions """""""""""" diff --git a/doc/src/angle_harmonic.rst b/doc/src/angle_harmonic.rst index 4110f01d9b..04a3361d7b 100644 --- a/doc/src/angle_harmonic.rst +++ b/doc/src/angle_harmonic.rst @@ -44,11 +44,12 @@ The following coefficients must be defined for each angle type via the the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\theta_0` (degrees) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of :math:`K` are in energy/radian\^2. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. ---------- @@ -61,11 +62,13 @@ produce the same results, except for round-off and precision issues. These accelerated styles are part of the GPU, USER-INTEL, KOKKOS, USER-OMP and OPT packages, respectively. They are only enabled if -LAMMPS was built with those packages. See the :doc:`Build package ` doc page for more info. +LAMMPS was built with those packages. See the :doc:`Build package +` doc page for more info. You can specify the accelerated styles explicitly in your input script -by including their suffix, or you can use the :doc:`-suffix command-line switch ` when you invoke LAMMPS, or you can use the -:doc:`suffix ` command in your input script. +by including their suffix, or you can use the :doc:`-suffix +command-line switch ` when you invoke LAMMPS, or you can +use the :doc:`suffix ` command in your input script. See the :doc:`Speed packages ` doc page for more instructions on how to use the accelerated styles effectively. diff --git a/doc/src/angle_mm3.rst b/doc/src/angle_mm3.rst index cc6ee120cd..988deb8ddc 100644 --- a/doc/src/angle_mm3.rst +++ b/doc/src/angle_mm3.rst @@ -28,20 +28,22 @@ as defined in :ref:`(Allinger) ` E = K (\theta - \theta_0)^2 \left[ 1 - 0.014(\theta - \theta_0) + 5.6(10)^{-5} (\theta - \theta_0)^2 - 7.0(10)^{-7} (\theta - \theta_0)^3 + 9(10)^{-10} (\theta - \theta_0)^4 \right] -where :math:`\theta_0` is the equilibrium value of the angle, and :math:`K` is a -prefactor. The anharmonic prefactors have units :math:`\deg^{-n}`, for example -:math:`-0.014 \deg^{-1}`, :math:`5.6 \cdot 10^{-5} \deg^{-2}`, ... +where :math:`\theta_0` is the equilibrium value of the angle, and +:math:`K` is a prefactor. The anharmonic prefactors have units +:math:`\deg^{-n}`, for example :math:`-0.014 \deg^{-1}`, :math:`5.6 +\cdot 10^{-5} \deg^{-2}`, ... The following coefficients must be defined for each angle type via the :doc:`angle_coeff ` command as in the example above, or in the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\theta_0` (degrees) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of :math:`K` are in energy/radian\^2. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. Restrictions """""""""""" diff --git a/doc/src/angle_quartic.rst b/doc/src/angle_quartic.rst index 4559389a2a..a9a4f4215a 100644 --- a/doc/src/angle_quartic.rst +++ b/doc/src/angle_quartic.rst @@ -39,12 +39,13 @@ the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: * :math:`\theta_0` (degrees) -* :math:`K_2` (energy/radian\^2) -* :math:`K_3` (energy/radian\^3) -* :math:`K_4` (energy/radian\^4) +* :math:`K_2` (energy) +* :math:`K_3` (energy) +* :math:`K_4` (energy) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of :math:`K` are in energy/radian\^2. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence the various :math:`K` are effectively energy +per radian\^2 or radian\^3 or radian\^4. ---------- diff --git a/doc/src/angle_sdk.rst b/doc/src/angle_sdk.rst index 5601e4f245..f986133774 100644 --- a/doc/src/angle_sdk.rst +++ b/doc/src/angle_sdk.rst @@ -44,13 +44,15 @@ is included in :math:`K`. The following coefficients must be defined for each angle type via the :doc:`angle_coeff ` command as in the example above: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\theta_0` (degrees) -:math:`\theta_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of :math:`K` are in energy/radian\^2. -The also required *lj/sdk* parameters will be extracted automatically -from the pair_style. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. + +The required *lj/sdk* parameters are extracted automatically from the +pair_style. ---------- @@ -63,7 +65,8 @@ produce the same results, except for round-off and precision issues. These accelerated styles are part of the GPU, USER-INTEL, KOKKOS, USER-OMP and OPT packages, respectively. They are only enabled if -LAMMPS was built with those packages. See the :doc:`Build package ` doc page for more info. +LAMMPS was built with those packages. See the :doc:`Build package +` doc page for more info. You can specify the accelerated styles explicitly in your input script by including their suffix, or you can use the :doc:`-suffix command-line switch ` when you invoke LAMMPS, or you can use the diff --git a/doc/src/dihedral_class2.rst b/doc/src/dihedral_class2.rst index 034020429b..efc835b619 100644 --- a/doc/src/dihedral_class2.rst +++ b/doc/src/dihedral_class2.rst @@ -111,34 +111,34 @@ be listed under a *AngleTorsion Coeffs* heading and you must leave out the *at*, i.e. only list 8 coefficients after the dihedral type. * *at* -* :math:`D_1` (energy/radian) -* :math:`D_2` (energy/radian) -* :math:`D_3` (energy/radian) -* :math:`E_1` (energy/radian) -* :math:`E_2` (energy/radian) -* :math:`E_3` (energy/radian) +* :math:`D_1` (energy) +* :math:`D_2` (energy) +* :math:`D_3` (energy) +* :math:`E_1` (energy) +* :math:`E_2` (energy) +* :math:`E_3` (energy) * :math:`\theta_1` (degrees) * :math:`\theta_2` (degrees) -:math:`\theta_1` and :math:`\theta_2` are specified in degrees, but LAMMPS converts -them to radians internally; hence the units of :math:`D` and :math:`E` are in -energy/radian. +:math:`\theta_1` and :math:`\theta_2` are specified in degrees, but +LAMMPS converts them to radians internally; hence the various +:math:`D` and :math:`E` are effectively energy per radian. -For the :math:`E_{aat}` formula, each line in a -:doc:`dihedral_coeff ` command in the input script lists -4 coefficients, the first of which is *aat* to indicate they are -AngleAngleTorsion coefficients. In a data file, these coefficients -should be listed under a *AngleAngleTorsion Coeffs* heading and you -must leave out the *aat*, i.e. only list 3 coefficients after the -dihedral type. +For the :math:`E_{aat}` formula, each line in a :doc:`dihedral_coeff +` command in the input script lists 4 coefficients, +the first of which is *aat* to indicate they are AngleAngleTorsion +coefficients. In a data file, these coefficients should be listed +under a *AngleAngleTorsion Coeffs* heading and you must leave out the +*aat*, i.e. only list 3 coefficients after the dihedral type. * *aat* -* :math:`M` (energy/radian\^2) +* :math:`M` (energy) * :math:`\theta_1` (degrees) * :math:`\theta_2` (degrees) -:math:`\theta_1` and :math:`\theta_2` are specified in degrees, but LAMMPS converts -them to radians internally; hence the units of M are in energy/radian\^2. +:math:`\theta_1` and :math:`\theta_2` are specified in degrees, but +LAMMPS converts them to radians internally; hence :math:`M` is +effectively energy per radian\^2. For the :math:`E_{bb13}` formula, each line in a :doc:`dihedral_coeff ` command in the input script lists diff --git a/doc/src/dihedral_quadratic.rst b/doc/src/dihedral_quadratic.rst index bdc5f79559..2b95e6ff30 100644 --- a/doc/src/dihedral_quadratic.rst +++ b/doc/src/dihedral_quadratic.rst @@ -39,9 +39,13 @@ above, or in the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\phi_0` (degrees) +:math:`\phi_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. + ---------- Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are diff --git a/doc/src/fix_restrain.rst b/doc/src/fix_restrain.rst index d3cdecd46a..fdc5be06bc 100644 --- a/doc/src/fix_restrain.rst +++ b/doc/src/fix_restrain.rst @@ -183,11 +183,13 @@ the restraint is with the following coefficients: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\theta_0` (degrees) -:math:`K` and :math:`\theta_0` are specified with the fix. Note that the usual 1/2 -factor is included in :math:`K`. +:math:`K` and :math:`\theta_0` are specified with the fix. +:math:`\theta_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. Note that the usual 1/2 factor is included in :math:`K`. ---------- diff --git a/doc/src/improper_class2.rst b/doc/src/improper_class2.rst index be50a18299..1345a1ed6f 100644 --- a/doc/src/improper_class2.rst +++ b/doc/src/improper_class2.rst @@ -74,29 +74,31 @@ commands. These are the 2 coefficients for the :math:`E_i` formula: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\chi_0` (degrees) -:math:`\chi_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of K are in energy/radian\^2. +:math:`\chi_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. -For the :math:`E_{aa}` formula, each line in a -:doc:`improper_coeff ` command in the input script lists -7 coefficients, the first of which is *aa* to indicate they are -AngleAngle coefficients. In a data file, these coefficients should be -listed under a *AngleAngle Coeffs* heading and you must leave out the -*aa*, i.e. only list 6 coefficients after the improper type. +For the :math:`E_{aa}` formula, each line in a :doc:`improper_coeff +` command in the input script lists 7 coefficients, +the first of which is *aa* to indicate they are AngleAngle +coefficients. In a data file, these coefficients should be listed +under a *AngleAngle Coeffs* heading and you must leave out the *aa*, +i.e. only list 6 coefficients after the improper type. * *aa* -* :math:`M_1` (energy/distance) -* :math:`M_2` (energy/distance) -* :math:`M_3` (energy/distance) +* :math:`M_1` (energy) +* :math:`M_2` (energy) +* :math:`M_3` (energy) * :math:`\theta_1` (degrees) * :math:`\theta_2` (degrees) * :math:`\theta_3` (degrees) -The theta values are specified in degrees, but LAMMPS converts them to -radians internally; hence the units of M are in energy/radian\^2. +The :math:`\theta` values are specified in degrees, but LAMMPS +converts them to radians internally; hence the hence the various +:math:`M` are effectively energy per radian\^2. ---------- @@ -109,7 +111,8 @@ produce the same results, except for round-off and precision issues. These accelerated styles are part of the GPU, USER-INTEL, KOKKOS, USER-OMP and OPT packages, respectively. They are only enabled if -LAMMPS was built with those packages. See the :doc:`Build package ` doc page for more info. +LAMMPS was built with those packages. See the :doc:`Build package +` doc page for more info. You can specify the accelerated styles explicitly in your input script by including their suffix, or you can use the :doc:`-suffix command-line switch ` when you invoke LAMMPS, or you can use the diff --git a/doc/src/improper_harmonic.rst b/doc/src/improper_harmonic.rst index 0f525ff34b..204d7e95c4 100644 --- a/doc/src/improper_harmonic.rst +++ b/doc/src/improper_harmonic.rst @@ -59,11 +59,12 @@ above, or in the data file or restart files read by the :doc:`read_data ` or :doc:`read_restart ` commands: -* :math:`K` (energy/radian\^2) +* :math:`K` (energy) * :math:`\chi_0` (degrees) -:math:`\chi_0` is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of K are in energy/radian\^2. +:math:`\chi_0` is specified in degrees, but LAMMPS converts it to +radians internally; hence :math:`K` is effectively energy per +radian\^2. ---------- @@ -76,11 +77,13 @@ produce the same results, except for round-off and precision issues. These accelerated styles are part of the GPU, USER-INTEL, KOKKOS, USER-OMP and OPT packages, respectively. They are only enabled if -LAMMPS was built with those packages. See the :doc:`Build package ` doc page for more info. +LAMMPS was built with those packages. See the :doc:`Build package +` doc page for more info. You can specify the accelerated styles explicitly in your input script -by including their suffix, or you can use the :doc:`-suffix command-line switch ` when you invoke LAMMPS, or you can use the -:doc:`suffix ` command in your input script. +by including their suffix, or you can use the :doc:`-suffix +command-line switch ` when you invoke LAMMPS, or you can +use the :doc:`suffix ` command in your input script. See the :doc:`Speed packages ` doc page for more instructions on how to use the accelerated styles effectively. From 8396ade2806d848e6eb4b75023b920e5fa89f154 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 10 Jul 2020 22:50:47 -0400 Subject: [PATCH 02/27] update information about the ubuntu binaries to recommend the new stable packages --- doc/src/Install_linux.rst | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/src/Install_linux.rst b/doc/src/Install_linux.rst index ca3f794fc2..bb67f1aa84 100644 --- a/doc/src/Install_linux.rst +++ b/doc/src/Install_linux.rst @@ -21,8 +21,14 @@ Pre-built Ubuntu Linux executables A pre-built LAMMPS executable suitable for running on the latest Ubuntu Linux versions, can be downloaded as a Debian package. This allows you to install LAMMPS with a single command, and stay -up-to-date with the current version of LAMMPS by simply updating your -operating system. +up-to-date with the current stable version of LAMMPS by simply updating +your operating system. Please note, that the repository below offers +two LAMMPS packages, ``lammps-daily`` and ``lammps-stable``. The +LAMMPS developers recommend to use the ``lammps-stable`` package for +any production simulations. The ``lammps-daily`` package is built +from the LAMMPS development sources, and those versions may have known +issues and bugs when new features are added and the software has not +undergone full release testing. To install the appropriate personal-package archives (PPAs), do the following once: @@ -37,16 +43,16 @@ To install LAMMPS do the following once: .. code-block:: bash - $ sudo apt-get install lammps-daily + $ sudo apt-get install lammps-stable -This downloads an executable named ``lmp_daily`` to your box, which +This downloads an executable named ``lmp_stable`` to your box, which can then be used in the usual way to run input scripts: .. code-block:: bash - $ lmp_daily -in in.lj + $ lmp_stable -in in.lj -To update LAMMPS to the most current version, do the following: +To update LAMMPS to the most current stable version, do the following: .. code-block:: bash @@ -58,25 +64,25 @@ To get a copy of the current documentation and examples: .. code-block:: bash - $ sudo apt-get install lammps-daily-doc + $ sudo apt-get install lammps-stable-doc which will download the doc files in -``/usr/share/doc/lammps-daily-doc/doc`` and example problems in +``/usr/share/doc/lammps-stable-doc/doc`` and example problems in ``/usr/share/doc/lammps-doc/examples``. To get a copy of the current potentials files: .. code-block:: bash - $ sudo apt-get install lammps-daily-data + $ sudo apt-get install lammps-stable-data which will download the potentials files to -``/usr/share/lammps-daily/potentials``. The ``lmp_daily`` binary is +``/usr/share/lammps-stable/potentials``. The ``lmp_stable`` binary is hard-coded to look for potential files in this directory (it does not use the `LAMMPS_POTENTIALS` environment variable, as described in :doc:`pair_coeff ` command). -The ``lmp_daily`` binary is built with the :ref:`KIM package ` which +The ``lmp_stable`` binary is built with the :ref:`KIM package ` which results in the above command also installing the `kim-api` binaries when LAMMPS is installed. In order to use potentials from `openkim.org `_, you can install the `openkim-models` package @@ -89,9 +95,9 @@ To un-install LAMMPS, do the following: .. code-block:: bash - $ sudo apt-get remove lammps-daily + $ sudo apt-get remove lammps-stable -Please use ``lmp_daily -help`` to see which compilation options, packages, +Please use ``lmp_stable -help`` to see which compilation options, packages, and styles are included in the binary. Thanks to Anton Gladky (gladky.anton at gmail.com) for setting up this From d32000239be9cbc18748dc71829cca9a138c8c5d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 6 Jul 2020 14:12:50 -0400 Subject: [PATCH 03/27] refactor tester --- unittest/formats/test_potential_file_reader.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index 0533d547c2..8a6db0197c 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -39,6 +39,13 @@ using namespace LAMMPS_NS; using ::testing::MatchesRegex; using utils::split_words; +#define TEST_FAILURE(...) \ + if (Info::has_exceptions()) { \ + ASSERT_ANY_THROW({__VA_ARGS__}); \ + } else { \ + ASSERT_DEATH({__VA_ARGS__}, ""); \ + } + // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; @@ -108,15 +115,9 @@ TEST_F(PotentialFileReaderTest, Sw_noconv) if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("units real"); if (!verbose) ::testing::internal::GetCapturedStdout(); + ::testing::internal::CaptureStdout(); - if (Info::has_exceptions()) { - ASSERT_ANY_THROW( - PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::REAL2METAL);); - } else { - ASSERT_DEATH( - { PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::REAL2METAL); }, - ""); - } + TEST_FAILURE(PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::REAL2METAL);); std::string mesg = ::testing::internal::GetCapturedStdout(); ASSERT_THAT(mesg, MatchesRegex(".*ERROR on proc.*potential.*requires metal units but real.*")); } From f8321d77d8e09a6b853be10768701ed6a6672276 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 6 Jul 2020 21:44:39 -0400 Subject: [PATCH 04/27] add missing symlink --- examples/threebody/CdTeZnSeHgS0.sw | 1 + 1 file changed, 1 insertion(+) create mode 120000 examples/threebody/CdTeZnSeHgS0.sw diff --git a/examples/threebody/CdTeZnSeHgS0.sw b/examples/threebody/CdTeZnSeHgS0.sw new file mode 120000 index 0000000000..405221bd72 --- /dev/null +++ b/examples/threebody/CdTeZnSeHgS0.sw @@ -0,0 +1 @@ +../../potentials/CdTeZnSeHgS0.sw \ No newline at end of file From 40e59b27a7ef15ff588bee37a68b0d565501e0fc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 7 Jul 2020 09:51:02 -0400 Subject: [PATCH 05/27] add prototypes for exception handling functions --- python/lammps.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/lammps.py b/python/lammps.py index ffcdbac456..feda10802e 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -204,6 +204,12 @@ class lammps(object): self.lib.lammps_neighlist_element_neighbors.argtypes = [c_void_p, c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(POINTER(c_int))] self.lib.lammps_neighlist_element_neighbors.restype = None + self.lib.lammps_has_error.argtypes = [v_void_p] + self.lib.lammps_has_error.restype = c_bool + + self.lib.lammps_get_last_error_message.argtypes = [c_void_p, c_char_p, c_int] + self.lib.lammps_get_last_error_message.restype = c_int + # if no ptr provided, create an instance of LAMMPS # don't know how to pass an MPI communicator from PyPar # but we can pass an MPI communicator from mpi4py v2.0.0 and later From d0c544224f5c7d0e53340f69c9e9e5dbdd5a7f2d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 7 Jul 2020 09:51:39 -0400 Subject: [PATCH 06/27] avoid exception when having a command fail due to an empty string --- src/input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input.cpp b/src/input.cpp index 27f8db7012..4a0f880505 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -227,7 +227,7 @@ void Input::file() // execute the command - if (execute_command()) + if (execute_command() && line) error->all(FLERR,fmt::format("Unknown command: {}",line)); } } From 6f775f659203a97e3acc93b72ff454f701dcc718 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 7 Jul 2020 09:54:16 -0400 Subject: [PATCH 07/27] fix typo --- python/lammps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lammps.py b/python/lammps.py index feda10802e..8bd1fc693b 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -204,7 +204,7 @@ class lammps(object): self.lib.lammps_neighlist_element_neighbors.argtypes = [c_void_p, c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(POINTER(c_int))] self.lib.lammps_neighlist_element_neighbors.restype = None - self.lib.lammps_has_error.argtypes = [v_void_p] + self.lib.lammps_has_error.argtypes = [c_void_p] self.lib.lammps_has_error.restype = c_bool self.lib.lammps_get_last_error_message.argtypes = [c_void_p, c_char_p, c_int] From 17d59a434290b47506a5b014df970e271007e5b2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 7 Jul 2020 10:29:43 -0400 Subject: [PATCH 08/27] small tweak --- unittest/force-styles/tests/kspace-pppm_tip4p.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/kspace-pppm_tip4p.yaml b/unittest/force-styles/tests/kspace-pppm_tip4p.yaml index ec70dd7d6b..83926fe39d 100644 --- a/unittest/force-styles/tests/kspace-pppm_tip4p.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tip4p.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jun 2020 date_generated: Sat Jul 4 16:24:28 202 -epsilon: 1e-13 +epsilon: 2e-13 prerequisites: ! | atom full pair tip4p/long From e6a8f3c8c03e7c2537d097900597920a7c338804 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 7 Jul 2020 21:21:32 -0400 Subject: [PATCH 09/27] use parenthesis to correct precedence --- unittest/utils/test_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index 3e3fe4aed3..2a634dd053 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -420,7 +420,7 @@ TEST(Utils, unit_conversion) flag = utils::get_supported_conversions(utils::ENERGY); ASSERT_EQ(flag, utils::METAL2REAL | utils::REAL2METAL); - factor = utils::get_conversion_factor(utils::UNKNOWN, 1 << 30 - 1); + factor = utils::get_conversion_factor(utils::UNKNOWN, (1 << 30) - 1); ASSERT_DOUBLE_EQ(factor, 0.0); factor = utils::get_conversion_factor(utils::UNKNOWN, utils::NOCONVERT); ASSERT_DOUBLE_EQ(factor, 0.0); From ed452c3624981cf28caba7217705f7383cf1c4c9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 10:18:01 -0400 Subject: [PATCH 10/27] synchronize exception based and non-exception based code paths --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index 320404b8dd..9fb084aaea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,6 +53,7 @@ int main(int argc, char **argv) } catch(LAMMPSAbortException &ae) { MPI_Abort(ae.universe, 1); } catch(LAMMPSException &e) { + MPI_Barrier(MPI_COMM_WORLD); MPI_Finalize(); exit(1); } From 207232c1a3b29cd08516bb7a81bed2bf2c76fc33 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 16:29:40 -0400 Subject: [PATCH 11/27] avoid illegal free() --- src/input.cpp | 2 +- src/lammps.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 4a0f880505..2a41cf5fc2 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1913,6 +1913,7 @@ void Input::suffix() delete [] lmp->suffix; delete [] lmp->suffix2; + lmp->suffix = lmp->suffix2 = nullptr; if (strcmp(arg[0],"hybrid") == 0) { if (narg != 3) error->all(FLERR,"Illegal suffix command"); @@ -1927,7 +1928,6 @@ void Input::suffix() int n = strlen(arg[0]) + 1; lmp->suffix = new char[n]; strcpy(lmp->suffix,arg[0]); - lmp->suffix2 = nullptr; } } } diff --git a/src/lammps.cpp b/src/lammps.cpp index 3b768d1862..890e3bcc27 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -335,7 +335,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : error->universe_all(FLERR,"Invalid command-line argument"); delete [] suffix; delete [] suffix2; - suffix2 = NULL; + suffix = suffix2 = NULL; suffix_enable = 1; // hybrid option to set fall-back for suffix2 if (strcmp(arg[iarg+1],"hybrid") == 0) { From 8eb77913421d315d709abc0ee1ae3b11f6f25910 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 16:31:36 -0400 Subject: [PATCH 12/27] avoid googletest stalling on exit tests when using OpenMPI --- unittest/commands/test_simple_commands.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 5f5ad0c0ce..eeb07dc0de 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -168,8 +168,10 @@ TEST_F(SimpleCommandsTest, Quit) auto mesg = ::testing::internal::GetCapturedStdout(); ASSERT_THAT(mesg, MatchesRegex(".*ERROR: Expected integer .*")); +#if !defined(OMPI_MAJOR_VERSION) // this stalls with OpenMPI. skip. ASSERT_EXIT(lmp->input->one("quit"), ExitedWithCode(0), ""); ASSERT_EXIT(lmp->input->one("quit 9"), ExitedWithCode(9), ""); +#endif } TEST_F(SimpleCommandsTest, ResetTimestep) From 26e21852ffee4e1829ae4d1fb4c281dbe1633cad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 20:07:54 -0400 Subject: [PATCH 13/27] several fixes to address issues detected by valgrind - make sure g_ewald_6 is not accessed uninitialized - fix memory leak - do not override g_ewald_6 if it is explicitly set --- src/KSPACE/ewald_disp.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 73a0fbdff8..b40e3cd34b 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -139,14 +139,16 @@ void EwaldDisp::init() nsums += n[k]; } - if (!gewaldflag) g_ewald = g_ewald_6 = 1.0; + if (!gewaldflag) g_ewald = 1.0; + if (!gewaldflag_6) g_ewald_6 = 1.0; pair->init(); // so B is defined init_coeffs(); init_coeff_sums(); if (function[0]) qsum_qsq(); else qsqsum = qsum = 0.0; natoms_original = atom->natoms; - if (!gewaldflag) g_ewald = g_ewald_6 = 0.0; + if (!gewaldflag) g_ewald = 0.0; + if (!gewaldflag_6) g_ewald_6 = 0.0; // turn off coulombic if no charge @@ -231,7 +233,9 @@ void EwaldDisp::init() utils::logmesg(lmp,fmt::format(" G vector = {:.8g}, accuracy = {:.8g}\n", g_ewald,accuracy)); - g_ewald_6 = g_ewald; + // apply coulomb g_ewald to dispersion unless it is explicitly set + + if (!gewaldflag_6) g_ewald_6 = g_ewald; deallocate_peratom(); peratom_allocate_flag = 0; } @@ -507,6 +511,7 @@ void EwaldDisp::init_coeffs() if (function[2]) { // arithmetic 1/r^6 double **epsilon = (double **) force->pair->extract("epsilon",tmp); double **sigma = (double **) force->pair->extract("sigma",tmp); + delete [] B; double eps_i, sigma_i, sigma_n, *bi = B = new double[7*n+7]; double c[7] = { 1.0, sqrt(6.0), sqrt(15.0), sqrt(20.0), sqrt(15.0), sqrt(6.0), 1.0}; From d4da99562f276f319b03107854f5c6c7f2eeb7a9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 20:09:23 -0400 Subject: [PATCH 14/27] use fmtlib for writing data file coefficients. use mixed coefficients for PairIJCoeffs --- src/KSPACE/pair_lj_long_coul_long.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 626f5423c4..70c385f9b8 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -34,6 +34,7 @@ #include "memory.h" #include "error.h" #include "utils.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -418,11 +419,12 @@ void PairLJLongCoulLong::read_restart_settings(FILE *fp) void PairLJLongCoulLong::write_data(FILE *fp) { for (int i = 1; i <= atom->ntypes; i++) - fprintf(fp,"%d %g %g\n",i,epsilon_read[i][i],sigma_read[i][i]); + fmt::print(fp,"{} {} {}\n",i,epsilon_read[i][i],sigma_read[i][i]); } /* ---------------------------------------------------------------------- - proc 0 writes all pairs to data file + proc 0 writes all pairs to data file. must use the "mixed" parameters. + also must not write out cutoff for lj = long ------------------------------------------------------------------------- */ void PairLJLongCoulLong::write_data_all(FILE *fp) @@ -430,11 +432,11 @@ void PairLJLongCoulLong::write_data_all(FILE *fp) 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]); + fmt::print(fp,"{} {} {} {}\n",i,j, + epsilon[i][j],sigma[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]); + fmt::print(fp,"{} {} {} {} {}\n",i,j, + epsilon[i][j],sigma[i][j],cut_lj[i][j]); } } } From 4b2c1f5eddb3a99c15f0c65987a35d64dce24169 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 20:10:52 -0400 Subject: [PATCH 15/27] some more OpenMPI suppressions --- tools/valgrind/OpenMPI.supp | 40 ++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tools/valgrind/OpenMPI.supp b/tools/valgrind/OpenMPI.supp index a4aeaf95be..d5a633b3ee 100644 --- a/tools/valgrind/OpenMPI.supp +++ b/tools/valgrind/OpenMPI.supp @@ -90,6 +90,25 @@ fun:orte_init fun:ompi_mpi_init } +{ + OpenMPI_MPI_init9 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + ... + fun:orte_init + fun:ompi_mpi_init + fun:PMPI_Init +} +{ + OpenMPI_MPI_init10 + Memcheck:Leak + match-leak-kinds: indirect + fun:malloc + ... + fun:ompi_mpi_init + fun:PMPI_Init +} { OpenMPI_MPI_thread1 Memcheck:Leak @@ -152,7 +171,26 @@ match-leak-kinds: definite fun:malloc fun:strdup - obj:* ... fun:dlopen* } +{ + OpenMPI_dlopen_strdup2 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:strdup + ... + fun:dl_open_worker +} +{ + OpenMPI_dlopen_strdup3 + Memcheck:Leak + match-leak-kinds: indirect + fun:malloc + fun:strdup + ... + fun:event_base_loop + ... + fun:clone +} From b49f0a6a09ba552b7f6983a7feae73a89f80a879 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 20:11:17 -0400 Subject: [PATCH 16/27] avoid memory leak in pair style sw/intel --- src/USER-INTEL/pair_sw_intel.cpp | 5 +++++ src/USER-INTEL/pair_sw_intel.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 1955cd2e6d..a15f255199 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1292,6 +1292,11 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, _memory->destroy(op2e); _memory->destroy(op3); } + memory->destroy(p2); + memory->create(p2f); + memory->create(p2f2); + memory->create(p2e); + memory->create(p3); if (ntypes > 0) { _cop = cop; memory->create(p2,ntypes,ntypes,"fc.p2"); diff --git a/src/USER-INTEL/pair_sw_intel.h b/src/USER-INTEL/pair_sw_intel.h index 36e39e3e85..973caa5daf 100644 --- a/src/USER-INTEL/pair_sw_intel.h +++ b/src/USER-INTEL/pair_sw_intel.h @@ -87,7 +87,7 @@ class PairSWIntel : public PairSW { fc_packed2 **p2e; fc_packed3 ***p3; - ForceConst() : _ntypes(0) {} + ForceConst() : _ntypes(0), p2(0), p2f(0), p2f2(0), p2e(0), p3(0) {} ~ForceConst() { set_ntypes(0, NULL, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); From 510d5277c10e24fa75cc251ec387bdef99f4207f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 21:35:54 -0400 Subject: [PATCH 17/27] fix typo --- src/USER-INTEL/pair_sw_intel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index a15f255199..2850162e00 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1293,10 +1293,10 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, _memory->destroy(op3); } memory->destroy(p2); - memory->create(p2f); - memory->create(p2f2); - memory->create(p2e); - memory->create(p3); + memory->destroy(p2f); + memory->destroy(p2f2); + memory->destroy(p2e); + memory->destroy(p3); if (ntypes > 0) { _cop = cop; memory->create(p2,ntypes,ntypes,"fc.p2"); From 47788872432c99b6b63acf2d1aebc3008770610f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 22:04:55 -0400 Subject: [PATCH 18/27] fix memory leak in pair style sw/intel for good --- src/USER-INTEL/pair_sw_intel.cpp | 15 +++++---------- src/USER-INTEL/pair_sw_intel.h | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 2850162e00..32afcbf8a9 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1286,17 +1286,12 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, } #endif - _memory->destroy(op2); - _memory->destroy(op2f); - _memory->destroy(op2f2); - _memory->destroy(op2e); - _memory->destroy(op3); + memory->destroy(p2); + memory->destroy(p2f); + memory->destroy(p2f2); + memory->destroy(p2e); + memory->destroy(p3); } - memory->destroy(p2); - memory->destroy(p2f); - memory->destroy(p2f2); - memory->destroy(p2e); - memory->destroy(p3); if (ntypes > 0) { _cop = cop; memory->create(p2,ntypes,ntypes,"fc.p2"); diff --git a/src/USER-INTEL/pair_sw_intel.h b/src/USER-INTEL/pair_sw_intel.h index 973caa5daf..5f7a511c9f 100644 --- a/src/USER-INTEL/pair_sw_intel.h +++ b/src/USER-INTEL/pair_sw_intel.h @@ -87,7 +87,7 @@ class PairSWIntel : public PairSW { fc_packed2 **p2e; fc_packed3 ***p3; - ForceConst() : _ntypes(0), p2(0), p2f(0), p2f2(0), p2e(0), p3(0) {} + ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {} ~ForceConst() { set_ntypes(0, NULL, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); From 9fe0b1cb5e0db7d38218c8d4f757ab3d0ff33053 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 23:48:58 -0400 Subject: [PATCH 19/27] ewald_order needs to be saved in restart --- src/KSPACE/pair_lj_long_tip4p_long.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index b46fb64898..92ff2f9ad1 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -1531,6 +1531,7 @@ void PairLJLongTIP4PLong::write_restart_settings(FILE *fp) fwrite(&mix_flag,sizeof(int),1,fp); fwrite(&ncoultablebits,sizeof(int),1,fp); fwrite(&tabinner,sizeof(double),1,fp); + fwrite(&ewald_order,sizeof(int),1,fp); } /* ---------------------------------------------------------------------- @@ -1552,6 +1553,7 @@ void PairLJLongTIP4PLong::read_restart_settings(FILE *fp) utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -1566,6 +1568,7 @@ void PairLJLongTIP4PLong::read_restart_settings(FILE *fp) MPI_Bcast(&mix_flag,1,MPI_INT,0,world); MPI_Bcast(&ncoultablebits,1,MPI_INT,0,world); MPI_Bcast(&tabinner,1,MPI_DOUBLE,0,world); + MPI_Bcast(&ewald_order,1,MPI_INT,0,world); } /* ---------------------------------------------------------------------- From c6dc8b54144d86349b00bb7774201504233437db Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 23:49:18 -0400 Subject: [PATCH 20/27] fix initialition issue --- src/USER-INTEL/intel_buffers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/USER-INTEL/intel_buffers.cpp b/src/USER-INTEL/intel_buffers.cpp index 436b2f1085..ca745e8054 100644 --- a/src/USER-INTEL/intel_buffers.cpp +++ b/src/USER-INTEL/intel_buffers.cpp @@ -44,6 +44,7 @@ IntelBuffers::IntelBuffers(class LAMMPS *lmp_in) : _off_threads = 0; _off_ccache = 0; _off_ncache = 0; + _need_tag = 0; _host_nmax = 0; #endif } From 8359a4384a3c4efe233968b3a3f62c824def151d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 8 Jul 2020 23:49:31 -0400 Subject: [PATCH 21/27] more OpenMPI suppressions --- tools/valgrind/OpenMPI.supp | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/valgrind/OpenMPI.supp b/tools/valgrind/OpenMPI.supp index d5a633b3ee..5e5c64cde8 100644 --- a/tools/valgrind/OpenMPI.supp +++ b/tools/valgrind/OpenMPI.supp @@ -109,6 +109,24 @@ fun:ompi_mpi_init fun:PMPI_Init } +{ + OpenMPI_MPI_init11 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + fun:ompi_mpi_init + fun:PMPI_Init +} +{ + OpenMPI_MPI_init12 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + ... + fun:ompi_mpi_init + fun:PMPI_Init +} { OpenMPI_MPI_thread1 Memcheck:Leak @@ -194,3 +212,26 @@ ... fun:clone } +{ + OpenMPI_dlerror1 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + ... + fun:_dl_init + fun:_dl_catch_exception + ... + fun:_dlerror_run +} +{ + OpenMPI_dlerror2 + Memcheck:Leak + match-leak-kinds: definite + fun:calloc + ... + fun:_dl_init + fun:_dl_catch_exception + ... + fun:dl_open_worker + fun:_dl_catch_exception +} From e42342ff51881688f87cd476d99dae4076b262e4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 9 Jul 2020 00:31:08 -0400 Subject: [PATCH 22/27] zero out additionally allocated struct Param storage --- src/MANYBODY/pair_comb.cpp | 5 +++++ src/MANYBODY/pair_comb3.cpp | 5 +++++ src/MANYBODY/pair_gw.cpp | 5 +++++ src/MANYBODY/pair_gw_zbl.cpp | 5 +++++ src/MANYBODY/pair_nb3b_harmonic.cpp | 5 +++++ src/MANYBODY/pair_sw.cpp | 5 +++++ src/MANYBODY/pair_tersoff.cpp | 5 +++++ src/MANYBODY/pair_tersoff_mod.cpp | 5 +++++ src/MANYBODY/pair_tersoff_mod_c.cpp | 5 +++++ src/MANYBODY/pair_tersoff_zbl.cpp | 5 +++++ src/MANYBODY/pair_vashishta.cpp | 5 +++++ src/MOLECULE/pair_hbond_dreiding_lj.cpp | 5 +++++ src/MOLECULE/pair_hbond_dreiding_morse.cpp | 5 +++++ src/USER-DPD/pair_exp6_rx.cpp | 5 +++++ src/USER-MISC/pair_drip.cpp | 5 +++++ src/USER-MISC/pair_edip.cpp | 5 +++++ src/USER-MISC/pair_edip_multi.cpp | 5 +++++ src/USER-MISC/pair_extep.cpp | 5 +++++ src/USER-MISC/pair_ilp_graphene_hbn.cpp | 5 +++++ src/USER-MISC/pair_kolmogorov_crespi_full.cpp | 5 +++++ src/USER-MISC/pair_kolmogorov_crespi_z.cpp | 5 +++++ src/USER-MISC/pair_lebedeva_z.cpp | 5 +++++ src/USER-MISC/pair_tersoff_table.cpp | 5 +++++ src/USER-OMP/pair_tersoff_zbl_omp.cpp | 4 ++++ 24 files changed, 119 insertions(+) diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 8c5871b71c..6b8d4e428e 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -623,6 +623,11 @@ void PairComb::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index db6caa3d40..385e3ca35d 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -559,6 +559,11 @@ void PairComb3::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 9b995e4b99..0928d14696 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -413,6 +413,11 @@ void PairGW::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index 97c1d01b93..1a2bf5eb5d 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -107,6 +107,11 @@ void PairGWZBL::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 6f1bfb8905..dc537a7b58 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -329,6 +329,11 @@ void PairNb3bHarmonic::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 3445680833..f6b5a803d2 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -394,6 +394,11 @@ void PairSW::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index 928550e9c5..c57740963f 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -438,6 +438,11 @@ void PairTersoff::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index 64ce66c0cf..d1ab6f2034 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -91,6 +91,11 @@ void PairTersoffMOD::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_tersoff_mod_c.cpp b/src/MANYBODY/pair_tersoff_mod_c.cpp index c4c86577e2..ff8916cdcd 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.cpp +++ b/src/MANYBODY/pair_tersoff_mod_c.cpp @@ -82,6 +82,11 @@ void PairTersoffMODC::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index ac6694ccda..141cb45964 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -109,6 +109,11 @@ void PairTersoffZBL::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 61ee8b0fc0..815854a34b 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -400,6 +400,11 @@ void PairVashishta::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 53c3101708..647060eab7 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -347,6 +347,11 @@ void PairHbondDreidingLJ::coeff(int narg, char **arg) maxparam += CHUNK; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, CHUNK*sizeof(Param)); } params[nparams].epsilon = epsilon_one; diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index 3039a662e6..44eefc07fd 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -273,6 +273,11 @@ void PairHbondDreidingMorse::coeff(int narg, char **arg) maxparam += CHUNK; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, CHUNK*sizeof(Param)); } params[nparams].d0 = d0_one; diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index f13f911326..4ac491afb1 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -797,6 +797,11 @@ void PairExp6rx::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ispecies = ispecies; diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index e6b0e5acc6..2e9221537a 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -302,6 +302,11 @@ void PairDRIP::read_file(char *filename) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index d873a04c39..cfb64bb31e 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -957,6 +957,11 @@ void PairEDIP::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index cfda5c1a7c..7fe620223b 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -723,6 +723,11 @@ void PairEDIPMulti::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 2036df7add..65f792b493 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -671,6 +671,11 @@ void PairExTeP::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 32689307c0..b2f659e0f4 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -335,6 +335,11 @@ void PairILPGrapheneHBN::read_file(char *filename) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index f5f2a6ca01..8590e7097e 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -336,6 +336,11 @@ void PairKolmogorovCrespiFull::read_file(char *filename) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 07f0a766e4..4315439624 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -394,6 +394,11 @@ void PairKolmogorovCrespiZ::read_file(char *filename) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index f6464153e5..53ee82274e 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -390,6 +390,11 @@ void PairLebedevaZ::read_file(char *filename) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; params[nparams].jelement = jelement; diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 53719508ca..4df172a001 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -890,6 +890,11 @@ void PairTersoffTable::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } // some parameters are not used since only Tersoff_2 is implemented diff --git a/src/USER-OMP/pair_tersoff_zbl_omp.cpp b/src/USER-OMP/pair_tersoff_zbl_omp.cpp index 489baf41f1..005cd427a9 100644 --- a/src/USER-OMP/pair_tersoff_zbl_omp.cpp +++ b/src/USER-OMP/pair_tersoff_zbl_omp.cpp @@ -131,6 +131,10 @@ void PairTersoffZBLOMP::read_file(char *file) maxparam += DELTA; params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + // make certain all addional allocated storage is initialized + // to avoid false positives when checking with valgrind + + memset(params + nparams, 0, DELTA*sizeof(Param)); } params[nparams].ielement = ielement; From b3060bc48e88c3c8ae2e6038a7046cda1da58ef9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 9 Jul 2020 09:12:23 -0400 Subject: [PATCH 23/27] add suppressions for googletest --- tools/valgrind/GTest.supp | 27 +++++++++++++++++++++++++++ tools/valgrind/README | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tools/valgrind/GTest.supp diff --git a/tools/valgrind/GTest.supp b/tools/valgrind/GTest.supp new file mode 100644 index 0000000000..0977288a06 --- /dev/null +++ b/tools/valgrind/GTest.supp @@ -0,0 +1,27 @@ +{ + Run_strdup_1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:strdup + ... + fun:_ZN7testing8UnitTest3RunEv +} +{ + Run_register_state_1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:register_state + ... + fun:_ZN7testing8TestSuite3RunEv.part.0 +} +{ + Run_register_state_2 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:register_state + ... + fun:_ZN7testing8TestSuite3RunEv +} diff --git a/tools/valgrind/README b/tools/valgrind/README index 012eab1b65..fb35b4586a 100644 --- a/tools/valgrind/README +++ b/tools/valgrind/README @@ -9,7 +9,8 @@ valgrind --show-leak-kinds=all --track-origins=yes \ --suppressions=/path/to/lammps/tools/valgrind/OpenMP.supp \ --suppressions=/path/to/lammps/tools/valgrind/OpenMPI.supp \ --suppressions=/path/to/lammps/tools/valgrind/Python3.supp \ + --suppressions=/path/to/lammps/tools/valgrind/GTest.supp \ lmp -in in.melt -Last update: 2020-06-24 +Last update: 2020-07-09 From cd0b034cab5d5db8594a7cbb252d360e53375eff Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 9 Jul 2020 20:46:31 -0400 Subject: [PATCH 24/27] adjust regex for removed styles to correctly handle command styles --- doc/utils/check-styles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/utils/check-styles.py b/doc/utils/check-styles.py index a5bf31801c..55933cc6c4 100755 --- a/doc/utils/check-styles.py +++ b/doc/utils/check-styles.py @@ -60,7 +60,7 @@ kokkos = re.compile("(.+)/kk$") kokkos_skip = re.compile("(.+)/kk/(host|device)$") omp = re.compile("(.+)/omp$") opt = re.compile("(.+)/opt$") -removed = re.compile("(.+)Deprecated$") +removed = re.compile("(.*)Deprecated$") def register_style(list,style,info): if style in list.keys(): From f307d7f5f92c91412d7832aa9a2bba57764e4743 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 9 Jul 2020 20:52:57 -0400 Subject: [PATCH 25/27] count total number of styles including aliases, suffixes, and undocumented --- doc/utils/check-styles.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/utils/check-styles.py b/doc/utils/check-styles.py index 55933cc6c4..40e6109f5b 100755 --- a/doc/utils/check-styles.py +++ b/doc/utils/check-styles.py @@ -52,6 +52,7 @@ minimize = {} pair = {} reader = {} region = {} +total = 0 upper = re.compile("[A-Z]+") gpu = re.compile("(.+)/gpu$") @@ -119,6 +120,7 @@ for h in headers: # skip over internal styles w/o explicit documentation style = m[1] + total += 1 if upper.match(style): continue @@ -197,12 +199,13 @@ print("""Parsed style names w/o suffixes from C++ tree in %s: Fix styles: %3d Improper styles: %3d Integrate styles: %3d Kspace styles: %3d Minimize styles: %3d Pair styles: %3d - Reader styles: %3d Region styles: %3d""" \ + Reader styles: %3d Region styles: %3d +---------------------------------------------------- +Total number of styles (including suffixes): %d""" \ % (src, len(angle), len(atom), len(body), len(bond), \ len(command), len(compute), len(dihedral), len(dump), \ len(fix), len(improper), len(integrate), len(kspace), \ - len(minimize), len(pair), len(reader), len(region))) - + len(minimize), len(pair), len(reader), len(region), total)) counter = 0 From f969d9ab720bc4d29e4807cf7567d976b2cbdc0e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 10 Jul 2020 09:22:44 -0400 Subject: [PATCH 26/27] add space for terminating NULL byte in MPIIO dump styles. closes #2225 --- src/MPIIO/dump_atom_mpiio.cpp | 4 ++-- src/MPIIO/dump_cfg_mpiio.cpp | 2 +- src/MPIIO/dump_custom_mpiio.cpp | 2 +- src/MPIIO/dump_xyz_mpiio.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index d59ed7bde8..9d15e8b1a8 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -618,7 +618,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf) if (mpifhStringCount > 0) { if (mpifhStringCount > maxsbuf) { if (mpifhStringCount > MAXSMALLINT) return -1; - maxsbuf = mpifhStringCount; + maxsbuf = mpifhStringCount+1; memory->grow(sbuf,maxsbuf,"dump:sbuf"); } sbuf[0] = '\0'; @@ -708,7 +708,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf) if (mpifhStringCount > 0) { if (mpifhStringCount > maxsbuf) { if (mpifhStringCount > MAXSMALLINT) return -1; - maxsbuf = mpifhStringCount; + maxsbuf = mpifhStringCount+1; memory->grow(sbuf,maxsbuf,"dump:sbuf"); } sbuf[0] = '\0'; diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index 18368db330..bca19e58c8 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -452,7 +452,7 @@ int DumpCFGMPIIO::convert_string_omp(int n, double *mybuf) if (mpifhStringCount > 0) { if (mpifhStringCount > maxsbuf) { if (mpifhStringCount > MAXSMALLINT) return -1; - maxsbuf = mpifhStringCount; + maxsbuf = mpifhStringCount+1; memory->grow(sbuf,maxsbuf,"dump:sbuf"); } sbuf[0] = '\0'; diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 526021d895..3f9c09738e 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -652,7 +652,7 @@ int DumpCustomMPIIO::convert_string_omp(int n, double *mybuf) if (mpifhStringCount > 0) { if (mpifhStringCount > maxsbuf) { if (mpifhStringCount > MAXSMALLINT) return -1; - maxsbuf = mpifhStringCount; + maxsbuf = mpifhStringCount+1; memory->grow(sbuf,maxsbuf,"dump:sbuf"); } sbuf[0] = '\0'; diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index a1e4f21a79..d1b2d5079a 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -382,7 +382,7 @@ int DumpXYZMPIIO::convert_string_omp(int n, double *mybuf) if (mpifhStringCount > 0) { if (mpifhStringCount > maxsbuf) { if (mpifhStringCount > MAXSMALLINT) return -1; - maxsbuf = mpifhStringCount; + maxsbuf = mpifhStringCount+1; memory->grow(sbuf,maxsbuf,"dump:sbuf"); } sbuf[0] = '\0'; From 83291fdd67d5f0db86b1cdc893c7b1bfac5be136 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 11 Jul 2020 18:07:25 -0400 Subject: [PATCH 27/27] may not use pair_style kim before box is defined NOTE: this will not happen when the kim_init and kim_interactions commands are used. --- src/KIM/pair_kim.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 354b660c0b..e408fae856 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -285,6 +285,13 @@ void PairKIM::allocate() void PairKIM::settings(int narg, char **arg) { + // some of the code below needs to know the number of atom types, + // but that is not set until the simulation box is created. + + if (domain->box_exist == 0) + error->all(FLERR,"May not use 'pair_style kim' command before " + "simulation box is defined"); + // This is called when "pair_style kim ..." is read from input // may be called multiple times ++settings_call_count;