Currently, VASP does not support LELF = True with KPAR > 1. However, I am not sure why. If an ELFCAR is simply a mathematical transformation of the charge density and kinetic energy, but VASP can write out a CHGCAR and TAUCAR with any KPAR value, why can't ELFCAR be written out with KPAR > 1? I assume this is for some historical reason but figured I'd put the question out there.
LELF = True with KPAR > 1
Moderators: Global Moderator, Moderator
-
manuel_engel1
- Global Moderator

- Posts: 279
- Joined: Mon May 08, 2023 4:08 pm
Re: LELF = True with KPAR > 1
Hi,
You're exactly right. There is no physical or mathematical reason for this. It is as you suspected a historical limitation of the code.
When KPAR was introduced, the routines that build CHGCAR and TAUCAR were extended to also sum across the k-point groups. The ELF routine was never updated in the same way, so with KPAR > 1 each group would only see part of the Brillouin zone. VASP stops with an error instead of writing a wrong ELFCAR.
I suggest the following workaround for now: converge your calculation with whatever KPAR you like. Then restart from the converged WAVECAR with KPAR = 1 and LELF = True to write the ELFCAR.
Thanks for pointing this out. I have put this on my to-do list as an improvement for a future update.
Manuel Engel
VASP developer
-
jcappola
- Newbie

- Posts: 1
- Joined: Mon Oct 02, 2023 9:00 pm
Re: LELF = True with KPAR > 1
Hi,
I was also interested in this since I'm interested in getting the ELFCAR out from a KPAR > 1 simulation to save myself time on the restarts.
I modified the elf.F code starting at line 43 directly to:
Code: Select all
#ifdef MPI
IF (WDES%COMM_KINTER%NCPU.NE.1) THEN
CALL KPAR_SYNC_WAVEFUNCTIONS(WDES,W)
END IF
#endif
and this produces ELFCAR with KPAR > 1 that exactly matched my test file produced with KPAR = 1. I haven't tested this on any HPC platforms yet (multi-node), but it works on my local machine running multiple MPI processes.
Also, the wiki states that NPAR must be 1, but this is not true in my testing. Is this legacy information?
-
asrosen
- Newbie

- Posts: 33
- Joined: Wed Oct 18, 2023 4:51 pm
Re: LELF = True with KPAR > 1
Fantastic, thank you!
-
manuel_engel1
- Global Moderator

- Posts: 279
- Joined: Mon May 08, 2023 4:08 pm
Re: LELF = True with KPAR > 1
jcappola wrote: Tue Nov 24, 2026 6:08 pmHi,
I was also interested in this since I'm interested in getting the ELFCAR out from a KPAR > 1 simulation to save myself time on the restarts.
I modified the elf.F code starting at line 43 directly to:
Code: Select all
#ifdef MPI IF (WDES%COMM_KINTER%NCPU.NE.1) THEN CALL KPAR_SYNC_WAVEFUNCTIONS(WDES,W) END IF #endifand this produces ELFCAR with KPAR > 1 that exactly matched my test file produced with KPAR = 1. I haven't tested this on any HPC platforms yet (multi-node), but it works on my local machine running multiple MPI processes.
Also, the wiki states that NPAR must be 1, but this is not true in my testing. Is this legacy information?
Thanks for testing this. Your patch is correct: KPAR_SYNC_WAVEFUNCTIONS gives every k-point group all orbitals, and we confirmed it reproduces the KPAR=1 ELFCAR. The official fix, in the next release, splits the k-points over the groups and then sums the results, which avoids copying the orbitals. And yes, the NPAR=1 statement on the wiki is out of date. ELFCAR is identical for any NPAR/NCORE, and we will correct the page.
Manuel Engel
VASP developer