4. Common Keywords¶
This section discusses several settings that are common for all calculations. Some of them are explained in more detail in later chapters.
4.1. General Settings¶
4.1.1. JOB¶
Each Spex run needs a job definition, which defines what Spex should do, e.g., JOB GW 1:(15)
for a GW calculation of the specified set of bands. The available jobs are
GW
 GW methodHF
 HartreeFock methodPBE0
 PBE0 hybrid functionalSX
 Screened exchangeCOSX
 Coulombhole screenedexchange (COHSEX)GT
 GT methodGWT
 GW and GT combinedHFENE
 Total HartreeFock exchange energyRPAENE
 RPA correlation energySUSCEP
 Susceptibility (Polarization function)SUSCEPR
 Renormalized susceptibility (RPA or BetheSalpeter)DIELEC
 Dielectric functionSCREEN
 Screened interactionSCREENW
 Screened interaction projected onto Wannier basisKS
 Singleparticle energies (e.g., KS energies)
Details of these jobs are explained in subsequent sections. The job definition must not be omitted but may be empty: JOB
,
in which case Spex will just read the wavefunctions and energies, perform some checks and some elemental calculations
(e.g., Wannier interpolation), and stop.
The job KS
is included only for convenience. When given, Spex simply writes the singleparticle energies (e.g., KS energies), read from the input data,
to the output in the standard format, similar to the output of GW or HF values.
In principle, Spex supports multiple jobs such as JOB GW 1:(15) DIELEC 1:{0:1,0.01}
.
This feature is, however, seldom used and is not guaranteed to work correctly in all versions.
JOB COSX 1:(15) 
Perform COHSEX calculation. 
JOB COSX 1:(15) SCREEN 2:{0:1,0.01} 
Subsequently, calculate the screened interaction on a frequency mesh. 
JOB 
Just perform some checks and stop. 
4.1.2. BZ and WRTKPT¶
There are only two keywords that must not be omitted from the input file. The first is JOB
, the second BZ
, which defines the kpoint set for the sampling of the Brillouin zone. The keyword requires four integer arguments, BZ l m n
, defining an \(l\times m\times n\) kpoint set. If the keyword WRTKPT
is set (or, alternatively, with the command line option spex w
), Spex uses the BZ
definition to construct the irreducible wedge of the kpoint set and writes the respective list of k points to a file, which is then read by the DFT code.
BZ 8 4 2 . 
Define a \(8\times 4\times 2\) kpoint sampling. 
4.1.3. MEM¶
Calculations based on manybody perturbation theory are costly, not only in terms of computation time but also in terms of memory. Since the problem sizes (e.g., number of atoms) are thus effectively restricted by the memory hardware of the computer, the latter constitutes in some ways a more serious limit than the computation time the user can afford to invest. Therefore, an upper limit for the memory that Spex is allowed to use can be defined with the keyword MEM x
with x in MB. The default is MEM 1000
.
In parallel Spex, the value would correspond to the upper limit per (physical) node. If possible, Spex will divide the work load into packets in such a way that the memory usage stays below the limit. (Actually, Spex might use a bit more memory than specified.)
MEM 2000 
Restrict memory usage to 2GB (Default: 1GB). 
4.1.4. STOREIBZ¶
Spex reads wavefunctions and energies as a first step. In general, these have to be stored for all k vectors in the set (e.g., for all 64 points of a \(4\times 4\times 4\) set), filling up a lot of memory. This can be restricted to the irreducible zone (only eight points in the example) with the keyword STOREIBZ
. Spex then regenerates the wavefunctions on equivalent k points on the fly. This might slow down the calculation but is more economical with computer memory.
4.1.5. –enableload¶
(*) Another possibility to reduce the memory consumption is to reconfigure (and recompile) the code with the option enableload
(or recompile with the flag DLOAD
in the Makefile). With this option, Spex stores the wavefunctions in memory only temporarily and rereads them from harddisc whenever they are needed. Obviously, this requires a fast harddisc and network connection. The HDF5 library is used for the data transfer. There is no possibility to set the option in the input file because it strongly affects the way the wavefunction data is handled in the code.
4.1.6. RESTART¶
This is an important keyword. It enables (a) continuing a calculation that has, for some reason, stopped or crashed and (b) reusing data of a previous calculation. If specified, Spex will store intermediate results in a file or read them if the particular data is already present in the file. Even if RESTART
was not specified in the first run, Spex might still be able to reuse data from a previous run with RESTART 2
. (This option usually gives less freedom for a change of parameters.) It depends on the particular job definition whether RESTART
and/or RESTART 2
are available and how they work. See below for details.
RESTART 
Read/write restart file. 
RESTART 1 
Same as RESTART 
RESTART 2 
Try to reuse data from standard output files. 
(*) We will come back to this keyword in the tutorials. Here, we give a more detailed explanation as reference.
Spex writes several files to harddisc during the program run (see Section 3.3 for details): “spex.cor”, “spex.cot”, “spex.ccou”, “spex.mb”, “spex.core”, “spex.sigx”, “spex.sigc”, “spex.sigt”, “spex.wcou”, “spex.uwan”, “spex.kolap”, as well as several files containing spectra (“suscep”, “dielec”, etc.) and a file “<KS>” containing the KS wavefunctions. (The name of the latter depends on the DFT program used.)
In addition to the arguments 1 and 2, described above, the keyword RESTART
can be given with a general fivedigit integer number, e.g., 32233
,
which explicitly specifies which files should be read and/or written. (The first digit is optional. It is interpreted as 0 if omitted.)
The digits can be 0 (don’t read and don’t write), 1 (read but don’t write), 2 (write but don’t read), and 3 (read and write). The following table shows to which
file(s) each digit refers to.
“spex.uwan”
“spex.kolap”

