TABLE OF CONTENTS


2.2 Specifying Input Data

DESCRIPTION

This section explains how to specify input data in PWTK.

TABLE OF CONTENTS

  1. Namelists and cards
  2. Atomic labels as indices of "ntyp" arrays
  3. Case-sensitivity
  4. Input data handling
  5. How to unset a namelist variable
  6. How to clear namelists and cards
  7. Input data stacking
  8. Description of namelists and cards supported by PWTK
  9. Namelist and card naming exceptions in PWK
  10. Specifying input data for non-supported programs

Namelists and cards

In PWTK, namelist and card names are case sensitive and are written in uppercase. They usually have the same name as in Quantum ESPRESSO (QE), with a few exceptions. Typical exceptions are the generic INPUT and INPUTPP namelists, which are used by several QE programs. Such namelists are renamed because PWTK requires unique names. Furthermore, for closed-cards, such as BEGIN_POSITIONS ... END_POSITIONS in neb.x (named as supercard in the following), the PWTK syntax is simpler (see below).

The difference between Quantum ESPRESSO input files and PWTK scripts is that in the latter, the content of namelists and cards is encapsulated either with curly braces:

    CONTROL { calculation = 'relax', outdir = '/temp/pwscf/' }

or with double quotes:

    SYSTEM " celldm(1) = $a "

The difference between curly braces {...} and double quotes "..." is that inside double quotes, variables (e.g. $a in the above example) are substituted with their values, whereas inside curly braces they are treated verbatim (i.e. no substitution).

Atomic labels as indices of "ntyp" arrays

As a convenience, indices of ntyp-type array variables, such as starting_magnetization(i), i=1,ntyp, can be specified with atomic labels, e.g.:

    SYSTEM { starting_magnetization(Fe) = -0.8 }

where Fe is one among atomic species defined by ATOMIC_SPECIES card. Indeed, it is highly recommended to use atomic-labels instead of atomic-indices in PWTK.

Case-sensitivity

Beware that in PWTK, the names are case-sensitive and commands for specifying namelists and cards are written in uppercase. Namelist variable names are also case-sensitive. This implies that, e.g., ibrav and IBRAV are two different namelist variables in PWTK.

Input data handling

The handling of input data in PWTK is dynamic and input data can be changed on the fly.

Multiple calls to namelist and card commands

Namelist or card commands can be called any number of times, but there is a big difference how multiple calls are handled for namelists and cards: cards are handled in the overwrite mode, whereas namelists are handled in kind of append or substitute mode. For example, consider calling a card command twice:

  ATOMIC_POSITIONS bohr {
     H 0.0 0.0 0.0
     H 0.0 0.0 1.1
  }
  ATOMIC_POSITIONS angstrom {
     N 0.0 0.0 0.0
     N 0.0 0.0 1.25
  }

The second call to ATOMIC_POSITIONS completely overwrites the first call. In addition, there are the cardPrepend and cardAppend commands for adding a new content at the beginning or end of an existing card, respectively (see procedures ::pwtk::input::cardPrepend and ::pwtk::input::cardAppend).

As for the ATOMIC_POSITIONS card, there are additional procedures, such as ::pwtk::pwi::insertAtoms and ::pwtk::pwi::deleteAtoms that add or delete atoms to/from the ATOMIC_POSITIONS card, respectively.

In contrast to cards, if a namelist command is called twice, e.g.:

   SYSTEM { ibrav=1, celldm(1)=10.0*sqrt(2), ecutwfc=25.0 }
   SYSTEM { ibrav=0, nat=2, ntyp=1 }

then the data from both calls is merged. In the above example, the ibrav from the second call will overwrite the value from the first call. So the corresponding input data will be: ibrav=0, celldm(1)=14.14213562373095048800, ecutwfc=25.0, nat=2, ntyp=1.

Mathematical expressions in namelists and cards

Note in the above example that celldm(1) was specified as simple mathematical expression: this can be done for all numbers in cards and for all namelist variables of real and integer type.

How to unset a namelist variable

