rename SNAP package to ML-SNAP and fix up some remaining MLIAP to ML-IAP issues

This commit is contained in:
Axel Kohlmeyer
2021-06-29 11:06:59 -04:00
parent 553a06e823
commit e482502691
29 changed files with 266 additions and 268 deletions

View File

@ -139,8 +139,8 @@ install(TARGETS lmp EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS
PLUGIN QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC ML-IAP MOLECULE PERI POEMS
PLUGIN QEQ REPLICA RIGID SHOCK SPIN ML-SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK
USER-COLVARS USER-DIELECTRIC USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-H5MD USER-HDNNP USER-LB USER-MANIFOLD USER-MDI USER-MEAMC USER-MESONT USER-MGPT
@ -229,7 +229,7 @@ endif()
# "hard" dependencies between packages resulting
# in an error instead of skipping over files
pkg_depends(MLIAP SNAP)
pkg_depends(ML-IAP ML-SNAP)
pkg_depends(MPIIO MPI)
pkg_depends(USER-ATC MANYBODY)
pkg_depends(USER-LB MPI)
@ -350,7 +350,7 @@ else()
set(CUDA_REQUEST_PIC)
endif()
foreach(PKG_WITH_INCL KSPACE PYTHON MLIAP VORONOI USER-COLVARS USER-HDNNP USER-MDI USER-MOLFILE USER-NETCDF
foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI USER-COLVARS USER-HDNNP USER-MDI USER-MOLFILE USER-NETCDF
USER-PLUMED USER-QMMM USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS USER-PACE)
if(PKG_${PKG_WITH_INCL})
include(Packages/${PKG_WITH_INCL})

View File

@ -1,4 +1,4 @@
# if PYTHON package is included we may also include Python support in MLIAP
# if PYTHON package is included we may also include Python support in ML-IAP
set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
if(PKG_PYTHON)
find_package(Cythonize QUIET)
@ -7,20 +7,20 @@ if(PKG_PYTHON)
endif()
endif()
option(MLIAP_ENABLE_PYTHON "Build MLIAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
if(MLIAP_ENABLE_PYTHON)
find_package(Cythonize REQUIRED)
if(NOT PKG_PYTHON)
message(FATAL_ERROR "Must enable PYTHON package for including Python support in MLIAP")
message(FATAL_ERROR "Must enable PYTHON package for including Python support in ML-IAP")
endif()
if(CMAKE_VERSION VERSION_LESS 3.12)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6)
message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later")
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
endif()
else()
if(Python_VERSION VERSION_LESS 3.6)
message(FATAL_ERROR "Python support in MLIAP requires Python 3.6 or later")
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
endif()
endif()

View File

@ -2,8 +2,8 @@
# an existing package selection without losing any other settings
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE
MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC ML-IAP MOLECULE
MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK ML-SNAP SPIN
SRD VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD

View File

@ -4,8 +4,8 @@
# with just a working C++ compiler and an MPI library.
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE
MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC ML-IAP MOLECULE
MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK ML-SNAP SPIN
SRD VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD

View File

@ -1,6 +1,6 @@
set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KSPACE LATTE MANYBODY MC MISC MLIAP MOLECULE OPT
PERI POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
GRANULAR KSPACE LATTE MANYBODY MC MISC ML-IAP MOLECULE OPT
PERI POEMS QEQ REPLICA RIGID SHOCK ML-SNAP SPIN SRD VORONOI
USER-ATC USER-AWPMD USER-BOCS USER-BROWNIAN USER-CGDNA USER-CGSDK
USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-HDNNP USER-INTEL USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD

View File

@ -3,8 +3,8 @@
# are removed. The resulting binary should be able to run most inputs.
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI
PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI
GRANULAR KSPACE MANYBODY MC MISC ML-IAP MOLECULE OPT PERI
PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK ML-SNAP SPIN SRD VORONOI
USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC
USER-MESODPD USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION

View File

@ -130,7 +130,7 @@ package can be compiled to include OpenMP threading.
In addition, there are a few commands in LAMMPS that have native OpenMP
support included as well. These are commands in the ``MPIIO``,
``SNAP``, ``USER-DIFFRACTION``, and ``USER-DPD`` packages. In addition
``ML-SNAP``, ``USER-DIFFRACTION``, and ``USER-DPD`` packages. In addition
some packages support OpenMP threading indirectly through the libraries
they interface to: e.g. ``LATTE``, ``KSPACE``, and ``USER-COLVARS``.
See the :doc:`Packages details <Packages_details>` page for more

View File

@ -814,8 +814,8 @@ be installed on your system.
ML-IAP package
---------------------------
Building the ML-IAP package requires including the :ref:`SNAP
<PKG-SNAP>` package. There will be an error message if this requirement
Building the ML-IAP package requires including the :ref:`ML-SNAP
<PKG-ML-SNAP>` package. There will be an error message if this requirement
is not satisfied. Using the *mliappy* model also requires enabling
Python support, which in turn requires to include the :ref:`PYTHON
<PKG-PYTHON>` package **and** requires to have the `cython

View File

@ -57,7 +57,7 @@ page gives those details.
* :ref:`REPLICA <PKG-REPLICA>`
* :ref:`RIGID <PKG-RIGID>`
* :ref:`SHOCK <PKG-SHOCK>`
* :ref:`SNAP <PKG-SNAP>`
* :ref:`ML-SNAP <PKG-ML-SNAP>`
* :ref:`SPIN <PKG-SPIN>`
* :ref:`SRD <PKG-SRD>`
* :ref:`VORONOI <PKG-VORONOI>`
@ -671,7 +671,7 @@ listing, "ls src/MISC", to see the list of commands.
.. _PKG-ML-IAP:
ML-IAP package
-------------
--------------
**Contents:**
@ -679,7 +679,7 @@ A general interface for machine-learning interatomic potentials, including PyTor
**Install:**
To use this package, also the :ref:`SNAP package <PKG-SNAP>` package needs
To use this package, also the :ref:`ML-SNAP package <PKG-ML-SNAP>` package needs
to be installed. To make the *mliappy* model available, also the
:ref:`PYTHON package <PKG-PYTHON>` package needs to be installed, the version
of Python must be 3.6 or later, and the `cython <https://cython.org/>`_ software
@ -1038,10 +1038,10 @@ a material.
----------
.. _PKG-SNAP:
.. _PKG-ML-SNAP:
SNAP package
------------
ML-SNAP package
---------------
**Contents:**
@ -1054,7 +1054,7 @@ computes which analyze attributes of the potential.
**Supporting info:**
* src/SNAP: filenames -> commands
* src/ML-SNAP: filenames -> commands
* :doc:`pair_style snap <pair_snap>`
* :doc:`compute sna/atom <compute_sna_atom>`
* :doc:`compute snad/atom <compute_sna_atom>`

View File

@ -85,7 +85,7 @@ package:
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
| :ref:`SHOCK <PKG-SHOCK>` | shock loading methods | :doc:`fix msst <fix_msst>` | n/a | no |
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
| :ref:`SNAP <PKG-SNAP>` | quantum-fitted potential | :doc:`pair_style snap <pair_snap>` | snap | no |
| :ref:`ML-SNAP <PKG-ML-SNAP>` | quantum-fitted potential | :doc:`pair_style snap <pair_snap>` | snap | no |
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+
| :ref:`SPIN <PKG-SPIN>` | magnetic atomic spin dynamics | :doc:`Howto spins <Howto_spins>` | SPIN | no |
+----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+

View File

@ -167,9 +167,10 @@ Restrictions
This compute is part of the ML-IAP package. It is only enabled if
LAMMPS was built with that package. In addition, building LAMMPS with
the ML-IAP package requires building LAMMPS with the SNAP package. The
*mliappy* model also requires building LAMMPS with the PYTHON package.
See the :doc:`Build package <Build_package>` doc page for more info.
the ML-IAP package requires building LAMMPS with the ML-SNAP package.
The *mliappy* model also requires building LAMMPS with the PYTHON
package. See the :doc:`Build package <Build_package>` doc page for more
info.
Related commands
""""""""""""""""

View File

@ -72,64 +72,66 @@ Description
"""""""""""
Define a computation that calculates a set of quantities related to the
bispectrum components of the atoms in a group. These computes are
used primarily for calculating the dependence of energy, force, and
stress components on the linear coefficients in the
:doc:`snap pair_style <pair_snap>`, which is useful when training a
SNAP potential to match target data.
bispectrum components of the atoms in a group. These computes are used
primarily for calculating the dependence of energy, force, and stress
components on the linear coefficients in the :doc:`snap pair_style
<pair_snap>`, which is useful when training a SNAP potential to match
target data.
Bispectrum components of an atom are order parameters characterizing
the radial and angular distribution of neighbor atoms. The detailed
Bispectrum components of an atom are order parameters characterizing the
radial and angular distribution of neighbor atoms. The detailed
mathematical definition is given in the paper by Thompson et
al. :ref:`(Thompson) <Thompson20141>`
The position of a neighbor atom *i'* relative to a central atom *i* is
a point within the 3D ball of radius :math:`R_{ii'}` = *rcutfac* :math:`(R_i + R_i')`
The position of a neighbor atom *i'* relative to a central atom *i* is a
point within the 3D ball of radius :math:`R_{ii'}` = *rcutfac*
:math:`(R_i + R_i')`
Bartok et al. :ref:`(Bartok) <Bartok20101>`, proposed mapping this 3D ball
onto the 3-sphere, the surface of the unit ball in a four-dimensional
space. The radial distance *r* within *R_ii'* is mapped on to a third
polar angle :math:`\theta_0` defined by,
Bartok et al. :ref:`(Bartok) <Bartok20101>`, proposed mapping this 3D
ball onto the 3-sphere, the surface of the unit ball in a
four-dimensional space. The radial distance *r* within *R_ii'* is
mapped on to a third polar angle :math:`\theta_0` defined by,
.. math::
\theta_0 = {\sf rfac0} \frac{r-r_{min0}}{R_{ii'}-r_{min0}} \pi
In this way, all possible neighbor positions are mapped on to a subset
of the 3-sphere. Points south of the latitude :math:`\theta_0` = *rfac0* :math:`\pi`
are excluded.
of the 3-sphere. Points south of the latitude :math:`\theta_0` =
*rfac0* :math:`\pi` are excluded.
The natural basis for functions on the 3-sphere is formed by the
representatives of *SU(2)*, the matrices :math:`U^j_{m,m'}(\theta, \phi, \theta_0)`.
These functions are better known as :math:`D^j_{m,m'}`, the elements of the Wigner
*D*\ -matrices :ref:`(Meremianin <Meremianin2006>`,
:ref:`Varshalovich <Varshalovich1987>`, :ref:`Mason) <Mason2009>`
The density of neighbors on the 3-sphere can be written as a sum of
Dirac-delta functions, one for each neighbor, weighted by species and
radial distance. Expanding this density function as a generalized
Fourier series in the basis functions, we can write each Fourier
coefficient as
representatives of *SU(2)*, the matrices :math:`U^j_{m,m'}(\theta, \phi,
\theta_0)`. These functions are better known as :math:`D^j_{m,m'}`, the
elements of the Wigner *D*\ -matrices :ref:`(Meremianin
<Meremianin2006>`, :ref:`Varshalovich <Varshalovich1987>`, :ref:`Mason)
<Mason2009>` The density of neighbors on the 3-sphere can be written as
a sum of Dirac-delta functions, one for each neighbor, weighted by
species and radial distance. Expanding this density function as a
generalized Fourier series in the basis functions, we can write each
Fourier coefficient as
.. math::
u^j_{m,m'} = U^j_{m,m'}(0,0,0) + \sum_{r_{ii'} < R_{ii'}}{f_c(r_{ii'}) w_{\mu_{i'}} U^j_{m,m'}(\theta_0,\theta,\phi)}
The :math:`w_{\mu_{i'}}` neighbor weights are dimensionless numbers that depend on
:math:`\mu_{i'}`, the SNAP element of atom *i'*, while the central atom is
arbitrarily assigned a unit weight. The function :math:`f_c(r)` ensures that
the contribution of each neighbor atom goes smoothly to zero at
:math:`R_{ii'}`:
The :math:`w_{\mu_{i'}}` neighbor weights are dimensionless numbers that
depend on :math:`\mu_{i'}`, the SNAP element of atom *i'*, while the
central atom is arbitrarily assigned a unit weight. The function
:math:`f_c(r)` ensures that the contribution of each neighbor atom goes
smoothly to zero at :math:`R_{ii'}`:
.. math::
f_c(r) = & \frac{1}{2}(\cos(\pi \frac{r-r_{min0}}{R_{ii'}-r_{min0}}) + 1), r \leq R_{ii'} \\
= & 0, r > R_{ii'}
The expansion coefficients :math:`u^j_{m,m'}` are complex-valued and they are
not directly useful as descriptors, because they are not invariant
under rotation of the polar coordinate frame. However, the following
scalar triple products of expansion coefficients can be shown to be
real-valued and invariant under rotation :ref:`(Bartok) <Bartok20101>`.
The expansion coefficients :math:`u^j_{m,m'}` are complex-valued and
they are not directly useful as descriptors, because they are not
invariant under rotation of the polar coordinate frame. However, the
following scalar triple products of expansion coefficients can be shown
to be real-valued and invariant under rotation :ref:`(Bartok)
<Bartok20101>`.
.. math::
@ -140,21 +142,20 @@ real-valued and invariant under rotation :ref:`(Bartok) <Bartok20101>`.
{j_2} {m_2} {m'_2} \end{array}}
u^{j_1}_{m_1,m'_1} u^{j_2}_{m_2,m'_2}
The constants :math:`H^{jmm'}_{j_1 m_1 m_{1'},j_2 m_ 2m_{2'}}`
are coupling coefficients,
analogous to Clebsch-Gordan coefficients for rotations on the
2-sphere. These invariants are the components of the bispectrum and
these are the quantities calculated by the compute *sna/atom*\ . They
characterize the strength of density correlations at three points on
the 3-sphere. The j2=0 subset form the power spectrum, which
characterizes the correlations of two points. The lowest-order
components describe the coarsest features of the density function,
while higher-order components reflect finer detail. Each bispectrum
component contains terms that depend on the positions of up to 4
atoms (3 neighbors and the central atom).
The constants :math:`H^{jmm'}_{j_1 m_1 m_{1'},j_2 m_ 2m_{2'}}` are
coupling coefficients, analogous to Clebsch-Gordan coefficients for
rotations on the 2-sphere. These invariants are the components of the
bispectrum and these are the quantities calculated by the compute
*sna/atom*\ . They characterize the strength of density correlations at
three points on the 3-sphere. The j2=0 subset form the power spectrum,
which characterizes the correlations of two points. The lowest-order
components describe the coarsest features of the density function, while
higher-order components reflect finer detail. Each bispectrum component
contains terms that depend on the positions of up to 4 atoms (3
neighbors and the central atom).
Compute *snad/atom* calculates the derivative of the bispectrum components
summed separately for each LAMMPS atom type:
Compute *snad/atom* calculates the derivative of the bispectrum
components summed separately for each LAMMPS atom type:
.. math::
@ -180,16 +181,16 @@ section below on output for a detailed explanation.
Compute *snap* calculates a global array containing information related
to all three of the above per-atom computes *sna/atom*\ , *snad/atom*\ ,
and *snav/atom*\ . The first row of the array contains the summation of
*sna/atom* over all atoms, but broken out by type. The last six rows
of the array contain the summation of *snav/atom* over all atoms, broken
out by type. In between these are 3\*\ *N* rows containing the same values
computed by *snad/atom* (these are already summed over all atoms and
broken out by type). The element in the last column of each row contains
the potential energy, force, or stress, according to the row.
*sna/atom* over all atoms, but broken out by type. The last six rows of
the array contain the summation of *snav/atom* over all atoms, broken
out by type. In between these are 3\*\ *N* rows containing the same
values computed by *snad/atom* (these are already summed over all atoms
and broken out by type). The element in the last column of each row
contains the potential energy, force, or stress, according to the row.
These quantities correspond to the user-specified reference potential
that must be subtracted from the target data when fitting SNAP.
The potential energy calculation uses the built in compute *thermo_pe*.
The stress calculation uses a compute called *snap_press* that is
that must be subtracted from the target data when fitting SNAP. The
potential energy calculation uses the built in compute *thermo_pe*. The
stress calculation uses a compute called *snap_press* that is
automatically created behind the scenes, according to the following
command:
@ -225,36 +226,32 @@ The keyword *switchflag* can be used to turn off the switching
function :math:`f_c(r)`.
The keyword *bzeroflag* determines whether or not *B0*\ , the bispectrum
components of an atom with no neighbors, are subtracted from
the calculated bispectrum components. This optional keyword
normally only affects compute *sna/atom*\ . However, when
*quadraticflag* is on, it also affects *snad/atom* and *snav/atom*\ .
components of an atom with no neighbors, are subtracted from the
calculated bispectrum components. This optional keyword normally only
affects compute *sna/atom*\ . However, when *quadraticflag* is on, it
also affects *snad/atom* and *snav/atom*\ .
The keyword *quadraticflag* determines whether or not the
quadratic combinations of bispectrum quantities are generated.
These are formed by taking the outer product of the vector
of bispectrum components with itself.
See section below on output for a
detailed explanation of the number of quadratic terms and the
ordered in which they are listed.
The keyword *quadraticflag* determines whether or not the quadratic
combinations of bispectrum quantities are generated. These are formed
by taking the outer product of the vector of bispectrum components with
itself. See section below on output for a detailed explanation of the
number of quadratic terms and the ordered in which they are listed.
The keyword *chem* activates the explicit multi-element variant
of the SNAP bispectrum components. The argument *nelements*
specifies the number of SNAP elements that will be handled.
This is followed by *elementlist*, a list of integers of
length *ntypes*, with values in the range [0, *nelements* ),
which maps each LAMMPS type to one of the SNAP elements.
Note that multiple LAMMPS types can be mapped to the same element,
and some elements may be mapped by no LAMMPS type. However, in typical
use cases (training SNAP potentials) the mapping from LAMMPS types
to elements is one-to-one.
The keyword *chem* activates the explicit multi-element variant of the
SNAP bispectrum components. The argument *nelements* specifies the
number of SNAP elements that will be handled. This is followed by
*elementlist*, a list of integers of length *ntypes*, with values in the
range [0, *nelements* ), which maps each LAMMPS type to one of the SNAP
elements. Note that multiple LAMMPS types can be mapped to the same
element, and some elements may be mapped by no LAMMPS type. However, in
typical use cases (training SNAP potentials) the mapping from LAMMPS
types to elements is one-to-one.
The explicit multi-element variant invoked by the *chem* keyword
partitions the density of neighbors into partial densities
for each chemical element. This is described in detail in the
paper by :ref:`Cusentino et al. <Cusentino2020>`
The bispectrum components are indexed on
ordered triplets of elements:
partitions the density of neighbors into partial densities for each
chemical element. This is described in detail in the paper by
:ref:`Cusentino et al. <Cusentino2020>` The bispectrum components are
indexed on ordered triplets of elements:
.. math::
@ -272,17 +269,19 @@ of element :math:`\mu`
u^{\mu}_{j,m,m'} = w^{self}_{\mu_{i}\mu} U^{j,m,m'}(0,0,0) + \sum_{r_{ii'} < R_{ii'}}{\delta_{\mu\mu_{i'}}f_c(r_{ii'}) w_{\mu_{i'}} U^{j,m,m'}(\theta_0,\theta,\phi)}
where :math:`w^{self}_{\mu_{i}\mu}` is the self-contribution, which is either 1 or 0
(see keyword *wselfallflag* below), :math:`\delta_{\mu\mu_{i'}}` indicates
that the sum is only over neighbor atoms of element :math:`\mu`,
and all other quantities are the same as those appearing in the
original equation for :math:`u^j_{m,m'}` given above.
where :math:`w^{self}_{\mu_{i}\mu}` is the self-contribution, which is
either 1 or 0 (see keyword *wselfallflag* below),
:math:`\delta_{\mu\mu_{i'}}` indicates that the sum is only over
neighbor atoms of element :math:`\mu`, and all other quantities are the
same as those appearing in the original equation for :math:`u^j_{m,m'}`
given above.
The keyword *wselfallflag* defines the rule used for the self-contribution.
If *wselfallflag* is on, then :math:`w^{self}_{\mu_{i}\mu}` = 1. If it is
off then :math:`w^{self}_{\mu_{i}\mu}` = 0, except in the case
of :math:`{\mu_{i}=\mu}`, when :math:`w^{self}_{\mu_{i}\mu}` = 1.
When the *chem* keyword is not used, this keyword has no effect.
The keyword *wselfallflag* defines the rule used for the
self-contribution. If *wselfallflag* is on, then
:math:`w^{self}_{\mu_{i}\mu}` = 1. If it is off then
:math:`w^{self}_{\mu_{i}\mu}` = 0, except in the case of
:math:`{\mu_{i}=\mu}`, when :math:`w^{self}_{\mu_{i}\mu}` = 1. When the
*chem* keyword is not used, this keyword has no effect.
The keyword *bnormflag* determines whether or not the bispectrum
component :math:`B_{j_1,j_2,j}` is divided by a factor of :math:`2j+1`.
@ -299,16 +298,16 @@ are not both set or not both unset.
.. note::
If you have a bonded system, then the settings of
:doc:`special_bonds <special_bonds>` command can remove pairwise
interactions between atoms in the same bond, angle, or dihedral. This
is the default setting for the :doc:`special_bonds <special_bonds>`
command, and means those pairwise interactions do not appear in the
neighbor list. Because this fix uses the neighbor list, it also means
those pairs will not be included in the calculation. One way to get
around this, is to write a dump file, and use the :doc:`rerun <rerun>`
command to compute the bispectrum components for snapshots in the dump
file. The rerun script can use a :doc:`special_bonds <special_bonds>`
If you have a bonded system, then the settings of :doc:`special_bonds
<special_bonds>` command can remove pairwise interactions between
atoms in the same bond, angle, or dihedral. This is the default
setting for the :doc:`special_bonds <special_bonds>` command, and
means those pairwise interactions do not appear in the neighbor list.
Because this fix uses the neighbor list, it also means those pairs
will not be included in the calculation. One way to get around this,
is to write a dump file, and use the :doc:`rerun <rerun>` command to
compute the bispectrum components for snapshots in the dump file.
The rerun script can use a :doc:`special_bonds <special_bonds>`
command that includes all pairs in the neighbor list.
----------
@ -317,10 +316,10 @@ Output info
"""""""""""
Compute *sna/atom* calculates a per-atom array, each column
corresponding to a particular bispectrum component. The total number
of columns and the identity of the bispectrum component contained in
each column depend of the value of *twojmax*\ , as
described by the following piece of python code:
corresponding to a particular bispectrum component. The total number of
columns and the identity of the bispectrum component contained in each
column depend of the value of *twojmax*\ , as described by the following
piece of python code:
.. parsed-literal::
@ -338,73 +337,72 @@ For even twojmax = 2(*m*\ -1), :math:`K = m(m+1)(2m+1)/6`, the *m*\ -th pyramida
since all potentials use the value of 3, corresponding to the
above set of bispectrum components.
Compute *snad/atom* evaluates a per-atom array. The columns are
arranged into *ntypes* blocks, listed in order of atom type *I*\ . Each
block contains three sub-blocks corresponding to the *x*\ , *y*\ , and *z*
Compute *snad/atom* evaluates a per-atom array. The columns are arranged
into *ntypes* blocks, listed in order of atom type *I*\ . Each block
contains three sub-blocks corresponding to the *x*\ , *y*\ , and *z*
components of the atom position. Each of these sub-blocks contains *K*
columns for the *K* bispectrum components, the same as for compute *sna/atom*
columns for the *K* bispectrum components, the same as for compute
*sna/atom*
Compute *snav/atom* evaluates a per-atom array. The columns are
arranged into *ntypes* blocks, listed in order of atom type *I*\ . Each
block contains six sub-blocks corresponding to the *xx*\ , *yy*\ , *zz*\ ,
Compute *snav/atom* evaluates a per-atom array. The columns are arranged
into *ntypes* blocks, listed in order of atom type *I*\ . Each block
contains six sub-blocks corresponding to the *xx*\ , *yy*\ , *zz*\ ,
*yz*\ , *xz*\ , and *xy* components of the virial tensor in Voigt
notation. Each of these sub-blocks contains *K*
columns for the *K* bispectrum components, the same as for compute *sna/atom*
notation. Each of these sub-blocks contains *K* columns for the *K*
bispectrum components, the same as for compute *sna/atom*
Compute *snap* evaluates a global array.
The columns are arranged into
*ntypes* blocks, listed in order of atom type *I*\ . Each block
contains one column for each bispectrum component, the same as for compute
*sna/atom*\ . A final column contains the corresponding energy, force component
on an atom, or virial stress component. The rows of the array appear
in the following order:
Compute *snap* evaluates a global array. The columns are arranged into
*ntypes* blocks, listed in order of atom type *I*\ . Each block contains
one column for each bispectrum component, the same as for compute
*sna/atom*\ . A final column contains the corresponding energy, force
component on an atom, or virial stress component. The rows of the array
appear in the following order:
* 1 row: *sna/atom* quantities summed for all atoms of type *I*
* 3\*\ *N* rows: *snad/atom* quantities, with derivatives w.r.t. x, y, and z coordinate of atom *i* appearing in consecutive rows. The atoms are sorted based on atom ID.
* 6 rows: *snav/atom* quantities summed for all atoms of type *I*
For example, if *K* =30 and ntypes=1, the number of columns in the per-atom
arrays generated by *sna/atom*\ , *snad/atom*\ , and *snav/atom*
are 30, 90, and 180, respectively. With *quadratic* value=1,
the numbers of columns are 930, 2790, and 5580, respectively.
The number of columns in the global array generated by *snap*
are 31, and 931, respectively, while the number of rows is
1+3\*\ *N*\ +6, where *N* is the total number of atoms.
For example, if *K* =30 and ntypes=1, the number of columns in the
per-atom arrays generated by *sna/atom*\ , *snad/atom*\ , and
*snav/atom* are 30, 90, and 180, respectively. With *quadratic* value=1,
the numbers of columns are 930, 2790, and 5580, respectively. The
number of columns in the global array generated by *snap* are 31, and
931, respectively, while the number of rows is 1+3\*\ *N*\ +6, where *N*
is the total number of atoms.
If the *quadratic* keyword value is set to 1, then additional
columns are generated, corresponding to
the products of all distinct pairs of bispectrum components. If the
number of bispectrum components is *K*\ , then the number of distinct pairs
is *K*\ (\ *K*\ +1)/2.
For compute *sna/atom* these columns are appended to existing *K* columns.
The ordering of quadratic terms is upper-triangular,
(1,1),(1,2)...(1,\ *K*\ ),(2,1)...(\ *K*\ -1,\ *K*\ -1),(\ *K*\ -1,\ *K*\ ),(\ *K*\ ,\ *K*\ ).
If the *quadratic* keyword value is set to 1, then additional columns
are generated, corresponding to the products of all distinct pairs of
bispectrum components. If the number of bispectrum components is *K*\ ,
then the number of distinct pairs is *K*\ (\ *K*\ +1)/2. For compute
*sna/atom* these columns are appended to existing *K* columns. The
ordering of quadratic terms is upper-triangular, (1,1),(1,2)...(1,\ *K*\
),(2,1)...(\ *K*\ -1,\ *K*\ -1),(\ *K*\ -1,\ *K*\ ),(\ *K*\ ,\ *K*\ ).
For computes *snad/atom* and *snav/atom* each set of *K*\ (\ *K*\ +1)/2
additional columns is inserted directly after each of sub-block
of linear terms i.e. linear and quadratic terms are contiguous.
So the nesting order from inside to outside is bispectrum component,
linear then quadratic, vector/tensor component, type.
additional columns is inserted directly after each of sub-block of
linear terms i.e. linear and quadratic terms are contiguous. So the
nesting order from inside to outside is bispectrum component, linear
then quadratic, vector/tensor component, type.
If the *chem* keyword is used, then the data is arranged into :math:`N_{elem}^3`
sub-blocks, each sub-block corresponding to a particular chemical labeling
:math:`\kappa\lambda\mu` with the last label changing fastest.
Each sub-block contains *K* bispectrum components. For the purposes
of handling contributions to force, virial, and quadratic combinations,
these :math:`N_{elem}^3` sub-blocks are treated as a single block
of :math:`K N_{elem}^3` columns.
If the *chem* keyword is used, then the data is arranged into
:math:`N_{elem}^3` sub-blocks, each sub-block corresponding to a
particular chemical labeling :math:`\kappa\lambda\mu` with the last
label changing fastest. Each sub-block contains *K* bispectrum
components. For the purposes of handling contributions to force, virial,
and quadratic combinations, these :math:`N_{elem}^3` sub-blocks are
treated as a single block of :math:`K N_{elem}^3` columns.
These values can be accessed by any command that uses per-atom values
from a compute as input. See the :doc:`Howto output <Howto_output>` doc
page for an overview of LAMMPS output options. To see how this command
can be used within a Python workflow to train SNAP potentials,
see the examples in `FitSNAP <https://github.com/FitSNAP/FitSNAP>`_.
can be used within a Python workflow to train SNAP potentials, see the
examples in `FitSNAP <https://github.com/FitSNAP/FitSNAP>`_.
Restrictions
""""""""""""
These computes are part of the SNAP package. They are only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>`
doc page for more info.
These computes are part of the ML-SNAP package. They are only enabled
if LAMMPS was built with that package. See the :doc:`Build package
<Build_package>` doc page for more info.
Related commands
""""""""""""""""

View File

@ -194,9 +194,9 @@ Restrictions
This pair style is part of the ML-IAP package. It is only enabled if
LAMMPS was built with that package. In addition, building LAMMPS with
the ML-IAP package requires building LAMMPS with the SNAP package. The
*mliappy* model requires building LAMMPS with the PYTHON package. See
the :doc:`Build package <Build_package>` doc page for more info.
the ML-IAP package requires building LAMMPS with the ML-SNAP package.
The *mliappy* model requires building LAMMPS with the PYTHON package.
See the :doc:`Build package <Build_package>` doc page for more info.
Related commands

View File

@ -24,32 +24,28 @@ Examples
Description
"""""""""""
Pair style *snap* defines the spectral
neighbor analysis potential (SNAP), a machine-learning
interatomic potential :ref:`(Thompson) <Thompson20142>`.
Like the GAP framework of Bartok et al. :ref:`(Bartok2010) <Bartok20102>`,
SNAP uses bispectrum components
to characterize the local neighborhood of each atom
in a very general way. The mathematical definition of the
bispectrum calculation and its derivatives w.r.t. atom positions
is identical to that used by :doc:`compute snap <compute_sna_atom>`,
which is used to fit SNAP potentials to *ab initio* energy, force,
and stress data.
In SNAP, the total energy is decomposed into a sum over
atom energies. The energy of atom *i* is
expressed as a weighted sum over bispectrum components.
Pair style *snap* defines the spectral neighbor analysis potential
(SNAP), a machine-learning interatomic potential :ref:`(Thompson)
<Thompson20142>`. Like the GAP framework of Bartok et
al. :ref:`(Bartok2010) <Bartok20102>`, SNAP uses bispectrum components
to characterize the local neighborhood of each atom in a very general
way. The mathematical definition of the bispectrum calculation and its
derivatives w.r.t. atom positions is identical to that used by
:doc:`compute snap <compute_sna_atom>`, which is used to fit SNAP
potentials to *ab initio* energy, force, and stress data. In SNAP, the
total energy is decomposed into a sum over atom energies. The energy of
atom *i* is expressed as a weighted sum over bispectrum components.
.. math::
E^i_{SNAP}(B_1^i,...,B_K^i) = \beta^{\mu_i}_0 + \sum_{k=1}^K \beta_k^{\mu_i} B_k^i
where :math:`B_k^i` is the *k*\ -th bispectrum component of atom *i*\ ,
and :math:`\beta_k^{\mu_i}` is the corresponding linear coefficient
that depends on :math:`\mu_i`, the SNAP element of atom *i*\ . The
number of bispectrum components used and their definitions
depend on the value of *twojmax* and other parameters
defined in the SNAP parameter file described below.
The bispectrum calculation is described in more detail
and :math:`\beta_k^{\mu_i}` is the corresponding linear coefficient that
depends on :math:`\mu_i`, the SNAP element of atom *i*\ . The number of
bispectrum components used and their definitions depend on the value of
*twojmax* and other parameters defined in the SNAP parameter file
described below. The bispectrum calculation is described in more detail
in :doc:`compute sna/atom <compute_sna_atom>`.
Note that unlike for other potentials, cutoffs for SNAP potentials are
@ -80,32 +76,28 @@ The two trailing 'In' arguments map LAMMPS atom types 1 and 2 to the
SNAP 'In' element. The two trailing 'P' arguments map LAMMPS atom types
3 and 4 to the SNAP 'P' element.
If a SNAP mapping value is
specified as NULL, the mapping is not performed.
This can be used when a *snap* potential is used as part of the
*hybrid* pair style. The NULL values are placeholders for atom types
that will be used with other potentials.
If a SNAP mapping value is specified as NULL, the mapping is not
performed. This can be used when a *snap* potential is used as part of
the *hybrid* pair style. The NULL values are placeholders for atom
types that will be used with other potentials.
The name of the SNAP coefficient file usually ends in the
".snapcoeff" extension. It may contain coefficients
for many SNAP elements. The only requirement is that
each of the unique element names appearing in the
LAMMPS pair_coeff command appear exactly once in
the SNAP coefficient file. It is okay if the SNAP coefficient file
contains additional elements not in the pair_coeff command,
except when using *chemflag* (see below).
The name of the SNAP parameter file usually ends in the ".snapparam"
extension. It contains a small number
of parameters that define the overall form of the SNAP potential.
See the :doc:`pair_coeff <pair_coeff>` doc page for alternate ways
to specify the path for these files.
The name of the SNAP coefficient file usually ends in the ".snapcoeff"
extension. It may contain coefficients for many SNAP elements. The only
requirement is that each of the unique element names appearing in the
LAMMPS pair_coeff command appear exactly once in the SNAP coefficient
file. It is okay if the SNAP coefficient file contains additional
elements not in the pair_coeff command, except when using *chemflag*
(see below). The name of the SNAP parameter file usually ends in the
".snapparam" extension. It contains a small number of parameters that
define the overall form of the SNAP potential. See the :doc:`pair_coeff
<pair_coeff>` doc page for alternate ways to specify the path for these
files.
Quite commonly,
SNAP potentials are combined with one or more other LAMMPS pair styles
using the *hybrid/overlay* pair style. As an example, the SNAP
tantalum potential provided in the LAMMPS potentials directory
combines the *snap* and *zbl* pair styles. It is invoked
by the following commands:
SNAP potentials are quite commonly combined with one or more other
LAMMPS pair styles using the *hybrid/overlay* pair style. As an
example, the SNAP tantalum potential provided in the LAMMPS potentials
directory combines the *snap* and *zbl* pair styles. It is invoked by
the following commands:
.. code-block:: LAMMPS
@ -118,13 +110,13 @@ by the following commands:
pair_coeff 1 1 zbl ${zblz}
pair_coeff * * snap Ta06A.snapcoeff Ta06A.snapparam Ta
It is convenient to keep these commands in a separate file that can
be inserted in any LAMMPS input script using the :doc:`include <include>`
It is convenient to keep these commands in a separate file that can be
inserted in any LAMMPS input script using the :doc:`include <include>`
command.
The top of the SNAP coefficient file can contain any number of blank and comment lines (start with #), but follows a strict
format after that. The first non-blank non-comment
line must contain two integers:
The top of the SNAP coefficient file can contain any number of blank and
comment lines (start with #), but follows a strict format after
that. The first non-blank non-comment line must contain two integers:
* nelem = Number of elements
* ncoeff = Number of coefficients
@ -157,39 +149,44 @@ The default values for these keywords are
* *wselfallflag* = 0
* *chunksize* = 4096
If *quadraticflag* is set to 1, then the SNAP energy expression includes additional quadratic terms
that have been shown to increase the overall accuracy of the potential without much increase
in computational cost :ref:`(Wood) <Wood20182>`.
If *quadraticflag* is set to 1, then the SNAP energy expression includes
additional quadratic terms that have been shown to increase the overall
accuracy of the potential without much increase in computational cost
:ref:`(Wood) <Wood20182>`.
.. math::
E^i_{SNAP}(\mathbf{B}^i) = \beta^{\mu_i}_0 + \boldsymbol{\beta}^{\mu_i} \cdot \mathbf{B}_i + \frac{1}{2}\mathbf{B}^t_i \cdot \boldsymbol{\alpha}^{\mu_i} \cdot \mathbf{B}_i
where :math:`\mathbf{B}_i` is the *K*-vector of bispectrum components,
:math:`\boldsymbol{\beta}^{\mu_i}` is the *K*-vector of linear coefficients
for element :math:`\mu_i`, and :math:`\boldsymbol{\alpha}^{\mu_i}`
is the symmetric *K* by *K* matrix of quadratic coefficients.
The SNAP coefficient file should contain *K*\ (\ *K*\ +1)/2 additional coefficients
in each element block, the upper-triangular elements of :math:`\boldsymbol{\alpha}^{\mu_i}`.
:math:`\boldsymbol{\beta}^{\mu_i}` is the *K*-vector of linear
coefficients for element :math:`\mu_i`, and
:math:`\boldsymbol{\alpha}^{\mu_i}` is the symmetric *K* by *K* matrix
of quadratic coefficients. The SNAP coefficient file should contain
*K*\ (\ *K*\ +1)/2 additional coefficients in each element block, the
upper-triangular elements of :math:`\boldsymbol{\alpha}^{\mu_i}`.
If *chemflag* is set to 1, then the energy expression is written in terms of explicit multi-element bispectrum
components indexed on ordered triplets of elements, which has been shown to increase the ability of the SNAP
potential to capture energy differences in chemically complex systems,
at the expense of a significant increase in computational cost :ref:`(Cusentino) <Cusentino20202>`.
If *chemflag* is set to 1, then the energy expression is written in
terms of explicit multi-element bispectrum components indexed on ordered
triplets of elements, which has been shown to increase the ability of
the SNAP potential to capture energy differences in chemically complex
systems, at the expense of a significant increase in computational cost
:ref:`(Cusentino) <Cusentino20202>`.
.. math::
E^i_{SNAP}(\mathbf{B}^i) = \beta^{\mu_i}_0 + \sum_{\kappa,\lambda,\mu} \boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i} \cdot \mathbf{B}^{\kappa\lambda\mu}_i
where :math:`\mathbf{B}^{\kappa\lambda\mu}_i` is the *K*-vector of bispectrum components
for neighbors of elements :math:`\kappa`, :math:`\lambda`, and :math:`\mu` and
:math:`\boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i}` is the corresponding *K*-vector
of linear coefficients for element :math:`\mu_i`. The SNAP coefficient file should contain
a total of :math:`K N_{elem}^3` coefficients in each element block,
where :math:`N_{elem}` is the number of elements in the SNAP coefficient file,
which must equal the number of unique elements appearing in the
LAMMPS pair_coeff command, to avoid ambiguity in the
number of coefficients.
where :math:`\mathbf{B}^{\kappa\lambda\mu}_i` is the *K*-vector of
bispectrum components for neighbors of elements :math:`\kappa`,
:math:`\lambda`, and :math:`\mu` and
:math:`\boldsymbol{\beta}^{\kappa\lambda\mu}_{\mu_i}` is the
corresponding *K*-vector of linear coefficients for element
:math:`\mu_i`. The SNAP coefficient file should contain a total of
:math:`K N_{elem}^3` coefficients in each element block, where
:math:`N_{elem}` is the number of elements in the SNAP coefficient file,
which must equal the number of unique elements appearing in the LAMMPS
pair_coeff command, to avoid ambiguity in the number of coefficients.
The keyword *chunksize* is only applicable when using the
pair style *snap* with the KOKKOS package and is ignored otherwise.
@ -221,9 +218,10 @@ specify a pair_coeff command with I != J arguments for this style.
This pair style does not support the :doc:`pair_modify <pair_modify>`
shift, table, and tail options.
This pair style does not write its information to :doc:`binary restart files <restart>`, since it is stored in potential files. Thus, you
need to re-specify the pair_style and pair_coeff commands in an input
script that reads a restart file.
This pair style does not write its information to :doc:`binary restart
files <restart>`, since it is stored in potential files. Thus, you need
to re-specify the pair_style and pair_coeff commands in an input script
that reads a restart file.
This pair style can only be used via the *pair* keyword of the
:doc:`run_style respa <run_style>` command. It does not support the
@ -238,8 +236,9 @@ This pair style can only be used via the *pair* keyword of the
Restrictions
""""""""""""
This style is part of the SNAP package. It is only enabled if LAMMPS
was built with that package. See the :doc:`Build package <Build_package>` doc page for more info.
This style is part of the ML-SNAP package. It is only enabled if LAMMPS
was built with that package. See the :doc:`Build package
<Build_package>` doc page for more info.
Related commands
""""""""""""""""

View File

@ -100,9 +100,9 @@ meam.spline modified EAM (MEAM) spline potential
meam.sw.spline modified EAM (MEAM) Stillinger-Weber spline potential
mesocnt mesoscopic carbon nanotube (CNT) potential
mgpt model generalized pseudopotential theory (MGPT) potential
mliap ML-IAP potential
mliap.descriptor ML-IAP potential descriptor
mliap.model ML-IAP potential model
mliap MLIAP potential
mliap.descriptor MLIAP potential descriptor
mliap.model MLIAP potential model
nb3b.harmonic nonbonded 3-body harmonic potential
poly polymorphic 3-body potential
reax ReaxFF potential (see README.reax for more info)

View File

@ -116,7 +116,7 @@ if (test $1 = "RIGID") then
depend USER-SDPD
fi
if (test $1 = "SNAP") then
if (test $1 = "ML-SNAP") then
depend KOKKOS
depend ML-IAP
fi

View File

@ -49,7 +49,7 @@ endif
PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \
granular kim kokkos kspace latte manybody mc message misc \
ml-iap molecule mpiio mscg opt peri plugin poems \
python qeq replica rigid shock snap spin srd voronoi
python qeq replica rigid shock ml-snap spin srd voronoi
PACKUSER = user-adios user-atc user-awpmd user-brownian user-bocs user-cgdna \
user-cgsdk user-colvars user-dielectric user-diffraction user-dpd user-drude \