To download and install the PWTK package click on the following link:
How to download and install PWTK package
PWTK allows (re)assigning namelist
variables or the content of cards on the fly, which is useful when
performing multiple calculations, where only a few parameters per
calculation change.
We need 2 files: scf.si.in and si_pbe_v1.uspp.F.UPF
&CONTROL
calculation = 'scf'
outdir = 'Si_example/'
pseudo_dir = './'
/
&SYSTEM
ibrav = 2
celldm(1) = 10.2
nat = 2
ntyp = 1
ecutwfc = 18.0
ecutrho = 72.0
/
&ELECTRONS
conv_thr = 1d-7
/
ATOMIC_SPECIES
Si 1.00 si_pbe_v1.uspp.F.UPF
ATOMIC_POSITIONS alat
Si 0.00 0.00 0.00
Si 0.25 0.25 0.25
K_POINTS automatic
4 4 4 1 1 1
As an example, let us perform a few tests on Si bulk. To this end, we will use the above scf.si.in
input file.
Below is the PWTK script that scans the energy cutoff (ecutwfc), k-point mesh (K_POINTS), and lattice parameter (celldm(1)):
# the "load_fromPWI" command loads the pw.x input file load_fromPWI scf.si.in #------------------------ # scan the energy-cuttofs #------------------------ # the "scanpar" command loops over a parameter; it is similar to a # one-parameter Tcl "foreach" command scanpar e {10.0 14.0 18.0 22.0} { # load the new energy cuttofs SYSTEM "ecutwfc = $e, ecutrho = 4*$e" # perform the pw.x calculation (I/O files: scf.Si_e$e.in & scf.Si_e$e.out) runPW scf.Si_e$e # store $e and total energy in the 'ecut.dat' file write ecut.dat [pwo_totene scf.Si_e$e.out] } # plot the result plot -xl "ecutwfc (Ry)" -yl "Total energy (Ry)" ecut.dat # let's perform below scans at ecutwfc = 18.0 Ry SYSTEM "ecutwfc = 18.0, ecutrho = 4*18.0" #----------------- # scan the kpoints #----------------- scanpar k {2 4 6} { # load new k-points K_POINTS automatic "$k $k $k 1 1 1" # perform the pw.x calculation (I/O files: scf.Si_k$k.in & scf.Si_k$k.out) runPW scf.Si_k$k # store $k and total energy into the 'k.dat' file write k.dat [pwo_totene scf.Si_k$k.out] } # plot the result plot -xl "K of the (KxKxK) k-point mesh" -yl "Total energy (Ry)" k.dat #--------------------------- # scan the lattice-parameter #--------------------------- # let's perform this scan at the 6x6x6 k-mesh K_POINTS automatic "6 6 6 1 1 1" # here we use the "seq" command, which behaves just like the Unix "seq" command foreach a [seq 9.2 0.2 10.8] { # load new celldm(1) SYSTEM " celldm(1) = $a " # perform the calculation (I/O files: scf.Si_alat$a.in & scf.Si_alat$a.out) runPW scf.Si_alat$a # store $a and total energy into the 'alat.dat' file write alat.dat [pwo_totene scf.Si_alat$a.out] } # plot the result plot -xl "A lattice paramater (bohr)" -yl "Total energy (Ry)" alat.dat
Let us store this script into the scan.pwtk file. The script is run from the terminal by executing:
pwtk scan.pwtk
After execution of the script we get the 3 following pictures:
0 Comments