[资源]
【分享】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.
我有个疑问,在进行一、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吗
真心感谢您,这些我真有些不明白