pythonÔÚ´¦Àí¶þάͼÐλ¹ÊÇÓкܶàÓÅÊƵģ¬ÔÚÕâÀïÍƼö¼¸¸öpython½Å±¾¡£¸½¼þÖÐÊǸöÈËÒѾÏÂÔصÄÏà¹Øpython½Å±¾¡£
ÆäÖеÚÒ»¸öÌṩµÄ½Å±¾Ö»ÊÊÓ¦vasp.5.3.3, µÚ¶þ¸öÌṩµÄ½Å±¾ÐèÒªÓõ½ase£¬ËùÓÐÐèÒª×Ô¼ºÏÈÐа²×°ase¡£
1: VASP Tools ÏÂÔصØÖ·£ºhttp://www.nsc.liu.se/~pla/vasptools/
Peter¡¯s collection of small, but useful, VASP scripts. Some of these may be found on NSC¡¯s computers by loading the ¡°vasptools¡± module.
vaspcheck
The ¡°vaspcheck¡± script scans your input files and looks for common errors such as: forgetting to copy CONTCAR to POSCAR, misspelled INCAR tags, and various inconsistent configurations such as having N atoms but only N-x magnetic moments specified. If you supply it with information about the intended number of cpu cores and nodes that you will run on, it will also check the NPAR and KPAR values and warn if they are unreasonable.
An alpha version is available in the ¡°vasptools¡± module on Triolith, and once the script has become more robust, I will make a version available for download here. The idea is to integrate it with the queue system in the future, so that your VASP jobs will be automatically checked when running the ¡°sbatch¡± command.
Install: Click here to download to the Python script. Install it by putting it in a folder in your $PATH (such as~/bin) and then do:
mv vaspcheck-standalone.py vaspcheck
chmod u+x vaspcheck
This should allow you to write ¡°vaspcheck¡± in any job folder.
grad2
The gradient program is used to quickly get an overview of VASP geometry optimization runs. It also works for molecular dynamics. It parses the OUTCAR file and writes a one-line summary per ionic step, including average forces and run-time per step. The output looks like this:
$ grad2 OUTCAR
Step 1 Energy: -42.794090 Log|dE|: +1.631 Avg|F|: 1.720176 Max|F|: 2.710237 SCF: 15 Time: 0.52m
Step 2 Energy: -43.336931 Log|dE|: -0.265 Avg|F|: 0.513256 Max|F|: 0.696803 SCF: 9 Time: 0.32m
Step 3 Energy: -43.384337 Log|dE|: -1.324 Avg|F|: 0.095940 Max|F|: 0.178813 SCF: 7 Time: 0.24m
Step 4 Energy: -43.387267 Log|dE|: -2.533 Avg|F|: 0.050399 Max|F|: 0.071963 SCF: 6 Time: 0.20m
Step 5 Energy: -43.388250 Log|dE|: -3.007 Avg|F|: 0.043184 Max|F|: 0.061866 SCF: 4 Time: 0.13m
Step 6 Energy: -43.390384 Log|dE|: -2.671 Avg|F|: 0.030630 Max|F|: 0.047413 SCF: 5 Time: 0.18m
Step 7 Energy: -43.392498 Log|dE|: -2.675 Avg|F|: 0.003760 Max|F|: 0.005849 SCF: 6 Time: 0.20m
Step 8 Energy: -43.392509 Log|dE|: -4.959 Avg|F|: 0.001285 Max|F|: 0.001861 SCF: 3 Time: 0.09m
The Log\|dE\| is the base-10 logarithm of the absolute value of the energy difference between steps, essentially the number of ¡°stable¡± decimals in the total energy, i.e. for a VASP run with EDIFF=1.0E-5, Log\|dE\| should approach -5 for convergence.
If your terminal has colors, each line will be color-coded with red color signalling convergence problems, and green color corresponding to energy convergence having been reached (as judged by the EDIFF tag in the INCAR file.)
Install: Click here to download to the Python script (version 2012-01-07). Install it by putting it in a folder in your $PATH (such as~/bin) and then do:
mv grad2.py grad2
chmod u+x grad2
This should allow you to write ¡°grad2 OUTCAR¡± in any job folder.
vasp2cif
The vasp2cif program creates a CIF-file from a POSCAR/CONTCAR file, which can be used for visualization in graphical applications, such as VESTA. Note that it will not preserve symmetries from VASP ¨C the output CIF is always in P1 symmetry. If there is no POTCAR file available, the script has a flag (¡°¨Celements¡±) whereby you can specify the atomic species.
Install: Click here to download to the Python script (version 2012-12-15). Install it by putting it in a folder in your $PATH (such as~/bin) and then do:
mv vasp2cif.py vasp2cif
chmod u+x vasp2cif
This should allow you to write e.g. ¡°vasp2cif CONTCAR¡± in any job folder.
cif2vasp
For CIF to VASP input conversion, a recommend a program by Torbjörn Björkman called cif2cell, which can generate input from CIF files for many ab initio programs, including VASP.
If anyone is interested in doing high-performance CIF to VASP conversion with optimized C code, I can provide source code to a CIF lexer written with the Ragel state machine compiler and CIF parser written with Lemon. Unfortunately, the tool I built to do CIF to VASP with this framework does not compile correctly anymore on recent platforms, so I cannot put up any binaries for download. You can email me at pla@nsc.liu.se if you want to give it a try.
supersize
Yet another script to make supercells out of VASP¡¯s POSCAR/CONTCAR files. It is basically a wrapper around the corresponding feature in ASE.
It works like this:
$ supersize POSCAR 4x4x4
And you get a new POSCAR file called ¡°POSCAR.4x4x4¡± containing the supercell repeated 4 times in a,b,c directions. You can achieve the same effect with three lines of Python code in ASE:
import ase.io.vasp
cell = ase.io.vasp.read_vasp("POSCAR"
ase.io.vasp.write_vasp("POSCAR.4x4x4",cell*(4,4,4), label='444supercell',direct=True,sort=True)
The script is a little bit more elaborate, however, since it includes error checks.
2. Scripts ÏÂÔصØÖ·£ºhttp://gvallver.perso.univ-pau.fr/vasptools/
The followings scripts are short programs which use the vasptools module. In the terminal if you give the option -h to the script a short help will be printed.
chgsplit
chgsplit [CHGCAR]
Split charge density into spin up and spin down charge density and write them into files.
Parameters: CHGCAR (file) ¨C name of a CHGCAR file (default is CHGCAR).
Default file name for the CHGCAR file is CHGCAR. In output the spin up charge density is written in file CHGCAR_up and the spin down charge density is written in file CHGCAR_down.
Examples
chgsplit
chgsplit CHGCAR
chgsum
chgsum CHGCAR1 CHGCAR2 fact1 fact2
Do simple linear operations on charge densities from two CHGCAR file.
Parameters:
CHGCAR1 (file) ¨C name of the first CHGCAR file
CHGCAR2 (file) ¨C name of the second CHGCAR file
fact1 (float) ¨C scaling factor for CHGCAR1 (default 1.0)
fact2 (float) ¨C scaling factor for CHGCAR2 (default 1.0)
On output the file CHGCAR_sum contains the density computed by the following expression
fact1 * CHGCAR1 + fact2 * CHGCAR2
Examples
chgsum AECAR0 AECAR2
chgsum AECAR0 CHGCAR 1.8 0.2
cvgVASP
convVASP [OPTIONS] ... [FILES]
convVASP read convergence data on the OUTCAR file and either write them into files in order to plot them with your favorite soft or plot them directly using matplotlib. The last argument has to be an OUTCAR file, if absent, ¡®./OUTCAR¡¯ will be used.
Parameters:
-h ¨C print help and exit
-t ¨C instead of plot convergence data, they are printed into files.
Examples
cvgVASP
cvgVASP ../OUTCAR
getBands
getBands [OPTIONS] ... [FILE]
Read energy bands on vasprun.xml file and either extract them into files or plot them directly. The last argument has to be the xml file, if absent ¡®./vasprun.xml¡¯ will be used.
Parameters:
¨Chelp (-h) ¨C print this help
¨Ctofiles (-t) ¨C Print energy bands into files.
¨Cdirections (-d) ¨C One file is created for each line of the reciprocal space along which energy bands were computed. This option is relevant only when you want to print energy bands into file, -t option, and if the k-point grid was generated automatically.
¨Cquiet (-q) ¨C Remove output
Examples
getBands
getBands -t
getDeplacement
getDeplacement [FILE1] [FILE2]
Read first and last structures in a vasprun.xml file and, for each atom, compute the distance between the initial position and the last position. You can also give two POSCAR files (or CONTCAR). The first one will be use as the initial position and the second will be use as the final position.
By default, the file ¡®./vasprun.xml¡¯ is read. You can give an other file in the command line.
Examples
getDeplacement my_calculation.xml
getDeplacement POSCAR CONTCAR
getDOS
getDOS [OPTIONS] ... [FILE]
Read density of states data on vasprun.xml files and either extract them into files or plot them directly. The last argument has to be the xml file, if absent ¡®./vasprun.xml¡¯ will be used.
Parameters:
¨Chelp (-h) ¨C Print this help
¨Ctofiles (-t) ¨C Print total DOS into files. Projected DOS are printed if you add -p option.
¨Cprojected (-p) ¨C Print projected DOS into files.
¨Cquiet (-q) ¨C Low verbosity
Examples
getDOS
getDOS -t
getDOS -t -p
getDOS -p
postDOS
postDOS()
Read density of states data on vasprun.xml files and do some post treatments :
Compute the sum of all projected DOS
Compute the contribution to the total DOS of each atom type or the contribution of one specific atom if -iat option is specified.
Parameters:
¨Chelp (-h) ¨C Print help and exit
¨Chelp ¨C Print help and exit
-iat N (int) ¨C Output the contribution of atom N to the total DOS
getMaille
getMaille [POSCAR]
Read the lattice vectors in a POSCAR or CONTCAR file and print the lattice parameters. If you do not give a file name getMaille will print suggestions.
getCharges
getCharges()
Compute atomic charges from a Bader caclculations done with the bader program of the University of Texas at Austin : bader.
Parameters: ¨Chelp (-h) ¨C Print help and exit
Run the script in the same directory where you did the bader calculation. Requirements :
a ACF.dat file (bader program output).
a vasprun.xml file or a POSCAR/CONTCAR file in order to read atom namess.
visVMD
I wrote this script before I found VESTA and today I do not use it anymore. But it could be useful in order to do nice crystal pictures such as the one in the sidebar.
visVMD [OPTIONS]
visVMD read output files of VASP and write a VMD script in order to visualize VASP structures with VMD. visVMD can read either POSCAR and CONTCAR files or directly vasprun.xml files. The xml file is the best choice because it contains atom names. If you read a POSCAR or a CONTCAR file of a 4.X version of VASP, visVMD will ask you the name of each atom.
Parameters:
¨Chelp (-h) ¨C print this help
-p ¨Cprefix prefix (string) ¨C visVMD use [prefix] in order to name output files (default is ¡®vis¡¯).
-f ¨Cfile file (string) ¨C file is an output file of VASP containing structure data. It is either the xml file or a POSCAR or CONTCAR (default ¡®vasprun.xml¡¯).
¨Cposcar ¨C say that the file is either a POSCAR or a CONTCAR
¨Cunitcell (-u) ¨C add all images of the atoms of the unit cell which are into the unit cell.
¨Cfinal (-e) ¨C read the last structure of the xml file (default if [file] is an xml file).
¨Cinitial (-i) ¨C read the first structure of the xml file.
-n ¨Csupercell N1xN2xN3 (int*int*int) ¨C make a supercell N1 times N2 times N3. Do not set spaces in the expression.
¨Cliaisons (-l) ¨C make connectivity between atoms.
Examples
visVMD -u -l
visVMD -u -l --poscar -f POSCAR
visVMD -u -l -n 2x2x2 |