TABLE OF CONTENTS
12-scan-Si
DESCRIPTION
This example shows how to perform pw.x scans over several parameters, such as energy-cutoff, k-points, and lattice-constant.
This example uses the PWTK input-data stacking mechanism (see ::pwtk::input_pushpop).
SEE ALSO
13-scanpar-Si or scanpar-Si.pwtk -- a somewhat better example that also plots the results
EXAMPLE SOURCE FILE
SOURCE
# input data for Si-bulk is imported from Si.pwtk with ::pwtk::import import Si.pwtk #------------------------ # scan #1: cutoff energy #------------------------ # we do not want that the modifications of 'ecutwfc' & 'ecutrho', used in # this scan, affect the subsequent tests, hence we use the input-data # stacking using 'input_pushpop', which is a shortcut to ::pwtk::input::pushpop input_pushpop { # ::pwtk::seq behaves just like the Unix 'seq' command foreach e [seq 10.0 4 22.0] { # load the new energy-cuttofs SYSTEM "ecutwfc = $e, ecutrho = 4*$e" # perform the pw.x calculation (I/O files: Si_e$e.scf.in & Si_e$e.scf.out) runPW pw.Si_e$e.scf # total energy is retrieved from the pw.x output file with # 'pwo_totene', which is a shortcut to ::pwtk::pwo::totene; # let's print the result to stdout using the ::pwtk::print print "ecutwfc = $e, Total energy = [pwo_totene pw.Si_e$e.scf.out]\n" } } # at this point, original values of ecutwfc & ecutrho are restored, # i.e., all the variable changes within the input_pushpop { ... } were # popped away #------------------ # scan #1: k-points #------------------ input_pushpop { foreach 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: Si_k$k.scf.in & Si_k$k.scf.out) runPW pw.Si_k$k.scf # print the result to stdout print "k = $k x $k x $k, Total energy = [pwo_totene pw.Si_k$k.scf.out]\n" } } # at this point, original K_POINTS values are restored thanks to use # of input_pushpop { ... } #--------------------------- # scan #3: lattice-parameter #--------------------------- input_pushpop { foreach a [seq 9.2 0.2 10.8] { # load new celldm(1) SYSTEM " celldm(1) = $a " # perform the calculation (I/O files: Si_a$a.scf.in & Si_a$a.scf.out) runPW pw.Si_a$a.scf # print the total energy to stdout print "a = $a, Total energy = [pwo_totene pw.Si_a$a.scf.out]\n" } } # original values of variables restored, i.e., all the variable # changes were popped away