Requests for technical support from the VASP group should be posted in the VASP-forum.

Machine learning force field calculations: Intermediate

From Vaspwiki
Jump to navigationJump to search

This chapter assumes that the reader is familiar of the basic methodology and tags of on the fly machine learning. If not please study first On-the-fly machine learning force field generation using Bayesian linear regression and Machine learning force field calculations: Basics.


Monitoring of the learning

For the monitoring of the calculations the ML_LOGFILE, ML_ABN and OSZICAR (or OUTCAR) are needed.

  • ML_LOGFILE: This file contains information on the errors of the basis set and accuracy of the force field at every step.
    • First the user should look for the line "Error in radial expansion: ...". The value given by this tag describes the error of the radial basis functions. A typical good value for the error threshold which was purely empirically determined (by us and in reference [1]) is . If the error is too large for a given cut-off radius ML_FF_RCUT2_MB (ML_FF_RCUT1_MB) and Gaussian broadening ML_FF_SION2_MB (ML_FF_SION1_MB) then the radial basis has to be increased ML_FF_MRB2_MB (ML_FF_MRB1_MB). For the default values of ML_FF_SION2_MB=0.5 and ML_FF_RCUT2_MB=5.0 we use ML_FF_MRB2_MB=9 by default. If ML_FF_SION2_MB or ML_FF_RCUT2_MB is changed then ML_FF_MRB2_MB is changed by the inverse or direct ratio, respectively. This behaviour is overwritten if a value is set explicitely for ML_FF_MRB2_MB.
    • If the on-the-fly algorithm at any point judges that new data is required an ab initio calculation is carried. After this calculation the error of the force field compared to the ab initio calculation is printed out. A sample output could look like the following:
====================================================================================================
     Variance in ab initio data
----------------------------------------------------------------------------------------------------
              Energy variance (eV atom^-1):     0.006226
              Force variance (eV Angst^-1):     0.924295
                      Stress variance (kB):     4.020634
====================================================================================================
     Variance in many-body data
----------------------------------------------------------------------------------------------------
              Energy variance (eV atom^-1):     0.006226
              Force variance (eV Angst^-1):     0.924295
                      Stress variance (kB):     4.020634
====================================================================================================
     Information on error estimations
----------------------------------------------------------------------------------------------------
              Error in energy (eV atom^-1):     0.001078
             Error in force  (eV Angst^-1):     0.120559
                      Error in stress (kB):     0.765367
               Bayesian error (eV Angst-1):     0.045367    0.048115
                       Spilling factor (-):     0.020630    0.020000
====================================================================================================
     Inaccurate. Execute ab-initio calculation.
Most of the lines should be self explanatory. The first entry of the line for Bayesian error is the actual value of the calculated error while the second line shows the threshold criterion. The same for the spilling factor. If one of these values is above the threshold the line "Inaccurate. Execute ab-initio calculation." is printed otherwise "Accurate. Use the predicted results." is printed.
  • ML_ABN: This file contains the ab initio data used for the regression. One should monitor the number of training structures following the line "The number of configurations" at the beginning of the file. This value should be lower than ML_FF_MCONF otherwise the code performs an emergency quit. After that the calculation can be continued with a larger value for ML_FF_MCONF. The number of basis sets for each atom type follows after the line "The numbers of basis sets per atom type". The largest of these values should not exceed ML FF_MB_MB otherwise the code performs an emergency quit, but after that the calculation can be continued with a larger value for ML FF_MB_MB. This file is renewed at every step where new ab initio data is added or removed (via sparsification). A sample output for MAPbI3 would look like the following:
**************************************************
     The number of configurations
--------------------------------------------------
        599
**************************************************
     The maximum number of atom type
--------------------------------------------------
       5
**************************************************
     The atom types in the data file
--------------------------------------------------
     Pb I  C
     N  H
**************************************************
     The maximum number of atoms per system
--------------------------------------------------
             96
**************************************************
     The maximum number of atoms per atom type
--------------------------------------------------
             48
**************************************************
     Reference atomic energy (eV)
--------------------------------------------------
  -72.5297190000000       -35.4081430000000       -2.39269120000000
  -4.60003440000000       -1.12020270000000
**************************************************
     Atomic mass
--------------------------------------------------
   20.0000000000000        20.0000000000000        12.0110000000000
   14.0010000000000        8.00000000000000
**************************************************
     The numbers of basis sets per atom type
--------------------------------------------------
       178  1653   168
       167  1108

  • OSZICAR: From this file one can very nicely see the learning progress. At every ionic step one sees how many electronic steps are carried out. If no electronic steps are carried out this means that the forces are obtained only by the force field. This step is very fast. At the beginning of the on the fly learning many calculations are carried out by ab initio but the ratio of ab initio to force field calculations should drastically decrease after the force field is learned to a point where (almost) only force field calculations are carried out. This is the point where learning is not needed anymore and the force-field can be used for production runs (see here). The output where ab initio calculations are still performed looks like the following:
