-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeometry_optimisation_cubic_qe
More file actions
executable file
·56 lines (34 loc) · 1.62 KB
/
Copy pathgeometry_optimisation_cubic_qe
File metadata and controls
executable file
·56 lines (34 loc) · 1.62 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# calculation must be set up to carry out a simple SCF cycle
lattice_param=$1 #the initial lattice parameter
max=$2 #the final lattice parameter
step=$3 #by how much the lattice parameter is incremented
ry_to_ev=13.605698066
bohr_to_angstrom=0.52917721067
if [ ! -f energy.txt ]; then
echo "# Lattice Parameter [Bohr]; Volume [A^3]; Energy [eV]" > energy.txt
fi
while [ `python3 -c "print(int($lattice_param <= $max))"` -eq 1 ]; do
if [ ! -d lattice_parameter_$lattice_param ]; then
mkdir lattice_parameter_$lattice_param
sed "s/lattice_parameter/$lattice_param/g" pw.in > lattice_parameter_$lattice_param/pw.in
cp *upf lattice_parameter_$lattice_param
cp *UPF lattice_parameter_$lattice_param
cd lattice_parameter_$lattice_param
echo "Now running Quantum Espresso pw.x at lattice parameter $lattice_param" # I think since "all output is appended to nohup.out", this should write it into the same file as all the other output
mpirun -np $NCORES pw.x -i pw.in > pw.out
energy=`awk '/total energy/ {print $5}' pw.out | tail -2 | head -1`
energy=`python3 -c "print(float('$energy')*float('$ry_to_ev'))"`
volume=`awk '/unit-cell volume/ {print $4}' pw.out`
volume=`python3 -c "print(float('$volume')*float('$bohr_to_angstrom')**3)"`
echo $lattice_param $volume $energy >> ../energy.txt
rm -r *.save
cd ..
fi
lattice_param=`echo $lattice_param + $step | bc`
done
c2x --int lattice_parameter_${1}/pw.in
space_group=`cat nohup.out | tail -1 | awk '{print $NF}'`
cp ~/bin/python_scripts/birch_murnaghan_eos_fit.py .
python3 birch_murnaghan_eos_fit.py $space_group
gnuplot energy_volume.gnu