Page 1 of 1
Weird ELFCAR for H2 in a box
Posted: Thu Aug 14, 2025 9:42 pm
by asrosen
We are running a toy calculation on H2 in a box of vacuum and writing out the ELFCAR with LELF = .TRUE. In doing so, we get some quite wrong behavior with VASP 6.5.1.
In the first calculation we run, nearly every single value in the ELFCAR () is 1 --- including the vacuum space!
weird_elfcar_1x1x1.zip
In the second example we run, the ELFCAR is not 1 everywhere but has non-zero values in the vacuum space.
weird_elfcar_kspacing.zip
The main difference between Example 1 and Example 2 is that in Example 1 we use a 1x1x1 KPOINTs file, whereas in Example 2 we set KSPACING = 0.2.
In both cases, the ELFCAR is clearly incorrect. We are using NPAR = 1 as recommended in the VASP manual. Regardless, NPAR does not seem to impact the results.
Re: Weird ELFCAR for H2 in a box
Posted: Thu Aug 14, 2025 11:14 pm
by asrosen
For your amusement, I am attaching two images of the ELFCARs below.
Here is the ELFCARF from the 1x1x1 KPOINTS calculation with the isosurface set to 1.0
elfcar_1x1x1.png
ELFCAR_1x1x1.zip
Here is the ELFCAR from the KSPACING = 0.2 calculation with the isosurface set to 0.5.
elfcar_kspacing.png
Unfortunately, the ELFCAR file for the second example is too large to upload.
Re: Weird ELFCAR for H2 in a box
Posted: Mon Aug 18, 2025 12:38 pm
by manuel_engel1
Hi,
Thanks for reaching out and filing a bug report on the VASP forum. This will help us improve the code.
I have reproduced your issue on my side and can confirm that the ELF calculation on the hydrogen dimer does not produce sensible results. I continue to investigate the issue, but I have already found the following:
Changing the Hydrogen to any other species gives reasonable results
Increasing the number of Hydrogen atoms from 2 to 4 also gives reasonable results
Changes in the number of electrons via NELECT influence the result but can still not produce the expected outcome
I will update this topic as soon as I know more.
Re: Weird ELFCAR for H2 in a box
Posted: Mon Aug 18, 2025 3:33 pm
by asrosen
Thanks for looking into this, Manuel! I appreciate it.
Part of me is wondering if this is a bug or "expected" behavior from the ELF definition. Since the ELF is defined with a (∇ρ)^2/ρ term, it is perhaps not unreasonable to think that the density ρ is simply so small for a 2-electron system that this causes some numerical messiness.
Re: Weird ELFCAR for H2 in a box
Posted: Tue Aug 19, 2025 8:04 am
by manuel_engel1
I can confirm that this is not a bug but a "feature" of the method. ELF measures the localization between same-spin states (which is something that was not immediately obvious to me). Since the hydrogen molecule forms a ground state with two electrons of opposite spin, the ELF method does not produce any meaningful results (or maybe you could call them meaningful since they just tell you that there is no localization). I convinced myself that this is actually true by looking at the kinetic-energy densities that enter the ELF expression. For a single electron, they all cancel out pointwise and the ELF will have a value of 1. This is what you observe.
Just to test this, I have run your example in a spin-polarized calculation (ISPIN=2) and I also set NUPDOWN=2, which forces the two electrons to have the same spin. In this case, the ELFCAR file produces reasonable numbers different from 1, although this is of course no longer the ground state of hydrogen.
Re: Weird ELFCAR for H2 in a box
Posted: Tue Aug 19, 2025 4:43 pm
by asrosen
Thanks, Manuel! I appreciate you taking the time to look at this.
It is a bit strange because an ELF of 1 implies a high degree of localization rather than no localization, but I will think through this further. Indeed, it seems to be an edge-case.