Namelist variables can be unset by assigning them an empty value, e.g.:

    # how to unset a namelist variable:
    SYSTEM {
       celldm(3) = 
    }

How to clear namelists and cards

A given namelist or card can be cleared (unset) with the input_clear command as follows:

   # how to clear namelists and cards:
   input_clear IONS CELL ATOMIC_POSITIONS

Input data stacking

Input data stacking is a useful concept when performing multiple calculations. For its description, see either the Section 2.5 Input Data Stacking or the corresponding section in the PWTK Short Guide.

Description of namelists and cards supported by PWTK

With namelist and card commands, input data of all explicitly supported QE programs and plugins can be specified (for a list of QE programs and plugins, explicitly supported by PWTK, see section 2.3). To get the list of namelist and card commands of a given explicitly supported QE program (say pp.x), enter the PWTK interactive prompt by typing "pwtk" in the terminal. Then type (PWTK-% stands for the PWTK prompt):

   PWTK-% report structure pp.x

This will output the input structure of the pp.x input, i.e.:

    INPUTPP
    PLOT

indicating that the pp.x input consists of INPUTPP and PLOT namelists. In contrast, if the "report structure" command is executed without an argument:

   PWTK-% report structure

then all namelist and card commands of QE programs and plugings, supported by PWTK will be listed, i.e.

    * input structure for the all_currents.x program:
    ENERGY_CURRENT
    
    * input structure for the band_interpolation.x program:
    INTERPOLATION
    ROUGHNESS
    USER_STARS
    K_POINTS
    
    * input structure for the bands.x program:
    BANDS
    
    * input structure ...
    ...

Namelist and card naming exceptions in PWK

PWTK requires unique names for namelists and cards (technically, namelists and cards are commands in PWTK). Hence, some QE namelists and cards are renamed in PWTK. Typical examples of such naming exceptions are the generic INPUT and INPUTPP namelists, which are used by several QE programs. To get the list of all naming exceptions in PWTK, type "report exceptions" in the PWTK prompt:

   PWTK-% report exceptions

This will output the following list:

    -------------------------------------------------------------------------------
     executable      type       QE-name                             PWTK-name        
    -------------------------------------------------------------------------------
     cp.x            supercard  AUTOPILOT/ENDRULES                  AUTOPILOT        
    
     cppp.x          namelist   INPUTPP                             CPPP             
    
     d3hess.x        namelist   INPUT                               D3HESS           
    
     dynmat.x        namelist   INPUT                               DYNMAT           
    
     kcw.x           namelist   CONTROL                             KCW_CONTROL      
    
     ld1.x           namelist   TEST                                LD1_TEST         
                     namelist   INPUTP                              LD1_INPUTP       
                     namelist   INPUT                               LD1_INPUT        
    
     matdyn.x        namelist   INPUT                               MATDYN           
    
     molecularpdos.x namelist   INPUTMOPDOS                         MOPDOS           
    
     neb.x           supercard  BEGIN/END                           {}               
                     supercard  BEGIN_ENGINE_INPUT/END_ENGINE_INPUT {}               
                     supercard  BEGIN_PATH_INPUT/END_PATH_INPUT     {}               
                     supercard  BEGIN_POSITIONS/END_POSITIONS       POSITIONS        
    
     oscdft_et.x     namelist   OSCDFT_ET_NAMELIST                  OSCDFT_ET        
    
     oscdft_pp.x     namelist   OSCDFT_PP_NAMELIST                  OSCDFT_PP        
    
     postahc.x       namelist   INPUT                               POSTAHC          
    
     pprism.x        namelist   PLOT                                RISM_PLOT        
                     namelist   INPUTPP                             RISM_INPUTPP     
    
     pw2gw.x         namelist   INPUTPP                             INPUT_PW2GW      
    
     pw2wannier90.x  namelist   INPUTPP                             INPUT_PW2WAN     
    
     q2r.x           namelist   INPUT                               Q2R
    -------------------------------------------------------------------------------
    # remark: {} implies that the corresponding QE supercard does not exist in PWTK

