Merge branch 'master' into reset-molecules

This commit is contained in:
Axel Kohlmeyer
2020-07-12 20:36:34 -04:00
57 changed files with 413 additions and 131 deletions

View File

@ -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 <pair_coeff>` command).
The ``lmp_daily`` binary is built with the :ref:`KIM package <kim>` which
The ``lmp_stable`` binary is built with the :ref:`KIM package <kim>` which
results in the above command also installing the `kim-api` binaries when LAMMPS
is installed. In order to use potentials from `openkim.org <openkim_>`_, 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

View File

@ -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 <read_data>`
or :doc:`read_restart <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.
----------

View File

@ -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) <angle-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 <angle_coeff>` command as in
the example above, or in the data file or restart files read by the
:doc:`read_data <read_data>` or :doc:`read_restart <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
<angle_coeff>` command as in the example above, or in the data file or
restart files read by the :doc:`read_data <read_data>` or
:doc:`read_restart <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 <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.

View File

@ -40,14 +40,15 @@ the data file or restart files read by the :doc:`read_data <read_data>`
or :doc:`read_restart <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
""""""""""""

View File

@ -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 <read_data>`
or :doc:`read_restart <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 <Build_package>` doc page for more info.
LAMMPS was built with those packages. See the :doc:`Build package
<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 <Run_options>` when you invoke LAMMPS, or you can use the
:doc:`suffix <suffix>` command in your input script.
by including their suffix, or you can use the :doc:`-suffix
command-line switch <Run_options>` when you invoke LAMMPS, or you can
use the :doc:`suffix <suffix>` command in your input script.
See the :doc:`Speed packages <Speed_packages>` doc page for more
instructions on how to use the accelerated styles effectively.

View File

@ -28,20 +28,22 @@ as defined in :ref:`(Allinger) <mm3-allinger1989>`
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 <angle_coeff>` command as in the example above, or in
the data file or restart files read by the :doc:`read_data <read_data>`
or :doc:`read_restart <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
""""""""""""

View File

@ -39,12 +39,13 @@ the data file or restart files read by the :doc:`read_data <read_data>`
or :doc:`read_restart <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.
----------

View File

@ -44,13 +44,15 @@ is included in :math:`K`.
The following coefficients must be defined for each angle type via the
:doc:`angle_coeff <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 <Build_package>` doc page for more info.
LAMMPS was built with those packages. See the :doc:`Build package
<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 <Run_options>` when you invoke LAMMPS, or you can use the

View File

@ -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 <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
<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 <dihedral_coeff>` command in the input script lists

View File

@ -39,9 +39,13 @@ above, or in the data file or restart files read by the
:doc:`read_data <read_data>` or :doc:`read_restart <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

View File

@ -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`.
----------

View File

@ -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 <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
<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 <Build_package>` doc page for more info.
LAMMPS was built with those packages. See the :doc:`Build package
<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 <Run_options>` when you invoke LAMMPS, or you can use the

View File

@ -59,11 +59,12 @@ above, or in the data file or restart files read by the
:doc:`read_data <read_data>` or :doc:`read_restart <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 <Build_package>` doc page for more info.
LAMMPS was built with those packages. See the :doc:`Build package
<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 <Run_options>` when you invoke LAMMPS, or you can use the
:doc:`suffix <suffix>` command in your input script.
by including their suffix, or you can use the :doc:`-suffix
command-line switch <Run_options>` when you invoke LAMMPS, or you can
use the :doc:`suffix <suffix>` command in your input script.
See the :doc:`Speed packages <Speed_packages>` doc page for more
instructions on how to use the accelerated styles effectively.

View File

@ -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;

View File

@ -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};

View File

@ -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]);
}
}
}

View File

@ -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);
}
/* ----------------------------------------------------------------------

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -44,6 +44,7 @@ IntelBuffers<flt_t, acc_t>::IntelBuffers(class LAMMPS *lmp_in) :
_off_threads = 0;
_off_ccache = 0;
_off_ncache = 0;
_need_tag = 0;
_host_nmax = 0;
#endif
}

View File

@ -1286,11 +1286,11 @@ void PairSWIntel::ForceConst<flt_t>::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);
}
if (ntypes > 0) {
_cop = cop;

View File

@ -87,7 +87,7 @@ class PairSWIntel : public PairSW {
fc_packed2 **p2e;
fc_packed3 ***p3;
ForceConst() : _ntypes(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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -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) {

View File

@ -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);
}

27
tools/valgrind/GTest.supp Normal file
View File

@ -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
}

View File

@ -90,6 +90,43 @@
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_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
@ -152,7 +189,49 @@
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
}
{
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
}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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);