24小时热门版块排行榜    

查看: 9040  |  回复: 66
【奖励】 本帖被评价59次,作者mywai520增加金币 47.2
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

mywai520

铁杆木虫 (著名写手)


[资源] 推荐几个vasp处理计算结果的python脚本

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 – the output CIF is always in P1 symmetry. If there is no POTCAR file available, the script has a flag (“–elements”) 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) – 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) – name of the first CHGCAR file
CHGCAR2 (file) – name of the second CHGCAR file
fact1 (float) – scaling factor for CHGCAR1 (default 1.0)
fact2 (float) – 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 – print help and exit
-t – 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:       
–help (-h) – print this help
–tofiles (-t) – Print energy bands into files.
–directions (-d) – 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.
–quiet (-q) – 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:       
–help (-h) – Print this help
–tofiles (-t) – Print total DOS into files. Projected DOS are printed if you add -p option.
–projected (-p) – Print projected DOS into files.
–quiet (-q) – 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:       
–help (-h) – Print help and exit
–help – Print help and exit
-iat N (int) – 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:        –help (-h) – 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:       
–help (-h) – print this help
-p –prefix prefix (string) – visVMD use [prefix] in order to name output files (default is ‘vis’).
-f –file file (string) – file is an output file of VASP containing structure data. It is either the xml file or a POSCAR or CONTCAR (default ‘vasprun.xml’).
–poscar – say that the file is either a POSCAR or a CONTCAR
–unitcell (-u) – add all images of the atoms of the unit cell which are into the unit cell.
–final (-e) – read the last structure of the xml file (default if [file] is an xml file).
–initial (-i) – read the first structure of the xml file.
-n –supercell N1xN2xN3 (int*int*int) – make a supercell N1 times N2 times N3. Do not set spaces in the expression.
–liaisons (-l) – make connectivity between atoms.
Examples

visVMD -u -l
visVMD -u -l --poscar -f POSCAR
visVMD -u -l -n 2x2x2
回复此楼

» 本帖附件资源列表

  • 欢迎监督和反馈:小木虫仅提供交流平台,不对该内容负责。
    本内容由用户自主发布,如果其内容涉及到知识产权问题,其责任在于用户本人,如对版权有异议,请联系邮箱:libolin3@tal.com
  • 附件 1 : VASP_Tools_python.zip
  • 2014-04-03 22:51:37, 3.86 M

» 收录本帖的淘贴专辑推荐

VASP 第一性原理计算-tg VASP软件从入门到高深 表界面计算
计算模拟-MS-CASTEP vasp 晶型研究 VASP资料
VASP 值得收藏 第一性 科研
第一性原理计算

» 本帖已获得的红花(最新10朵)

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

scuedu2

金虫 (小有名气)


44楼2016-01-25 13:20:28
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 67 个回答

mywai520

铁杆木虫 (著名写手)


下面是本人用上面一些脚本做的图,大家可以参考一下:
推荐几个vasp处理计算结果的python脚本
QQ图片20140403225756.jpg


推荐几个vasp处理计算结果的python脚本-1
QQ图片20140403230111.jpg


推荐几个vasp处理计算结果的python脚本-2
QQ图片20140403230147.jpg

2楼2014-04-03 23:02:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

lidanyt

新虫 (初入文坛)


★★★★★ 五星级,优秀推荐

非常好,顶一下,感谢分享!
5楼2014-05-05 13:42:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

甲斐之虎

银虫 (正式写手)


★★★★★ 五星级,优秀推荐

受益良多!谢谢!
7楼2014-05-10 09:20:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
简单回复
stoneyww3楼
2014-04-04 08:24   回复  
五星好评  顶一下,感谢分享!
2853520654楼
2014-04-04 11:07   回复  
五星好评  顶一下,感谢分享!
chao_xuan6楼
2014-05-06 13:47   回复  
五星好评  顶一下,感谢分享!
2014-06-19 08:37   回复  
五星好评  顶一下,感谢分享!
lwk20510楼
2014-06-26 08:45   回复  
五星好评  顶一下,感谢分享!
流年水11楼
2014-06-27 12:12   回复  
五星好评  顶一下,感谢分享!
2008089012楼
2014-07-02 19:34   回复  
五星好评  顶一下,感谢分享!
huichli14楼
2014-07-15 00:07   回复  
五星好评  顶一下,感谢分享!
☆ 无星级 ★ 一星级 ★★★ 三星级 ★★★★★ 五星级
普通表情 高级回复(可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[教师之家] 神奇的中医 +8 水冰月月野兔 2024-06-24 10/500 2024-06-26 12:10 by lyfbangong
[硕博家园] 怎么带研究生? +22 豆豆小小2 2024-06-20 39/1950 2024-06-26 11:49 by 豆豆小小2
[教师之家] 高校辞职,要求赔偿,这到底合不合理 +23 传动_海神 2024-06-23 35/1750 2024-06-26 10:30 by 阳光道路下
[有机交流] 酚羟基甲基化 10+4 A好运来啦啦啦 2024-06-25 6/300 2024-06-26 10:08 by 88817753
[有机交流] 过柱子,产品,杂质在是 pe:ea=100:1 也一起出来? +5 w256 2024-06-25 5/250 2024-06-26 09:31 by 小木木cc
[有机交流] 大佬们,打的核磁氢谱与chemdraw预测的有偏差 +4 来了个 2024-06-26 4/200 2024-06-26 08:45 by czyzsu
[论文投稿] 我在写关于多维空间的论文,希望能与大家交流,准备在science上发表 +7 lgf519 2024-06-24 9/450 2024-06-26 08:29 by xxxxxxOdis
[基金申请] 厅级项目出校却没中 +13 Iwould 2024-06-23 20/1000 2024-06-26 06:14 by foolishmani
[硕博家园] 回家两天,不想呆了 +5 368ghnf 2024-06-22 11/550 2024-06-25 17:58 by 我是王小帅
[基金申请] 2024安徽省哲社立项名单公示 +3 robin_work 2024-06-24 6/300 2024-06-25 14:37 by Pickfoot
[硕博家园] 夏至,要不要硕博联谊 +4 我是王小帅 2024-06-21 6/300 2024-06-25 14:25 by 庭前花开月儿明
[有机交流] 求助析晶问题 20+4 dengdawang 2024-06-24 5/250 2024-06-24 21:22 by cc116
[基金申请] 博后面上和特助今天出吗? +41 逗您玩 2024-06-21 77/3850 2024-06-24 09:47 by weichuny
[基金申请] b口yq上会情况 +5 XUAAAAA 2024-06-19 6/300 2024-06-24 01:13 by sunrise3148
[基金申请] 国自然青年基金,1A4B能上会吗?青年和面上的上会标准是一样的吗? +19 今晚推荐22 2024-06-20 32/1600 2024-06-23 23:17 by andywei1028
[有机交流] 生成亚胺的反应怎么能进行完全 +3 1369836 2024-06-23 3/150 2024-06-23 18:44 by hwqMSE
[基金申请] 工材口青年基金大概什么样能上会? +15 今晚推荐22 2024-06-20 21/1050 2024-06-22 23:04 by qbn0326
[论文投稿] 水果保鲜投稿 5+4 zhengjiandong 2024-06-19 6/300 2024-06-21 22:27 by 宋小爷
[基金申请] 听大佬说今年信息口本子数量大幅增加? +8 wutzxt 2024-06-21 9/450 2024-06-21 19:58 by wutzxt
[论文投稿] 第一篇论文投稿进程记录 +4 慎独的小花卷 2024-06-20 9/450 2024-06-20 20:37 by 慎独的小花卷
信息提示
请填处理意见