In the above list, QE-name and PWTK-name refer to the namelist and card names used in QE and PWTK respectively, whereas {} implies that the corresponding QE supercard does not exist in PWTK: such instances appear for the neb.x executable, where BEGIN / END, BEGIN_PATH_INPUT / END_PATH_INPUT, BEGIN_ENGINE_INPUT / END_ENGINE_INPUT supercards are not used, whereas the BEGIN_POSITIONS / END_POSITIONS supercard is specified as POSITIONS card in PWTK.

Structure of the neb.x input

Here is an example of how to specify the neb.x input in PWTK:

    PATH {
       CI_scheme = 'manual', num_of_images  = 9, ...
    }
    CLIMBING_IMAGES { 3 6 }

    CONTROL {  ... }
    SYSTEM { ... }
    ELECTRONS { ... }
    ATOMIC_SPECIES { ... }
    K_POINTS automatic { ... }

    POSITIONS  {
       FIRST_IMAGE
       ATOMIC_POSITIONS angstrom
       ...
       INTERMEDIATE_IMAGE
       ATOMIC_POSITIONS angstrom
       ...
       LAST_IMAGE
       ATOMIC_POSITIONS angstrom
       ...
    }

Futher exceptions in PWTK

cp.x

For the cp.x executable, the AUTOPILOT / ENDRULES supercard is specified as:

    AUTOPILOT {
        on_step = N : ....
        on_step = M : ....
    }

ph.x

For the ph.x executable, the INPUTPH command can be used in any of the following three different flavors:

    1. INPUTPH { title-line } { inputph-namelist } { affix-lines }
    2. INPUTPH { inputph-namelist } { affix-lines }
    3. INPUTPH { inputph-namelist }

Example:

   INPUTPH {
      phonons of Si at Gamma
   } {
        tr2_ph = 1.0d-14,
         epsil = .true.,
      amass(1) = 28.08,
        fildyn = 'si.dynG',
   } {
      0.0 0.0 0.0
   }

matdyn.x

For the matdyn.x executable, the MATDYN command can be specified in two different flavors:

    1. MATDYN { matdyn-namelist} { affix-lines }
    2. MATDYN { matdyn-namelist}

Example:

    MATDYN {
       asr   = .true. 
       flfrc = 'si.fc'
       flfrq = 'si.freq'
    } {
      26
      0.0 0.0 0.0  0.0
      ...
    }

q2r.x

For the q2r.x executable, the Q2R command can be specified in two different flavors:

    1. Q2R { q2r-namelist} { affix-lines }
    2. Q2R { q2r-namelist}

ld1.x

For the ld1.x executable, the LD1_TEST, LD1_INPUTP, and LD1_INPUT commands can be specified in two different flavors:

    1. LD1_TEST { namelist-specs } { affix-lines }
       LD1_INPUTP { namelist-specs } { affix-lines }
       LD1_INPUT { namelist-specs } { affix-lines }

    2. LD1_TEST { namelist-specs }
       LD1_INPUTP { namelist-specs }
       LD1_INPUT { namelist-specs }

pwcond.x

For the pwcond.x executable, the INPUTCOND command can be specified in two different flavors:

    1. INPUTCOND { inputcond-namelist} { affix-lines }
    2. INPUTCOND { inputcond-namelist}

turbo_*.x

The turbo_*.x programs share the LR_INPUT and LR_CONTROL namelists, which are also shared in PWTK. Hence, be carefull with their specs. To this end, input data stacking can be used.

Specifying input data for non-supported programs

For executables that are not directly supported by PWTK, input files can be created "manually" in PWTK scripts with the writeFile command (see: ::pwtk::writeFile). Here is an example how to run the ev.x code in a PWTK script:

     writeFile ev.murnaghan.in "au
     fcc
     4
     Etot-vs-alat.dat
     Etot-vs-alat.out
     "
     # beware that ev.x is a serial code, and input
     # file cannot be specified with the -in option 
     run -ihandle < -serial ev.x ev.murnaghan.in

     # an alternative option is
     execute ev.x < ev.murnaghan.in > ev.murnaghan.out

See also the last part of the following example script: examples/Si.pwtk