Merge pull request #4004 from akohlmey/collected-small-changes

Collected small changes and updates
This commit is contained in:
Axel Kohlmeyer
2023-12-13 16:25:16 -05:00
committed by GitHub
38 changed files with 444 additions and 173 deletions

View File

@ -30,7 +30,7 @@ jobs:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

View File

@ -24,7 +24,7 @@ jobs:
fetch-depth: 2
- name: Select Python version
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'

View File

@ -518,6 +518,8 @@ The following options are available.
make fix-errordocs # remove error docs in header files
make check-permissions # search for files with permissions issues
make fix-permissions # correct permissions issues in files
make check-docs # search for several issues in the manual
make check-version # list files with pending release version tags
make check # run all check targets from above
These should help to make source and documentation files conforming

View File

@ -43,12 +43,14 @@ When the KSPACE package is included in a LAMMPS build, the
require use of an FFT library to compute 1d FFTs. The KISS FFT
library is included with LAMMPS, but other libraries can be faster.
LAMMPS can use them if they are available on your system.
Alternatively, LAMMPS can use the
`heFFTe <https://icl-utk-edu.github.io/heffte/>`_
library for the MPI communication algorithms,
which comes with many optimizations for special cases,
e.g., leveraging 2D and 3D backend transforms and
better pipelining for packing and communication.
.. versionadded:: TBD
Alternatively, LAMMPS can use the `heFFTe
<https://icl-utk-edu.github.io/heffte/>`_ library for the MPI
communication algorithms, which comes with many optimizations for
special cases, e.g. leveraging available 2D and 3D FFTs in the back end
libraries and better pipelining for packing and communication.
.. tabs::
@ -83,14 +85,15 @@ better pipelining for packing and communication.
-D MKL_INCLUDE_DIR=path # ditto for Intel MKL library
-D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries
-D MKL_LIBRARY=path # path to MKL libraries
-D FFT_HEFFTE_BACKEND=value # FFTW or MKL or empty/undefined for the stock backend
-D FFT_HEFFTE_BACKEND=value # FFTW or MKL or empty/undefined for the stock heFFTe back end
-D Heffte_ROOT=path # path to an existing heFFTe installation
.. note::
heFFTe comes with a builtin stock backend for FFTs; however, the backend
is intended for testing purposes and is not performance optimized
for large scale production runs.
heFFTe comes with a builtin (= stock) back end for FFTs, i.e. a
default internal FFT implementation; however, this stock back
end is intended for testing purposes only and is not optimized
for production runs.
.. tab:: Traditional make
@ -140,9 +143,9 @@ better pipelining for packing and communication.
which will define the `heffte_` include variables needed to link to heFFTe from
an external project using traditional make.
The `-DFFT_HEFFTE` is required to switch to using heFFTe, while the optional `-DFFT_HEFFTE_FFTW`
selects the desired heFFTe backend, e.g., `-DFFT_HEFFTE_FFTW` or `-DFFT_HEFFTE_MKL`,
omitting the variable will default to the `stock` backend.
The heFFTe `stock` backend is intended to be used for testing and debugging,
selects the desired heFFTe back end, e.g., `-DFFT_HEFFTE_FFTW` or `-DFFT_HEFFTE_MKL`,
omitting the variable will default to the `stock` back end.
The heFFTe `stock` back end is intended to be used for testing and debugging,
but is not performance optimized for large scale production runs.
The `KISS FFT library <https://github.com/mborgerding/kissfft>`_ is
@ -204,14 +207,14 @@ Depending on the machine, the size of the FFT grid, the number of
processors used, one option may be slightly faster. The default is
ARRAY mode.
When using ``-DFFT_HEFFTE`` CMake will first look for an existing install
with hints provided by ``-DHeffte_ROOT``, as recommended by the CMake
standard and note that the name is case sensitive. If CMake cannot find
a heFFTe installation with the correct backend (e.g., FFTW or MKL),
it will attempt to download and build the library automatically.
In this case, LAMMPS CMake will also accept all heFFTe specific variables
listed in the
`heFFTe documentation <https://mkstoyanov.bitbucket.io/heffte/md_doxygen_installation.html>`_
When using ``-DFFT_HEFFTE`` CMake will first look for an existing
install with hints provided by ``-DHeffte_ROOT``, as recommended by the
CMake standard and note that the name is case sensitive. If CMake cannot
find a heFFTe installation with the correct back end (e.g., FFTW or
MKL), it will attempt to download and build the library automatically.
In this case, LAMMPS CMake will also accept all heFFTe specific
variables listed in the `heFFTe documentation
<https://mkstoyanov.bitbucket.io/heffte/md_doxygen_installation.html>`_
and those variables will be passed into the heFFTe build.
----------
@ -507,8 +510,8 @@ Exception handling when using LAMMPS as a library
LAMMPS errors do not kill the calling code, but throw an exception. In
the C-library interface, the call stack is unwound and control returns
to the caller, e.g. to Python or a code that is coupled to LAMMPS and
the error status can be queried. When using C++ directly, the calling
to the caller, e.g. to Python or a code that is coupled to LAMMPS. The
error status can then be queried. When using C++ directly, the calling
code has to be set up to *catch* exceptions thrown from within LAMMPS.
.. note::

View File