...
    5 T=   438. E= -.18356725E+04 F= -.18414985E+04 E0= -0.1841498499105E+04  EK= 0.53787E+01 SP= 0.44E+00 SK= 0.87E-02
       N       E                     dE             d eps       ncg     rms          ort
SDA:   1    -0.183302208033E+04    0.84763E+01    0.00000E+00   840   0.248E+02 0.000E+00
CGA:   2    -0.183971564650E+04   -0.66936E+01   -0.66959E+01   840   0.595E+01 0.148E-01
CGA:   3    -0.184131910439E+04   -0.16035E+01   -0.16037E+01   840   0.111E+01 0.270E-02
CGA:   4    -0.184159641236E+04   -0.27731E+00   -0.27739E+00   840   0.215E+00 0.823E-03
CGA:   5    -0.184165920854E+04   -0.62796E-01   -0.62783E-01   840   0.512E-01 0.472E-03
CGA:   6    -0.184167736264E+04   -0.18154E-01   -0.18166E-01   840   0.162E-01-0.841E-04
CGA:   7    -0.184168332499E+04   -0.59624E-02   -0.59656E-02   840   0.503E-02 0.276E-04
CGA:   8    -0.184168509915E+04   -0.17742E-02   -0.17771E-02   840   0.127E-02-0.817E-04
CGA:   9    -0.184168553060E+04   -0.43145E-03   -0.43253E-03   840   0.289E-03-0.353E-04
CGA:  10    -0.184168562753E+04   -0.96930E-04   -0.98446E-04   840   0.675E-04-0.740E-05
    6 T=   447. E= -.18357058E+04 F= -.18416856E+04 E0= -0.1841685627526E+04  EK= 0.54864E+01 SP= 0.49E+00 SK= 0.79E-02
       N       E                     dE             d eps       ncg     rms          ort
SDA:   1    -0.183297233399E+04    0.87132E+01    0.00000E+00   840   0.238E+02 0.000E+00
CGA:   2    -0.183940122974E+04   -0.64289E+01   -0.64327E+01   840   0.576E+01 0.155E-01
CGA:   3    -0.184094088576E+04   -0.15397E+01   -0.15400E+01   840   0.109E+01 0.202E-02
CGA:   4    -0.184121722224E+04   -0.27634E+00   -0.27641E+00   840   0.210E+00 0.680E-03
CGA:   5    -0.184127881138E+04   -0.61589E-01   -0.61592E-01   840   0.506E-01 0.420E-03
CGA:   6    -0.184129650072E+04   -0.17689E-01   -0.17688E-01   840   0.160E-01 0.621E-04
CGA:   7    -0.184130231093E+04   -0.58102E-02   -0.58144E-02   840   0.500E-02 0.986E-04
CGA:   8    -0.184130404738E+04   -0.17364E-02   -0.17347E-02   840   0.123E-02 0.177E-04
CGA:   9    -0.184130449929E+04   -0.45191E-03   -0.45460E-03   840   0.307E-03-0.769E-04
CGA:  10    -0.184130459469E+04   -0.95395E-04   -0.95397E-04   840   0.616E-04 0.533E-05
...

The ouput where only the force field is executed anymore looks like:

