VASPy is a pure Python library designed to make it easy and quick to manipulate VASP files.
You can use VASPy to manipulate VASP files in command lins or write your own python scripts to process VASP files and visualize VASP data.
In /scripts , there are some scripts written by me for daily use.
Via pip(recommend):
pip install vaspy
Via easy_install:
easy_install vaspy
From source:
python setup.py install
# 处理分割好的DOS文件
>>> from vaspy.electro import DosX
>>> a = DosX('DOS1')
>>> b = DosX('DOS8')
# 分波态密度合并
>>> c = a
>>> c.reset_data() # 初始化DOS数据
>>> for i in xrange(1, 10):
>>> c += DosX('DOS'+str(i)) # 循环合并DOS数据
>>> ...
>>> c.data # 以float矩阵显示合并后的数据
# 可直接进行计算等操作
>>> c.tofile() # 生成新的合并后的DOS文件
# 绘图
>>> c.plotsum(0, (5, 10)) # 绘制d轨道pDOS图
Output
>>> from vaspy.electro import ElfCar
>>> a = ElfCar()
>>> a.plot_contour() # 绘制等值线图
>>> a.plot_mcontour() # 使用mlab绘制等值线图(需安装Mayavi)
>>> a.plot_contour3d() # 绘制3d等值线图
>>> a.plot_field() # 绘制标量场
Output
3D contour
Scalar field
>>> from vaspy.atomco import XdatCar
>>> xdatcar = XdatCar()
>>> # 输出xdatcar相应Cartesian坐标
>>> for step, data in xdatcar:
>>> print step
>>> print xdatcar.dir2cart(xdatcar.bases, data)
>>> # 可直接运行script/中脚本生成相应.arc文件用于MaterialStudio显示动画
>>> python xdatcar_to_arc.py
animation
You can write your OWN script to process VASP files
Date | Version | Description |
---|---|---|
2016-08-08 | 0.7.0 | 增强库的通用性 |
2016-07-15 | 0.6.0 | 兼容python 3 |
2015-08-04 | 0.1.0 | 初始版本 |