@ -274,9 +274,7 @@ Tests for using the Fortran module are in the ``unittest/fortran``
folder. Since they are also using the GoogleTest library, they require
to also implement test wrappers in C++ that will call fortran functions
which provide a C function interface through ISO_C_BINDINGS that will in
turn call the functions in the LAMMPS Fortran module. This part of the
unit tests is incomplete since the Fortran module it is based on is
incomplete as well.
turn call the functions in the LAMMPS Fortran module.
Tests for the C++-style library interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -397,10 +395,10 @@ compare with the reference and also start from the data file. A final
check will use multi-cutoff r-RESPA (if supported by the pair style) at
a 1:1 split and compare to the Verlet results. These sets of tests are
run with multiple test fixtures for accelerated styles (OPT, OPENMP,
INTEL) and for the latter two with 4 OpenMP threads enabled. For
these tests the relative error (epsilon) is lowered by a common factor
due to the additional numerical noise, but the tests are still comparing
to the same reference data.
INTEL, KOKKOS (OpenMP only)) and for the latter three with 4 OpenMP
threads enabled. For these tests the relative error (epsilon) is lowered
by a common factor due to the additional numerical noise, but the tests
are still comparing to the same reference data.
Additional tests will check whether all listed extract keywords are
supported and have the correct dimensionality and the final set of tests
@ -434,17 +432,19 @@ The ``test_pair_style`` tester is used with 4 categories of test inputs:
pair style is defined, but the computation of the pair style contributions
is disabled.
The ``test_bond_style`` and ``test_angle_style`` are set up in a similar
fashion and share support functions with the pair style tester. The final
group of tests in this section is for fix styles that add/manipulate forces
and velocities, e.g. for time integration, thermostats and more.
The ``test_bond_style``, ``test_angle_style``, ``test_dihedral_style``, and
``test_improper_style`` tester programs are set up in a similar fashion and
share support functions with the pair style tester. The final group of
tests in this section is for fix styles that add/manipulate forces and
velocities, e.g. for time integration, thermostats and more.
Adding a new test is easiest done by copying and modifying an existing test
for a style that is similar to one to be tested. The file name should follow
the naming conventions described above and after copying the file, the first
step is to replace the style names where needed. The coefficient values
do not have to be meaningful, just in a reasonable range for the given system.
It does not matter if some forces are large, for as long as they do not diverge.
Adding a new test is easiest done by copying and modifying an existing YAML
file for a style that is similar to one to be tested. The file name should
follow the naming conventions described above and after copying the file,
the first step is to replace the style names where needed. The coefficient
values do not have to be meaningful, just in a reasonable range for the
given system. It does not matter if some forces are large, for as long as
they do not diverge.
The template input files define a large number of index variables at the top
that can be modified inside the YAML file to control the behavior. For example,
@ -472,7 +472,7 @@ Note that this disables computing the kspace contribution, but still will run
the setup. The "gewald" parameter should be set explicitly to speed up the run.
For styles with long-range electrostatics, typically two tests are added one using
the (slower) analytic approximation of the erfc() function and the other using
the tabulated coulomb, to test both code paths. The reference results in the YAML
the tabulated coulomb, to test both code paths. The reference results in the YAML
files then should be compared manually, if they agree well enough within the limits
of those two approximations.

View File

@ -193,11 +193,14 @@ file changed):
write_data tip4p-implicit.data nocoeff
Below is the code for a LAMMPS input file using the explicit method and
a TIP4P molecule file. Because of using :doc:`fix rigid/nvt/small
a TIP4P molecule file. Because of using :doc:`fix rigid/small
<fix_rigid>` no bonds need to be defined and thus no extra storage needs
to be reserved for them, but we need to switch to atom style full or use
:doc:`fix property/atom mol <fix_property_atom>` so that fix
rigid/nvt/small can identify rigid bodies by their molecule ID:
to be reserved for them, but we need to either switch to atom style full
or use :doc:`fix property/atom mol <fix_property_atom>` so that fix
rigid/small can identify rigid bodies by their molecule ID. Also a
:doc:`neigh_modify exclude <neigh_modify>` command is added to exclude
computing intramolecular non-bonded interactions, since those are
removed by the rigid fix anyway:
.. code-block:: LAMMPS
@ -216,17 +219,17 @@ rigid/nvt/small can identify rigid bodies by their molecule ID:
pair_coeff 2 2 0.0 1.0
pair_coeff 3 3 0.0 1.0
fix mol all property/atom mol
fix mol all property/atom mol ghost yes
molecule water tip4p.mol
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
neigh_modify exclude molecule/intra all
timestep 0.5
fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0
velocity all create 300.0 5463576
fix integrate all rigid/small molecule langevin 300.0 300.0 100.0 2345634
thermo_style custom step temp press etotal density pe ke
thermo 1000
run 20000
thermo 2000
run 40000
write_data tip4p-explicit.data nocoeff
.. _tip4p_molecule:

View File

@ -81,11 +81,13 @@ long-range Coulombic solver (e.g. Ewald or PPPM in LAMMPS).
Below is the code for a LAMMPS input file for setting up a simulation of
TIP5P water with a molecule file. Because of using :doc:`fix
rigid/nvt/small <fix_rigid>` no bonds need to be defined and thus no
extra storage needs to be reserved for them, but we need to switch to
rigid/small <fix_rigid>` no bonds need to be defined and thus no extra
storage needs to be reserved for them, but we need to either switch to
atom style full or use :doc:`fix property/atom mol <fix_property_atom>`
so that fix rigid/nvt/small can identify rigid bodies by their molecule
ID:
so that fix rigid/small can identify rigid bodies by their molecule ID.
Also a :doc:`neigh_modify exclude <neigh_modify>` command is added to
exclude computing intramolecular non-bonded interactions, since those
are removed by the rigid fix anyway:
.. code-block:: LAMMPS
@ -107,11 +109,11 @@ ID:
fix mol all property/atom mol
molecule water tip5p.mol
create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33
neigh_modify exclude molecule/intra all
timestep 0.5
fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0
fix integrate all rigid/small molecule langevin 300.0 300.0 50.0 235664
reset_timestep 0
velocity all create 300.0 5463576
thermo_style custom step temp press etotal density pe ke
thermo 1000

View File

@ -2226,7 +2226,7 @@ and third order tensor from finite differences.
**Install:**
The PHONON package requires that also the :ref:`KSPACE <PKG-KSPACE>`
The fix phonon command also requires that the :ref:`KSPACE <PKG-KSPACE>`
package is installed.

View File

@ -1,11 +1,11 @@
Handling LAMMPS errors
**********************
The shared library is compiled with :ref:`C++ exception support
<exceptions>` to provide a better error handling experience. C++
exceptions allow capturing errors on the C++ side and rethrowing them on
the Python side. This way LAMMPS errors can be handled through the
Python exception handling mechanism.
LAMMPS and the LAMMPS library are compiled with :ref:`C++ exception support
<exceptions>` to provide a better error handling experience. LAMMPS errors
trigger throwing a C++ exception. These exceptions allow capturing errors on
the C++ side and rethrowing them on the Python side. This way LAMMPS errors
can be handled through the Python exception handling mechanism.
.. code-block:: python

View File

