.. _getting_started:
===============
Getting Started
===============
This section is intended to give a first impression on how a typical calculation is carried out. Details are given in later sections.
Many-body perturbation theory is defined with respect to a formally unperturbed system, i.e., a system without electron-electron interaction.
Any mean-field theory, e.g., Hartree-Fock or Kohn-Sham (KS) DFT, provides such a system.
(For simplicity of presentation, we will assume throughout this manual that KS-DFT is used for the reference system.)
Thus, before running Spex, we must find a self-consistent
mean-field solution. Normally this first step is fast and we can use a dense k-point set. For the calculation with Spex, we have to generate a new
(and usually coarser) k-point set and calculate the corresponding wavefunctions and energies with the mean-field program in a second run.
Thus, a typical procedure is
1. self-consistent DFT calculation (e.g., with Fleur),
2. generate new k-point set with Spex,
3. second run of the DFT program to generate the eigenstates at the new k points,
4. finally run Spex.
Of course, for subsequent Spex runs, steps 1-3 need not be repeated, unless the reference mean-field system is to be
recalculated with different parameters (e.g., different k-point set or different crystal structure).
For the first and third step consult the manual of your DFT program. (The `Fleur manual`_ is available online. As explained in more detail in
:numref:`spex_and_fleur`, you must set ``gw=1`` and ``gw=2`` for the first and third step, respectively.)
For the second and fourth step you need to create an input file "spex.inp" for Spex. A very simple input file for a *GW* calculation of Si is this:
.. _Fleur manual: https://www.flapw.de/site/Docu-Main/
.. code-block:: bash
# Quasiparticle energies of bands at the high-symmetry points Gamma, X, and L.
BZ 4 4 4
WRTKPT
KPT X=[0,0,1] L=1/2*[1,1,1]
JOB GW 1:(1,2,5) X:(1,3,5) L:(1-3,5)
.. note:: Refer to the tutorials and other chapters for a full list of available keywords
For the second step, only the lines beginning with ``BZ`` and ``WRTKPT`` are necessary. The line ``BZ 4 4 4`` defines a :math:`4\times 4\times 4` k-point set, and the keyword ``WRTKPT`` tells Spex to write the (irreducible) k-points to a file ("kpts" for Fleur) and stop.
For the fourth step, you must remove (or comment out) the keyword ``WRTKPT``. Now all other parameters are needed.
The results are written to standard output and should be piped to an output file (:numref:`spex.out`).
.. note:: As an alternative to ``WRTKPT``, the command line option ``-w`` can be used (``spex -w``). It sets the keyword ``WRTKPT`` automatically (:numref:`cmdlineopt`).
.. note:: Unless you intend to run self-consistent `GW` calculations, the steps 2-4 can be combined into a single Spex run using the keyword ``ITERATE``.