-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqe_convergence_test_k_points
More file actions
executable file
·42 lines (26 loc) · 1.08 KB
/
Copy pathqe_convergence_test_k_points
File metadata and controls
executable file
·42 lines (26 loc) · 1.08 KB
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
#!/bin/bash
# run in directory containing input files for a CASTEP run
first_kpoint=$1
final_kpoint=$2
kpoint_step=$3
ry_to_ev=13.605698066
if [ ! -f k_points.txt ]; then
echo "K-point grid; Total calculated energy per atom [eV]; Time [s]" >> k_points.txt
fi
for kpoint in `seq $first_kpoint $kpoint_step $final_kpoint`; do
mkdir ${kpoint}_k_points
cp *upf ${kpoint}_k_points
cp *UPF ${kpoint}_k_points
sed "s/AAA/${kpoint}/gi" pw.in > ${kpoint}_k_points/pw.in
cd ${kpoint}_k_points
mpirun -np $NCORES pw.x -i pw.in > pw.out
energy=`awk '/total energy/ {print $5}' pw.out | tail -2 | head -1`
time=`awk '/WALL/ {print $5}' pw.out | tail -1`
# determine number of atoms per UC in order to calculate the total energy per atom
natoms_raw=`awk '{IGNORECASE=1}; {FS="="}; /nat/ {print $2}' pw.in`
natoms=`echo ${natoms_raw%,*}`
energy_per_atom=`python3 -c "print(float('$energy')*float('$ry_to_ev')/float('$natoms'))"`
echo "$kpoint x $kpoint x $kpoint" $energy_per_atom $time >> ../k_points.txt
rm -r *.save
cd ..
done