Bug in vasprun.xml energies
Posted: Wed Jul 01, 2020 2:40 pm
Hi;
In vasprun.xml, the "energy without entropy" (e_wo_entrp; or, E) and "energy(sigma->0)" (e_0_energy; or, E0) are not correct. Below, I am presenting an example to show this; but, before this, let me give background of the energy "types" as treated with DFT in VASP, just to have common terminology.
When finite temperature (or smearing/broadening) approaches are used, then we have a generalized free energy F, instead of total energy, so
F = E - TS
where, at the given temperature T (or, smearing sigma), E is the total energy and S is the electronic entropy. In vasprun.xml, these terms are defined as:
F = e_fr_energy
E = e_wo_entrp
-TS = eentropy
The ground-state energy E0 ("e_0_energy" in vasprun.xml) is obtained as extrapolation of F and E.
According to
vasp-workshop/k-points.pdf
the extrapolated E0 is given as
E0 = (F+E)/2 , for Gaussian (ISMEAR=0) or Fermi-Dirac (ISMEAR=-1).
or,
E0 = [ (ISMEAR+1) F + E ]/(ISMEAR+2) , for Methfessel-Paxton (ISMEAR>0).
So, for example, if ISMEAR=1 (default), the Methfessel-Paxton method will give,
E0 = 1/3 (2 F + E)
---
Now, I am going to present the "bug" issue I detected. Attached is vasprun.xml file of one of my MD runs, using Methfessel-Paxton (ISMEAR=1). Let's look at the first step. The last scf energies (part of the 'calculation/scstep/energy' tree in vasprun.xml) are printed as:
<calculation>
<scstep>
<energy>
<i name="eentropy"> -0.01340739 </i>
<i name="e_fr_energy"> -70.82827141 </i>
<i name="e_wo_entrp"> -70.81486402 </i>
<i name="e_0_energy"> -70.82380228 </i>
while, the final energies (part of the "calculation/energy" tree; and should be taken from the last (converged) scstep), are printed as
<calculation>
<energy>
<i name="e_fr_energy"> -70.82827141 </i>
<i name="e_wo_entrp"> -70.82380228 </i>
<i name="e_0_energy"> -0.01340739 </i>
It is clear that "e_wo_entrp" and "e_0_energy" are not consistent between the last scstep and the final printed numbers. The observations are:
1. e_fr_energy (F) is printed correctly,
2. e_wo_entrp (E) is incorrect. It is printed as "-70.82380228", which is given (incorrectly) from the value of E0 (e_0_energy) of the last scstep.
3. Similarly, e_0_energy (E0) is incorrect. It is printed as "-0.01340739", which is given (incorrectly) from the value of "-TS" (eentropy) from the last scstep.
This issue happens regardless the ISMEAR method used. I took a look at the source code and found that e_wo_entrp and e_0_energy are assigned incorrectly to e_0_energy and eentropy, respectively, in consistency with the results I show here.
Note, however, that the values from the OUTCAR are "correct" as they are consistent with the last scstep in vasprun.xml:
FREE ENERGIE OF THE ION-ELECTRON SYSTEM (eV)
---------------------------------------------------
free energy TOTEN = -70.82827141 eV
energy without entropy= -70.81486402 energy(sigma->0) = -70.82380228
We have created a package (pyHMA; https://pyhmadocs.readthedocs.io/en/latest/) to compute anharmonic properties, which reads vasprun.xml file as it is much faster than reading OUTCAR. But since we are aware of this issue, we made the package such that it reads the last scstep (not the final calculation/energy tree). But, I would appreciate it if this issue is considered in the new VASP version.
Thanks;
Sabry
In vasprun.xml, the "energy without entropy" (e_wo_entrp; or, E) and "energy(sigma->0)" (e_0_energy; or, E0) are not correct. Below, I am presenting an example to show this; but, before this, let me give background of the energy "types" as treated with DFT in VASP, just to have common terminology.
When finite temperature (or smearing/broadening) approaches are used, then we have a generalized free energy F, instead of total energy, so
F = E - TS
where, at the given temperature T (or, smearing sigma), E is the total energy and S is the electronic entropy. In vasprun.xml, these terms are defined as:
F = e_fr_energy
E = e_wo_entrp
-TS = eentropy
The ground-state energy E0 ("e_0_energy" in vasprun.xml) is obtained as extrapolation of F and E.
According to
vasp-workshop/k-points.pdf
the extrapolated E0 is given as
E0 = (F+E)/2 , for Gaussian (ISMEAR=0) or Fermi-Dirac (ISMEAR=-1).
or,
E0 = [ (ISMEAR+1) F + E ]/(ISMEAR+2) , for Methfessel-Paxton (ISMEAR>0).
So, for example, if ISMEAR=1 (default), the Methfessel-Paxton method will give,
E0 = 1/3 (2 F + E)
---
Now, I am going to present the "bug" issue I detected. Attached is vasprun.xml file of one of my MD runs, using Methfessel-Paxton (ISMEAR=1). Let's look at the first step. The last scf energies (part of the 'calculation/scstep/energy' tree in vasprun.xml) are printed as:
<calculation>
<scstep>
<energy>
<i name="eentropy"> -0.01340739 </i>
<i name="e_fr_energy"> -70.82827141 </i>
<i name="e_wo_entrp"> -70.81486402 </i>
<i name="e_0_energy"> -70.82380228 </i>
while, the final energies (part of the "calculation/energy" tree; and should be taken from the last (converged) scstep), are printed as
<calculation>
<energy>
<i name="e_fr_energy"> -70.82827141 </i>
<i name="e_wo_entrp"> -70.82380228 </i>
<i name="e_0_energy"> -0.01340739 </i>
It is clear that "e_wo_entrp" and "e_0_energy" are not consistent between the last scstep and the final printed numbers. The observations are:
1. e_fr_energy (F) is printed correctly,
2. e_wo_entrp (E) is incorrect. It is printed as "-70.82380228", which is given (incorrectly) from the value of E0 (e_0_energy) of the last scstep.
3. Similarly, e_0_energy (E0) is incorrect. It is printed as "-0.01340739", which is given (incorrectly) from the value of "-TS" (eentropy) from the last scstep.
This issue happens regardless the ISMEAR method used. I took a look at the source code and found that e_wo_entrp and e_0_energy are assigned incorrectly to e_0_energy and eentropy, respectively, in consistency with the results I show here.
Note, however, that the values from the OUTCAR are "correct" as they are consistent with the last scstep in vasprun.xml:
FREE ENERGIE OF THE ION-ELECTRON SYSTEM (eV)
---------------------------------------------------
free energy TOTEN = -70.82827141 eV
energy without entropy= -70.81486402 energy(sigma->0) = -70.82380228
We have created a package (pyHMA; https://pyhmadocs.readthedocs.io/en/latest/) to compute anharmonic properties, which reads vasprun.xml file as it is much faster than reading OUTCAR. But since we are aware of this issue, we made the package such that it reads the last scstep (not the final calculation/energy tree). But, I would appreciate it if this issue is considered in the new VASP version.
Thanks;
Sabry