In this tutorial, we will take the example of Aluminum Al. We need the cell file and a script to create the param file with different values of cutoff energy.
Al.cell
%BLOCK LATTICE_ABC
2.86 2.86 2.86
60 60 60
%ENDBLOCK LATTICE_ABC
%BLOCK POSITIONS_ABS
Al 0 0 0
%ENDBLOCK POSITIONS_ABS
%block species_pot
NCP19
%endblock species_pot
kpoint_mp_grid 12 12 12
symmetry_generatecutoff-conv.sh
#!/bin/sh
NAME=Al
rm -f ${NAME}_CUTOFF.dat
for CUTOFF in 400 600 800 1000 1200 1400 1600 1800 2000
do
cat > ${NAME}.param << EOF
task SinglePoint ! The TASK keyword instructs CASTEP what to do
xc_functional LDA_PW ! Which exchange-correlation functional to use.
cut_off_energy $CUTOFF !
opt_strategy speed ! Choose algorithms for best speed
fine_grid_scale = 2
EOF
echo ${NAME}_${CUTOFF}
mpirun -np 4 castep.mpi ${NAME}
done
#analyse the runs and extract the values we need into a single results file
grep 'cut-off energy for mixing ' ${NAME}.castep | awk '{print $6}' > C
grep 'Final energy' ${NAME}.castep | awk '{print $5}' > E
paste C E >> ${NAME}_CUTOFF.dat
rm C E
echo ' '
echo 'finished with results in '${NAME}_CUTOFF.dat
Execution
$ sh cutoff-conv.shAl_400
Al_600
Al_800
Al_1000
Al_1200
Al_1400
Al_1600
Al_1800
Al_2000
finished with results in Al_CUTOFF.dat
The content of the file Al_CUTOFF.dat is :
400.0 -192.7083844767
600.0 -192.7105862983
800.0 -192.7123204974
1000. -192.7132612141
1200. -192.7142051707
1400. -192.7144481942
1600. -192.7149716189
1800. -192.7151728479
2000. -192.7157828622
Plotting
To plot the results we need to use the following python script:
cutoff-conv.py
import matplotlib.pyplot as plt
from matplotlib import rcParamsDefault
import numpy as np
plt.rcParams["figure.dpi"]=150
plt.rcParams["figure.facecolor"]="white"
x, y = np.loadtxt('Al_CUTOFF.dat', delimiter=' ', unpack=True)
plt.plot(x, y, "o-", markersize=5, label='Etot vs cut_off_energy')
plt.xlabel('cut_off_energy (eV)')
plt.ylabel('Etot (eV)')
plt.legend(frameon=False)
plt.show()Before running the script we need to install matplotlib tool for plotting
$ sudo apt-get install python3-matplotlib
$ python cutoff-conv.py
We get the following picture

0 Comments