From f8ddeb033cb42b8c551fe4cac805f17cd05dbd2c Mon Sep 17 00:00:00 2001 From: Yury Lysogorskiy Date: Wed, 29 Jun 2022 14:38:37 +0200 Subject: [PATCH] change default is_dump_extrapolative_structures=false add pair_pace.rst --- doc/src/pair_pace.rst | 68 ++++++++++++++++++++++++++++++++++-- src/ML-PACE/pair_pace_al.cpp | 1 + src/ML-PACE/pair_pace_al.h | 2 +- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/doc/src/pair_pace.rst b/doc/src/pair_pace.rst index c9857c5caa..d50bd7e097 100644 --- a/doc/src/pair_pace.rst +++ b/doc/src/pair_pace.rst @@ -1,11 +1,15 @@ .. index:: pair_style pace .. index:: pair_style pace/kk +.. index:: pair_style pace/al pair_style pace command ======================= Accelerator Variants: *pace/kk* +pair_style pace/al command +========================= + Syntax """""" @@ -22,6 +26,18 @@ Syntax *recursive* = use recursive algorithm for basis functions *chunksize* value = number of atoms in each pass +.. code-block:: LAMMPS + + pair_style pace/al gamma_lower_bound gamma_upper_bound gamma_freq dump + +* one or more arguments may be appended + + .. parsed-literal:: + *gamma_lower_bound* = minimal value of extrapolation grade considered as moderate extrapolation + *gamma_upper_bound* = maximal value of extrapolation grade considered as moderate extrapolation + *gamma_freq* value = frequency of computing extrapolation grade (in steps) + dump = *dump* or *nodump* = dump structures with gamma > *gamma_lower_bound* to `extrapolative_structures.dat` file + Examples """""""" @@ -31,6 +47,9 @@ Examples pair_style pace product chunksize 2048 pair_coeff * * Cu-PBE-core-rep.ace Cu + pair_style pace/al 1.5 10 20 nodump + pair_coeff * * Cu.yaml Cu.asi Cu + Description """"""""""" @@ -76,6 +95,43 @@ avoid running out of memory. For example if there are 8192 atoms in the simulation and the *chunksize* is set to 4096, the ACE calculation will be broken up into two passes (running on a single GPU). +Extrapolation grade and active learning +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +Calculation of extrapolation grade in PACE is implemented in `pair_style pace/al`. +It is based on the MaxVol algorithm similar to Moment Tensor Potential (MTP) by Shapeev et al. +and described in :ref:`(Lysogorskiy2) `. +In order to compute extrapolation grade one needs to provide: + +#. ACE potential in B-basis form (`.yaml` format) and +#. Active Set Inverted (ASI) file for corresponding potential (`.asi` format) + +Calculation of extrapolation grades requires matrix-vector multiplication for each atom +and can be slower than the usual `pair_style pace recursive`, +therefore it make sense not to do it on every step. +Extrapolation grade calculation frequency is controlled by *gamma_freq* parameter. +On all other steps `pair_style pace recursive` is used. + +The maximal value of *gamma* for all atoms in a structure determines the extrapolation grade for structure. +If per-structure extrapolation grade exceeds *gamma_lower_bound* but less than *gamma_upper_bound*, +the structure is considered as extrapolative and will be stored into +`extrapolative_structures.dat` if *dump* keyword is provided. +If extrapolation grade exceeds *gamma_upper_bound*, simulation is aborted. + +Both per-atom and per-structure extrapolation grades are accessible via `compute pace/atom` +that is **always** instantiated for `pair_style pace/al` by name `c_pace_gamma`: + +.. code-block:: LAMMPS + + # per-structure extrapolation grade + thermo_style custom step etotal temp press c_pace_gamma + + # per-atom extrapolation grade + dump 1 all custom 100 my.dump id type mass x y z c_pace_gamma + + +---------- + See the :doc:`pair_coeff ` page for alternate ways to specify the path for the ACE coefficient file. @@ -119,7 +175,11 @@ Related commands Default """"""" -recursive, chunksize = 4096 +recursive, chunksize = 4096, +gamma_lower_bound = 1.5, +gamma_upper_bound = 10, +gamma_freq = 1, +nodump .. _Drautz20191: @@ -127,4 +187,8 @@ recursive, chunksize = 4096 .. _Lysogorskiy20211: -**(Lysogorskiy)** Lysogorskiy, van der Oord, Bochkarev, Menon, Rinaldi, Hammerschmidt, Mrovec, Thompson, Csanyi, Ortner, Drautz, TBD (2021). +**(Lysogorskiy)** Lysogorskiy, van der Oord, Bochkarev, Menon, Rinaldi, Hammerschmidt, Mrovec, Thompson, Csanyi, Ortner, Drautz, npj Comp Mat, 7, 97 (2021). + +.. _Lysogorskiy2022: + +**(Lysogorskiy2022)** Lysogorskiy, Bochkarev, Mrovec, Drautz, TBS (2022). diff --git a/src/ML-PACE/pair_pace_al.cpp b/src/ML-PACE/pair_pace_al.cpp index b20798f3a7..4c678d5060 100644 --- a/src/ML-PACE/pair_pace_al.cpp +++ b/src/ML-PACE/pair_pace_al.cpp @@ -392,6 +392,7 @@ void PairPACEActiveLearning::settings(int narg, char **arg) { } if (narg > 3) { + //default value is_dump_extrapolative_structures = false if (strcmp(arg[3], "nodump") == 0) is_dump_extrapolative_structures = false; if (strcmp(arg[3], "dump") == 0) is_dump_extrapolative_structures = true; } diff --git a/src/ML-PACE/pair_pace_al.h b/src/ML-PACE/pair_pace_al.h index 29a76e1f3c..219958a6ab 100644 --- a/src/ML-PACE/pair_pace_al.h +++ b/src/ML-PACE/pair_pace_al.h @@ -59,7 +59,7 @@ namespace LAMMPS_NS { struct ACEALImpl *aceimpl; int gamma_grade_eval_freq = 1; - bool is_dump_extrapolative_structures = true; + bool is_dump_extrapolative_structures = false; DumpCustom *dump = nullptr; Compute *computePaceAtom = nullptr; int natoms; //total number of atoms