The self-consistent field (SCF) calculations should be tested with respect to several parameters which determine precision of the results. The most important are (i) the number of k-points (very important in case of the metallic systems) and (ii) energy cutoff that controls size of the Hamiltonian basis. In this exercise we consider Aluminium as it was in previous exercise 02.
Run series of SCF calculations for Aluminium for different number of k-point mesh considering 10x10x10, 12x12x12, … Change appropriately the input file
K_POINTS (automatic)
8 8 8 0 0 0
Extract the total energy of the system and plot it as a function of the k-point mesh size. Estimate number of k-point mesh size needed to obtain absolute error in total energy in consecutive steps below 1 mRy.
To automatize your work you can write a simple bash script:
#!/bin/bash
function gener_input()
{
cat << THEEND
&control
calculation = 'scf'
restart_mode = 'from_scratch',
pseudo_dir = './',
outdir = './',
prefix = 'al'
tprnfor = .true.
tstress = .true.
/
&system
ibrav = 2, celldm(1) = 7.652446, nat = 1, ntyp = 1,
ecutwfc = 15.0, occupations = 'smearing',
smearing = 'marzari-vanderbilt', degauss = 0.05
/
&electrons
diagonalization = 'david'
mixing_beta = 0.7
/
ATOMIC_SPECIES
Al 26.98 Al.pz-vbc.UPF
ATOMIC_POSITIONS
Al 0.0 0.0 0.0
K_POINTS (automatic)
$1 $1 $1 0 0 0
THEEND
}
for case in 8 10 12 14 16 18 20
do
gener_input $case > pw-scf_$case.in
pw.x -input pw-scf_$case.in > out.pw-scf_$case
echo "DONE $case"
done
To plot the results you can use gnuplot
with the script:
#set term png large font "Helvetica,12" #uncomment to save the png figure
set xlabel "k-point mesh size"
set ylabel "Total energy [Ry]"
set title "Aluminium (FCC #225) ecutwfc = 15 (Al.pz-vbc.UPF)"
plot "< grep ! out.pw-scf_* | sed 's/out.pw-scf_/ /g' | sed 's/:! total energy =//g' | sort -n -k1" t"" w lp pt 6
The plot should look like
For k-point mesh size 12x12x12 run series of SCF calculations considering different energy cutoff in the input file, considering values 20, 25, 30, 35, …
ecutwfc = 15.0,
Plot the total energy as a function of the ecutwfc
parameter.
Discuss or eventually plot a graph of time needed to perform calculations in Task 01 and 02. Hint: see end of the output files.
Note: Another tools to automatize the series of calculations see pwtk toolkit or automated infrastructure AiiDa.
Martin Gmitra :: martin.gmitra@upjs.sk
This work is licensed under a Creative Commons Attribution 4.0 International License.