LELF = True with KPAR > 1

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
asrosen
Newbie
Newbie
Posts: 33
Joined: Wed Oct 18, 2023 4:51 pm

LELF = True with KPAR > 1

#1 Post by asrosen » Mon Nov 23, 2026 11:17 pm

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.


manuel_engel1
Global Moderator
Global Moderator
Posts: 279
Joined: Mon May 08, 2023 4:08 pm

Re: LELF = True with KPAR > 1

#2 Post by manuel_engel1 » Tue Nov 24, 2026 8:22 am

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
Newbie
Posts: 1
Joined: Mon Oct 02, 2023 9:00 pm

Re: LELF = True with KPAR > 1

#3 Post by jcappola » 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?


asrosen
Newbie
Newbie
Posts: 33
Joined: Wed Oct 18, 2023 4:51 pm

Re: LELF = True with KPAR > 1

#4 Post by asrosen » Tue Nov 24, 2026 6:29 pm

Fantastic, thank you!


manuel_engel1
Global Moderator
Global Moderator
Posts: 279
Joined: Mon May 08, 2023 4:08 pm

Re: LELF = True with KPAR > 1

#5 Post by manuel_engel1 » Wed Nov 25, 2026 10:27 am

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.

Manuel Engel
VASP developer


Post Reply