24小时热门版块排行榜    

查看: 4273  |  回复: 18
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

fly_elephan

银虫 (小有名气)

[交流] vasp计算结果处理态密度要用到的程序 已有7人参与

在材料电学特性的研究中,能带和态密度是我们最关心的,下面的这个程序可以用于vasp计算结果的处理,可以分离出总态密度和分态密度,这个程序是我们研究所用了很久的,绝对没问题,有资源大家共享,欢迎下载。
#! /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


# Executables reside here
BIN=~/tzyy/AlP/swnt10


if [ $# -ne 0 ]; then
        echo "Usage: split_dos"
        exit 2
fi

# Script to split the DOSCAR file into the atomic
# projections labeled by atom number
dosfile=DOSCAR
outfile=OUTCAR
infile=INCAR


# Token for splitting the files
token=$(sed -n '6 p' $dosfile | awk '{print $1}')

# Number of points
nl=$(sed -n '6 p' $dosfile | awk '{print $3}')

# Number of atoms
natom=$(sed -n '1 p' $dosfile | awk '{print $1}')


# Get the Fermi level if the OUTCAR file is present,
# else we set it to zero.
if [ -a $outfile ]; then
    echo "The" $outfile "exists, we use it to get the Fermi level,"
    echo "the RWIGS tag and the number of spins."
    efermi=$(grep "E-fermi" $outfile | tail -1 | awk '{print $3}')
    echo "Fermi level:" $efermi
    nspin=$(grep "ISPIN" $outfile | tail -1 | awk '{print $3}')
    if [ $nspin -eq 2 ]; then
        echo "Spin polarized calculation"
    else
        echo "Unpolarized calculation"
    fi

# 2.a
# JMS 2/3/03 Modified to accept specification by LORBIT token.
#
    lorbit=$(grep "LORBIT" $outfile | tail -1 | awk '{print $3}')
    if [ $lorbit -ge 10 ]; then
        echo "LORBIT > 10"
        echo "WARNING: not completely test for vasp.4.*"
        echo "Use at your own risk. Please check results for consistency."
        form=1
    else
# 2.a
        rwigs=$(grep "RWIGS" $outfile | tail -1 | awk '{print $3}' | sed 's/\.//g')
        if [ $rwigs -eq -100 ]; then
            echo "RWIGS token not set"
            form=0
        else
            echo "RWIGS token set"
            form=1
        fi
# 2.a
    fi
# 2.a

else
    echo "The" $outfile "does not exist, we set the Fermi level to 0"
    echo "assume an unpolarized calculation, and RWIGS not set"
    form=0
    nspin=1
    efermi=0.0
fi

# If the outcar file is not present and you wish to set something by hand
# you should do it here. Uncomment the tokens below and set them by hand.

#efermi=2.255
#form=
#nspin=



# Get the atomic coordinates
$BIN/vp >| tmp.dat
tail -$natom tmp.dat | awk '{printf "%s %12.8f %12.8f %12.8f \n", "#", $2, $3, $4}' >| tmp.dat2


# Total is first DOS
if [ $form -eq 0 ]; then
i=0
else
i=0
fi


start=7
end=$((start+nl-1))
#echo $start $end
#exit 0
rm -f DOS0
if [ $form -eq 1 ]; then

    while [ $i -le $natom ]; do

            #echo $i $start $end

        if [ $i -gt 0 ]; then
            sed -n ''$i' p' tmp.dat2 >| DOS$i
        fi

        if [ $i -gt 0 ]; then

# Atomic projected DOS
            if [ $nspin -eq 2 ]; then
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f %12.8f %12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, -1*$3, $4, -1*$5, $6, -1*$7}' >> DOS$i
            else
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, $3, $4 }' >> DOS$i
            fi               

        else

# Total DOS
            if [ $nspin -eq 2 ]; then
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, -1*$3, $4, -1*$5 }' >> DOS$i
            else
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, $3 }' >> DOS$i
            fi

        fi

        start=$((end+2))
        end=$((start+nl-1))
        i=$((i+1))
    done

else

    while [ $i -le 0 ]; do

            #echo $i $start $end

        if [ $i -gt 0 ]; then
            sed -n ''$i' p' tmp.dat2 >| DOS$i
        fi

        if [ $i -gt 0 ]; then

# Atomic projected DOS
            if [ $nspin -eq 2 ]; then
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f %12.8f %12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, -1*$3, $4, -1*$5, $6, -1*$7}' >> DOS$i
            else
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, $3, $4 }' >> DOS$i
            fi               

        else

