LH5/LWAVEH5/LCHARGH5 Combinations

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


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
aohara
Newbie
Newbie
Posts: 21
Joined: Sat Apr 16, 2016 5:54 am
License Nr.: 24-0107

LH5/LWAVEH5/LCHARGH5 Combinations

#1 Post by aohara » Thu Feb 26, 2026 4:08 am

Dear VASP team,

I don't know if the following behavior should be considered a bug or just a misinterpretation of the documentation on the wiki.

I recently recompiled version 6.5.1 on our cluster with HDF5 support and wanted to run a few tests on a simple system (primitive cell silicon) in order to understand how the various LWAVE, LCHARG, LH5, LWAVEH5, and LCHARGH5 flags combine. Based on my understanding from the wiki, I feel that some of the results were inconsistent, but wanted to double check.

Based on the wiki entry https://vasp.at/wiki/LWAVEH5, it was my understanding that even if LH5 = .FALSE. that this could be overwritten by setting LWAVEH5 = .TRUE. However, my tests showed the following behavior when I used h5py to do a quick check of the vaspwave.h5 file:
If LWAVEH5 = .FALSE. and LH5 = .TRUE. and LCHARGH5 = .FALSE. then no vaspwave.h5 was written out.
If LWAVEH5 = .FALSE. and LH5 = .FALSE. and LCHARGH5 = .TRUE. then a vaspwave.h5 was written out with only charge density information but no wave function information.
If LWAVEH5 = .FALSE. and LH5 = .TRUE. and LCHARGH5 = .TRUE. then a vaspwave.h5 was written out with only charge density information and no wave function information.
In each of these cases, the legacy CHG, CHGCAR, and WAVECAR files had data as expected.

Now, if I set LWAVEH5 = .TRUE. then I always got wave function data written out to vaspwave.h5 even if LH5 = .FALSE. while the LWAVECHGH5 tag did properly turn on / off the write out of charge density information to the vaspwave.h5 file.

So, it seems that, in general, for the above that LH5 is controlling legacy vs HDF5 write out of wave function information, and unless LWAVE = .FALSE. with LH5 = .FALSE. we always get wave function data.

Lastly, however, if I set LCHARG = .TRUE. and LH5 = .TRUE. and LCHARGH5 = .FALSE. then there is no charge density information written out to CHG, CHGCAR, or vaspwave.h5 which may be unexpected for some users as some users treat charge density as more fundamental for archive purposes than wave functions for future restarts.

Currently, I have not uploaded any files with this as there may be too many. However, I am more than happy to share any files that may be needed for clarification.

Thank you for your help.


ahampel
Global Moderator
Global Moderator
Posts: 197
Joined: Tue Feb 16, 2016 11:41 am

Re: LH5/LWAVEH5/LCHARGH5 Combinations

#2 Post by ahampel » Thu Feb 26, 2026 12:03 pm

Hi,

thank you for reaching out to us on the VASP forum. Indeed the output file control can be a bit confusing. Let me explain briefly. TL;DR: I think the behavior you observed is all correct and not a bug.

The general idea is that LH5=True/False controls whether charge / wave-functions + other output are written to the vaspwave.h5 output file or the legacy files. This is not thought to be additional but conditional, i.e. setting LH5=True will prevent writing legacy output files completely. Mind that this also includes GW, phonon, machine learning files etc. Once you decided to opt for LH5=True, you should use LWAVE and LCHARG to decide whether wave-functions/charge density are written to the vaspwave.h5 file. Meaning that LWAVE/LCHARG are always used to choose whether the corresponding output is written NOT LWAVEH5/LCHARGH5. This is the design philosophy in the code. I updated https://vasp.at/wiki/LH5 to make this a little bit clearer.

Now there is one exception for this: LCHARGH5. This was introduced to be able to use legacy files for restarting (LH5=False), but have the charge density for post-processing via py4vasp. I think this is properly documented, even though slightly confusing in my opinion.

The real bug is the fact that the wiki shows the tag LWAVEH5 (I will not link it now). As you noticed the tag actually does not do anything. I had to check myself but this tag is not in the code since VASP 6.4.X . We will make appropriate changes to the wiki asap.

Here is an up-to-date logic table to check what output to expect when:

Code: Select all

