版块导航
正在加载中...
客户端APP下载
论文辅导
调剂小程序
登录
注册
帖子
帖子
用户
本版
应《网络安全法》要求,自2017年10月1日起,未进行实名认证将不得使用互联网跟帖服务。为保障您的帐号能够正常使用,请尽快对帐号进行手机号验证,感谢您的理解与支持!
24小时热门版块排行榜
>
论坛更新日志
(569)
>
导师招生
(47)
>
考研
(39)
>
虫友互识
(23)
>
考博
(18)
>
无机/物化
(10)
>
文献求助
(8)
>
公派出国
(4)
>
绿色求助(高悬赏)
(3)
>
教师之家
(3)
>
硕博家园
(3)
>
休闲灌水
(3)
>
论文道贺祈福
(2)
>
基金申请
(2)
>
论文投稿
(2)
>
育儿交流
(1)
小木虫论坛-学术科研互动平台
»
计算模拟区
»
第一性原理
»
Vasp&MedeA
»
处理态密度的脚本:vasp_pdos.py
2
1/1
返回列表
查看: 2704 | 回复: 1
只看楼主
@他人
存档
新回复提醒
(忽略)
收藏
在APP中查看
hakuna
木虫
(知名作家)
1ST强帖: 3
应助: 82
(初中生)
金币: 8735.9
散金: 158
红花: 126
帖子: 5599
在线: 1367.2小时
虫号: 167622
注册: 2006-01-15
专业: 考古理论
[交流]
处理态密度的脚本:vasp_pdos.py
已有1人参与
http://cmd.kist.re.kr/code/etc/vasp_pdos.py
CODE:
#!/usr/bin/python
##### by jhshin #####
##
## 1. Extract DOS and from DOSCAR of VASP
## 2. Analysis DOS by distribution moment Eq.
##
## 2010.12.2
##########
import os
import sys
from getopt import getopt
from numpy import array
from ase.io import *
from ase.calculators.vasp import Vasp
from ase.calculators.vasp import VaspDos
from ase.dft import get_distribution_moment
outcar_name_q = " OUTCAR name > "
doscar_name_q = " DOSCAR name > "
atom_list_q = " Atom index > "
orbit_list_q = " Orbital > "
en_range_q = " Energy Min. Max. > "
screen_q = " Screen on/off > "
##### Check and read options #####
optlist, args = getopt(sys.argv[1:], 'hs')
help = 0 ; script = 0
for op,p in optlist:
if op == '-h' : help = 1
if op == '-s' : script = 1
if help==1:
print ""
print " Wellcome!"
print ""
print " Usage) ./vasp_pdos.py : Input variables directly."
print " ./vasp_pdos.py < vasp_pdos.in : Use script file generated by user."
print " ./vasp_pdos.py -h : Print explanation of this utility."
print " ./vasp_pdos.py -s : Generate the sample script file named"
print " as 'vasp_pdos.in'."
print " ./vasp_pdos.py -hs (or) -sh : Use 'h' and then 's' option, or inversly."
print ""
print " For all variables, see bellow. () is a default value"
print ""
print " - OUTCAR name : one string(OUTCAR), name of OUTCAR file"
print " ex) OUTCAR.xXX0"
print ""
print " - DOSCAR name : one string(DOSCAR), name of DOSCAR file"
print " ex) DOSCAR.xXX0"
print ""
print " - Atom index : list of integer, from 0 to # of total atoms"
print " ex) 0 1 2 3"
print ""
print " - Orbital : list of strings, which orbital to plot"
print ""
print " | Phase factor : X | Phase factor : O "
print " ==================.========================.==========================="
print " | s | s "
print " Spin-unpolarized | p | px py pz "
print " | d | dxy dyz dz2 dxz dx2 "
print " ------------------.------------------------.---------------------------"
print " | s-up s-down (or) s+ s- | s-up s-down (or) s+ s- "
print " Spin-polarized | p-up p-down (or) p+ p- | px-up ... (or) px+ ... "
print " | d-up d-down (or) d+ d- | dxy-up ... (or) dxy+ ... "
print " ex) s d"
print ""
print " - Energy Min. Max. : list of integer(* *), minimum and maximum of energy range"
print " ex) -10.0 5.0"
print ""
print " - Screen on/off : one integer(0), 0 is off and 1 is on"
print ""
print " Thanks!!\n"
exit()
if script==1:
print ""
print " Edit 'vasp_pdos.in' file !!\n"
in_script = open("vasp_pdos.in", 'wb')
in_script.write( "%s\n" % outcar_name_q)
in_script.write( "%s\n" % doscar_name_q)
in_script.write( "%s\n" % atom_list_q )
in_script.write( "%s\n" % orbit_list_q )
in_script.write( "%s\n" % en_range_q )
in_script.write( "%s\n\n" % screen_q )
in_script.write( "# Enter values on the right side of '>'\n")
in_script.write( "# Orbital list | (s) s (p) px py pz (d) dxy dyz dz2 dxz dx2")
in_script.close()
exit()
##########
##### Input variables #####
print ""
print " Wellcome! Enter bellow."
print " If you want to use a default value, do not enter anything."
print " ----------------------------------------------------------\n"
print " < Input variables >"
print ""
print " - Orbital list | (s) s (p) px py pz (d) dxy dyz dz2 dxz dx2"
print ""
print outcar_name_q, ; outcar_name = raw_input().replace(outcar_name_q,"")
if len(outcar_name) == outcar_name.count(" "): outcar_name="OUTCAR"
outcar_name = outcar_name.replace(" ","")
print "", outcar_name
print doscar_name_q, ; doscar_name = raw_input().replace(doscar_name_q,"")
if len(doscar_name) == doscar_name.count(" "): doscar_name="DOSCAR"
doscar_name = doscar_name.replace(" ","")
print "", doscar_name
print atom_list_q, ; atom_list = raw_input().replace(atom_list_q,"").split()
if len(atom_list) == 0:
print "Enter list of integers!"
exit()
print "", atom_list
print orbit_list_q, ; orbit_list = raw_input().replace(orbit_list_q,"").split()
if len(orbit_list) == 0:
print "Enter list of strings!"
exit()
print "", orbit_list
print en_range_q, ; en_range = raw_input().replace(en_range_q,"")
if len(en_range) == en_range.count(" "): en_range="* *"
en_range = en_range.split()
print "", en_range
print screen_q, ; screen = raw_input().replace(screen_q,"")
if len(screen) == screen.count(" "): screen="0"
screen = screen.replace(" ","")
print "", screen
print ""
print " ----------------------------------------------------------\n"
##########
##### Read OUTCAR and DOSCAR #####
fermiEn = (os.popen('grep E-fermi %s | cut -d":" -f 2' % outcar_name)).read().split()[0]
fermiEn = float(fermiEn)
doscar = VaspDos(doscar=doscar_name)
doscar.read_doscar(doscar_name)
en_list = array(doscar._get_energy()) -fermiEn
if en_range[0] == "*": en_min = min(en_list)
else: en_min = float(en_range[0])
if en_range[1] == "*": en_max = max(en_list)
else: en_max = float(en_range[1])
##########
##### Prepare output #####
outfile2_name = doscar_name + ".info.out"
outfile2 = open(outfile2_name, 'wb')
gpInFile = open("gnuplot.in", 'wb')
print " < Output results >"
print "\n# %10s %13s %16s %16s\n" % ("Atom index", "Elec. count", "Band center", "Band width")
outfile2.write("\n# %10s %13s %16s %16s\n" % ("Atom index", "Elec. count", "Band center", "Band width"))
##########
##### Main loop : make DOS data and analysis #####
sum=0
orbit0=""
dos_list0 = []
for atom in atom_list:
for orbit in orbit_list:
atom = int(atom)
if orbit == "+":
sum = 1
if len(orbit0)==0 : orbit0= orbit
dos_list0 = dos_list
else:
dos_list = doscar.site_dos(atom, orbit)
if sum==1:
orbit = orbit0 + orbit
orbit0 = orbit
dos_list = dos_list + dos_list0
sum = 0
outfile1_name = str(doscar_name + ".atom" + str(atom) + orbit + "Orbit" + ".dat")
outfile1 = open(outfile1_name, 'wb')
en_list_mod = []
dos_list_mod = []
i=0
for en in en_list:
dos = dos_list[i]
if en_min < en < en_max:
en_list_mod.append(en)
dos_list_mod.append(dos)
outfile1.write(' %16.6lf %9.6lf\n' % (en, dos))
i += 1
volume, center, width = get_distribution_moment(en_list_mod, dos_list_mod, (0,1,2))
print " %10d %13.3lf %16.6lf %16.6lf # %s" % (atom, volume, center, width, orbit + " orbital")
outfile2.write(" %10d %13.3lf %16.6lf %16.6lf # %s\n" % (atom, volume, center, width, orbit + " orbital"))
if str(atom) + str(orbit) == atom_list[0] + orbit_list[0]:
gpInFile.write ("plot '%s' w l\n" % outfile1_name)
else:
gpInFile.write ("replot '%s' w l\n" % outfile1_name)
##########
##### Post-precessing #####
outfile2.write('\n')
outfile1.close()
outfile2.close()
gpInFile.close()
if screen == '1': os.popen('gnuplot -persist gnuplot.in')
print ""
print " End\n"
##########
回复此楼
» 收录本帖的淘帖专辑推荐
精华网帖收集
计算-vasp
vasp
» 猜你喜欢
281求调剂(0805)
已经有8人回复
环境领域全国重点实验室招收博士1-2名
已经有3人回复
材料专硕306英一数二
已经有10人回复
301求调剂
已经有6人回复
一志愿天津大学化学工艺专业(081702)315分求调剂
已经有7人回复
302求调剂
已经有6人回复
26博士申请
已经有3人回复
268求调剂
已经有3人回复
311求调剂
已经有10人回复
被我言中:新模板不强调格式了,假专家开始管格式了
已经有4人回复
高级回复
» 本主题相关价值贴推荐,对您同样有帮助:
请大家帮一下忙,教教我怎样从P4VASP中导出Band的数据,然后再在Origin里面做出来。
已经有4人回复
求问关于分波态密度的问题
已经有17人回复
vasp计算表面态密度自旋向上和向下不对称
已经有21人回复
关于态密度分析成键,大家给点意见。
已经有19人回复
VASP态密度分析
已经有14人回复
怎么用p4vasp画能带图???求助
已经有4人回复
VASP计算中,分波态密度问题
已经有6人回复
求教:关于PDOS的处理
已经有16人回复
求助:关于通过态密度估算电子转移
已经有10人回复
关于态密度计算的一些问题
已经有4人回复
态密度问题求正解
已经有9人回复
P4VASP做pdos交流,及后续origin计算d-band center
已经有34人回复
DOS态密度作图
已经有4人回复
vasp计算含有磷原子结构的态密度时磷原子为什么还有d态
已经有14人回复
vasp计算,DOS图的分析,分波态密度的数据分析~·
已经有4人回复
从PROCAR中提取态密度的shell代码
已经有42人回复
VASP的AMIX,BMIX的设置居然对费米面以上的态密度有很大的影响!!!
已经有8人回复
用VASP计算Mg的PDOS的时候出现d电子是什么原因?
已经有6人回复
求处理vasp能带的小程序
已经有14人回复
求助pdos的问题
已经有10人回复
vasp计算结果处理态密度要用到的程序
已经有18人回复
【求助】vasp怎么计算PDOS?
已经有10人回复
【求助】VASP计算电子态密度
已经有34人回复
1楼
2015-06-29 19:36:30
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
512771485
金虫
(小有名气)
博士
应助: 5
(幼儿园)
金币: 1020.2
红花: 2
帖子: 271
在线: 66.7小时
虫号: 1895409
注册: 2012-07-16
性别: GG
专业: 金属材料的合金相、相变及
★
小木虫: 金币+0.5, 给个红包,谢谢回帖
我只想说,用不懂,一开始就是不停的输入
赞
一下
回复此楼
努力做研究,早些出成果
2楼
2015-07-16 17:27:04
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
相关版块跳转
第一性原理
量子化学
计算模拟
分子模拟
仿真模拟
程序语言
我要订阅楼主
hakuna
的主题更新
2
1/1
返回列表
如果回帖内容含有宣传信息,请如实选中。否则帐号将被全论坛禁言
普通表情
龙
兔
虎
猫
高级回复
(可上传附件)
百度网盘
|
360云盘
|
千易网盘
|
华为网盘
在新窗口页面中打开自己喜欢的网盘网站,将文件上传后,然后将下载链接复制到帖子内容中就可以了。
最具人气热帖推荐
[查看全部]
作者
回/看
最后发表
[
考研
]
一志愿天津大学化学工艺专业(081702)315分求调剂
+7
yangfz
2026-03-17
7/350
2026-03-17 23:57
by
星空星月
[
考研
]
296求调剂
+5
大口吃饭 身体健
2026-03-13
5/250
2026-03-17 21:05
by
不惑可乐
[
考研
]
293求调剂
+7
zjl的号
2026-03-16
12/600
2026-03-17 18:22
by
重科小霸王
[
考研
]
293求调剂
+6
世界首富
2026-03-11
6/300
2026-03-17 17:04
by
ruiyingmiao
[
考研
]
085600材料与化工
+4
安全上岸!
2026-03-16
4/200
2026-03-17 14:02
by
勇敢太监王公公
[
考研
]
材料工程专硕274一志愿211求调剂
+6
薛云鹏
2026-03-15
6/300
2026-03-17 11:05
by
学员h26Tkc
[
考研
]
289求调剂
+6
步川酷紫123
2026-03-11
6/300
2026-03-17 10:23
by
Sammy2
[
考研
]
11408 一志愿西电,277分求调剂
+3
zhouzhen654
2026-03-16
3/150
2026-03-17 07:03
by
laoshidan
[
考研
]
085600材料与化工 求调剂
+13
enenenhui
2026-03-13
14/700
2026-03-16 15:19
by
了了了了。。
[
考研
]
0703化学调剂 290分有科研经历,论文在投
+7
腻腻gk
2026-03-14
7/350
2026-03-16 10:12
by
houyaoxu
[
考研
]
0856求调剂
+3
刘梦微
2026-03-15
3/150
2026-03-16 10:00
by
houyaoxu
[
基金申请
]
有必要更换申报口吗
20
+3
fannyamoy
2026-03-11
3/150
2026-03-14 00:52
by
zhanghaozhu
[
考研
]
304求调剂
+7
7712b
2026-03-13
7/350
2026-03-13 21:42
by
peike
[
考研
]
求b区学校调剂
+3
周56
2026-03-11
3/150
2026-03-13 16:20
by
JourneyLucky
[
考研
]
材料专硕350 求调剂
+4
王金科
2026-03-12
4/200
2026-03-13 16:02
by
ruiyingmiao
[
考研
]
一志愿山大07化学 332分 四六级已过 本科山东双非 求调剂!
+3
不想理你
2026-03-12
3/150
2026-03-13 14:18
by
JourneyLucky
[
考研
]
070303一志愿西北大学学硕310找调剂
+3
d如愿上岸
2026-03-13
3/150
2026-03-13 10:43
by
houyaoxu
[
考研
]
270求调剂 085600材料与化工专硕
+3
YXCT
2026-03-11
3/150
2026-03-13 10:13
by
houyaoxu
[
考博
]
福州大学杨黄浩课题组招收2026年专业学位博士研究生,2026.03.20截止
+3
Xiangyu_ou
2026-03-12
3/150
2026-03-13 09:36
by
duanwu655
[
考博
]
26读博
+4
Rui135246
2026-03-12
10/500
2026-03-13 07:15
by
gaobiao
信息提示
关闭
请填处理意见
关闭
确定