# Total DOS
            if [ $nspin -eq 2 ]; then
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, -1*$3, $4, -1*$5 }' >> DOS$i
            else
                sed -n ''$start','$end' p' $dosfile | awk '{printf "%12.8f %12.8f %12.8f \n", $1+(-1)*'$efermi', $2, $3 }' >> DOS$i
            fi

        fi

        start=$((end+2))
        end=$((start+nl-1))
        i=$((i+1))
    done

fi

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

gougou531

禁虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖
cenwanglai: 看手册。手册上是这么说的。至于为什么,我不知道。 2011-11-14 17:33:01
本帖内容被屏蔽

12楼2011-11-14 17:08:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 19 个回答

cenwanglai

荣誉版主 (知名作家)

老和山猥琐派九段

优秀版主

★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖
zzy870720z(金币+2): 谢谢指教 2011-05-30 15:23:30
这个程序vtstool code中有的。

你们组看起来是做单壁纳米管的,所以这个脚本可以一直用着。

如果含有f电子,就没有办法用了。LORBIT = 11和LORBIT = 10是有很大差异的,这个脚本需要修改才能用。

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

2楼2011-05-30 11:01:16
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

wujing110

禁虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖
本帖内容被屏蔽

3楼2011-11-14 11:21:03
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

cenwanglai

荣誉版主 (知名作家)

老和山猥琐派九段

优秀版主


小木虫(金币+0.5):给个红包,谢谢回帖
引用回帖:
3楼: Originally posted by wujing110 at 2011-11-14 11:21:03:
请问区长童鞋,LORBIT = 11时候应该怎么改呀?我设置LORBIT = 11,一共有19列数据,但是我现在只想要 s+,s-,p+,p-,d+,d-,那些角动量分量要一列一列加成总的么?

是啊。第四列到九列是p的三个分量及上下旋。三个奇数列相加的p+,三个偶数列相加的p-。后面10列是d分量及自旋。上旋和下旋分别相加。

可以用excel或者origin来做列的相加。
4楼2011-11-14 13:21:54
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 大佬帮着分析今年的评审意见?该课题连续申请了三年了,明年要不要换个方向。 100+3 cai-11138 2026-08-31 11/550 2026-09-06 20:49 by archvillain
[文学芳草园] 两块石头 +7 阿美_Lml888 2026-09-03 10/500 2026-09-06 20:08 by 阿美_Lml888
[考博] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 j5mmowWXNWxv 2026-09-05 4/200 2026-09-06 19:21 by eObJPa4gWmp6
[博后之家] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +3 j5mmowWXNWxv 2026-09-05 6/300 2026-09-06 18:41 by eObJPa4gWmp6
[硕博家园] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +4 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 18:21 by eObJPa4gWmp6
[公派出国] 售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急 +3 jPDp0sc2B7zQ 2026-09-05 4/200 2026-09-06 18:09 by eObJPa4gWmp6
[论文投稿] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +4 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 18:01 by eObJPa4gWmp6
[公派出国] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +3 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 17:21 by eObJPa4gWmp6
[教师之家] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +3 jPDp0sc2B7zQ 2026-09-05 9/450 2026-09-06 17:09 by eObJPa4gWmp6
[考研] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 jPDp0sc2B7zQ 2026-09-04 8/400 2026-09-06 17:09 by eObJPa4gWmp6
[博后之家] 广西大学-广州大学招聘博士后 欢迎广大优秀人才!!! +5 SCSIOyxguo 2026-09-03 8/400 2026-09-06 15:06 by 可爱小花朵
[教师之家] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 j5mmowWXNWxv 2026-09-05 3/150 2026-09-06 13:09 by eObJPa4gWmp6
[考博] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +3 j5mmowWXNWxv 2026-09-05 4/200 2026-09-06 12:29 by eObJPa4gWmp6
[基金申请] 科研人应该花精力去思考如何解决问题,而不是去凝练问题 +10 瞬息宇宙 2026-09-01 19/950 2026-09-06 11:15 by jiangxuan2004
[博后之家] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +3 jPDp0sc2B7zQ 2026-09-05 8/400 2026-09-06 11:09 by eObJPa4gWmp6
[论文投稿] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 jPDp0sc2B7zQ 2026-09-04 8/400 2026-09-06 11:00 by eObJPa4gWmp6
[考研] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +3 jPDp0sc2B7zQ 2026-09-05 4/200 2026-09-06 07:20 by E1iiBLMU2XnD
[基金申请] 面上没中,邀请各位路过的虫友分析一下分数 +12 jackleilei 2026-09-03 13/650 2026-09-05 18:10 by fireguard
[文学芳草园] 初秋的晨风 +4 阿美_Lml888 2026-09-04 6/300 2026-09-05 13:51 by 阿美_Lml888
[基金申请] 学科评审组评审是指会评吗? +6 瞬息宇宙 2026-08-31 9/450 2026-09-05 13:11 by haizai99
信息提示
请填处理意见