“spex.sigc”
“spex.sigt”
“spex.wcou”
spectra files^{1}

“spex.sigx”

“spex.cor”
“spex.cot”
“spex.ccou”
“spex.mb”
“spex.core”^{1}

“<KS>”


Don’t read, don’t write  0  0  0  0  0 
Read but don’t write  1  1  1  1  1 
Write but don’t read  2  2  2  2  2 
Read and write  3  3  3  3  3 
^{1}The spectra files and “spex.core” are always written.
The arguments 1 and 2 correspond to 32233
and 33333
, respectively. The default (i.e., without RESTART
) is 02200
.
When using MPIKPT
in a parallel calculation, the restart data is written to multiple
files: “spex.sigx”, “spex.sigx.2”, “spex.sigx.3”, etc. (accordingly for “spex.sigc”) as well as “spex.cor.1”, “spex.cor.2”, etc. In the latter case, there
is also a directory “spex.cor.map” containing, for each k point, links to the respective cor file. Whenever restart files need to be copied, make sure that all
files (including the directory) are copied. Apart from that, Spex will always manage to read the correct data, independently of whether the calculation is
in parallel or serial, with or without MPIKPT
.
Warning
The RESTART
option is a powerful tool. It is not only of practical importance due to the possibility of restarting calculations or reusing data of previous
calculations. It also gives the user a lot of freedom to taylor calculations, for example, using different kpoint sets (or different numbers of bands, etc.)
for G and W. However, this freedom comes with the risk that calculations are performed with inconsistent data. Spex has only limited capabilities to catch
such inconsistencies. The user should be aware of that.
4.1.7. NOSTORE (COULOMB)¶
Most job types require the calculation of the Coulomb matrix (with respect to the mixed product basis). The Coulomb matrix is k dependent.
By default, Spex precalculates the Coulomb matrices for all k and stores them in memory. However, this can be quite memorydemanding (especially
for large kpoint sets). Therefore, the keyword NOSTORE
(section COULOMB
) avoids the storage of all Coulomb matrices.
Instead, at any given time, only one Coulomb matrix is stored in memory. This keyword is recommendable in particular for parallel runs (due to a
rather inefficient parallelization of calculations without NOSTORE
.)
4.2. Input data¶
Spex needs data from a previous selfconsistent solution of a meanfield system (e.g., KSDFT). Several keywords can be used to analyze, check, and modify the input data.
4.2.1. NBAND¶
The Green function involves a summation over electronic bands, as do the polarization function [Eq. (5)] and the selfenergy. The convergence with respect to the number of bands is a very important aspect in calculations based on manybody perturbation theory. The keyword NBAND n
sets the number of bands to n. Obviously, n must not be larger than the number of bands provided by the input data. It should be noted that the actual number of bands can differ from n and also from k point to k point because Spex makes sure that degenerate subspaces are not cut in order to avoid symmetry breaking. If n is a real number (i.e., if it contains a decimal point: 3.0
), it is interpreted as the maximal band energy. Then, all bands up to this energy are included. This is helpful if one wants to use a single parameter for calculations with differently sized unit cells. For example, when the unit cell doubles, one would have to include twice as many bands to reach the same accuracy, while the maximal band energy (practically) remains unchanged. If NBAND
is unset, all available bands are used.
NBAND 100 
Use 100 bands per k point. 
NBAND 3.0 
Use all bands up to 3 Hartree. 
NBAND 50.0eV 
Use all bands up to 50 eV. 
4.2.2. CORESOC¶
By default, Spex averages over the SOCsplitted states. For example, the two states 2p^{1/2} and the four states 2p^{3/2} are
averaged to give the six quasinonrelativistic states of the 2p shell (or the three spinup 2p states and the three spindown 2p states
in the case of spin polarization). Then, all core states of a given shell have the same energy and the same radial form of the wavefunction. The averaging procedure
can be avoided by specifying CORESOC
. The SOCsplitted states and the different energies and wavefunctions are then retained and taken
into account in the calculations of the selfenergy, polarization function, et cetera. In the case of spin polarization, the Weiss field gives
rise to further lifting of degeneracies. Spex calculates the respective new splittings, energies, and wavefunctions.
For reference, the corestate energies are written to the output file. Usually, the effect of CORESOC
is numerically small, but it
still might play an important role for GW calculations in the case of very small band gaps.
4.2.3. CHKMISM and CHKOLAP¶
(*) The set of wavefunctions read from harddisc can be checked in terms of their orthonormality and continuity (mismatch) at the muffintin (MT) boundary with the keywords CHKOLAP
and CHKMISM
, respectively. The former test gives a value for the deviation from exact orthonormality. The smaller the value, the better the condition of orthonormality is fulfilled. If the deviation is too large, the program stops.
The second keyword yields, for each k point, the average and maximal MT mismatch of the wavefunctions. If any of these tests yield too large errors, there could be a problem with the readin process or with the data written by the DFT code. The developers should be informed in this case.
4.2.4. MTACCUR¶
(*) The LAPW method relies on a partitioning of space into MT spheres and the interstitial region.
The basis functions are defined differently in the two regions, interstitial plane waves in the latter and numerical functions
in the spheres with radial parts \({u(r)}, {\dot{u}(r)=\partial u(r)/\partial\epsilon}\), \({u^\mathrm{LO}(r)}\) and
spherical harmonics \({Y_{lm}(\hat{\mathbf{r}})}\).
The plane waves and the angular part of the MT functions can be converged straightforwardly with the reciprocal cutoff radius \({g_\mathrm{max}}\)
and the maximal l quantum number \({l_\mathrm{max}}\), respectively, whereas the radial part of the MT functions is not converged as easily.
The standard LAPW basis is restricted to the functions \({u}\) and \({\dot{u}}\). Local orbitals \({u^\mathrm{LO}}\)
can be used to extend the basis set, to enable the description of semicore and highlying conduction states.
The accuracy of the radial MT basis can be analyzed with the keyword MTACCUR e1 e2
which gives the MT representation error [Phys. Rev. B 83, 081101]
in the energy range between e1 and e2. (If unspecified, e1 and e2 are chosen automatically.) The results are written to the output files “spex.mt.t”
where t is the atom type index, or “spex.mt.s.t” with the spin index s(=1 or 2) for spinpolarized calculations.
The files contain sets of data for all l quantum numbers, which can be plotted separately with gnuplot (e.g., plot "spex.mt.1" i 3
for \({l=3}\))
MTACCUR 1 2 
Calculate MT representation error between 1 and 2 Hartree. 
MTACCUR 
Automatic energy range. 
4.2.5. BANDINFO¶
(*) This keyword lets Spex analyze the orbital character of the wavefunctions. The results are given, first, in the form of a table in the output file containing the orbital decomposition for each eigenstate and, second, as projected densityofstates (DOS) plots in the files “spex.dos.NNN” (where NNN is a threedigit running index). As the table can be very large, there is a possibility to choose the atom type index at whose spheres the analysis is to be performed.
BANDINFO 
Calculate orbital decomposition and DOS plots. 
BANDINFO 2 
Restrict the orbitaldecomposition table to atom type 2. 
4.2.6. ENERGY¶
(*) In some cases, it may be necessary to replace the energy eigenvalues, provided by the meanfield (DFT) calculation,
by energies (e.g., GW quasiparticle energies) obtained in a previous Spex run, for example,
to determine the GW Fermi energy or to perform energyonly selfconsistent calculations.
This can be achieved with the keyword ENERGY file
, where “file” contains the new energies in eV.
The format of “file” corresponds to the output of the spex.extr
utility: spex.extr g spex.out > file
.
It must be made sure that “file” contains energy values for the whole irreducible Brillouin zone.
Band energies not contained in “file” will be adjusted so that the energies are in ascending order
(provided that there is at least one energy value for the particular k point).
ENERGY energy.inp 
Replace the meanfield energy eigenvalues by the energies provided in the file “energy.inp”. 
4.2.7. DELTAEX¶
(*) This keyword modifies the exchange splitting of a collinear magnetic system, i.e., it shifts spinup and spindown energies relative to to each other so as to increase or decrease the exchange splitting. With DELTAEX x
, the spinup (spindown) energies are lowered (elevated) by x/2. The parameter x can be used to enforce the Goldstone condition in spinwave calculations [Phys. Rev. B 94, 064433 (2016)]
DELTAEX 0.2eV 
Increase the exchange splitting by 0.2 eV (spinup/down energies are decreased/increased by 0.1 eV) 
4.2.8. PLUSSOC¶
(*) With this keyword, Spex adds spinorbit coupling (SOC) to the meanfield solution using a oneshot secondvariation approach and stops,
so it is noniterative but updates the wavefunctions and energies.
The new energies are written to standard output and, together with the new wavefunctions, to new input files on the harddisc,
thus overwriting the old input data. In the case of Fleur, the modified files are “gwa”, “KS.hdf”, and “spex.sym”.
The latter is written only if the system is spin polarized (noncollinear magnetism). It has the same form as “sym.out”.
Spex reads the file “spex.sym” if it exists and “sym.out” otherwise. After the PLUSSOC
calculation, a subsequent
Spex run will read the new input data, now including SOC. (The keyword PLUSSOC
must be removed for this new run, otherwise
Spex stops with an error, since it cannot add SOC to a solution that contains it already.)
A possible application of this feature is to add SOC corrections to GW quasiparticle energies, already calculated.
To this end, store the GW energies to a file using the “spex.extr” utility (example: spex.extr g spex.out > energy.inp
).
Then, tell Spex to replace the singleparticle energies (that it reads from the input data) by the ones from the file (“energy.inp”) with
the keyword ENERGY
(ENERGY energy.inp
, see Section 4.2.6) and add PLUSSOC
. In a subsequent run, Spex will apply the SOC operator to the GW quasiparticle
energies using a secondvariation technique, write the corrected energies to the output, and write the new input data files.
The latter can be used in a subsequent Spex run, for example, to calculate a Wannierinterpolated band structure,
containing GW quasiparticle and SOC corrections. From a theoretical point of view this approach is a bit inconsistent
[Phys. Rev. B 88, 165136 (2013)], but it is considerably faster than running GW with SOC from the start. Besides, the
latter approach is currently not applicable to systems with noncollinear magnetism. So, using the present procedure with PLUSSOC
is the only viable approach for this case.
4.2.9. ITERATE¶
(*) If ITERATE
is specified, Spex only reads the LAPW basis set from the input data, provided by the meanfield (DFT) code,
but performs the diagonalization of the Hamiltonian at the k points itself. This calculation effectively replaces
the second run of the DFT code. In this sense, the name of the keyword is a bit misleading, as the calculation is noniterative.
The keyword ITERATE
is mostly intended for testing and debugging. It is not available for executables compiled with DLOAD
(configured with enableload
).
ITERATE NR 
Diagonalize a nonrelativistic Hamiltonian. 
ITERATE SR 
Use scalarrelativity. 
ITERATE FR 
Also include SOC. 
ITERATE SR 1 
Diagonalize scalarrelativistic Hamiltonian and neglect eigenvalues below 1 htr. 
ITERATE FR STOP 
Diagonalize relativistic Hamiltonian (including SOC), then stop. 