-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAFLOWQE
144 lines (121 loc) · 4.51 KB
/
AFLOWQE
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
#!/bin/bash
#
# Created on Mon Mar 25 06:23:16 IST 2019
#
#----------------------------------------------------------#
# Import Configuration file #
#----------------------------------------------------------#
#
#
#----------------------------------------------------------#
# Read input arguments and export them to variables #
#----------------------------------------------------------#
#
INP_POSCAR=$1
PSEUDO_STRING=$2
TEMPLATE_NAME=$3
SYS_NAME=$4
export INP_POSCAR
export PSEUDO_STRING
export TEMPLATE_NAME
export SYS_NAME
export AFLOW_PATH
#
export numargs=$#
banner(){
echo "+--------------------------------------------------------+"
echo "| AFLOWQE -v 1.0.0 |"
echo "+--------------------------------------------------------+"
}
check_args() {
if [ $numargs -ne 4 ] ; then
echo "Usage :: AFLOWQE [INP_POSCAR] [PSEUDO_STRING] [TEMPLATE_NAME] [SYS_NAME]"
exit 1;
fi
if test ! -f $INP_POSCAR ; then
echo "FATAL ERROR :: $INP_POSCAR not found"
exit 1;
fi
if test ! -f $TEMPLATE_NAME ; then
echo "FATAL ERROR :: $TEMPLATE_NAME not found"
exit 1;
fi
if test ! -d qe_inp ; then
mkdir qe_inp
fi
if test ! -d aflowqe_files ; then
mkdir aflowqe_files
fi
}
aflow_qe_init() {
# Generates all files
#
#----------------------------------------------------------#
# Read input POSCAR and rewrite to AFLOW STD POSCAR format #
#----------------------------------------------------------#
#
printf "Generating AFLOW customized POSCAR from stdin ..... "
aflow --poscar < $INP_POSCAR > $SYS_NAME.aflow.std_poscar
printf "Done\n"
#
#--------------------------------------------------------#
# Convert aflow.std_poscar to POSCAR (CONVENTIONAL CELL) #
#--------------------------------------------------------#
# aflow --std_conv | --standard_conventional | --sconv | --sc < POSCAR
#
printf "Generating AFLOW CONVENTIONAL POSCAR ..... "
#$AFLOW_PATH/aflow --std_conv < $SYS_NAME.aflow.std_poscar > $SYS_NAME.aflow.std_conv_poscar
aflow --poscar < $SYS_NAME.aflow.std_poscar > $SYS_NAME.aflow.std_conv_poscar
#
#-----------------------------------------------------#
# Convert aflow.std_poscar to POSCAR (PRIMITIVE CELL) #
#-----------------------------------------------------#
# aflow --std_prim | --standard_primitive | --sprim | --sp < POSCAR
printf "Done\n"
printf "Generating AFLOW PRIMITIVE POSCAR ..... "
#aflow --std_prim < $SYS_NAME.aflow.std_poscar > $SYS_NAME.aflow.std_prim_poscar
aflow --prim < $SYS_NAME.aflow.std_poscar > $SYS_NAME.aflow.std_prim_poscar
printf "Done\n"
#
#
#---------------------------------------------------------------#
# Convert aflow.std_conv_poscar to QE INPUT (CONVENTIONAL CELL) #
#---------------------------------------------------------------#
# aflow --std_prim | --standard_primitive | --sprim | --sp < POSCAR
printf "Generating QE CONVENTIONAL FILE ..... "
aflow --qe < $SYS_NAME.aflow.std_conv_poscar > $SYS_NAME.qe.std_conv
printf "Done\n"
#
#-------------------------------------------------------#
# Convert aflow.std_poscar to QE INPUT (PRIMITIVE CELL) #
#-------------------------------------------------------#
# aflow --std_prim | --standard_primitive | --sprim | --sp < POSCAR
printf "Generating QE PRIMITIVE FILE ..... "
aflow --qe < $SYS_NAME.aflow.std_prim_poscar > $SYS_NAME.qe.std_prim
printf "Done\n"
#
}
tweak_qe_inp (){
INPFILE=$1
export ibrav=`grep -i ibrav $INPFILE |gawk -F= '{print \$2}'| gawk -F, '{print \$1}'`
export nat=`grep -i nat $INPFILE |gawk -F= '{print \$2}'| gawk -F, '{print \$1}'`
export ntyp=`grep -i ntyp $INPFILE |gawk -F= '{print \$2}'| gawk '{print \$1}'`
export INPFILE
echo ""
sed -e "s/AAAAA/$SYS_NAME/g;s/BBBBB/$ibrav/g;s/CCCCC/$nat/g;s/DDDDD/$ntyp/g;" $TEMPLATE_NAME
atoms.py $PSEUDO_STRING `sed -n 6p $SYS_NAME.aflow.std_poscar`
echo ""
grep "ATOMIC_POSITIONS" -A $nat $INPFILE
echo ""
grep "CELL_PARAMETERS" -A 3 $INPFILE
echo ""
echo "K_POINTS {automatic}"
}
banner
check_args
aflow_qe_init
tweak_qe_inp $SYS_NAME.qe.std_prim > qe_inp/$SYS_NAME.qe.std_prim.in
tweak_qe_inp $SYS_NAME.qe.std_conv > qe_inp/$SYS_NAME.qe.std_conv.in
echo "`aflow --kpoints=1000 < $SYS_NAME.aflow.std_conv_poscar|tail -n 1|gawk -F= {'print $2'}` 0 0 0" >> qe_inp/$SYS_NAME.qe.std_conv.in
echo "`aflow --kpoints=1000 < $SYS_NAME.aflow.std_prim_poscar|tail -n 1|gawk -F= {'print $2'}` 0 0 0" >> qe_inp/$SYS_NAME.qe.std_prim.in
mv *.aflow.* *.qe.* ./aflowqe_files