Page 1 of 1

ML_REG format

Posted: Fri Oct 21, 2022 7:21 am
by duccoi
Hello, I found in the VASP wiki: "This file contains the regression results of the force field training compared to the ab-initio training data." Can anyone please help me confirm the format of the ML_REG file:
The energy part of two columns: Column1- Energy F obtained by MLFF; and Column 2 - the energy obtained by ab into.
The force part consists of two columns: Column 1 - Average force obtained by MLFF and Column 2 - the average force obtained by Ab initio.
One more question. I trained MLFF with 20,000 steps, then I found about 200 lines were printed out for the energy part, which means only 200 steps included in the comparison between MLFF and Ab Initio. Some may comment that more comparisons should be done. Which parameter should I control to increase more lines (maybe 1000-2000 lines) written in energy parts of ML_REG (I tried to increase NSW, but it slightly increase)?

Re: ML_REG format

Posted: Tue Oct 25, 2022 10:01 am
by ferenc_karsai
We have updated the ML_REG page on the VASP wiki:
wiki/index.php/ML_REG

The first column is always the ab-initio data. The second is the fitted data. The forces are not averaged forces, but all force components for eacht training structure listed after each other.

The number of entries for the energies corresponds to the number of training structures. That means "The number of configurations" in the corresponding ML_ABN file. This should be all "grep STATUS ML_LOGFILE" lines that contain 'threshold, learning and critical'.
In the on-the-fly learning this is much less than the number of MD steps set by NSW.

Re: ML_REG format

Posted: Tue Nov 01, 2022 2:10 am
by duccoi
Dear @ferenc_karsai,
Thank you for your clarification.
For the number of configurations for the training process, is it impossible to control the number of training structures with parameters from INCAR such as NSW or ML_MCONF?

Re: ML_REG format

Posted: Thu Nov 03, 2022 8:11 am
by ferenc_karsai
Actually there is no way to say in advance how many training structures one will have, since it is determined by the on-the-fly learning. Hence there is also no way of controlling the training structures directly. Rather you can influence the frequency of the sampling of local reference structures and hence also training structures (since training structures are only sampled if at least one new local reference configuration is taken) as described here
wiki/index.php/Best_practices_for_machi ... parameters

Re: ML_REG format

Posted: Sun Nov 06, 2022 1:50 pm
by duccoi
Dear @ferenc_karsai,
Thank you so much for your answer. I tried to train the force field with a structure of 140 atoms (an oxide of transition metals). I plotted data written in ML_REG files and found that the differences between energies obtained by Ab initio and MLFF are still large even though I trained several times. Could you please suggest to me to choose suitable parameters in the INCAR file?
Image

Code: Select all

   ISTART = 1
   LWAVE = .FALSE.
   LCHARG = .FALSE.
   NCORE  = 8
   LREAL= .F.
   ICHARG = 1
   LORBIT = 10
   KSPACING = 0.5
   ENCUT  = 450 eV
   ISPIN  = 2
   LMAXMIX= 4
   MAGMOM = 3*0 1 15*0 1 16*0 72*0 36*0
   GGA    = PE
   ISMEAR = 0
   SIGMA  = 0.02
   IALGO  = 48
   NELMIN = 3
   NELM   = 300
   EDIFF  = 1E-07
   ML_LMLFF  = .TRUE.
   ML_ISTART = 1
   RANDOM_SEED =         688344966                0                0
   ML_MCONF  = 10000
   ML_IWEIGHT = 2
   ML_WTOTEN = 2
   ML_IALGO_LINREG = 1
   ML_SION1 = 0.3
   ML_MRB1 = 12
   ISIF   = 2 
   TEBEG  = 400
   TEEND  = 400
   IBRION = 0 
   ISYM   = 0
   NSW    = 50000
   NBLOCK = 1
   MDALGO = 2
   SMASS  = 1.0 
   POTIM  = 2.0 
   IALGO  = 48 
 

Code: Select all

