Page 1 of 1

Plotting dielectric function

Posted: Wed Jul 05, 2023 6:40 pm
by atul_pandey
is there any tool to extract frequency dependent dielectric constant in all xx yy zz direction?

awk 'BEGIN{i=1} /imag/,\
/\/imag/ \
{a=$2 ; b=$3 ; i=i+1} \
END{for (j=12;j<i-3;j++) print a[j],b[j]}' vasprun.xml > imag.dat

awk 'BEGIN{i=1} /real/,\
/\/real/ \
{a=$2 ; b=$3 ; i=i+1} \
END{for (j=12;j<i-3;j++) print a[j],b[j]}' vasprun.xml > real.dat

cat >plotfile<<!
# set term postscript enhanced eps colour lw 2 "Helvetica" 20
# set output "optics.eps"
plot [0:25] "imag.dat" using (\$1):(\$2) w lp, "real.dat" using (\$1):(\$2) w lp
!

gnuplot -persist plotfile

I used this script to extract but got only xx direction data. Is there any post processing tool available to extrat data in all direction easily?

Re: Plotting dielectric function

Posted: Thu Jul 06, 2023 9:38 am
by jonathan_lahnsteiner2
Dear atul_pandey,

Regarding your question. We have a tool to plot the dielectric function. You can use py4vasp
for this purpose. For installation check the following page:
https://www.vasp.at/py4vasp/latest/#installation
From vasp 6.3 on you can do GW,BSE... calculations and compute the frequency dependent dielectric function with the LOPTICS tag. With py4vasp you can plot the function under the use of the command

Code: Select all

calc.dielectric_function.plot()
For information to the LOPTICS tag check here
https://www.vasp.at/wiki/index.php/LOPTICS
You can find guidelines for basic usage of py4vasp here
https://www.vasp.at/py4vasp/latest/#quick-start

I hope this is of help.

All the best Jonathan

Re: Plotting dielectric function

Posted: Wed Jul 26, 2023 8:12 am
by atul_pandey
okay sir thanks

Re: Plotting dielectric function

Posted: Wed Jul 26, 2023 12:25 pm
by atul_pandey
Respected sir,
I have installed py4vasp in my anaconda prompt command, I think I have not installed vasp6.3 with h5 in hpc thats why I am not getting vaspout.h5 file. I have tried to plot in anaconda prompt bit failed, can you help me sir in plottind data. Because have calculated frequency dependent dielectric funcions including loacal field effect with dft and got this.
INVERSE MACROSCOPIC DIELECTRIC TENSOR (test charge-test charge, local field effects in DFT)
-------------------------------------
w= 0.000 0.000
3.9879 -0.0083 0.0000 -0.0000 -0.0000 0.0000
0.0000 0.0000 3.9627 0.0173 0.0000 0.0000
-0.0000 -0.0000 0.0000 -0.0000 1.4263 -0.0099

0.000 3.126 -0.000 dielectric constant

w= 0.764 0.000
3.8691 0.7186 0.0000 -0.0000 -0.0000 -0.0000
-0.0000 0.0000 3.8559 0.7835 0.0000 0.0000
-0.0000 -0.0000 0.0000 0.0000 1.4241 0.0111

0.764 3.050 0.504 dielectric constant

w= 1.527 0.000
3.1370 1.4510 0.0000 0.0000 -0.0000 -0.0000
-0.0000 -0.0000 3.1467 1.4166 0.0000 0.0000
-0.0000 -0.0000 0.0000 0.0000 1.4169 0.0053

1.527 2.567 0.958 dielectric constant

w= 2.289 0.000
2.5582 1.1361 0.0000 0.0000 -0.0000 -0.0000
-0.0000 -0.0000 2.6959 1.1322 0.0000 -0.0000
-0.0000 -0.0000 0.0000 -0.0000 1.4131 0.0254

2.289 2.222 0.765 dielectric constant
.
.
.
etc
I am confused how to plot, and which one is correct dielectric constant, why am I not getting in all three directions in above like previous one using loptics=.True.( Independent particle picture method). How to plot this data in all three axis. Please help me sir

Re: Plotting dielectric function

Posted: Wed Jul 26, 2023 4:18 pm
by jonathan_lahnsteiner2
Dear atul_pandey,

