Unverified Commit 585ed5e1 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #2228 from athomps/compute-mliap

Compute mliap updates
parents ad02d7a5 e98056c0
Loading
Loading
Loading
Loading
+23 −16
Original line number Diff line number Diff line
@@ -12,25 +12,25 @@ Syntax

* ID, group-ID are documented in :doc:`compute <compute>` command
* mliap = style name of this compute command
* two keyword/value pairs must be appended
* keyword = *model* or *descriptor*
* two or more keyword/value pairs must be appended
* keyword = *model* or *descriptor* or *gradgradflag*

  .. parsed-literal::

       *model* values = style Nelems Nparams
       *model* values = style
         style = *linear* or *quadratic*
         Nelems = number of elements
         Nparams = number of parameters per element
       *descriptor* values = style filename
         style = *sna*
         filename = name of file containing descriptor definitions
       *gradgradflag* value = 0/1
         toggle gradgrad method for force gradient

Examples
""""""""

.. code-block:: LAMMPS

   compute mliap model linear 2 31 descriptor sna Ta06A.mliap.descriptor
   compute mliap model linear descriptor sna Ta06A.mliap.descriptor

Description
"""""""""""
@@ -57,20 +57,13 @@ The compute *mliap* command must be followed by two keywords
*model* and *descriptor* in either order.

The *model* keyword is followed by a model style, currently limited to
either *linear* or *quadratic*. In both cases,
this is followed by two arguments. *nelems* is the number of elements.
It must be equal to the number of LAMMPS atom types. *nparams*
is the number of parameters per element for this model i.e.
the number of parameter gradients for each element. Note these definitions
are identical to those of *nelems* and *nparams* in the
:doc:`pair_style mliap <pair_mliap>` model file.
either *linear* or *quadratic*.

The *descriptor* keyword is followed by a descriptor style, and additional arguments.
Currently the only descriptor style is *sna*, indicating the bispectrum component
descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of
:doc:`pair_style snap <pair_snap>`.
The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped
out by the LAMMPS command parser. A single additional argument specifies the descriptor filename
A single additional argument specifies the descriptor filename
containing the parameters and setting used by the SNAP descriptor.
The descriptor filename usually ends in the *.mliap.descriptor* extension.
The format of this file is identical to the descriptor file in the
@@ -109,6 +102,17 @@ command:
See section below on output for a detailed explanation of the data
layout in the global array.

The optional keyword *gradgradflag* controls how the force
gradient is calculated. A value of 1 requires that the model provide
the matrix of double gradients of energy w.r.t. both parameters
and descriptors. For the linear and quadratic models this matrix is
sparse and so is easily calculated and stored. For other models, this
matrix may be prohibitively expensive to calculate and store.
A value of 0 requires that the descriptor provide the derivative
of the descriptors w.r.t. the position of every neighbor atom.
This is not optimal for linear and quadratic models, but may be
a better choice for more complex models.

Atoms not in the group do not contribute to this compute.
Neighbor atoms not in the group do not contribute to this compute.
The neighbor list needed to compute this quantity is constructed each
@@ -167,4 +171,7 @@ Related commands

:doc:`pair_style mliap <pair_mliap>`

**Default:** none
Default
"""""""

The keyword defaults are gradgradflag = 1
+1 −2
Original line number Diff line number Diff line
@@ -86,8 +86,7 @@ The *descriptor* keyword is followed by a descriptor style, and additional argum
Currently the only descriptor style is *sna*, indicating the bispectrum component
descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of
:doc:`pair_style snap <pair_snap>`.
The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped
out by the LAMMPS command parser. A single additional argument specifies the descriptor filename
A single additional argument specifies the descriptor filename
containing the parameters and setting used by the SNAP descriptor.
The descriptor filename usually ends in the *.mliap.descriptor* extension.

+1 −0
Original line number Diff line number Diff line
@@ -1075,6 +1075,7 @@ GPa
gpu
gpuID
gpus
gradgradflag
gradV
GradVidottan
graining
+20 −10
Original line number Diff line number Diff line
@@ -67,13 +67,6 @@ compute vbsum all reduce sum c_vb[*]
# fix 		vbsum all ave/time 1 1 1 c_vbsum file vbsum.dat mode vector
variable	db_2_100 equal c_db[2][100]

# set up compute snap generating global array

compute   	snap all mliap descriptor sna compute.mliap.descriptor model quadratic 2 21
fix 		snap all ave/time 1 1 1 c_snap[*] file compute.quadratic.dat mode vector

thermo 		100

# test output:   1: total potential energy
#                2: xy component of stress tensor
#                3: Sum(0.5*(B_{222}^i)^2, all i of type 2) 
@@ -81,15 +74,32 @@ thermo 100
#                5: y component of -Sum(d(0.5*(B_{222}^i)^2/dR[2]), all i of type 2)
#
#                followed by 5 counterparts from compute snap
thermo 		100

# run compute mliap with gradgradflag = 1

compute   	snap all mliap descriptor sna compute.mliap.descriptor model quadratic gradgradflag 1
fix 		snap all ave/time 1 1 1 c_snap[*] file compute.quadratic.gg1.dat mode vector

thermo_style	custom &
		pe            pxy            c_bsum2[20]   c_vbsum[220]    v_db_2_100 &
		c_snap[1][43] c_snap[13][43] c_snap[1][42] c_snap[12][42] c_snap[6][42] 
thermo_modify 	norm no

# dump 		mydump_db all custom 1000 dump_db id c_db[*]
# dump_modify 	mydump_db sort id
run             ${nsteps}

uncompute	snap
unfix		snap

# run compute mliap with gradgradflag = 0

# Run MD
compute   	snap all mliap descriptor sna compute.mliap.descriptor model quadratic gradgradflag 0
fix 		snap all ave/time 1 1 1 c_snap[*] file compute.quadratic.gg0.dat mode vector

thermo_style	custom &
		pe            pxy            c_bsum2[20]   c_vbsum[220]    v_db_2_100 &
		c_snap[1][43] c_snap[13][43] c_snap[1][42] c_snap[12][42] c_snap[6][42] 
thermo_modify 	norm no

run             ${nsteps}
+18 −8
Original line number Diff line number Diff line
@@ -67,11 +67,6 @@ compute vbsum all reduce sum c_vb[*]
# fix 		vbsum all ave/time 1 1 1 c_vbsum file vbsum.dat mode vector
variable	db_2_25 equal c_db[2][25]

# set up compute snap generating global array

compute   	snap all mliap descriptor sna compute.mliap.descriptor model linear 2 6
fix 		snap all ave/time 1 1 1 c_snap[*] file compute.snap.dat mode vector

thermo 		100

# test output:   1: total potential energy
@@ -82,14 +77,29 @@ thermo 100
#
#                followed by 5 counterparts from compute snap

# run compute mliap with gradgradflag = 1

compute   	snap all mliap descriptor sna compute.mliap.descriptor model linear gradgradflag 1
fix 		snap all ave/time 1 1 1 c_snap[*] file compute.snap.gg1.dat mode vector

thermo_style	custom &
		pe            pxy            c_bsum2[1]   c_vbsum[55]    v_db_2_25 &
		c_snap[1][13] c_snap[13][13] c_snap[1][8] c_snap[12][12] c_snap[6][12] 
thermo_modify 	norm no

# dump 		mydump_db all custom 1000 dump_db id c_db[*]
# dump_modify 	mydump_db sort id
run             ${nsteps}

uncompute	snap
unfix		snap

# Run MD
# run compute mliap with gradgradflag = 0

compute   	snap all mliap descriptor sna compute.mliap.descriptor model linear gradgradflag 0
fix 		snap all ave/time 1 1 1 c_snap[*] file compute.snap.gg0.dat mode vector

thermo_style	custom &
		pe            pxy            c_bsum2[1]   c_vbsum[55]    v_db_2_25 &
		c_snap[1][13] c_snap[13][13] c_snap[1][8] c_snap[12][12] c_snap[6][12] 
thermo_modify 	norm no

run             ${nsteps}
Loading