TABLE OF CONTENTS
2.4 Input Data Stacking
DESCRIPTION
Input data stacking is a useful concept when performing multiple calculations. In such a case, one typically defines a set of default parameters for all calculations. However, each individual calculation may require some modification of the input data, yet it is inconvenient if such a change would affect the input data for other subsequent calculations. This inconvenience can be prevented by using the input data stacking and to this end the PWTK provides the input_pushpop command. The concept is illustrated below:
#------------------------------------------------------------------------ import input-data.pwtk # let's label the input-data at this point as (#0)
# prepare and run the 1st calculation input_pushpop { # input data has been pushed on the stack; # at this point the input data is the same as in (#0)
... modify input data for this calculation (#1) ... perform the 1st calculation } # the modification of input data made inside the above input_pushpop { ... } # was popped away; at this point the input data is the same as in (#0)
# prepare and run the 2nd calculation input_pushpop { # input data still the same as in (#0)
... modify input data for this calculation (#2) ... perform the 2nd calculation
# prepare and run the 3rd calculation input_pushpop { # input data is the same as in (#2)
... modify input data for this calculation (#3) ... perform the 3rd calculation }
# at this point the input data is the same as in (#2) }
# at this point the input data is again the same as in (#0)
... perform further calculations #-----------------------------------------------------------------------
EXAMPLE
And here is a simple actual example that consists of three scans: (i) scan over cutoff energy, (ii) scan over k-points, and (iii) scan over A-lattice parameter. Note that due to use of input_pushpop { ... } none of the test affects the input data for subseuqent tests.
# pw.x input data are stored in "input-data.pwtk file import input-data.pwtk
# scan the cutoff energy input_pushpop { foreach e [seq 20.0 5.0 50.0] { SYSTEM "ecutwfc = $e, ecutrho = 8*$e" runPW scf.ecut$e.in } }
# scan the k-points input_pushpop { foreach k {2 4 6 8 10 12} { K_POINTS automatic "$k $k $k 1 1 1" runPW scf.k$k.in } }
# scan the lattice-parameter input_pushpop { foreach alat [seq 9.0 0.2 10.8] { SYSTEM " celldm(1) = $alat " runPW scf.alat$alat.in } }