...
11201 T=   394. E= -.18309437E+04 F= -.18413458E+04 E0= -0.1841345750667E+04  EK= 0.48386E+01 SP= 0.56E+01 SK= 0.57E-03
11202 T=   397. E= -.18309571E+04 F= -.18414044E+04 E0= -0.1841404415010E+04  EK= 0.48804E+01 SP= 0.56E+01 SK= 0.58E-04
11203 T=   397. E= -.18309494E+04 F= -.18413865E+04 E0= -0.1841386456913E+04  EK= 0.48807E+01 SP= 0.56E+01 SK= 0.15E-02
11204 T=   398. E= -.18309463E+04 F= -.18413658E+04 E0= -0.1841365821064E+04  EK= 0.48878E+01 SP= 0.55E+01 SK= 0.47E-02
11205 T=   405. E= -.18309366E+04 F= -.18414003E+04 E0= -0.1841400304391E+04  EK= 0.49709E+01 SP= 0.55E+01 SK= 0.93E-02
11206 T=   424. E= -.18309416E+04 F= -.18415939E+04 E0= -0.1841593912762E+04  EK= 0.52124E+01 SP= 0.54E+01 SK= 0.14E-01
11207 T=   452. E= -.18309537E+04 F= -.18418784E+04 E0= -0.1841878431041E+04  EK= 0.55482E+01 SP= 0.54E+01 SK= 0.15E-01
11208 T=   473. E= -.18309588E+04 F= -.18420716E+04 E0= -0.1842071617725E+04  EK= 0.58026E+01 SP= 0.53E+01 SK= 0.14E-01
11209 T=   478. E= -.18309554E+04 F= -.18420766E+04 E0= -0.1842076551952E+04  EK= 0.58718E+01 SP= 0.52E+01 SK= 0.10E-01
11210 T=   472. E= -.18309458E+04 F= -.18419427E+04 E0= -0.1841942748731E+04  EK= 0.57995E+01 SP= 0.52E+01 SK= 0.77E-02
11211 T=   461. E= -.18309562E+04 F= -.18417701E+04 E0= -0.1841770060681E+04  EK= 0.56604E+01 SP= 0.51E+01 SK= 0.61E-02
11212 T=   435. E= -.18309519E+04 F= -.18414057E+04 E0= -0.1841405704538E+04  EK= 0.53391E+01 SP= 0.51E+01 SK= 0.63E-02
11213 T=   407. E= -.18308981E+04 F= -.18409681E+04 E0= -0.1840968106985E+04  EK= 0.49961E+01 SP= 0.51E+01 SK= 0.92E-02
11214 T=   419. E= -.18309237E+04 F= -.18410936E+04 E0= -0.1841093569477E+04  EK= 0.51482E+01 SP= 0.50E+01 SK= 0.14E-01
11215 T=   453. E= -.18309579E+04 F= -.18414842E+04 E0= -0.1841484242454E+04  EK= 0.55687E+01 SP= 0.49E+01 SK= 0.16E-01
11216 T=   470. E= -.18309576E+04 F= -.18416211E+04 E0= -0.1841621144641E+04  EK= 0.57727E+01 SP= 0.49E+01 SK= 0.14E-01
11217 T=   465. E= -.18309295E+04 F= -.18414749E+04 E0= -0.1841474876564E+04  EK= 0.57157E+01 SP= 0.48E+01 SK= 0.12E-01
11218 T=   465. E= -.18309202E+04 F= -.18413986E+04 E0= -0.1841398575510E+04  EK= 0.57048E+01 SP= 0.48E+01 SK= 0.99E-02
11219 T=   479. E= -.18309335E+04 F= -.18415345E+04 E0= -0.1841534482658E+04  EK= 0.58796E+01 SP= 0.47E+01 SK= 0.76E-02
11220 T=   493. E= -.18309499E+04 F= -.18416750E+04 E0= -0.1841675042579E+04  EK= 0.60480E+01 SP= 0.47E+01 SK= 0.44E-02
11221 T=   491. E= -.18309375E+04 F= -.18416135E+04 E0= -0.1841613527248E+04  EK= 0.60298E+01 SP= 0.46E+01 SK= 0.18E-02
11222 T=   488. E= -.18309197E+04 F= -.18415409E+04 E0= -0.1841540867151E+04  EK= 0.59922E+01 SP= 0.46E+01 SK= 0.37E-03
11223 T=   492. E= -.18309614E+04 F= -.18416317E+04 E0= -0.1841631743127E+04  EK= 0.60460E+01 SP= 0.46E+01 SK= 0.16E-04
11224 T=   472. E= -.18309527E+04 F= -.18413785E+04 E0= -0.1841378495513E+04  EK= 0.57924E+01 SP= 0.46E+01 SK= 0.51E-03
11225 T=   438. E= -.18308968E+04 F= -.18409209E+04 E0= -0.1840920882539E+04  EK= 0.53755E+01 SP= 0.46E+01 SK= 0.64E-03
11226 T=   437. E= -.18309229E+04 F= -.18409520E+04 E0= -0.1840952022374E+04  EK= 0.53694E+01 SP= 0.47E+01 SK= 0.33E-03
11227 T=   451. E= -.18309454E+04 F= -.18411479E+04 E0= -0.1841147899157E+04  EK= 0.55354E+01 SP= 0.47E+01 SK= 0.21E-03
11228 T=   452. E= -.18309270E+04 F= -.18411544E+04 E0= -0.1841154392910E+04  EK= 0.55525E+01 SP= 0.47E+01 SK= 0.24E-03
11229 T=   455. E= -.18309263E+04 F= -.18411923E+04 E0= -0.1841192261893E+04  EK= 0.55825E+01 SP= 0.47E+01 SK= 0.31E-03
11230 T=   458. E= -.18309539E+04 F= -.18412706E+04 E0= -0.1841270633134E+04  EK= 0.56234E+01 SP= 0.47E+01 SK= 0.45E-03
...

References