forked from lammps/lammps
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lammps#4401 from mala-project/mala
Kokkos versions of bispectrum and Gaussian descriptors on grid
- Loading branch information
Showing
36 changed files
with
3,434 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
.. index:: compute gaussian/grid/local | ||
.. index:: compute gaussian/grid/local/kk | ||
|
||
compute gaussian/grid/local command | ||
=================================== | ||
|
||
Accelerator Variants: *gaussian/grid/local/kk* | ||
|
||
Syntax | ||
"""""" | ||
|
||
.. code-block:: LAMMPS | ||
compute ID group-ID gaussian/grid/local grid nx ny nz rcutfac R_1 R_2 ... sigma_1 sigma_2 | ||
* ID, group-ID are documented in :doc:`compute <compute>` command | ||
* gaussian/grid/local = style name of this compute command | ||
* *grid* values = nx, ny, nz, number of grid points in x, y, and z directions (positive integer) | ||
* *rcutfac* = scale factor applied to all cutoff radii (positive real) | ||
* *R_1, R_2,...* = list of cutoff radii, one for each type (distance units) | ||
* *sigma_1, sigma_2,...* = Gaussian widths, one for each type (distance units) | ||
|
||
Examples | ||
"""""""" | ||
|
||
.. code-block:: LAMMPS | ||
compute mygrid all gaussian/grid/local grid 40 40 40 4.0 0.5 0.5 0.4 0.4 | ||
Description | ||
""""""""""" | ||
|
||
Define a computation that calculates a Gaussian representation of the ionic | ||
structure. This representation is used for the efficient evaluation | ||
of quantities related to the structure factor in a grid-based workflow, | ||
such as the ML-DFT workflow MALA :ref:`(Ellis) <Ellis2021b>`, for which it was originally | ||
implemented. Usage of the workflow is described in a separate publication :ref:`(Fiedler) <Fiedler2023>`. | ||
|
||
For each LAMMPS type, a separate sum of Gaussians is calculated, using | ||
a separate Gaussian broadening per type. The computation | ||
is always performed on the numerical grid, no atom-based version of this | ||
compute exists. The Gaussian representation can only be executed in a local | ||
fashion, thus the output array only contains rows for grid points | ||
that are local to the processor subdomain. The layout of the grid is the same | ||
as for the see :doc:`sna/grid/local <compute_sna_atom>` command. | ||
|
||
Namely, the array contains one row for each of the | ||
local grid points, looping over the global index *ix* fastest, | ||
then *iy*, and *iz* slowest. Each row of the array contains | ||
the global indexes *ix*, *iy*, and *iz* first, followed by the *x*, *y*, | ||
and *z* coordinates of the grid point, followed by the values of the Gaussians | ||
(one floating point number per type per grid point). | ||
|
||
---------- | ||
|
||
|
||
.. include:: accel_styles.rst | ||
|
||
|
||
|
||
---------- | ||
|
||
Output info | ||
""""""""""" | ||
|
||
Compute *gaussian/grid/local* evaluates a local array. | ||
The array contains one row for each of the | ||
local grid points, looping over the global index *ix* fastest, | ||
then *iy*, and *iz* slowest. The array contains math :math:`ntypes+6` columns, | ||
where *ntypes* is the number of LAMMPS types. The first three columns are | ||
the global indexes *ix*, *iy*, and *iz*, followed by the *x*, *y*, | ||
and *z* coordinates of the grid point, followed by the *ntypes* columns | ||
containing the values of the Gaussians for each type. | ||
|
||
Restrictions | ||
"""""""""""" | ||
|
||
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>` page for more info. | ||
|
||
Related commands | ||
"""""""""""""""" | ||
|
||
:doc:`compute sna/grid/local <compute_sna_atom>` | ||
|
||
---------- | ||
|
||
.. _Ellis2021b: | ||
|
||
**(Ellis)** Ellis, Fiedler, Popoola, Modine, Stephens, Thompson, Cangi, Rajamanickam, `Phys. Rev. B, 104, 035120, (2021) <https://doi.org/10.1103/PhysRevB.104.035120>`_ | ||
|
||
.. _Fiedler2023: | ||
|
||
**(Fiedler)** Fiedler, Modine, Schmerler, Vogel, Popoola, Thompson, Rajamanickam, and Cangi, | ||
`npj Comp. Mater., 9, 115 (2023) <https://doi.org/10.1038/s41524-023-01070-z>`_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Demonstrate calculation of Gaussian descriptors on a grid | ||
# for a cell with two atoms of type 1 and type 2. | ||
# The output in dump.glocal shows that for grid points | ||
# sitting on an atom of type 1 or 2: | ||
# val1 = 1.0/(0.1355*sqrt(2.0*pi))**3 = 25.5219 | ||
# val2 = 1.0/(0.2 *sqrt(2.0*pi))**3 = 7.93670 | ||
# These values are extracted to the log file | ||
# | ||
|
||
variable nrep index 1 | ||
variable a index 3.316 | ||
variable ngrid index 2 | ||
|
||
units metal | ||
atom_modify map hash | ||
|
||
# generate the box and atom positions using a BCC lattice | ||
|
||
variable nx equal ${nrep} | ||
variable ny equal ${nrep} | ||
variable nz equal ${nrep} | ||
|
||
boundary p p p | ||
|
||
lattice custom $a & | ||
a1 1 0 0 & | ||
a2 0 1 0 & | ||
a3 0 0 1 & | ||
basis 0 0 0 & | ||
basis 0.5 0.5 0.5 & | ||
|
||
region box block 0 ${nx} 0 ${ny} 0 ${nz} | ||
create_box 2 box | ||
create_atoms 1 box basis 1 1 basis 2 2 | ||
|
||
mass * 180.88 | ||
|
||
# define atom compute and grid compute | ||
|
||
variable rcutfac equal 4.67637 | ||
variable radelem1 equal 0.5 | ||
variable radelem2 equal 0.5 | ||
variable sigmaelem1 equal 0.1355 | ||
variable sigmaelem2 equal 0.2 | ||
variable gaussian_options string & | ||
"${rcutfac} ${radelem1} ${radelem2} ${sigmaelem1} ${sigmaelem2}" | ||
|
||
# build zero potential to force ghost atom creation | ||
|
||
pair_style zero ${rcutfac} | ||
pair_coeff * * | ||
|
||
# define atom and grid computes | ||
|
||
compute mygridlocal all gaussian/grid/local grid ${ngrid} ${ngrid} ${ngrid} & | ||
${gaussian_options} | ||
|
||
# define output | ||
|
||
dump 1 all local 1000 dump.glocal c_mygridlocal[*] | ||
dump 2 all custom 1000 dump.gatom id x y z | ||
compute val1 all reduce max c_mygridlocal[7] inputs local | ||
compute val2 all reduce max c_mygridlocal[8] inputs local | ||
thermo_style custom step c_val1 c_val2 | ||
|
||
# run | ||
|
||
run 0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.