Energy inconsistency in the on-the-fly machine learning process

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
Yicheng
Newbie
Newbie
Posts: 14
Joined: Tue Nov 19, 2019 9:45 am

Energy inconsistency in the on-the-fly machine learning process

#1 Post by Yicheng » Fri Mar 04, 2022 8:45 am

Dear all:
In vasp.6.3.0, i tested the on-the-fly machine learning method. I found the "E0" in the OSZICAR file is a bit different. The "E0" obtained from ML force field (E0_ML) is smaller than that obtained from the ab initio (E0_FP) (Fig. 1 and Fig. 2), but "EK" is consistent. The ML_LOGFILE file reports the errors for energy, force and stress are 2.87738279E-03, 1.69086557E-01 and 4.55565253E+00, respectively.

I have two questions:
1. Why does this phenomenon occur? Is it a calculation error?
2. Which energy (E0_ML or E0_FP) is the correct one to reflect the energy of the system?

Fig.1
ML.png
Fig. 2
ML2.png
You do not have the required permissions to view the files attached to this post.

ferenc_karsai
Global Moderator
Global Moderator
Posts: 460
Joined: Mon Nov 04, 2019 12:44 pm

Re: Energy inconsistency in the on-the-fly machine learning process

#2 Post by ferenc_karsai » Fri Mar 04, 2022 12:11 pm

Please post your calculation files (POSCAR, KPOINTS, POTCAR, INCAR, ML_LOGFILE, OUTCAR, stdout).

ferenc_karsai
Global Moderator
Global Moderator
Posts: 460
Joined: Mon Nov 04, 2019 12:44 pm

Re: Energy inconsistency in the on-the-fly machine learning process

#3 Post by ferenc_karsai » Fri Mar 04, 2022 12:11 pm

Also ML_REG file please.

Yicheng
Newbie
Newbie
Posts: 14
Joined: Tue Nov 19, 2019 9:45 am

Re: Energy inconsistency in the on-the-fly machine learning process

#4 Post by Yicheng » Fri Mar 04, 2022 1:19 pm

ferenc_karsai wrote: Fri Mar 04, 2022 12:11 pm Please post your calculation files (POSCAR, KPOINTS, POTCAR, INCAR, ML_LOGFILE, OUTCAR, stdout).
Dear Moderator,
Since the 20000-step OUTCAR file was too large, I ran a 100-step calculation to show the results.

Please download the files:
ML_test.rar
The result:
ML_01.png
You do not have the required permissions to view the files attached to this post.

ferenc_karsai
Global Moderator
Global Moderator
Posts: 460
Joined: Mon Nov 04, 2019 12:44 pm

Re: Energy inconsistency in the on-the-fly machine learning process

#5 Post by ferenc_karsai » Mon Mar 07, 2022 10:10 am

E0 in ab-initio calculations is defined as the total energy ("F" in the OSZICAR file) minus an entropy part. The machine learning code learns only the totel energy "F" which already contains the entropy part. So for machine learning calculations the entropy part is not separately available and we cannot calculate E0. If it's an MLFF step where no ab initio calculation is printed out, then simply "E0=F" is printed out.

It's the best to look at the tofal free energy in the OUTCAR file. Since it is printed both for ab initio and MLFF (in the OSZICAR file it's only printed out for either one of them at every step).
You can grep like this:
"free energy TOTEN"
"free energy ML TOTEN"

I've plotted your calculation:
ML_vs_FP.png
The calculations looks fine.
At the beginning of course there is no free energy available in MLFF so that's why it starts from zero and also in the first steps the fit is probably very bad. But later you can see that the MLFF nicely lays on top of ab initio.
You do not have the required permissions to view the files attached to this post.

Yicheng
Newbie
Newbie
Posts: 14
Joined: Tue Nov 19, 2019 9:45 am

Re: Energy inconsistency in the on-the-fly machine learning process

#6 Post by Yicheng » Tue Mar 08, 2022 8:19 am

ferenc_karsai wrote: Mon Mar 07, 2022 10:10 am E0 in ab-initio calculations is defined as the total energy ("F" in the OSZICAR file) minus an entropy part. The machine learning code learns only the totel energy "F" which already contains the entropy part. So for machine learning calculations the entropy part is not separately available and we cannot calculate E0. If it's an MLFF step where no ab initio calculation is printed out, then simply "E0=F" is printed out.

It's the best to look at the tofal free energy in the OUTCAR file. Since it is printed both for ab initio and MLFF (in the OSZICAR file it's only printed out for either one of them at every step).
You can grep like this:
"free energy TOTEN"
"free energy ML TOTEN"
Thank you very much!
I have another question. At this time, is the internal energy of the system "E0 + EK" in the ab-initio step or "free energy ML TOTEN + EK" in machine-learning step?

ferenc_karsai
Global Moderator
Global Moderator
Posts: 460
Joined: Mon Nov 04, 2019 12:44 pm

Re: Energy inconsistency in the on-the-fly machine learning process

#7 Post by ferenc_karsai » Thu Mar 10, 2022 3:33 pm

If you use the definition of potential (E0) plus kinetic energy (Ekin) is the internal energy of your system, then only the ab-initio steps give you this energy.

Yicheng
Newbie
Newbie
Posts: 14
Joined: Tue Nov 19, 2019 9:45 am

Re: Energy inconsistency in the on-the-fly machine learning process

#8 Post by Yicheng » Fri Mar 11, 2022 7:44 am

ferenc_karsai wrote: Thu Mar 10, 2022 3:33 pm If you use the definition of potential (E0) plus kinetic energy (Ekin) is the internal energy of your system, then only the ab-initio steps give you this energy.
It seems that in the original literature [PHYSICAL REVIEW B 100, 014105 (2019)], the potential energy calculated by the MLFF is used to match the potential energy calculated by the first principle Uα, so why is the U calculated by the MLFF now used to match the F calculated by the first principle instead of E0 ?
Does it mean that the total energy (usually the internal energy) obtained by the machine learning force field is (F+EK)? where F=E0.

ferenc_karsai
Global Moderator
Global Moderator
Posts: 460
Joined: Mon Nov 04, 2019 12:44 pm

Re: Energy inconsistency in the on-the-fly machine learning process

#9 Post by ferenc_karsai » Mon Mar 14, 2022 7:24 am

We always fitted F in our calculations, since it also contains the entropic part of the electrons (it's not a true free energy of the system since it contains only the entropic part of the electrons of the current system and is dependent on the smearing of your system).
If you don't run and MD F is the total energy. For an MD (using the Nose Hoover thermostat for example) E is the total energy, where E = F + Ekin + Etherm, where Etherm contains the potential and kinetic energy from the thermostat.

Post Reply