@ -49,14 +49,17 @@ simulation. An example set of statistics is shown here:
----------
The first section provides a global loop timing summary. The *loop time*
is the total wall-clock time for the simulation to run. The
*Performance* line is provided for convenience to help predict how long
it will take to run a desired physical simulation and to have numbers
useful for performance comparison between different simulation settings
or system sizes. The *CPU use* line provides the CPU utilization per
MPI task; it should be close to 100% times the number of OpenMP threads
(or 1 of not using OpenMP). Lower numbers correspond to delays due to
file I/O or insufficient thread utilization.
is the total wall-clock time for the MD steps of the simulation run,
excluding the time for initialization and setup (i.e. the parts that may
be skipped with :doc:`run N pre no <run>`). The *Performance* line is
provided for convenience to help predict how long it will take to run a
desired physical simulation and to have numbers useful for performance
comparison between different simulation settings or system sizes. The
*CPU use* line provides the CPU utilization per MPI task; it should be
close to 100% times the number of OpenMP threads (or 1 if not using
OpenMP). Lower numbers correspond to delays due to file I/O or
insufficient thread utilization from parts of the code that have not
been multi-threaded.
----------

View File

@ -12,7 +12,7 @@ Syntax
* ID, group-ID are documented in :doc:`compute <compute>` command
* pace = style name of this compute command
* ace_potential_filename = file name (in the .yace or .ace format from :doc:`pace pair_style <pair_pace>`) including ACE hyperparameters, bonds, and generalized coupling coefficients
* ace_potential_filename = file name (in the .yace or .ace format from :doc:`pace pair_style <pair_pace>`) including ACE hyper-parameters, bonds, and generalized coupling coefficients
* keyword = *bikflag* or *dgradflag*
.. parsed-literal::
@ -38,28 +38,30 @@ Description
.. versionadded:: TBD
This compute calculates a set of quantities related to the atomic cluster
expansion (ACE) descriptors of the atoms in a group. ACE descriptors are
a highly generalizable atomic descriptor, encoding the radial and angular
distribution of neighbor atoms, up to arbitrary bond order (rank). The
detailed mathematical definition is given in the paper by
:ref:`(Drautz) <Drautz19>`. These descriptors are used in the
:doc:`pace pair_style <pair_pace>`. Quantities obtained from `compute pace`
are related to those used in :doc:`pace pair_style <pair_pace>` to
This compute calculates a set of quantities related to the atomic
cluster expansion (ACE) descriptors of the atoms in a group. ACE
descriptors are highly general atomic descriptors, encoding the radial
and angular distribution of neighbor atoms, up to arbitrary bond order
(rank). The detailed mathematical definition is given in the paper by
:ref:`(Drautz) <Drautz19>`. These descriptors are used in the
:doc:`pace pair_style <pair_pace>`. Quantities obtained from `compute
pace` are related to those used in :doc:`pace pair_style <pair_pace>` to
evaluate atomic energies, forces, and stresses for linear ACE models.
For example, the energy for a linear ACE model is calculated as:
:math:`E=\sum_i^{N\_atoms} \sum_{\boldsymbol{\nu}} c_{\boldsymbol{\nu}} B_{i,\boldsymbol{\boldsymbol{\nu}}}`.
The ACE descriptors for atom `i` :math:`B_{i,\boldsymbol{\nu}}`, and
:math:`c_{\nu}` are linear model parameters. The detailed definition
and indexing convention for ACE descriptors is given in :ref:`(Drautz) <Drautz19>`.
In short, body order :math:`N`, angular character, radial character,
and chemical elements in the *N-body* descriptor are encoded by :math:`\nu`.
In the :doc:`pace pair_style <pair_pace>`, the linear model parameters
and the ACE descriptors are combined for efficient evaluation of energies
and forces. The details and benefits of this efficient implementation are
given in :ref:`(Lysogorskiy) <Lysogorskiy21>`. et. al, but the combined
descriptors and linear model parameters for the purposes of `compute pace`
may be expressed in terms of the ACE descriptors mentioned above.
:math:`E=\sum_i^{N\_atoms} \sum_{\boldsymbol{\nu}} c_{\boldsymbol{\nu}}
B_{i,\boldsymbol{\boldsymbol{\nu}}}`. The ACE descriptors for atom `i`
:math:`B_{i,\boldsymbol{\nu}}`, and :math:`c_{\nu}` are linear model
parameters. The detailed definition and indexing convention for ACE
descriptors is given in :ref:`(Drautz) <Drautz19>`. In short, body
order :math:`N`, angular character, radial character, and chemical
elements in the *N-body* descriptor are encoded by :math:`\nu`. In the
:doc:`pace pair_style <pair_pace>`, the linear model parameters and the
ACE descriptors are combined for efficient evaluation of energies and
forces. The details and benefits of this efficient implementation are
given in :ref:`(Lysogorskiy) <Lysogorskiy21>`, but the combined
descriptors and linear model parameters for the purposes of `compute
pace` may be expressed in terms of the ACE descriptors mentioned above.
:math:`c_{\boldsymbol{\nu}} B_{i,\boldsymbol{\nu}}= \sum_{\boldsymbol{\nu}' \in \boldsymbol{\nu} } \big[ c_{\boldsymbol{\nu}} C(\boldsymbol{\nu}') \big] A_{i,\boldsymbol{\nu}'}`
@ -90,7 +92,7 @@ The coefficient file, `<name>.yace`, ultimately defines the number of ACE
descriptors to be computed, their maximum body-order, the degree of angular
character they have, the degree of radial character they have, the chemical
character (which element-element interactions are encoded by descriptors),
and other hyperparameters defined in :ref:`(Drautz) <Drautz19>`. These may
and other hyper-parameters defined in :ref:`(Drautz) <Drautz19>`. These may
be modeled after the potential files in :doc:`pace pair_style <pair_pace>`,
and have the same format. Details on how to generate the coefficient files
to train ACE models may be found in `FitSNAP <https://github.com/FitSNAP/FitSNAP>`_.

View File

@ -1,7 +1,7 @@
.. index:: compute rattlers/atom
compute rattlers/atom command
========================
=============================
Syntax
""""""
@ -35,7 +35,7 @@ Description
.. versionadded:: TBD
Define a compute that identifies rattlers in a system. Rattlers are often
identified in granular or glassy packings as undercoordinated atoms that
identified in granular or glassy packings as under-coordinated atoms that
do not have the required number of contacts to constrain their translational
degrees of freedom. Such atoms are not considered rigid and can often freely
rattle around in the system. This compute identifies rattlers which can be