# ERR ######################################################################
# ERR This line contains the RMSEs of the predictions with respect to ab initio results for the training data.
# ERR 
# ERR nstep ......... MD time step or input structure counter
# ERR rmse_energy ... RMSE of energies (eV atom^-1)
# ERR rmse_force .... RMSE of forces (eV Angst^-1)
# ERR rmse_stress ... RMSE of stress (kB)
# ERR ######################################################################
# ERR               nstep      rmse_energy       rmse_force      rmse_stress
# ERR                   2                3                4                5
# ERR ######################################################################
ERR                     0   4.50398330E-03   3.58666632E-02   8.56463489E-01
ERR                     1   4.50504300E-03   3.56574344E-02   8.53957528E-01
ERR                     2   4.50567464E-03   3.56811046E-02   8.54435940E-01
ERR                     3   4.50624798E-03   3.56109230E-02   8.53375338E-01
ERR                     4   4.50681918E-03   3.55859759E-02   8.52932644E-01
ERR                     5   4.50739952E-03   3.55715772E-02   8.52425643E-01
ERR                     6   4.50785073E-03   3.55533846E-02   8.51737706E-01
ERR                     7   4.50834818E-03   3.55499122E-02   8.51893755E-01
ERR                     8   4.50880821E-03   3.55221450E-02   8.51464303E-01
ERR                     9   4.50938291E-03   3.54937760E-02   8.51365065E-01
....
ERR                 16591   4.55124994E-03   3.48468351E-02   8.41362815E-01
ERR                 17294   4.55219874E-03   3.48278895E-02   8.41119079E-01
ERR                 19507   4.55310823E-03   3.48100958E-02   8.40667789E-01
ERR                 22622   4.55413019E-03   3.47888100E-02   8.40398921E-01
ERR                 25720   4.55511057E-03   3.47763432E-02   8.39986837E-01
ERR                 30414   4.55566064E-03   3.47635375E-02   8.40297753E-01
ERR                 32528   4.55626462E-03   3.47542045E-02   8.39833238E-01
ERR                 34126   4.55662674E-03   3.47410917E-02   8.39368749E-01
ERR                 42067   4.55741335E-03   3.47222220E-02   8.39830052E-01
ERR                 42132   4.55770161E-03   3.47102062E-02   8.39746328E-01
ERR                 50000   4.55773958E-03   3.47022296E-02   8.39277708E-01

Code: Select all

