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) option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF)
set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE
GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC ML-IAP MOLECULE PERI POEMS
PLUGIN QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI 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-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-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 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 # "hard" dependencies between packages resulting
# in an error instead of skipping over files # in an error instead of skipping over files
pkg_depends(MLIAP SNAP) pkg_depends(ML-IAP ML-SNAP)
pkg_depends(MPIIO MPI) pkg_depends(MPIIO MPI)
pkg_depends(USER-ATC MANYBODY) pkg_depends(USER-ATC MANYBODY)
pkg_depends(USER-LB MPI) pkg_depends(USER-LB MPI)
@ -350,7 +350,7 @@ else()
set(CUDA_REQUEST_PIC) set(CUDA_REQUEST_PIC)
endif() 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) USER-PLUMED USER-QMMM USER-QUIP USER-SCAFACOS USER-SMD USER-VTK KIM LATTE MESSAGE MSCG COMPRESS USER-PACE)
if(PKG_${PKG_WITH_INCL}) if(PKG_${PKG_WITH_INCL})
include(Packages/${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) set(MLIAP_ENABLE_PYTHON_DEFAULT OFF)
if(PKG_PYTHON) if(PKG_PYTHON)
find_package(Cythonize QUIET) find_package(Cythonize QUIET)
@ -7,20 +7,20 @@ if(PKG_PYTHON)
endif() endif()
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) if(MLIAP_ENABLE_PYTHON)
find_package(Cythonize REQUIRED) find_package(Cythonize REQUIRED)
if(NOT PKG_PYTHON) 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() endif()
if(CMAKE_VERSION VERSION_LESS 3.12) if(CMAKE_VERSION VERSION_LESS 3.12)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3.6) 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() endif()
else() else()
if(Python_VERSION VERSION_LESS 3.6) 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()
endif() endif()

View File

@ -2,8 +2,8 @@
# an existing package selection without losing any other settings # an existing package selection without losing any other settings
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE 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 MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK ML-SNAP SPIN
SRD VORONOI SRD VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK 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 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. # with just a working C++ compiler and an MPI library.
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KIM KOKKOS KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE 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 MPIIO MSCG OPT PERI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK ML-SNAP SPIN
SRD VORONOI SRD VORONOI
USER-ADIOS USER-ATC USER-AWPMD USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK 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 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 set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU
GRANULAR KSPACE LATTE MANYBODY MC MISC MLIAP MOLECULE OPT GRANULAR KSPACE LATTE MANYBODY MC MISC ML-IAP MOLECULE OPT
PERI POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI PERI POEMS QEQ REPLICA RIGID SHOCK ML-SNAP SPIN SRD VORONOI
USER-ATC USER-AWPMD USER-BOCS USER-BROWNIAN USER-CGDNA USER-CGSDK 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-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP
USER-HDNNP USER-INTEL USER-MANIFOLD USER-MDI USER-MEAMC USER-MESODPD 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. # are removed. The resulting binary should be able to run most inputs.
set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI GRANULAR KSPACE MANYBODY MC MISC ML-IAP MOLECULE OPT PERI
PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI PLUGIN POEMS PYTHON QEQ REPLICA RIGID SHOCK ML-SNAP SPIN SRD VORONOI
USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-BROWNIAN USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS
USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC
USER-MESODPD USER-MISC USER-MOFFF USER-OMP USER-PHONON USER-REACTION 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 In addition, there are a few commands in LAMMPS that have native OpenMP
support included as well. These are commands in the ``MPIIO``, 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 some packages support OpenMP threading indirectly through the libraries
they interface to: e.g. ``LATTE``, ``KSPACE``, and ``USER-COLVARS``. they interface to: e.g. ``LATTE``, ``KSPACE``, and ``USER-COLVARS``.
See the :doc:`Packages details <Packages_details>` page for more See the :doc:`Packages details <Packages_details>` page for more

View File

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

View File

@ -57,7 +57,7 @@ page gives those details.
* :ref:`REPLICA <PKG-REPLICA>` * :ref:`REPLICA <PKG-REPLICA>`
* :ref:`RIGID <PKG-RIGID>` * :ref:`RIGID <PKG-RIGID>`
* :ref:`SHOCK <PKG-SHOCK>` * :ref:`SHOCK <PKG-SHOCK>`
* :ref:`SNAP <PKG-SNAP>` * :ref:`ML-SNAP <PKG-ML-SNAP>`
* :ref:`SPIN <PKG-SPIN>` * :ref:`SPIN <PKG-SPIN>`
* :ref:`SRD <PKG-SRD>` * :ref:`SRD <PKG-SRD>`
* :ref:`VORONOI <PKG-VORONOI>` * :ref:`VORONOI <PKG-VORONOI>`
@ -671,7 +671,7 @@ listing, "ls src/MISC", to see the list of commands.
.. _PKG-ML-IAP: .. _PKG-ML-IAP:
ML-IAP package ML-IAP package
------------- --------------
**Contents:** **Contents:**
@ -679,7 +679,7 @@ A general interface for machine-learning interatomic potentials, including PyTor
**Install:** **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 to be installed. To make the *mliappy* model available, also the
:ref:`PYTHON package <PKG-PYTHON>` package needs to be installed, the version :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 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:** **Contents:**
@ -1054,7 +1054,7 @@ computes which analyze attributes of the potential.
**Supporting info:** **Supporting info:**
* src/SNAP: filenames -> commands * src/ML-SNAP: filenames -> commands
* :doc:`pair_style snap <pair_snap>` * :doc:`pair_style snap <pair_snap>`
* :doc:`compute sna/atom <compute_sna_atom>` * :doc:`compute sna/atom <compute_sna_atom>`
* :doc:`compute snad/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:`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 | | :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 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 LAMMPS was built with that package. In addition, building LAMMPS with
the ML-IAP package requires building LAMMPS with the SNAP package. The the ML-IAP package requires building LAMMPS with the ML-SNAP package.
*mliappy* model also requires building LAMMPS with the PYTHON package. The *mliappy* model also requires building LAMMPS with the PYTHON
See the :doc:`Build package <Build_package>` doc page for more info. package. See the :doc:`Build package <Build_package>` doc page for more
info.
Related commands Related commands
"""""""""""""""" """"""""""""""""

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ endif
PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \ PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \
granular kim kokkos kspace latte manybody mc message misc \ granular kim kokkos kspace latte manybody mc message misc \
ml-iap molecule mpiio mscg opt peri plugin poems \ 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 \ 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 \ user-cgsdk user-colvars user-dielectric user-diffraction user-dpd user-drude \