| 查看: 2304 | 回复: 3 | ||
sulisha_agrh新虫 (小有名气)
|
[求助]
vasp分割DOSCAR和PROCAR 救助 已有1人参与
|
在设置LORBIT =11的情况下得到的分波态密度数据中,第一列示能量第二列示s轨道的dos那么第三四五列示px-py-pz(因为PROCAR中貌似是按s--py-pz-px-dxy-dyz-dz2.....的顺序)吗用网上流传的split_dos.py处理,PORCAR用dos_procar.f处理,后附代码求大神罩我![]() #!/usr/bin/env python import numpy as np import ase ### READ DOSCAR ### def read_dosfile(): f = open("DOSCAR", 'r') lines = f.readlines() f.close() index = 0 natoms = int(lines[index].strip().split()[0]) index = 5 nedos = int(lines[index].strip().split()[2]) efermi = float(lines[index].strip().split()[3]) print natoms, nedos, efermi return lines, index, natoms, nedos, efermi ###READ POSCAR or CONTCAR and save pos def read_posfile(): from ase.io import read try: atoms = read('POSCAR') except IOError: print "[__main__]: Couldn't open input file POSCAR, atomic positions will not be written...\n" atoms = [] return atoms ### WRITE DOS0 CONTAINING TOTAL DOS ### def write_dos0(lines, index, nedos, efermi): fdos = open("DOS0", 'w') index +=1 line = lines[index+2].strip().split() ncols = int(len(line)) fdos.write('# %d \n' % (ncols)) for n in xrange(1,nedos): index +=1 e = float(lines[index].strip().split()[0]) e_f = e-efermi fdos.write('%15.8f ' % (e_f)) for col in xrange(1, ncols): dos = float(lines[index].strip().split()[col]) fdos.write('%15.8f ' % (dos)) col +=1 fdos.write('\n ') n +=1 return index ### LOOP OVER SETS OF DOS, NATOMS ### def write_nospin(lines, index, nedos, natoms, ncols, efermi): atoms = read_posfile() if len(atoms) < natoms: pos = np.zeros((natoms, 3)) else: pos = atoms.get_positions() for i in xrange(1,natoms+1): si = str(i) ## OPEN DOSi FOR WRITING ## fdos = open("DOS"+si, 'w') index +=2 ia = i -1 fdos.write('# %d \n' % (ncols)) fdos.write('# %15.8f %15.8f %15.8f \n' % (pos[ia,0], pos[ia,1], pos[ia,2])) ### LOOP OVER NEDOS ### for n in xrange(1,nedos): index +=1 e = float(lines[index].strip().split()[0]) e_f = e-efermi fdos.write('%15.8f ' % (e_f)) for col in xrange(1, ncols): dos = float(lines[index].strip().split()[col]) fdos.write('%15.8f ' % (dos)) col +=1 fdos.write('\n ') n +=1 i+=1 fdos.close() def write_spin(lines, index, nedos, natoms, ncols, efermi): #pos=[] atoms = read_posfile() if len(atoms) < natoms: pos = np.zeros((natoms, 3)) else: pos = atoms.get_positions() nsites = (ncols -1)/2 for i in xrange(1,natoms+1): si = str(i) ## OPEN DOSi FOR WRITING ## fdos = open("DOS"+si, 'w') index +=2 ia = i-1 fdos.write('# %d \n' % (ncols)) fdos.write('# %15.8f %15.8f %15.8f \n' % (pos[ia,0], pos[ia,1], pos[ia,2])) ### LOOP OVER NEDOS ### for n in xrange(1,nedos): index +=1 e = float(lines[index].strip().split()[0]) e_f = e-efermi fdos.write('%15.8f ' % (e_f)) for col in xrange(1, nsites): dos_up = float(lines[index].strip().split()[col]) dos_down = float(lines[index].strip().split()[col+1])*-1 fdos.write('%15.8f %15.8f ' % (dos_up, dos_down)) col +=1 fdos.write('\n ') n +=1 i+=1 fdos.close() # if __name__ == '__main__': import sys import os import datetime import time import optparse lines, index, natoms, nedos, efermi = read_dosfile() index = write_dos0(lines, index, nedos, efermi) ##Test if there a spin calculation was performed ## line = lines[index+2].strip().split() ncols = int(len(line)) if ncols==7 or ncols==19 or ncols==9 or ncols==33: write_spin(lines, index, nedos, natoms, ncols, efermi) is_spin=True else: write_nospin(lines, index, nedos, natoms, ncols, efermi) is_spin=False print "Spin unrestricted calculation: ", is_spin #if is_spin: # write_spin(lines, index, ncols, natoms, nedos, efermi) #else: # write_nospin(lines, index, ncols, natoms, nedos, efermi) |
» 猜你喜欢
假如你的研究生提出不合理要求
已经有8人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
实验室接单子
已经有4人回复
全日制(定向)博士
已经有4人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
» 本主题相关价值贴推荐,对您同样有帮助:
求助,画DOS图
已经有12人回复
用dos_procar处理dos数据不准
已经有3人回复
PROCAR里数据是什么意思
已经有8人回复
如何计算LDOS和PDOS
已经有4人回复
各位大侠进来看一下哇,计算石墨烯态密度时出现警告,是什么意思?
已经有13人回复
请教split_dos处理DOS的相关问题
已经有4人回复
py,pz,px,dxy,dyz,dz2,dxz,dx2
已经有7人回复
从PROCAR中提取态密度的shell代码
已经有42人回复
在用Vasp计算时,遇到的问题
已经有8人回复
vasp计算石墨烯能带时,dirac点是打开的,带隙不为零,与静态的DOSCAR也对不上
已经有10人回复
用vasp计算PDOS的问题
已经有5人回复
求助pdos的问题
已经有10人回复
DOSCAR画态密度
已经有16人回复
VASP计算:LORBIT设置出现问题
已经有5人回复
计算自旋轨道耦合DOSCAR中数据意义
已经有12人回复
vasp计算结果处理态密度要用到的程序
已经有18人回复
【求助】DOSCAR
已经有14人回复
【求助完毕】集群上用vasp计算ELF有ELFCAR而没有DOSCAR是啥问题?
已经有15人回复
【求助】vasp怎么计算PDOS?
已经有10人回复
【求助成功】怎么使用DOSCAR画出DOS图形
已经有23人回复
【求助】请教一下PROCAR的格式
已经有11人回复
sulisha_agrh
新虫 (小有名气)
- 应助: 2 (幼儿园)
- 金币: 30.4
- 散金: 324
- 红花: 1
- 帖子: 88
- 在线: 273.8小时
- 虫号: 3638590
- 注册: 2015-01-10
- 性别: MM
- 专业: 凝聚态物性I:结构、力学和
|
上边的是split_dos.py代码下边贡献一个split_dos(需要vp)代码 #!/bin/ksh # Script to break the VASP DOSCAR file into segments for # each atomic site. # JMS NRL 5/0/02 # Modified to also align the Fermi level from the ground state # to E=0.0 # JMS NRL 6/19/02 # Modified to be compatible to LORBIT=11 # weibingchen.thu@gmail.com # 2009.11.1 # Executables reside here #BIN=~/bin/vtstscripts # GH: replace this so that it looks for vp in the same directory as this script EXE=$0 BIN=${EXE%/*} if [ $# -ne 0 ]; then "split_dos" 230L, 5859C |
2楼2015-04-29 18:43:30
huterx
金虫 (小有名气)
- 应助: 9 (幼儿园)
- 金币: 1485.5
- 散金: 300
- 红花: 2
- 帖子: 193
- 在线: 432.8小时
- 虫号: 1380155
- 注册: 2011-08-26
- 专业: 凝聚态物性 II :电子结构
3楼2015-04-30 07:58:55
sulisha_agrh
新虫 (小有名气)
- 应助: 2 (幼儿园)
- 金币: 30.4
- 散金: 324
- 红花: 1
- 帖子: 88
- 在线: 273.8小时
- 虫号: 3638590
- 注册: 2015-01-10
- 性别: MM
- 专业: 凝聚态物性I:结构、力学和
4楼2015-04-30 19:21:56













回复此楼