# BEEF ########################################################################################################################
# BEEF This line shows the Bayesian error estimations and the current threshold criterion.
# BEEF 
# BEEF nstep ............ MD time step or input structure counter
# BEEF bee_energy ....... BEE of energy per atom (eV atom^-1)
# BEEF bee_max_force .... BEE of forces (max) (eV Angst^-1)
# BEEF bee_ave_force .... BEE of forces (average) (kB)
# BEEF threshold ........ Current value of threshold criterion (eV Angst^-1)
# BEEF bee_max_stress ... BEE of stresses (max) (kB)
# BEEF bee_ave_stress ... BEE of stresses (average) (kB)
# BEEF ########################################################################################################################
# BEEF              nstep       bee_energy    bee_max_force    bee_ave_force        threshold   bee_max_stress   bee_ave_stress
# BEEF                  2                3                4                5                6                7                8
# BEEF ########################################################################################################################
BEEF                    0   0.00000000E+00   0.00000000E+00   0.00000000E+00   2.00000000E-03   0.00000000E+00   0.00000000E+00
BEEF                    1   1.39735472E-07   1.07822273E-02   2.86131956E-03   2.00000000E-03   8.25802901E-02   6.26389645E-02
BEEF                    2   1.36786793E-07   1.06018412E-02   2.83074079E-03   2.00000000E-03   8.12703047E-02   6.12463379E-02
BEEF                    3   1.34562019E-07   1.03259493E-02   2.81156988E-03   2.00000000E-03   8.06198930E-02   6.05198244E-02
BEEF                    4   1.32202624E-07   9.94784054E-03   2.78776478E-03   2.00000000E-03   8.05619193E-02   6.02620460E-02
BEEF                    5   1.29910878E-07   9.78424950E-03   2.76091370E-03   2.00000000E-03   8.11237187E-02   6.04451403E-02
BEEF                    6   1.27612149E-07   9.60263153E-03   2.72981541E-03   2.00000000E-03   8.21944973E-02   6.09242134E-02
BEEF                    7   1.25224973E-07   9.06388980E-03   2.69457926E-03   2.00000000E-03   8.35069183E-02   6.14642393E-02
BEEF                    8   1.23300230E-07   8.25745732E-03   2.66165857E-03   2.00000000E-03   8.45500437E-02   6.18008615E-02
BEEF                    9   1.22073272E-07   7.57083201E-03   2.63657115E-03   2.00000000E-03   8.49832480E-02   6.17298302E-02
BEEF                   10   1.22106800E-07   7.57999916E-03   2.62491346E-03   9.35169177E-03   8.46277889E-02   6.12287029E-02
BEEF                   11   1.22879121E-07   7.77161446E-03   2.62547172E-03   9.35169177E-03   8.44858031E-02   6.09907472E-02
BEEF                   12   1.23515590E-07   8.08440552E-03   2.63659549E-03   9.35169177E-03   8.37660690E-02   6.06099015E-02
BEEF                   13   1.23910179E-07   8.44539519E-03   2.65555459E-03   9.35169177E-03   8.26577059E-02   6.02257469E-02
BEEF                   14   1.24430393E-07   8.78036399E-03   2.67965326E-03   9.35169177E-03   8.14788303E-02   5.99549887E-02
BEEF                   15   1.25259198E-07   9.21077155E-03   2.70577228E-03   9.35169177E-03   8.05633248E-02   5.98614648E-02
BEEF                   16   1.26462613E-07   9.74337988E-03   2.73052150E-03   9.35169177E-03   8.01507195E-02   5.99602311E-02
....
BEEF                49989   1.46464070E-07   1.12690722E-02   3.10842446E-03   2.36818029E-02   8.90924362E-02   6.83355420E-02
BEEF                49990   1.46485741E-07   1.13239641E-02   3.10832900E-03   2.36818029E-02   9.12662501E-02   6.95469181E-02
BEEF                49991   1.45821690E-07   1.09594351E-02   3.10200998E-03   2.36818029E-02   9.29271753E-02   7.04206216E-02
BEEF                49992   1.44683433E-07   1.02993363E-02   3.09328887E-03   2.36818029E-02   9.39407177E-02   7.08848537E-02
BEEF                49993   1.43626199E-07   1.06683781E-02   3.08638738E-03   2.36818029E-02   9.44075741E-02   7.10447587E-02
BEEF                49994   1.42973700E-07   1.09000059E-02   3.08409728E-03   2.36818029E-02   9.43294030E-02   7.09667569E-02
BEEF                49995   1.43060059E-07   1.09784856E-02   3.08879644E-03   2.36818029E-02   9.37458122E-02   7.07321439E-02
BEEF                49996   1.43880941E-07   1.09132546E-02   3.10332632E-03   2.36818029E-02   9.30897857E-02   7.05804205E-02
BEEF                49997   1.45639880E-07   1.07315605E-02   3.12837659E-03   2.36818029E-02   9.30941661E-02   7.08392422E-02
BEEF                49998   1.48160513E-07   1.08187197E-02   3.15925015E-03   2.36818029E-02   9.41416464E-02   7.16372492E-02
BEEF                49999   1.50508802E-07   1.12654710E-02   3.18699796E-03   2.36818029E-02   9.58798703E-02   7.27362433E-02
BEEF                50000   1.52001293E-07   1.15908456E-02   3.20189940E-03   2.29205530E-02   9.73523558E-02   7.35974466E-02

Re: ML_REG format

Posted: Mon Nov 07, 2022 10:34 am
by ferenc_karsai
Your root means square error of 4.5 meV/atom is not bad. Especially the error of 30 meV/Angstrom for the forces is great.
But it also depends on how good the force field is on an independent test set.

We have a page for best practices in machine learning together with molecular dynamics:
https://www.vasp.at/wiki/index.php/Best ... rce_fields

Basically you are not employing many of the advises on that page. Nevertheless your force-field is quite good. I suggest you study that page and employ the things on that page to further improve your force field.
Here are some key points you should definitely try out:
-) ML_WTOTEN: Weight energy stronger (factor 10-50). This will worsen the forces and stress fits a bit, but can really greatly increase the accuracy on the energy. So this trade-off is worth it.
-) Accurate force fields: Complete on the fly training with ML_IALGO_LINREG=1; ML_SION1=0.3; ML_MRB1=12 and then refit using NSW=0; ML_IALGO_LINREG=3; ML_CTIFOR=1000.0; ML_EPS_LOW=1.0E-14; ML_SION1=0.5; ML_MRB1= 8.
-) To get a more stable force field use run in an NpT ensemble (MDALGO=3, ISIF=3 and remaining Langevin parameters) and definitely use a temperature ramp. You wrote that it only picked out 200 training structures (and possibly also not many local reference configurations). The temperature ramp and fluctuating lattice should increase the numbers.
-) Possibly try to improve the ab-initio data, since the more accurate the ab-initio data the easier it is to fit it. Increase ENCUT to let's say 550 eV (needs to be anyway larger for an NpT ensemble). You haven't written how large your supercell is but if it is not huge then possibly increase the k-spacing, since you set KSPACING = 0.5 and that results in a very low number of k points.

I hope you will see some improvement.