Page 1 of 1

Ewald energy calculation error when using KERNEL_TRUNCATION

Posted: Sun Dec 21, 2025 4:38 am
by ywchoi

Dear experts,

I am reporting an issue where the Ewald energy calculation fails (returns NaN) when using the KERNEL_TRUNCATION option for a long 2D slab system.
this error appears to be dependent on the system size (number of layers). I have tested the same setup with different layer thicknesses
2 and 3 layers: The calculation completes successfully without any issues.
4 or more layers: Ewald energy TEWEN = NaN error occurs consistently from the first iteration.

OUTCAR:

Code: Select all

--------------------------------------- Iteration      1(   1)  ---------------------------------------


    POTLOK:  cpu time      0.9096: real time      0.9199
    SETDIJ:  cpu time      0.0627: real time      0.0630
     EDDAV:  cpu time      2.2556: real time      2.2956
       DOS:  cpu time      0.0038: real time      0.0039
    --------------------------------------------
      LOOP:  cpu time      3.2321: real time      3.2844

 eigenvalue-minimisations  : 16128
 total energy-change (2. order) :           NaN  (-0.9811510E+05)
 number of electron     104.0000000 magnetization 
 augmentation part      104.0000000 magnetization 

 Free energy of the ion-electron system (eV)
  ---------------------------------------------------
  alpha Z        PSCENC =         0.00000000
  Ewald energy   TEWEN  =                NaN
  -Hartree energ DENC   =    518075.75668292
  -exchange      EXHF   =         0.00000000
  -V(xc)+E(xc)   XCENC  =       359.79731494
  PAW double counting   =      7734.02099078    -7647.93876759
  entropy T*S    EENTRO =        -0.00165409
  eigenvalues    EBANDS =    -96731.10811112
  atomic energy  EATOM  =      9682.53318035
  Solvation  Ediel_sol  =         0.00000000
  ---------------------------------------------------
  free energy    TOTEN  =                NaN eV

  energy without entropy =               NaN  energy(sigma->0) =               NaN

I have attached the INCAR and POSCAR files I used below. The structure has a thickness of 21.7 Å with a 50 Å vacuum, and the layers are positioned in the center of the cell.

INCAR:

Code: Select all

System = MoS2
PREC = Accurate 
ENCUT = 500.0
EDIFF = 1E-8
ISYM = 0
NCORE = 2
KPAR = 4
ALGO = Normal

#------rVV10 of Sabatini et al. ------------------------
GGA       = ML
LUSE_VDW  = .TRUE.
IVDW_NL   = 2
BPARAM    = 6.3     # default but can be overwritten by this tag
CPARAM    = 0.0093  # default but can be overwritten by this tag
LASPH     = .TRUE.

ISPIN = 1 #does spin-polarized calc.

#--------OUTPUT FILE CONTROL---------
LORBIT = 11
NEDOS = 2000
LWAVE  = .FALSE. 
LCHARG = .FALSE. 

ISMEAR = 0 
SIGMA=0.1

 KERNEL_TRUNCATION {
       LTRUNCATE      = T
       IDIMENSIONALITY = 2
       LCOARSEN       = F
       ISURFACE       = 3
  }

POSCAR:

Code: Select all

Generated by VASPKIT code               
   1.00000000000000     
     3.2182657598431033   -0.0000010946757415    0.0000000188723630
    -1.6091338279532288    2.7870993183750494   -0.0000000073360658
     0.0000004151795089    0.0000000574878470   71.7187625893623846
  Mo              S             
     4     8
Direct
     0.0000000245375861    0.0000000253101545    0.5430315299245932
     0.6666666880175047    0.3333333364044524    0.3707663947433152
     0.6666666650141739    0.3333333544272531    0.6292241052657448
     0.3333333422475198    0.6666666930535939    0.4569429145887748
     0.0000000220151665    0.0000000124768911    0.3487857909612084
     0.0000000111490195    0.9999999829017471    0.6072500396082302
     0.6666666792821385    0.3333333434751254    0.4349762429389977
     0.3333333522353835    0.6666666890091242    0.5210655114016074
     0.9999999952437634    0.0000000133540298    0.3927534447758242
     0.9999999837961203    0.9999999923279267    0.6512141798867679
     0.6666666732158412    0.3333333270948957    0.4789323123252539
     0.3333333402457930    0.6666666631648132    0.5650213565796909

bset and regards


Re: Ewald energy calculation error when using KERNEL_TRUNCATION

Posted: Mon Dec 22, 2025 2:05 pm
by ferenc_karsai

Please provide us the smallest reproducable example so that we can investigate the problem. Please upload the necessary files according to the forum guidelines.