[资源]
【分享】code for ploting VASP output__from Panda Blog已有1人参与
此内容转自panda的博客,尽量保持原形,有兴趣的话自己研究吧
Plotting the EIGNEVAL file
Now that we have written the module we simply import it like this:
import eigenval_reader as er
Now the entirety of the source code is simply import statements and matplotlib directives. In other words, all of the programming logic is self-contained within the module, which can be used again and again, from the command line or within your ide of choice. See how much cleaner things are when the logic is separated on a lower-level and the plotting is handled on a higher level? Modules are a really nice way to accomplish whatever task you wish to accomplish in Python. In fact, matplotlib, numpy, and scipy are just huge modules that we interact with in Python at a higher level just as the very simple module given in the previous post that we interact with in the source code below!
************** ****************
Writing a Python Module for the VASP EIGENVAL file
Sometimes you will have tasks that need to be performed again and again. In this case, it is oftentimes advantageous to write a module. In python, modules are imported just like libraries. By separating your code in this manner, you benefit in flexibility as well as in producing code that is reusable. I have written a module for parsing the VASP EIGENVAL file, but you can write a module for anything you wish.
*************** *****************
In this example, first the re module in imported, as regular expression pattern matching is typically the easiest way to parse a file in Python. After that a class is defined. In that class, we define an event handler. After that, the file is opened and parsed using the re module. The “try” “except” clauses are included so that if the arrays are not loaded into memory then an exception is thrown and an error is printed. It is always a good idea to add break points like this in your code. The class EignevalReader reads the file and the class EignevalParser parses the file and splits the file data neatly into arrays. The next post will deal with using this module to plot the EIGENVAL file.
Parsing VASP PROCAR file ******************
VASP (Vienna Ab-Initio Simulation Package) is a plane wave density functional theory code. When the tag LORBIT is set in the INCAR file, the PROCAR file is generated. The PROCAR file contains the site-projected character of the orbitals (spherical harmonics used). The code above illustrates how to parse and plot the PROCAR file using Python and matplotlib.
Again, the first few lines of code are just the import statements and formatting for matplotlib. The re module is used, in which regular expression pattern matching searches the file for matching characters. More information regarding Python’s re module can be found here. The code could be cleaned up a bit, currently you must manually enter the Fermi energy (it is not parsed from the DOSCAR file), you must manually enter the working directory in which the file resides, etc. Overall though it gets the job done quite nicely with very little coding.
One thing to remember is that depending on which direction you are integrating in the Brillouin Zone, because depending on the crystal structure a scaling length may have to be implemented. You could do this programmatically, but I find it easier to apply the scaling length via pixel scaling, using an image manipulation program like GIMP.
Si
5.38936000000000
0.5000000000000000 0.5000000000000000 0.0000000000000000
0.0000000000000000 0.5000000000000000 0.5000000000000000
0.5000000000000000 0.0000000000000000 0.5000000000000000
2
Direct
0.0000000000000000 0.0000000000000000 0.0000000000000000
0.2500000000000000 0.2500000000000000 0.2500000000000000
POTCAR file is supplied with VASP 5.2, remember to use paw pseudopotentials so that in the band structure calculation the Wigner-Seitz radius for Si need not be directly specified in INCAR.
After this run completes you are ready to perform the HF-type (HSE06) calculation. Change the INCAR file to:
Keep the other files constant for this run (e.g. KPOINTS, POSCAR, POTCAR need not be changed).
Once this run has completed, add to the bottom of the INCAR file from the HSE06 calculation:
LOPTICS = .TRUE.
This step calculates the dielectric matrix
Once this run has completed, change
ALGO = Damped
to
ALGO = GWo
and
ICHARG = 2
to
ICHARG = 11
and add:
NOMEGA = 50
ENCUTGW = 100
LORBIT = 11
and change the KPOINTS file to:
k-points along high symmetry lines
20 ! 20 intersections
Line-mode
rec
0 0 0 ! gamma
0.5 0.0 0 ! X
0.5 0.0 0 ! X
0.5 0.5 0.0 ! M
0.5 0.5 0.0 ! M
0.0 0.0 0.0 ! gamma
0.0 0.0 0.0 ! gamma
0.5 0.5 0.0 ! M
0.5 0.5 0.0 ! M
0.5 0.5 0.5 ! R
0.5 0.5 0.5 ! R
0.0 0.0 0.0 ! gamma
These values are the points of high symmetry along the lines of high symmetry within the first Brillouin Zone of the Si unit cell structure in reciprocal space. And that’s it! Once complete you can plot the PROCAR, EIGENVAL, and DOSCAR files from the output of this run as described in the previous posts. The band structure plot produced from the plotting utility is shown below.
我有个疑问,在进行一、perform a DFT calculation时
(1)为什么不进行弛豫呢?
(2)LORBIT = 11应该是在输出DOSCAR,这里应该不需要DOSCAR吧
二、在After this run completes you are ready to perform the HF-type (HSE06) calculation后
(3)ISYM = 0,为什么设置为0呢
(4)这时发现LORBIT = 11没有了
三、计算完HSE06后
(4)LORBIT = 11又有了,不是计算band的吗,为什么输出DOSCAR吗
真心感谢您,这些我真有些不明白
听说HSE06计算对半导体带隙就有一定的改善。为何我用里面的设置,没发现带隙变寬呢。什么原因?
还有就是用GW0计算时用上面的KPOINTS时,运行总提示
error in IBZKPT_HF: two k-points are equivalent 1 60
this will cause problems in the HF routine