Page 1 of 1
LELF = True with KPAR > 1
Posted: Mon Nov 23, 2026 11:17 pm
by asrosen
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.
Re: LELF = True with KPAR > 1
Posted: Tue Nov 24, 2026 8:22 am
by manuel_engel1
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.
Re: LELF = True with KPAR > 1
Posted: Tue Nov 24, 2026 6:08 pm
by jcappola
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?
Re: LELF = True with KPAR > 1
Posted: Tue Nov 24, 2026 6:29 pm
by asrosen
Re: LELF = True with KPAR > 1
Posted: Wed Nov 25, 2026 10:27 am
by manuel_engel1
jcappola wrote: Tue Nov 24, 2026 6:08 pm
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?
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.