-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcoul_2_run.sh
82 lines (73 loc) · 2.23 KB
/
coul_2_run.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
#!/usr/bin/env bash
cwd=$PWD
source ~/.myshrc
echo 'assume the current folder has PBE input files'
echo 'Before this, you should edit POSCAR by hand to single out one magnetic atom. '
echo 'Do the entire procedure for every non-identical magnetic atoms'
if [ -z $1 ]; then
echo -e '\nError! Should enter a string like n d f n, each for one element in POSCAR'
exit
else
echo 'The arguments are ' $@
fin=coul_1_in.sh
fout=coul_2_out.sh
echo -e 'rm -r coul_reference/ nsc_* sc_*\nsh $SCRIPT/coul_2*' $@ > $fin
chmod u+x $fin
args=( $@ )
args=( ${args[@]/n} )
echo -e 'python $SCRIPT/coul_3* ' $args '\n## put atom index starting from zero'> $fout
chmod u+x $fout
fi
### step 1:
fol1=coul_reference
mkdir $fol1
vaspcp $cwd $fol1
cd $cwd/$fol1
python $SCRIPT/coul_1_editINCAR.py 0 0.0 $@
touch CHGCAR
touch WAVECAR
touch CONTCAR
cd $cwd
## step 2:
#shifts=(-0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 -0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 )
shifts=(0.0 -0.2 -0.15 -0.1 -0.05 -0.02 0.02 0.05 0.1 0.15 0.2 )
total_num=`expr ${#shifts[@]} - 1 `
for i in $(seq 0 $total_num)
#for i in {$begin_num..$total_num}
do
begin_num=00000
zero_num=`expr ${#total_num} - ${#i} `
begin_num=${begin_num:1:${zero_num}}
magn=${shifts[$i]}
echo $begin_num$i poten_shift=$magn
## create folders for each
fola=sc_$begin_num${i}_coul
folb=nsc_$begin_num${i}_coul
mkdir $fola $folb
### edit INCAR for each
## self-consistent
cd $cwd/$fola
cp $cwd/INCAR $cwd/$fola
ln -sf ../$fol1/CONTCAR POSCAR
ln -sf ../$fol1/POTCAR
ln -sf ../$fol1/KPOINTS
ln -sf ../${fol1}/CHGCAR
ln -sf ../${fol1}/WAVECAR
python $SCRIPT/coul_1_editINCAR.py 1 $magn $@
## non-self-consistent
cd $cwd/$folb
cp $cwd/INCAR $cwd/$folb
ln -sf ../$fol1/CONTCAR POSCAR
ln -sf ../$fol1/POTCAR
ln -sf ../$fol1/KPOINTS
ln -sf ../${fol1}/CHGCAR
ln -sf ../${fol1}/WAVECAR
python $SCRIPT/coul_1_editINCAR.py 2 $magn $@
## get out of subfolders
cd $cwd
done
echo -e 'Submit by:
rotate.sh begin=coul run
rotate.sh begin=sc run
rotate.sh begin=nsc run'
echo 'Remember to run coul_reference/ multiple times, make sure it converges by one ionic step'