-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc2_u.sh
152 lines (136 loc) · 4.81 KB
/
calc2_u.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash/
#只适用于单金属氧化物
#使用前请详细阅读vasp手册https://www.vasp.at/wiki/index.php/Calculate_U_for_LSDA%2BU
#---------------------------------------------------------------------------------
#手动指定参数
#---------------------------------------------------------------------------------
#指定加U电子类型(s,p,d)
l=2
#---------------------------------------------------------------------------------
#运行内容
#---------------------------------------------------------------------------------
#创建三个目录分别用于dft计算,非自洽响应,自洽响应计算
dir=(dft nsc sc)
for i in ${dir[*]}
do
#不存在时才创建该文件夹
if [ ! -d $i ]; then
mkdir $i
fi
done
#将vasp计算相关文件复制到三个文件夹下
echo ./dft/ ./nsc/ ./sc/ | xargs -n 1 cp -v ./{POSCAR,POTCAR,KPOINTS,vasp_mpi.sh,INCAR.DFT}
#判断dft_groundstate是否计算完成,完成后开始后续计算,否则提交dft_groundstate计算
dft_outcar=./dft/OUTCAR
dft_chgcar=./dft/CHGCAR
dft_wavecar=./dft/WAVECAR
if [ ! -f $dft_outcar ] || [ ! -f $dft_chgcar ] || [ ! -f $dft_wavecar ]; then
cp ./dft/INCAR.DFT ./dft/INCAR
rm -f ./dft/CHGCAR ./dft/WAVECAR
cd ./dft
echo "dft file missing or not submitted yet"
bsub < vasp_mpi.sh
echo "dft job submitted"
cd ../
else
if [ `grep -c "General timing and accounting informations for this job" ./dft/OUTCAR ` -ne '1' ];then
cp ./dft/INCAR.DFT ./dft/INCAR
rm -f ./dft/CHGCAR ./dft/WAVECAR
cd ./dft
echo "dft job not finished"
bsub < vasp_mpi.sh
echo "dft job resubmitted"
cd ../
else
#dft——groundstate计算结果保存
cp ./dft/OUTCAR ./dft/OUTCAR.0
cp ./dft/OSZICAR ./dft/OSZICAR.0
cp ./dft/WAVECAR ./dft/WAVECAR.0
cp ./dft/CHGCAR ./dft/CHGCAR.0
#DFT计算完成后在一系列LDAUU和LDAUJ取值下进行非自洽响应计算和自洽响应计算
list=$(seq -0.20 0.05 0.20) #这个值的范围不同的人取的不同,主要是用作微扰项,因此越小可能越准确???
#非自洽响应计算
for v in ${list[*]}
do
a=./nsc/_$v
if [ ! -d $a ]; then
mkdir $a
echo $a | xargs -n 1 cp -v ./nsc/{POSCAR,POTCAR,KPOINTS,vasp_mpi.sh,INCAR.DFT}
fi
nsc_outcar=$a/OUTCAR
nsc_wavecar=$a/CHGCAR
nsc_chgcar=$a/WAVECAR
cp $a/INCAR.DFT $a/INCAR
cat >> $a/INCAR <<!
ICHARG = 11
LDAU = .TRUE.
LDAUTYPE = 3 #The "LDAUTYPE = 1 and 2" are able to do LSAD+U (spin polarized) but "LDAUTYPE = 4" can just do LDA+U; LDAUTYPE = 3 is a hidden feature of vasp.5
LDAUL = -1 $l -1 -1
LDAUU = 0.00 $v 0.00 0.00 #for LDAUTYPE=3, LDAUU and LDAUJ denote the shifts acting on the up and down electrons, respectively
LDAUJ = 0.00 $v 0.00 0.00 #LDAUU and LDAUJ should be identical
LDAUPRINT = 2
!
if [ ! -f $nsc_outcar ] || [ ! -f $nsc_chgcar ] || [ ! -f $nsc_wavecar ]; then
rm -f $a/CHGCAR $a/WAVECAR
cp ./dft/WAVECAR.0 $a/WAVECAR
cp ./dft/CHGCAR.0 $a/CHGCAR
echo "nsc file missing or not submitted yet"
cd $a/
bsub < vasp_mpi.sh
echo "non_selfconsistent job submitted"
cd ../../
else
if [ `grep -c "General timing and accounting informations for this job" $a/OUTCAR ` -ne '1' ];then
rm -f $a/CHGCAR $a/WAVECAR
cp ./dft/WAVECAR.0 $a/WAVECAR
cp ./dft/CHGCAR.0 $a/CHGCAR
echo "nsc job not finished yet"
cd $a/
bsub < vasp_mpi.sh
echo "nsc job resubmitted"
cd ../../
else
#非自洽响应完成后提交自洽响应计算
b=./sc/_$v
if [ ! -d $b ]; then
mkdir $b
echo $b | xargs -n 1 cp -v ./sc/{POSCAR,POTCAR,KPOINTS,vasp_mpi.sh,INCAR.DFT}
fi
sc_outcar=$b/OUTCAR
sc_wavecar=$b/CHGCAR
sc_chgcar=$b/WAVECAR
cp $b/INCAR.DFT $b/INCAR
cat >> $b/INCAR <<!
LDAU = .TRUE.
LDAUTYPE = 3
LDAUL = -1 $l -1 -1
LDAUU = 0.00 $v 0.00 0.00
LDAUJ = 0.00 $v 0.00 0.00
LDAUPRINT = 2
!
if [ ! -f $sc_outcar ] || [ ! -f $sc_chgcar ] || [ ! -f $sc_wavecar ]; then
rm -f $b/CHGCAR $b/WAVECAR
cp ./dft/WAVECAR.0 $b/WAVECAR
cp ./dft/CHGCAR.0 $b/CHGCAR
echo "sc file missing or not submitted yet"
cd $b/
bsub < vasp_mpi.sh
echo "sc job submitted"
cd ../../
else
if [ `grep -c "General timing and accounting informations for this job" $b/OUTCAR ` -ne '1' ];then
rm -f $b/CHGCAR $b/WAVECAR
cp ./dft/WAVECAR.0 $b/WAVECAR
cp ./dft/CHGCAR.0 $b/CHGCAR
echo "sc job not finished yet"
cd $b/
bsub < vasp_mpi.sh
echo "sc job resubmitted"
cd ../../
fi
fi
fi
fi
done
fi
fi