-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeometry_optimisation_cubic_castep
More file actions
executable file
·69 lines (44 loc) · 2.35 KB
/
geometry_optimisation_cubic_castep
File metadata and controls
executable file
·69 lines (44 loc) · 2.35 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
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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
# auto-determine fileroot
name=`ls *.param`
fileroot=${name%.param}
if [ ! -f energy.txt ]; then
echo "# Lattice Parameter [A]; 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
cp ${fileroot}.param lattice_parameter_$lattice_param
cp *.usp* lattice_parameter_$lattice_param
cp *pot* lattice_parameter_$lattice_param
sed "s/lattice_parameter/$lattice_param/g" ${fileroot}.cell > lattice_parameter_$lattice_param/${fileroot}.cell
cd lattice_parameter_$lattice_param
echo "Now running CASTEP 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 -n $NCORES castep.mpi $fileroot
# the output format for the energy is different between SOC and not SOC calculations, so here we determine which it is
is_soc=`awk '/spin-orbit coupling/ {print $4}' ${fileroot}.castep`
# the same goes for non-metallic (fix_occupancy=true) and metallic calculations
is_non_metallic=`awk '/non-metallic/ {print}' ${fileroot}.castep`
# this will be empty if the calculations is metallic
if [ $is_soc == "off" ] && [ `python3 -c "print(int(not '$is_non_metallic'))"` -eq 1 ] || [ $is_soc == "on" ]; then
# calculation is metallic and not spin-orbit coupled
energy=`awk '/Final energy/ {print $5}' ${fileroot}.castep`
else
energy=`awk '/Final energy/ {print $4}' ${fileroot}.castep`
fi
volume=`awk '/Current cell volume/ {print $5}' ${fileroot}.castep`
echo $lattice_param $volume $energy >> ../energy.txt
rm ${fileroot}.check ${fileroot}.castep_bin ${fileroot}.bands
cd ..
fi
lattice_param=`echo $lattice_param + $step | bc`
done
c2x --int lattice_parameter_${1}/${fileroot}.cell
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