-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeometry_optimisation_cubic_profess_serial
More file actions
executable file
·85 lines (53 loc) · 2.33 KB
/
geometry_optimisation_cubic_profess_serial
File metadata and controls
executable file
·85 lines (53 loc) · 2.33 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/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 *.inpt`
fileroot=`python3 -c "print('$name'.split('.')[0])"`
if [ ! -f energy.txt ]; then
echo "# Lattice Parameter [A]; Volume [A^3]; Energy [eV]" > energy.txt
fi
counter=0
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}.inpt lattice_parameter_$lattice_param
cp *.usp* lattice_parameter_$lattice_param
cp *pot* lattice_parameter_$lattice_param
sed "s/lattice_parameter/$lattice_param/g" ${fileroot}.ion > lattice_parameter_$lattice_param/${fileroot}.ion
cd lattice_parameter_$lattice_param
echo "Now running PROFESS 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
PROFESS $fileroot > profess.run &
cd ..
counter=$((counter+1))
fi
lattice_param=`echo $lattice_param + $step | bc`
if [ $counter -eq $NCORES ]; then
wait
# all jobs are done; next num_cores jobs can be started
counter=0
fi
done
running_jobs=`jobs -r | tail -1`
# as long as this is not empty, there are running jobs
while [ `python3 -c "print(int(not '$running_jobs'))"` -eq 0 ]; do
# OFDFT jobs are quite fast, so it makes sense to check frequently
running_jobs=`jobs -r | tail -1`
done
# do the same loop again to read output data
lattice_param=$1 # reset to initial lattice parameter
while [ `python3 -c "print(int($lattice_param <= $max))"` -eq 1 ]; do
cd lattice_parameter_$lattice_param
energy=`awk '{IGNORECASE=1} /total energy/ {print $5}' ${fileroot}.out`
volume=`awk '/Cell Volume/ {print $4}' ${fileroot}.out`
echo $lattice_param $volume $energy >> ../energy.txt
cd ..
lattice_param=`echo $lattice_param + $step | bc`
done
c2x --int lattice_parameter_${1}/${fileroot}.ion
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