### TABLE OF CONTENTS

## 2.5 Input Data Stacking

DESCRIPTION

Input data stacking is a useful concept when performing multiple
calculations. In such cases, one typically defines a set of default
parameters for all calculations. However, each individual
calculation tipically modifies some input data and it is
inconvenient if such changes affect the input data for other
subsequent calculations. This inconvenience can be prevented by
with the PWTK's input data stacking, using the
the **input_pushpop** command
(see ::pwtk::input::pushpop).

The concept of the input-data stacking is illustrated with the below "symbolic" example:

#------------------------------------------------------------------------ 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 was 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 #-----------------------------------------------------------------------

FURTHER DESCRIPTION

In addition to input data of all supported QE programs, PWTK also "keeps" the following data on the stack:

- how to run QE programs, i.e., specs specified with ::pwtk::nice, ::pwtk::container, ::pwtk::prefix, ::pwtk::serial_prefix, ::pwtk::postfix, ::pwtk::serial_postfix, ::pwtk::input_handle
- directories specified with ::pwtk::bin_dir, ::pwtk::pseudo_dir, ::pwtk::outdir, ::pwtk::outdir_prefix, ::pwtk::outdir_postfix, ::pwtk::wfcdir, ::pwtk::wfcdir_prefix, ::pwtk::wfcdir_postfix
- pathnames of all supported QE programs specified with ::pwtk::prog
- on|off behavior specified with ::pwtk::stopOnError, ::pwtk::restart, ::pwtk::bin_query, ::pwtk::backup_io, plugins (e.g. ::pwtk::environ::environ, ::pwtk::artn::artn, ::pwtk::oscdft::oscdft)
- run modifiers specified with ::pwtk::remedy, ::pwtk::prerun, ::pwtk::postrun, ::pwtk::treatrun

ILLUSTRATION

Here is a simple actual example that consists of three parameter 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 { ... }`, preceding tests do not affect 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 } }