## Bug in vasprun.xml energies

Problems running VASP: crashes, internal errors, "wrong" results.

Moderators: Global Moderator, Moderator

Message
Author
Newbie
Posts: 2
Joined: Tue Jul 31, 2018 4:12 pm

### Bug in vasprun.xml energies

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

martin.schlipf
Global Moderator
Posts: 162
Joined: Fri Nov 08, 2019 7:18 am

### Re: Bug in vasprun.xml energies

Which version of Vasp are you using?

I can see an effect like this in Vasp 5.4.4, but it seems to be fixed in 6.1.1.

If you are using the current version, could you verify if the issue appears in the MD tutorial.

Newbie
Posts: 2
Joined: Tue Jul 31, 2018 4:12 pm

### Re: Bug in vasprun.xml energies

I am using VASP 5.x versions. Great to know this issue is fixed in VASP 6.x versions!

I do not have licence for VASP 6.x, butcould you please send me a sample vasprun.xml output from the MD H2O example you mentioned to read using our pyHMA package? Just 10 MD steps would be enough to test.

Thanks;
Sabry

martin.schlipf
Global Moderator
Posts: 162
Joined: Fri Nov 08, 2019 7:18 am

### Re: Bug in vasprun.xml energies

I will get in touch with you to send you the xml file.