Since py4vasp is a good tool for the evaluations your planning to do I would recommend to compile vasp with hd5 support.
You can do this by commenting in the following lines in your makefile.include

Code: Select all

CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT  ?= /path/to/your/hdf5/installation
LLIBS      += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS       += -I$(HDF5_ROOT)/include
Regarding your output: What you see is as you say INVERSE MACROSCOPIC DIELECTRIC TENSOR.
What you get is a 3x3 tensor with components as follows

Code: Select all

real xx imag xx    real xy imag xy   real xz imag xz
real yx imag yx    real yy imag yy   real yz imag yz
real zx imag zx    real zy imag zy   real zz imag zz
Because the dielectric tensor is frequency dependent you get this complex 3x3 tensor for every omega w.
Maybe it can be of help for you to check the vasp tutorials about dielectric properties. You can find them on this
page: wiki/index.php/Dielectric_properties_of_SiC
You will also find awk scripts there to plot you tensorial quantities.

I hope this is of help.

All the best Jonathan

Re: Plotting dielectric function

Posted: Thu Jul 27, 2023 10:08 am
by atul_pandey
thankyou sir for your valuable response.

Re: Plotting dielectric function

Posted: Wed Aug 02, 2023 10:44 am
by atul_pandey
After mentioning this "CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include"
My calculations are not running.
I have attached the screenshot of makefile.include

Re: Plotting dielectric function

Posted: Wed Aug 02, 2023 1:39 pm
by jonathan_lahnsteiner2
Dear atul_pandey,

Why are your calculations not running? What error message do you get?
Could you upload your OUTCAR and slurm_output file and your input files according
to the forum guidelines forum/viewtopic.php?f=4&t=17928

All the best Jonathan

Re: Plotting dielectric function

Posted: Wed Aug 09, 2023 10:25 am
by atul_pandey
I am getting this error.

Re: Plotting dielectric function

Posted: Wed Aug 09, 2023 10:38 am
by atul_pandey
Dear Sir,

after commenting this "CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include" in cmake.include file

calculations are not going into queue in hpc, and I am getting this error "loading the modules required !!"
I have attached the error and slurm file below.

Re: Plotting dielectric function

Posted: Thu Aug 10, 2023 8:23 am
by jonathan_lahnsteiner2
Dear atul_pandey,

According to the files you sent it looks like you are missing the hdf5 modules.
When compiling vasp with the hdf5 support you have to load the hdf5 modules during compilation.
You also have to load the used libraries in the job file. Right now you are not loading
the hdf5 modules.
Another thing I recognized is your are loading intel compilers and some gnu libraries in your job script. According
to the makefile.include you sent, you are using an intel build. So it should be okay to only load the intel libraries.
And hence you also have to load the hdf5 modules built with intel during compilation and in your job script.

In the output file you supplied, I don't see an error message. Does the job script terminate after your echo statement without writing anything?


All the best Jonathan

Re: Plotting dielectric function

Posted: Fri Aug 11, 2023 4:40 am
by atul_pandey
Dear Sir,
In job.err file i am getting this.

Re: Plotting dielectric function

Posted: Fri Aug 11, 2023 6:43 am
by jonathan_lahnsteiner2
Dear atul pandey,

As expected already in my last post, you don't load the hdf5 library before executing your job.
During compilation of vasp you have to load the hdf5 library otherwise you would not be able to compile.
When executing your job you have to load the same hdf5 library again.
The error message tells, you that the program is not able to find the dynamically linked hdf5 library which should be in the file libhdf5_fortran.so.
So you have to put a line

Code: Select all

module load "name of you hdf5 library"
in your job script.
If you compiled the code yourself just load the same hdf5 modules which you used during compilation.
If you did not, the best would be to ask your system admin which libraries where used during compilation and which ones you should load.
And the last approach would be to do

Code: Select all

ldd /home/atulp.iitpr/vasp_6.4.1/bin/vasp_std
This should show you a path where libhdf5_fortran.so can be found.
In your job script you have to export this path as

Code: Select all

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path to the file libhdf5_fortran.so/
But the preferred way is to do this with a module load command in your job script.

All the best Jonathan

Re: Plotting dielectric function

Posted: Sat Aug 12, 2023 10:14 am
by hszhao.cn@gmail.com
See here for the related discussion.