LH5    LWAVE  LCHARG  LCHARGH5  WAVECAR>0  CHGCAR>0  vaspwave.h5?  h5:/wave  h5:/charge
-----  -----  ------  --------  ---------  --------  ------------  --------  ----------
UNSET  FALSE  FALSE   FALSE     F          F         F             -         F         
UNSET  FALSE  FALSE   TRUE      F          F         T             F         T         
UNSET  FALSE  TRUE    FALSE     F          T         F             -         F         
UNSET  FALSE  TRUE    TRUE      F          T         T             F         T         
UNSET  TRUE   FALSE   FALSE     T          F         F             -         F         
UNSET  TRUE   FALSE   TRUE      T          F         T             F         T         
UNSET  TRUE   TRUE    FALSE     T          T         F             -         F         
UNSET  TRUE   TRUE    TRUE      T          T         T             F         T         
FALSE  FALSE  FALSE   FALSE     F          F         F             -         F         
FALSE  FALSE  FALSE   TRUE      F          F         T             F         T         
FALSE  FALSE  TRUE    FALSE     F          T         F             -         F         
FALSE  FALSE  TRUE    TRUE      F          T         T             F         T         
FALSE  TRUE   FALSE   FALSE     T          F         F             -         F         
FALSE  TRUE   FALSE   TRUE      T          F         T             F         T         
FALSE  TRUE   TRUE    FALSE     T          T         F             -         F         
FALSE  TRUE   TRUE    TRUE      T          T         T             F         T         
TRUE   FALSE  FALSE   FALSE     F          F         T             F         F         
TRUE   FALSE  FALSE   TRUE      F          F         T             F         T         
TRUE   FALSE  TRUE    FALSE     F          F         T             F         F         
TRUE   FALSE  TRUE    TRUE      F          F         T             F         T         
TRUE   TRUE   FALSE   FALSE     F          F         T             T         F         
TRUE   TRUE   FALSE   TRUE      F          F         T             T         T         
TRUE   TRUE   TRUE    FALSE     F          F         T             T         F         
TRUE   TRUE   TRUE    TRUE      F          F         T             T         T   

As you said the combination: LH5=FALSE LCHARG=FALSE LWAVE=FALSE LCHARGH5=TRUE is a bit confusing but within the logic I would say. Let me know if this clarifies things for you, or if there are any open questions. I will try to add such logic table on the vasp wiki in the near future.

Best regards,
Alex


aohara
Newbie
Newbie
Posts: 21
Joined: Sat Apr 16, 2016 5:54 am
License Nr.: 24-0107

Re: LH5/LWAVEH5/LCHARGH5 Combinations

#3 Post by aohara » Thu Feb 26, 2026 2:44 pm

Alex,

Thank you for the quick response and I believe it does make sense, but having the logic table clarification on the wiki would certainly be helpful for future reference.

If I understand, the LH5 is a global switch on legacy vs HDF5. However, by default, I can use it unset/false and get the charge density in both places via LCHARGH5.

To follow up, is it correct to assume that the LH5 tag only controls the charge density and wave functions? That is, as long as VASP is compiled with HDF5 support, the vaspout.h5 will always be written (in addition to legacy EIGENVAL, DOSCAR, etc.)? Also, if I have HDF5 support compiled and leave LH5 unset or false, would the workflows for newer capabilities that require HDF5 support (like electron-phonon coupling) still write out?

Thanks again,
Andy


ahampel
Global Moderator
Global Moderator
Posts: 197
Joined: Tue Feb 16, 2016 11:41 am

Re: LH5/LWAVEH5/LCHARGH5 Combinations

#4 Post by ahampel » Fri Feb 27, 2026 8:27 am

Hi Andy,

To follow up, is it correct to assume that the LH5 tag only controls the charge density and wave functions?

that is correc - the vaspout.h5 will be written. But the vaspwave.h5 will as I mentioned also store other output that is maybe currently not yet documented so cleanly on the wiki for specialized calculations like GW. But let's say all physical output quantities like DOS etc are store in vaspout.h5 anyway.

Also, if I have HDF5 support compiled and leave LH5 unset or false, would the workflows for newer capabilities that require HDF5 support (like electron-phonon coupling) still write out?

yes they will - no need to set this. If this does not work let us know, then this is a bug.

Best,
Alex


Post Reply