View File

@ -68,7 +68,7 @@ reciprocal lattice nodes. The mesh spacing is defined either (a) by
the entire simulation domain or (b) manually using selected values as
shown in the 2D diagram below.
.. image:: img/saed_mesh.jpg
.. image:: img/saed_mesh.png
:scale: 75%
:align: center

View File

@ -127,11 +127,11 @@ result in more consistent heat flux values for angle, dihedrals,
improper and constraint force contributions
when computed via :doc:`compute heat/flux <compute_heat_flux>`.
If no extra keywords are listed, the kinetic contribution all of the
virial contribution terms are included in the per-atom stress tensor.
If any extra keywords are listed, only those terms are summed to
compute the tensor. The *virial* keyword means include all terms
except the kinetic energy *ke*\ .
If no extra keywords are listed, the kinetic contribution *and* all
of the virial contribution terms are included in the per-atom stress
tensor. If any extra keywords are listed, only those terms are
summed to compute the tensor. The *virial* keyword means include all
terms except the kinetic energy *ke*\ .
Note that the stress for each atom is due to its interaction with all
other atoms in the simulation, not just with other atoms in the group.

View File

@ -221,7 +221,7 @@ formulas for the meaning of these parameters:
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
| :doc:`table <pair_table>` | table_cutoff | type pairs |
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
| :doc:`ufm <pair_ufm>` | epsilon,sigma | type pairs |
| :doc:`ufm <pair_ufm>` | epsilon,sigma,scale | type pairs |
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
| :doc:`wf/cut <pair_wf_cut>` | epsilon,sigma,nu,mu | type pairs |
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+

View File

@ -123,19 +123,29 @@ styles and their energy formulas for the meaning of these parameters:
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`born <pair_born>` | a,b,c | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`born/gauss <pair_born_gauss>` | biga0,biga1,r0 | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`buck, buck/coul/cut, buck/coul/long, buck/coul/msm <pair_buck>` | a,c | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`buck/mdf <pair_mdf>` | a,c | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`coul/cut <pair_coul>` | scale | type pairs |
| :doc:`coul/cut, coul/cut/global <pair_coul>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`coul/cut/soft <pair_fep_soft>` | lambda | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`coul/debye <pair_coul>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`coul/long, coul/msm <pair_coul>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`coul/long/soft <pair_fep_soft>` | scale, lambda | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`eam <pair_eam>` | scale | type pairs |
| :doc:`coul/slater/long <pair_coul_slater>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`coul/streitz <pair_coul>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`eam, eam/alloy, eam/fs <pair_eam>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`harmonic/cut <pair_harmonic_cut>` | k | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`gauss <pair_gauss>` | a | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
@ -163,6 +173,8 @@ styles and their energy formulas for the meaning of these parameters:
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`lj/sf/dipole/sf <pair_dipole>` | epsilon,sigma,scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`meam <pair_meam>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`mie/cut <pair_mie>` | epsilon,sigma,gamR,gamA | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`morse, morse/smooth/linear <pair_morse>` | d0,r0,alpha | type pairs |
@ -173,12 +185,16 @@ styles and their energy formulas for the meaning of these parameters:
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`nm/cut/coul/cut, nm/cut/coul/long <pair_nm>` | e0,r0,nn,mm | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`pace, pace/extrapolation <pair_pace>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`snap <pair_snap>` | scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`soft <pair_soft>` | a | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`ufm <pair_ufm>` | epsilon,sigma,scale | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
| :doc:`wf/cut <pair_wf_cut>` | epsilon,sigma,nu,mu | type pairs |
+------------------------------------------------------------------------------+-------------------------+------------+
.. note::

View File

