-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqe_convergence_test_ecutwfc
More file actions
executable file
·42 lines (26 loc) · 1 KB
/
qe_convergence_test_ecutwfc
File metadata and controls
executable file
·42 lines (26 loc) · 1 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 file pw.in for a QE run
first_energy=$1
final_energy=$2
energy_step=$3
ry_to_ev=13.605698066
if [ ! -f ecutwfc.txt ]; then
echo "Cutoff Energy [Ry]; Total calculated energy per atom [eV]; Time" >> ecutwfc.txt
fi
for cutoff in `seq $first_energy $energy_step $final_energy`; do
mkdir ecutwfc_${cutoff}
cp *upf ecutwfc_${cutoff}
cp *UPF ecutwfc_${cutoff}
sed "s/XYZ/${cutoff}/gi" pw.in > ecutwfc_${cutoff}/pw.in
cd ecutwfc_${cutoff}
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 $cutoff $energy_per_atom $time >> ../ecutwfc.txt
rm -r *.save
cd ..
done