Page 1 of 1

Read dielectric function form vasprun.xml

Posted: Sat Jun 21, 2025 5:26 am
by Jike.Wang

Dear all,

I got the file vasprun.xml after doing calculation of SiC, but unfortunately the imaginary part of dielectric function in vasprun.xml is zero. Did I set false parameters leading to this error?

I have attached some basic input and output files here. Could you give me some advice? Thanks!


Re: Read dielectric function form vasprun.xml

Posted: Wed Jun 25, 2025 1:40 pm
by merzuk.kaltak

Dear Jike Wang,

using vasp-6.4.2 I have been able to extract the dielectric function using your INCAR in combination with the script extract_optics.sh provided in the tutorial about improving the dielectric function.
Following figure was generated using a 4×4×1 k-point grid, leveraging the WAVECAR output from a prior PBE calculation performed with an 8×8×2 k-point grid.
Note, LDOWNSAMPLE was set to enable downsampling of the WAVECAR to this reduced k-point subset.

Si_dielectric.png

To produce this figure, I have started in a clean working directory using following INCAR settings:

Code: Select all

ALGO = NORMAL
SYSTEM   = SiC TDHF
ISMEAR   = 0      ! Gaussian smearing
SIGMA    = 0.01   ! smearing in eV, small sigma is required to avoid partial occupancies
ENCUT    = 500    ! energy cutoff
NBANDS   = 288    ! use large number of bands 
LOPTICS = .TRUE. ; CSHIFT = 0.100
NEDOS = 2000

In step two, I changed the KPOINTS file to

Code: Select all

Auto 
0
Gamma
4 4 1
0 0 0 

and used the WAVECAR from step 1 with following INCAR settings:

Code: Select all

LDOWNSAMPLE = T  ! downsample k-point data 
LWAVE = F ; LCHARG = F 
SYSTEM   = SiC TDHF
ISMEAR   = 0      ! Gaussian smearing
SIGMA    = 0.01   ! smearing in eV, small sigma is required to avoid partial occupancies
ENCUT    = 500    ! energy cutoff

LMODELHF = .TRUE. ! range-separated hybrid functional
HFSCREEN = 1.47   ! the range-separation parameter
AEXX     = 0.153  ! the fraction of exact exchange
LFXC     = .TRUE. ! local fxc

NBANDS   = 96     ! reduced number of bands for rough estimate 

ALGO     = TDHF   ! use TDHF algorithm
ANTIRES  = 0      ! Tamm-Dancoff approximation
NBANDSV  = 30     ! number of conduction bands in BSE
NBANDSO  = 10      ! number of valence bands in BSE
NBSEEIG  = 100     ! number of BSE/TDHF eigenvectors

LOPTICS = .TRUE. ; CSHIFT = 0.100
NEDOS = 2000

Afterwards, I extracted the dielectric function with the script extract_optics.sh of the mentioned tutorial.
For completeness the content of the script is as follows:

Code: Select all

awk 'BEGIN{i=0} /<dielectricfunction>/,\
                /<\/dielectricfunction>/ \
                 {if ($1=="<r>") {a[i]=$2 ; b[i]=($3+$4+$5)/3 ; c[i]=$4 ; d[i]=$5 ; i=i+1}} \
     END{for (j=0;j<i/2;j++) print a[j],b[j],b[j+i/2]}' vasprun.xml > optics.dat

The newly generated file optics.dat contains the imaginary part of the dielectric function.

For users of recent VASP versions, I recommend utilizing data from the vaspout.h5 file.
Relevant tutorials demonstrating its application are available in the official tutorial section.
Specifically, the BSE section might be of interest to you.