@ -181,10 +181,10 @@ This fix assumes a crystalline system with periodical lattice. The
temperature of the system should not exceed the melting temperature to
keep the system in its solid state.
This fix is part of the PHONON package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
This fix requires LAMMPS be built with an FFT library. See the :doc:`Build settings <Build_settings>` page for details.
This fix is part of the PHONON package. It is only enabled if LAMMPS
was built with that package. This fix also requires LAMMPS to be built
with 3d-FFT support which is included in the KSPACE package. See the
:doc:`Build package <Build_package>` page for more info.
Related commands
""""""""""""""""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

BIN
doc/src/img/saed_mesh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -164,8 +164,8 @@ defining a *body* particle, which requires setting the number of
* Nd *dihedrals* = # of dihedrals Nd in molecule, default = 0
* Ni *impropers* = # of impropers Ni in molecule, default = 0
* Nf *fragments* = # of fragments Nf in molecule, default = 0
* Ninteger Ndouble *body* = # of integer and floating-point values in body
particle, default = 0
* Ninteger Ndouble *body* = # of integer and floating-point values
in body particle, default = 0
* Mtotal *mass* = total mass of molecule
* Xc Yc Zc *com* = coordinates of center-of-mass of molecule
* Ixx Iyy Izz Ixy Ixz Iyz *inertia* = 6 components of inertia tensor of molecule

View File

@ -1396,6 +1396,7 @@ Hebbeker
Hebenstreit
Hecht
Heenen
heFFTe
Hendrik
Henin
Henkelman
@ -2813,6 +2814,7 @@ pIm
pimd
Piola
pIp
pipelining
Pisarev
Pishevar
Pitera
@ -4046,6 +4048,7 @@ xy
xyz
xz
xzhou
yace
Yade
yade
yaff

View File

@ -21,7 +21,7 @@ OBJ = $(SRC:.cpp=.o)
# ------ SETTINGS ------
CXXFLAGS = -O3 -fPIC -Isrc/ML-PACE -I$(YAML_CPP_INC) -I$(WIGNER_CPP_INC) -I$(CNPY_CPP_INC) -DEXTRA_C_PROJECTIONS
CXXFLAGS = -O3 -fPIC -Isrc/ML-PACE -I$(YAML_CPP_INC) -I$(WIGNER_CPP_INC) -I$(CNPY_CPP_INC) -DEXTRA_C_PROJECTIONS -DCOMPUTE_B_GRAD
ARCHIVE = ar
ARCHFLAG = -rc

View File

@ -1,3 +1,3 @@
pace_SYSINC =-I../../lib/pace/src/ML-PACE -I../../lib/pace/src/yaml-cpp/include -I../../lib/pace/src/wigner-cpp/include -DEXTRA_C_PROJECTIONS
pace_SYSINC =-I../../lib/pace/src/ML-PACE -I../../lib/pace/src/yaml-cpp/include -I../../lib/pace/src/wigner-cpp/include -DEXTRA_C_PROJECTIONS -DCOMPUTE_B_GRAD
pace_SYSLIB = -L../../lib/pace/ -lpace -L../../lib/pace/src/yaml-cpp/ -lyaml-cpp
pace_SYSPATH =

View File

@ -0,0 +1,41 @@
# DATE: 2023-10-30 UNITS: metal CONTRIBUTOR: Federica Lodesani <federica.lodesani@unimore.it> CITATION: Bertani, Menziani, Pedone (2021). Physical Review Materials, 5(4), 045602
#
# Multiple entries can be added to this file, LAMMPS only reads the ones it needs
#
# These entries are in LAMMPS "metal" units:
#
# Format of a single entry (one or more lines):
# element 1 (central atom), element 2, element 3,
# k_theta, theta_0, rho, cutoff
#
# (ijj)-->determines cutoff for i-j distance
# (jik)-->determines k, theta_0 for i-j-k angle term
#
# i j k K theta0 rho cutoff
O P P 32.5 109.47 1.0 3.3
O P Si 60.0 109.47 1.0 0.000
O P O 0.000 0.000 1.0 0.000
O Si P 60.0 109.47 1.0 0.000
O Si Si 12.5 109.47 1.0 3.3
O Si O 0.000 0.000 1.0 0.000
O O P 0.000 0.000 1.0 0.000
O O Si 0.000 0.000 1.0 0.000
O O O 0.000 0.000 1.0 0.000
P P P 0.000 0.000 1.0 0.000
P P Si 0.000 0.000 1.0 0.000
P P O 0.000 0.000 1.0 0.000
P Si P 0.000 0.000 1.0 0.000
P Si Si 0.000 0.000 1.0 0.000
P Si O 0.000 0.000 1.0 0.000
P O P 0.000 0.000 1.0 0.000
P O Si 0.000 0.000 1.0 0.000
P O O 0.000 0.000 1.0 0.000
Si P P 0.000 0.000 1.0 0.000
Si P Si 0.000 0.000 1.0 0.000
Si P O 0.000 0.000 1.0 0.000
Si Si P 0.000 0.000 1.0 0.000
Si Si Si 0.000 0.000 1.0 0.000
Si Si O 0.000 0.000 1.0 0.000
Si O P 0.000 0.000 1.0 0.000
Si O Si 0.000 0.000 1.0 0.000
Si O O 0.000 0.000 1.0 0.000

View File

@ -48,9 +48,9 @@ enum{DIAMETER, CHARGE};
FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
if (narg < 5) error->all(FLERR,"Illegal fix adapt/fep command");
if (narg < 5) utils::missing_cmd_args(FLERR,"fix adapt/fep", error);
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
if (nevery < 0) error->all(FLERR,"Illegal fix adapt/fep command");
if (nevery < 0) error->all(FLERR,"Illegal fix adapt/fep every value {}", nevery);
dynamic_group_allow = 1;
create_attribute = 1;
@ -62,21 +62,21 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
int iarg = 4;
while (iarg < narg) {
if (strcmp(arg[iarg],"pair") == 0) {
if (iarg+6 > narg) error->all(FLERR,"Illegal fix adapt/fep command");
if (iarg+6 > narg) utils::missing_cmd_args(FLERR,"fix adapt/fep pair", error);
nadapt++;
iarg += 6;
} else if (strcmp(arg[iarg],"kspace") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt/fep command");
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"fix adapt/fep kspace", error);
nadapt++;
iarg += 2;
} else if (strcmp(arg[iarg],"atom") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix adapt/fep command");
if (iarg+4 > narg) utils::missing_cmd_args(FLERR,"fix adapt/fep atom", error);
nadapt++;
iarg += 4;
} else break;
}
if (nadapt == 0) error->all(FLERR,"Illegal fix adapt/fep command");
if (nadapt == 0) error->all(FLERR,"Nothing to adapt in fix adapt/fep command");
adapt = new Adapt[nadapt];
// parse keywords
@ -136,11 +136,11 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) {
if (strcmp(arg[iarg],"reset") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt/fep command");
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"fix adapt/fep reset", error);
resetflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"scale") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt/fep command");
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"fix adapt/fep scale", error);
scaleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"after") == 0) {
@ -208,7 +208,7 @@ void FixAdaptFEP::post_constructor()
id_fix_diam = nullptr;
id_fix_chg = nullptr;
if (diam_flag) {
if (diam_flag && atom->radius_flag) {
id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM"));
fix_diam = dynamic_cast<FixStoreAtom *>(
modify->add_fix(fmt::format("{} {} STORE/ATOM 1 0 0 1", id_fix_diam,group->names[igroup])));
@ -226,7 +226,7 @@ void FixAdaptFEP::post_constructor()
}
}
if (chgflag) {
if (chgflag && atom->q_flag) {
id_fix_chg = utils::strdup(id + std::string("_FIX_STORE_CHG"));
fix_chg = dynamic_cast<FixStoreAtom *>(
modify->add_fix(fmt::format("{} {} STORE/ATOM 1 0 0 1",id_fix_chg,group->names[igroup])));
@ -267,9 +267,9 @@ void FixAdaptFEP::init()
ad->ivar = input->variable->find(ad->var);
if (ad->ivar < 0)
error->all(FLERR,"Variable name for fix adapt/fep does not exist");
error->all(FLERR,"Variable name {} for fix adapt/fep does not exist", ad->var);
if (!input->variable->equalstyle(ad->ivar))
error->all(FLERR,"Variable for fix adapt/fep is invalid style");
error->all(FLERR,"Variable {} for fix adapt/fep is invalid style", ad->var);
if (ad->which == PAIR) {
anypair = 1;
@ -285,8 +285,9 @@ void FixAdaptFEP::init()
if (ptr == nullptr)
error->all(FLERR,"Fix adapt/fep pair style param not supported");
ad->pdim = 2;
if (ad->pdim == 0) ad->scalar = (double *) ptr;
if (ad->pdim != 2)
error->all(FLERR,"Pair style parameter {} is not compatible with fix adapt/fep", ad->pparam);
if (ad->pdim == 2) ad->array = (double **) ptr;
// if pair hybrid, test that ilo,ihi,jlo,jhi are valid for sub-style

View File

@ -89,6 +89,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) :
ngroups = 0;
ngrouptypes = 0;
triclinic = domain->triclinic;
// required args
@ -123,8 +124,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) :
// error checks on region and its extent being inside simulation box
region_xlo = region_xhi = region_ylo = region_yhi =
region_zlo = region_zhi = 0.0;
region_xlo = region_xhi = region_ylo = region_yhi = region_zlo = region_zhi = 0.0;
if (region) {
if (region->bboxflag == 0)
error->all(FLERR,"Fix gcmc region does not support a bounding box");
@ -298,8 +298,7 @@ void FixGCMC::options(int narg, char **arg)
} else if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command");
region = domain->get_region_by_id(arg[iarg+1]);
if (!region)
error->all(FLERR,"Region {} for fix gcmc does not exist",arg[iarg+1]);
if (!region) error->all(FLERR,"Region {} for fix gcmc does not exist",arg[iarg+1]);
idregion = utils::strdup(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"maxangle") == 0) {
@ -464,6 +463,8 @@ int FixGCMC::setmask()
void FixGCMC::init()
{
triclinic = domain->triclinic;
// set index and check validity of region
if (idregion) {
@ -471,19 +472,31 @@ void FixGCMC::init()
if (!region) error->all(FLERR, "Region {} for fix gcmc does not exist", idregion);
}
triclinic = domain->triclinic;
if (region) {
if (region->bboxflag == 0)
error->all(FLERR,"Fix gcmc region does not support a bounding box");
if (region->dynamic_check())
error->all(FLERR,"Fix gcmc region cannot be dynamic");
if (triclinic) {
if ((region_xlo < domain->boxlo_bound[0]) || (region_xhi > domain->boxhi_bound[0]) ||
(region_ylo < domain->boxlo_bound[1]) || (region_yhi > domain->boxhi_bound[1]) ||
(region_zlo < domain->boxlo_bound[2]) || (region_zhi > domain->boxhi_bound[2])) {
error->all(FLERR,"Fix gcmc region extends outside simulation box");
region_xlo = region->extent_xlo;
region_xhi = region->extent_xhi;
region_ylo = region->extent_ylo;
region_yhi = region->extent_yhi;
region_zlo = region->extent_zlo;
region_zhi = region->extent_zhi;
if (triclinic) {
if ((region_xlo < domain->boxlo_bound[0]) || (region_xhi > domain->boxhi_bound[0]) ||
(region_ylo < domain->boxlo_bound[1]) || (region_yhi > domain->boxhi_bound[1]) ||
(region_zlo < domain->boxlo_bound[2]) || (region_zhi > domain->boxhi_bound[2])) {
error->all(FLERR,"Fix gcmc region extends outside simulation box");
}
} else {
if ((region_xlo < domain->boxlo[0]) || (region_xhi > domain->boxhi[0]) ||
(region_ylo < domain->boxlo[1]) || (region_yhi > domain->boxhi[1]) ||
(region_zlo < domain->boxlo[2]) || (region_zhi > domain->boxhi[2]))
error->all(FLERR,"Fix gcmc region extends outside simulation box");
}
} else {
if ((region_xlo < domain->boxlo[0]) || (region_xhi > domain->boxhi[0]) ||
(region_ylo < domain->boxlo[1]) || (region_yhi > domain->boxhi[1]) ||
(region_zlo < domain->boxlo[2]) || (region_zhi > domain->boxhi[2]))
error->all(FLERR,"Fix gcmc region extends outside simulation box");
}
// set probabilities for MC moves

View File

@ -73,6 +73,8 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) :
restart_global = 1;
time_depend = 1;
triclinic = domain->triclinic;
// required args
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
@ -111,18 +113,6 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) :
region_zlo = region->extent_zlo;
region_zhi = region->extent_zhi;
if (triclinic) {
if ((region_xlo < domain->boxlo_bound[0]) || (region_xhi > domain->boxhi_bound[0]) ||
(region_ylo < domain->boxlo_bound[1]) || (region_yhi > domain->boxhi_bound[1]) ||
(region_zlo < domain->boxlo_bound[2]) || (region_zhi > domain->boxhi_bound[2]))
error->all(FLERR,"Fix widom region {} extends outside simulation box", region->id);
} else {
if ((region_xlo < domain->boxlo[0]) || (region_xhi > domain->boxhi[0]) ||
(region_ylo < domain->boxlo[1]) || (region_yhi > domain->boxhi[1]) ||
(region_zlo < domain->boxlo[2]) || (region_zhi > domain->boxhi[2]))
error->all(FLERR,"Fix widom region {} extends outside simulation box", region->id);
}
// estimate region volume using MC trials
double coord[3];
@ -216,8 +206,7 @@ void FixWidom::options(int narg, char **arg)
} else if (strcmp(arg[iarg],"region") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command");
region = domain->get_region_by_id(arg[iarg+1]);
if (!region)
error->all(FLERR,"Region {} for fix widom does not exist",arg[iarg+1]);
if (!region) error->all(FLERR,"Region {} for fix widom does not exist",arg[iarg+1]);
idregion = utils::strdup(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"charge") == 0) {
@ -292,6 +281,7 @@ int FixWidom::setmask()
void FixWidom::init()
{
triclinic = domain->triclinic;
// set index and check validity of region
@ -300,7 +290,31 @@ void FixWidom::init()
if (!region) error->all(FLERR, "Region {} for fix widom does not exist", idregion);
}
triclinic = domain->triclinic;
if (region) {
if (region->bboxflag == 0)
error->all(FLERR,"Fix gcmc region does not support a bounding box");
if (region->dynamic_check())
error->all(FLERR,"Fix gcmc region cannot be dynamic");
region_xlo = region->extent_xlo;
region_xhi = region->extent_xhi;
region_ylo = region->extent_ylo;
region_yhi = region->extent_yhi;
region_zlo = region->extent_zlo;
region_zhi = region->extent_zhi;
if (triclinic) {
if ((region_xlo < domain->boxlo_bound[0]) || (region_xhi > domain->boxhi_bound[0]) ||
(region_ylo < domain->boxlo_bound[1]) || (region_yhi > domain->boxhi_bound[1]) ||
(region_zlo < domain->boxlo_bound[2]) || (region_zhi > domain->boxhi_bound[2]))
error->all(FLERR,"Fix widom region {} extends outside simulation box", region->id);
} else {
if ((region_xlo < domain->boxlo[0]) || (region_xhi > domain->boxhi[0]) ||
(region_ylo < domain->boxlo[1]) || (region_yhi > domain->boxhi[1]) ||
(region_zlo < domain->boxlo[2]) || (region_zhi > domain->boxhi[2]))
error->all(FLERR,"Fix widom region {} extends outside simulation box", region->id);
}
}
ave_widom_chemical_potential = 0.0;

View File

@ -48,6 +48,17 @@ FixMDIQM::FixMDIQM(LAMMPS *lmp, int narg, char **arg) :
if (atom->map_style == Atom::MAP_NONE)
error->all(FLERR, "Fix mdi/qm requires an atom map be defined");
// initialize class members
plugin = 0;
natoms_exists = 0;
celldispl_exists = 0;
elements_exists = 0;
types_exists = 0;
stress_exists = 0;
pe_exists = 0;
keelec_exists = 0;
// confirm LAMMPS is being run as a driver
int role;

View File

@ -53,6 +53,18 @@ FixMDIQMMM::FixMDIQMMM(LAMMPS *lmp, int narg, char **arg) :
if (atom->map_style == Atom::MAP_NONE)
error->all(FLERR, "Fix mdi/qmmm requires an atom map be defined");
// initialize class members
plugin = 0;
maxlocal = 0;
natoms_exists = 0;
celldispl_exists = 0;
elements_exists = 0;
types_exists = 0;
stress_exists = 0;
pe_exists = 0;
keelec_exists = 0;
// confirm LAMMPS is being run as a driver
int role;

View File

@ -20,6 +20,7 @@
#include "error.h"
#include "input.h"
#include "memory.h"
#include "modify.h"
#include <cstdlib>
@ -67,12 +68,12 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp)
// do variable substitution in multiple word extra_arg
int ncopy = strlen(extra_arg) + 1;
char *copy = (char *) malloc(ncopy);
char *copy = (char *) memory->smalloc(ncopy,"mdi_plugin:copy");
strncpy(copy, extra_arg, ncopy);
char *work = (char *) malloc(ncopy);
char *work = (char *) memory->smalloc(ncopy,"mdi_plugin:work");
int nwork = ncopy;
input->substitute(copy, work, ncopy, nwork, 0);
free(work);
memory->sfree(work);
extra_arg = copy;
iarg += 2;
@ -83,12 +84,12 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp)
// do variable substitution in multiple word lammps_command
int ncopy = strlen(lammps_command) + 1;
char *copy = (char *) malloc(ncopy);
strncpy(copy, extra_arg, ncopy);
char *work = (char *) malloc(ncopy);
char *copy = (char *) memory->smalloc(ncopy,"mdi_plugin:work");
strncpy(copy, lammps_command, ncopy);
char *work = (char *) memory->smalloc(ncopy,"mdi_plugin:work");
int nwork = ncopy;
input->substitute(copy, work, ncopy, nwork, 0);
free(work);
memory->sfree(work);
lammps_command = copy;
iarg += 2;
@ -128,8 +129,8 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp)
MDI_Launch_plugin(plugin_name, plugin_args, &world, plugin_wrapper, (void *) this);
delete[] plugin_args;
delete[] extra_arg;
delete[] lammps_command;
memory->sfree(extra_arg);
memory->sfree(lammps_command);
}
/* ----------------------------------------------------------------------

View File

@ -474,7 +474,7 @@ tar:
@cd STUBS; $(MAKE)
@echo "Created $(ROOT)_src.tar.gz"
check: check-whitespace check-permissions check-homepage check-errordocs check-version
check: check-whitespace check-permissions check-homepage check-errordocs check-docs check-version
check-whitespace:
$(PYTHON) ../tools/coding_standard/whitespace.py ..
@ -500,8 +500,12 @@ check-errordocs:
fix-errordocs:
$(PYTHON) ../tools/coding_standard/errordocs.py .. -f
check-docs:
$(MAKE) $(MFLAGS) -C ../doc anchor_check style_check package_check role_check
check-version:
$(PYTHON) ../tools/coding_standard/versiontags.py ..
$(PYTHON) ../tools/coding_standard/versiontags.py .. || echo
format-src:
clang-format -i --verbose --style=file *.cpp *.h */*.cpp */*.h

View File

@ -29,19 +29,31 @@
#ifdef MLIAP_PYTHON
#include "mliap_model_python.h"
#if defined(__PYX_EXTERN_C) && !defined(CYTHON_EXTERN_C)
#undef __PYX_EXTERN_C
#endif
#include "mliap_unified.h"
// The above should somehow really be included in the next file.
// We could get around this with cython --capi-reexport-cincludes
// However, that exposes -too many- headers.
#include "mliap_model_python_couple.h"
#if defined(__PYX_EXTERN_C) && !defined(CYTHON_EXTERN_C)
#undef __PYX_EXTERN_C
#endif
#include "mliap_unified_couple.h"
#ifdef LMP_KOKKOS
#include "mliap_model_python_kokkos.h"
#if defined(__PYX_EXTERN_C) && !defined(CYTHON_EXTERN_C)
#undef __PYX_EXTERN_C
#endif
#include "mliap_unified_kokkos.h"
// The above should somehow really be included in the next file.
// We could get around this with cython --capi-reexport-cincludes
// However, that exposes -too many- headers.
#include "mliap_model_python_couple_kokkos.h"
#if defined(__PYX_EXTERN_C) && !defined(CYTHON_EXTERN_C)
#undef __PYX_EXTERN_C
#endif
#include "mliap_unified_couple_kokkos.h"

View File

@ -395,7 +395,24 @@ double utils::numeric(const char *file, int line, const std::string &str, bool d
lmp->error->all(file, line, msg);
}
return atof(buf.c_str());
double rv = 0;
try {
rv = stod(buf);
} catch (std::invalid_argument const &) {
auto msg = fmt::format("Floating point number {} in input script or data file is invalid", buf);
if (do_abort)
lmp->error->one(file, line, msg);
else
lmp->error->all(file, line, msg);
} catch (std::out_of_range const &) {
auto msg =
fmt::format("Floating point number {} in input script or data file is out of range", buf);
if (do_abort)
lmp->error->one(file, line, msg);
else
lmp->error->all(file, line, msg);
}
return rv;
}
/* ----------------------------------------------------------------------
@ -439,7 +456,17 @@ int utils::inumeric(const char *file, int line, const std::string &str, bool do_
lmp->error->all(file, line, msg);
}
return atoi(buf.c_str());
int rv = 0;
try {
rv = stoi(buf);
} catch (std::out_of_range const &) {
auto msg = fmt::format("Integer {} in input script or data file is out of range", buf);
if (do_abort)
lmp->error->one(file, line, msg);
else
lmp->error->all(file, line, msg);
}
return rv;
}
/* ----------------------------------------------------------------------
@ -484,7 +511,18 @@ bigint utils::bnumeric(const char *file, int line, const std::string &str, bool
lmp->error->all(file, line, msg);
}
return ATOBIGINT(buf.c_str());
long long rv = 0;
try {
rv = stoll(buf);
if (rv > MAXBIGINT) throw std::out_of_range("64-bit");
} catch (std::out_of_range const &) {
auto msg = fmt::format("Integer {} in input script or data file is out of range", buf);
if (do_abort)
lmp->error->one(file, line, msg);
else
lmp->error->all(file, line, msg);
}
return static_cast<bigint>(rv);
}
/* ----------------------------------------------------------------------
@ -529,7 +567,18 @@ tagint utils::tnumeric(const char *file, int line, const std::string &str, bool
lmp->error->all(file, line, msg);
}
return ATOTAGINT(buf.c_str());
long long rv = 0;
try {
rv = stoll(buf);
if (rv > MAXTAGINT) throw std::out_of_range("64-bit");
} catch (std::out_of_range const &) {
auto msg = fmt::format("Integer {} in input script or data file is out of range", buf);
if (do_abort)
lmp->error->one(file, line, msg);
else
lmp->error->all(file, line, msg);
}
return static_cast<tagint>(rv);
}
/* ----------------------------------------------------------------------

View File

@ -1 +1,2 @@
#define LAMMPS_VERSION "21 Nov 2023"
#define LAMMPS_UPDATE "Development"

View File

@ -93,7 +93,7 @@ void SearchAndFill(struct FrcFieldItem *item)
file_pos = ftell(FrcF);
if (file_pos < 0) {
fprintf(stderr, "Could not obtain file stream position: ", strerror(errno));
fprintf(stderr, "Could not obtain file stream position: %s\n", strerror(errno));
exit(2);
}

41
tools/valgrind/MPICH.supp Normal file
View File

@ -0,0 +1,41 @@
{
MPICH_MPI_init1
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
obj:*
...
fun:psm3_init
...
fun:MPIDI_OFI_init_local
...
fun:PMPI_Init
fun:main
}
{
MPICH_MPI_init2
Memcheck:Leak
match-leak-kinds: reachable
fun:malloc
fun:strdup
obj:*
...
fun:fi_ini
...
fun:MPIDI_OFI_init_local
...
fun:PMPI_Init
fun:main
}
{
MPICH_MPI_init3
Memcheck:Leak
match-leak-kinds: reachable
fun:calloc
obj:*
...
fun:MPIDI_OFI_init_local
...
fun:PMPI_Init
fun:main
}

View File

@ -8,6 +8,7 @@ on running LAMMPS, use a command line like following:
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/MPICH.supp \
--suppressions=/path/to/lammps/tools/valgrind/Python3.supp \
--suppressions=/path/to/lammps/tools/valgrind/GTest.supp \
--suppressions=/path/to/lammps/tools/valgrind/FlexiBLAS.supp \

View File

@ -117,6 +117,17 @@ TEST_F(InputConvertTest, numeric)
TEST_FAILURE(".*ERROR: Expected floating point.*", utils::numeric(FLERR, nullptr, false, lmp););
TEST_FAILURE(".*ERROR: Expected floating point.*",
utils::numeric(FLERR, "2.56D+3", false, lmp););
TEST_FAILURE(".*ERROR: Floating point number.*out of range.*",
utils::numeric(FLERR, "1.0e2000", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating .*", utils::numeric(FLERR, "--546700-", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "546700+", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "--546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "++546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "+-546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating .*", utils::numeric(FLERR, "5.467e--1", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "4.4e++1", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "--5.0460", false, lmp););
TEST_FAILURE(".*ERROR: Expected floating.*", utils::numeric(FLERR, "++5.4670", false, lmp););
}
TEST_F(InputConvertTest, inumeric)
@ -142,6 +153,13 @@ TEST_F(InputConvertTest, inumeric)
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "0x05", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, nullptr, false, lmp););
TEST_FAILURE(".*ERROR: Integer.*out of range.*",
utils::inumeric(FLERR, "1263012546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "--546700-", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "546700+", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "--546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "++546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::inumeric(FLERR, "+-546700", false, lmp););
}
TEST_F(InputConvertTest, bnumeric)
@ -167,6 +185,13 @@ TEST_F(InputConvertTest, bnumeric)
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "0x05", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, nullptr, false, lmp););
TEST_FAILURE(".*ERROR: Integer.*out of range.*",
utils::bnumeric(FLERR, "18446744073709551616123", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "--546700-", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "546700+", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "--546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "++546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::bnumeric(FLERR, "+-546700", false, lmp););
}
TEST_F(InputConvertTest, tnumeric)
@ -192,6 +217,17 @@ TEST_F(InputConvertTest, tnumeric)
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "0x05", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, nullptr, false, lmp););
#if defined(LAMMPS_SMALLBIG)
TEST_FAILURE(".*ERROR: Integer.*out of range.*",
utils::tnumeric(FLERR, "4294967296", false, lmp););
#endif
TEST_FAILURE(".*ERROR: Integer.*out of range.*",
utils::tnumeric(FLERR, "18446744073709551616123", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "--546700-", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "546700+", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "--546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "++546700", false, lmp););
TEST_FAILURE(".*ERROR: Expected integer.*", utils::tnumeric(FLERR, "+-546700", false, lmp););
}
} // namespace LAMMPS_NS