%
% Copyright (C) 2006 Andrea Benassi
% This file is distributed under the terms of the
% GNU General Public License. See the file `License'
% in the root directory of the present distribution,
% or http://www.gnu.org/copyleft/gpl.txt .
%
\documentclass[twocolumn]{article}
\usepackage[english]{babel}
\usepackage[centertags,intlimits]{amsmath}
\usepackage{amssymb}
\usepackage{verbatim}
\begin{document}
\begin{titlepage}
\Huge
\begin{center}
$PW_{SCF}$'s epsilon.x user's manual\\[4.5cm]
\normalsize
\vspace{10.5cm}
\textbf{Manual Author:}
\emph{Andrea Benassi}$^{1,2}$\\[0.3cm]
\textbf{Code Developers:}
\emph{Andrea Benassi$^{1,2}$, Andrea Ferretti$^{1,2}$, Carlo Cavazzoni$^{2,3}$}\\[1cm]
$^{1}$ \emph{Physics Department, Universit\'a degli Studi di Modena e Reggio Emilia,} www.fisica.unimore.it\\
$^{2}$ \emph{INFM/S$^{3}$ (Nanostructure and Biosystem at Surfaces),} www.s3.infm.it\\
$^{3}$ \emph{High Performance Computing Department, CINECA Consorzio Interuniversitario,} www.cineca.it\\
\end{center}
\end{titlepage}
\newpage
\section{Introduction}
Epsilon.x is a post processing code of $PW_{SCF}$. Starting from DFT eigenvalues and eigenvectors,
epsilon.x provides the real and imaginary parts of the dielectric tensor or the joint density of states, it works both in serial and
parallel mode, also pool parallelization is supported.
Epsilon.x doesn't support the reduction of the k-points grid into the irreducible Brillouin zone, so the previous PW runs must be
performed with a uniform k-points grid and all k-points weights must be equal to each other, i.e. in the k-points card the k-points
coordinates must be given manually in \emph{crystal} or \emph{alat} or \emph{bohr}, but not with the \emph{automatic} option. Also the
auto-symmetrization of k-points grid can produce a non uniform distribution of k-points weights, in order to avoid this
PW's behavior the variable NOSYM must be set .TRUE. disabling auto-symmetrization.
\section{Input file}
When executed, epsilon.x reads an input file from standard input, this file contains two Fortran namelists
(value associated to each variable is the default one):
\begin{verbatim}
 &inputpp
    outdir='./'
    prefix='pwscf'
    calculation='eps'
 /
 &energy_grid
    smeartype='gauss'
    intersmear=0.136d0
    intrasmear=0.0d0
    wmax=30.0d0
    wmin=0.0d0
    nw=600
    shift=0.0d0
 /
\end{verbatim}
the first two characters are the location and name of the output files from the previous PW runs. \emph{calculation}
select the kind of calculation to be performed by epsilon.x, actually the following calculation are implemented:
\begin{itemize}
\item  \emph{eps}: dielectric tensor calculation, in addition to the standard output the code produces the four files
\emph{epsr.dat}, \emph{epsi.dat}, \emph{eels.dat} and \emph{ieps.dat}. The first two contain the real and imaginary
parts of the dielectric
tensor diagonal components $\epsilon_{1_{\alpha,\alpha}}(\omega)$ e $\epsilon_{2_{\alpha,\alpha}}(\omega)$,
as a function of frequency (in eV). The third file contains the electron energy loss spectrum calculated from the diagonal
elements of dielectric tensor and the last one contains the diagonal components of
dielectric tensor calculated on the imaginary axis of frequency (via London transformation)
$\epsilon_{\alpha,\alpha}(i\omega)$. If the PW calculations have been performed in collinear spin mode the previous files 
contain the sum of spin up and spin down contribution, other files with prefix \emph{u-} or  \emph{d-} are created containing 
the same quantities for spin up or spin down separately. 
\item  \emph{jdos}: joint density of state (JDOS) calculation. 
In addition to the standard output the code produces the file
\emph{jdos.dat}, containing the JDOS (in eV$^{-1}$) as a function 
of frequency (in eV). The JDOS is normalized to 1. If the PW 
calculations have been performed in collinear spin mode, 
\emph{jdos.dat} contains separately the spin up and spin down JDOS.
\item  \emph{offdiag}: calculation of diagonal and off-diagonal components of dielectric tensor. In addition
to the standard output the code produces one file for each component of the dielectric tensor (i.e.
\emph{epsxy.dat}), each file contains real and imaginary part of the tensor component.
\item  \emph{occ}: calculation of occupation factors and its first derivative, results are written on 
\emph{occupations.dat}. In metallic systems it is highly recommended to perform this calculation before
anything else.  
Plotting this file it is easy to see if the chosen broadening parameter and k points number 
are enough to have a good sampling of the fermi surface.
\end{itemize}
\emph{smeartype} select the kind of broadening for the plot of JDOS, it can be both
\emph{gauss} or \emph{lorentz} for a Gaussian or Lorentzian broadening. \emph{intersmear} is the broadening 
parameter (in eV) for the interband contribution,
it will be the Gaussian or Lorentzian broadening parameter in the case of JDOS
or the
Drude-Lorentz broadening parameter for the dielectric tensor calculation.
\emph{intrasmear} is the broadening parameter for the intraband, i.e. metal Drude like term (again in eV), 
the intraband contribution is calculated only if a Gaussian broadening or tetrahedron method it's been 
applied in PW calculations.    
The desired functions will be calculated in a frequency interval $\big[$-\emph{wmax},\emph{wmax}$\big]$ and \emph{nw}
is the number of points of the frequency mesh, \emph{wmax} is expected to be in eV. Finally \emph{shift} is the number
of eV for an optional rigid shift of the imaginary part of the dielectric function.

\section{Joint density of states}
The joint density of state (JDOS) is defined has:
\begin{displaymath}
n(\omega)=\sum_{\sigma}\sum_{n\in V}\sum_{n'\in C}\frac{\Omega}{(2\pi)^3}\int d^3\textbf{k}\delta(E_{\textbf{k},n'}-E_{\textbf{k},n}
-\hbar\omega)
\end{displaymath}
or alternatively:
\begin{equation}
n(\omega)=\sum_{n}\sum_{n'}\frac{\Omega}{(2\pi)^3}\int d^3\textbf{k}\delta(E_{\textbf{k},n'}-E_{\textbf{k},n}
-\hbar\omega)...
\label{imp2}
\end{equation}
\begin{displaymath}
...f(E_{\textbf{k},n})[2-f(E_{\textbf{k},n'})]/2
\end{displaymath}
or finally:
\begin{equation}
n(\omega)=\sum_{n\in V}\sum_{n'\in C}\frac{\Omega}{(2\pi)^3}\int d^3\textbf{k}\delta(E_{\textbf{k},n'}-E_{\textbf{k},n}
-\hbar\omega)...
\label{imp}
\end{equation}
\begin{displaymath}
...[f(E_{\textbf{k},n})-f(E_{\textbf{k},n'})]
\end{displaymath}
were $\sigma$ is the spin component, $\Omega$ is the volume of the lattice cell, $n$ and $n'$ belong respectively to the
valence and conduction bands,
$E_{\textbf{k},n}$ are the eigenvalues of the Hamiltonian and $f(E_{\textbf{k},n})$ is the Fermi distribution function
that account for the occupation of the bands. In the last two notation the sum over spin values is included into
Fermi function whose normalization is two instead of one.
The Dirac Delta function it's numerically implemented by means of Lorentzian
or Gaussian functions normalized to one:
\begin{equation}
L(\omega)=\frac{\Gamma}{\pi\big[(E_{\textbf{k},n'}-E_{\textbf{k},n}-\hbar\omega)^2+\Gamma^2\big]}
\label{lor}
\end{equation}
\begin{equation}
G(\omega)=\frac{1}{\Gamma\sqrt{\pi}}e^{(E_{\textbf{k},n'}-E_{\textbf{k},n}-\hbar\omega)^2/\Gamma^2}
\label{gau}
\end{equation}
$\Gamma$ is the broadening parameter from the input file. The implemented formula is obtained substituting the
Dirac Delta function in (\ref{imp}) by (\ref{lor}) or (\ref{gau}) and substituting $\frac{\Omega}{(2\pi)^3}\int
d^3\textbf{k}$ by a simple sun over k-points.\\
Integrating analytically (\ref{imp}) one obtains:
\begin{eqnarray}
\sum_{\textbf{k}}\sum_{n}\sum_{n'}[f(E_{\textbf{k},n})-f(E_{\textbf{k},n'})]
\end{eqnarray}
so a division by this quantity is needed to renormalize to 1 the JDOS, the standard output file
contains a convergence check on this normalization. Note that in the case of
joint density of state the two kinds of broadening (\ref{lor}) and (\ref{gau}) are exactly equivalent.

\section{Dielectric tensor}
The imaginary part of the dielectric tensor $\epsilon_{2_{\alpha,\beta}}(\omega)$ can be viewed as a response function
that comes from a perturbation theory with adiabatic turning on:
\begin{displaymath}
\epsilon_{\alpha,\beta}(\omega)=1+\frac{4 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n,n'}\sum_{\textbf{k}}
\frac{\hat{\textbf{M}}_{\alpha,\beta}}{(E_{\textbf{k},n'}-E_{\textbf{k},n})^2}...
\end{displaymath}
\begin{displaymath}
...\Bigg\{\frac{f(E_{\textbf{k},n})}{E_{\textbf{k},n'}-E_{\textbf{k},n}+\hbar\omega+i\hbar\Gamma}+...
\end{displaymath}
\begin{equation}
...\frac{f(E_{\textbf{k},n})}{E_{\textbf{k},n'}-E_{\textbf{k},n}-\hbar\omega-i\hbar\Gamma}\Bigg\}
\end{equation}
where $\Gamma$ is the adiabatic parameter and, for the total energy conservation it must tend to zero.
This is the way in
which the Dirac Delta function appears and this means that every excited state has an infinite lifetime, i.e. is stationary.
\begin{displaymath}
\epsilon_{2_{\alpha,\beta}}(\omega)=\frac{4 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n,n'}\sum_{\textbf{k}}
\frac{\hat{\textbf{M}}_{\alpha,\beta} f(E_{\textbf{k},n})}{(E_{\textbf{k},n'}-E_{\textbf{k},n})^2}...
\end{displaymath}
\begin{equation}
...\bigg[\delta(E_{\textbf{k},n'}-E_{\textbf{k},n}+\hbar\omega)+\delta(E_{\textbf{k},n'}-
E_{\textbf{k},n}-\hbar\omega)\bigg]
\end{equation}
This situation is unphysical because the interaction with
electromagnetic field (even in the absence of photons, i.e. spontaneous emission) gives an intrinsic broadening to all exited
states, the lifetime is finite and $\Gamma$ must be greater than zero. In the limit of small but non vanishing $\Gamma$
the dielectric tensor turns into the Drude-Lorentz one:
\begin{displaymath}
\epsilon_{2_{\alpha,\beta}}(\omega)=\frac{4 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n,\textbf{k}}
\frac{d f(E_{\textbf{k},n})}{d E_{\textbf{k},n}}\frac{\eta \omega \hat{\textbf{M}}_{\alpha,\beta}}
{\omega^4+\eta^2 \omega^2}+...
\end{displaymath}
\begin{displaymath}
...+\frac{8 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n\ne n'}\sum_{\textbf{k}}
\frac{\hat{\textbf{M}}_{\alpha,\beta}}{E_{\textbf{k},n'}-E_{\textbf{k},n}}...
\end{displaymath}
\begin{equation}
...\frac{\Gamma \omega f(E_{\textbf{k},n})}{\big[(\omega_{\textbf{k},n'}-\omega_{\textbf{k},n})^2-\omega^2\big]^2+\Gamma^2\omega^2}
\end{equation}
while the real part comes from the Kramers-Kronig transformation:
\begin{equation}
\epsilon_{1_{\alpha,\beta}}(\omega)=1+\frac{2}{\pi}\int_{0}^{\infty}\frac{\omega' \epsilon_{2_{\alpha,\beta}}(\omega')}
{\omega'^{2}-\omega^{2}}d\omega'
\end{equation}
\begin{displaymath}
\epsilon_{1_{\alpha,\beta}}(\omega)=1-\frac{4 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n,\textbf{k}}
\frac{d f(E_{\textbf{k},n})}{d E_{\textbf{k},n}}\frac{\omega^2 \hat{\textbf{M}}_{\alpha,\beta}}
{\omega^4+\eta^2 \omega^2}+...
\end{displaymath}
\begin{displaymath}
...+\frac{8 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n\ne n'}\sum_{\textbf{k}}
\frac{\hat{\textbf{M}}_{\alpha,\beta}}{E_{\textbf{k},n'}-E_{\textbf{k},n}}...
\end{displaymath}
\begin{equation}
...\frac{\big[(\omega_{\textbf{k},n'}-\omega_{\textbf{k},n})^2-\omega^2\big]f(E_{\textbf{k},n})}
{\big[(\omega_{\textbf{k},n'}-\omega_{\textbf{k},n})^2
-\omega^2\big]^2+\Gamma^2\omega^2}
\end{equation}
finally the complex dielectric function is:
\begin{displaymath}
\epsilon_{\alpha,\beta}(\omega)=1-\frac{4 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n,\textbf{k}}
\frac{d f(E_{\textbf{k},n})}{d E_{\textbf{k},n}}\frac{\hat{\textbf{M}}_{\alpha,\beta}}
{\omega^2+i\eta\omega}+...
\end{displaymath}
\begin{displaymath}
...+\frac{8 \pi e^2}{\Omega N_{\textbf{k}} m^2}\sum_{n'\ne n}\sum_{\textbf{k}}
\frac{\hat{\textbf{M}}_{\alpha,\beta}}{(E_{\textbf{k},n'}-E_{\textbf{k},n})}...
\end{displaymath}
\begin{displaymath}
...\frac{f(E_{\textbf{k},n})}{(\omega_{\textbf{k},n'}-\omega_{\textbf{k},n})^2+\omega^2+i\Gamma\omega}
\end{displaymath}
$\Gamma$ and $\eta$ are respectively \emph{intersmear} and \emph{intrasmear}. 
The squared matrix elements are defined as follow:
\begin{equation}
\hat{\textbf{M}}_{\alpha,\beta}=\langle u_{\textbf{k},n'}\vert\hat{\textbf{p}}_{\alpha}\vert u_{\textbf{k},n}\rangle
\langle u_{\textbf{k},n}\vert\hat{\textbf{p}}_{\beta}^{\dagger}\vert u_{\textbf{k},n'}\rangle
\label{nos}
\end{equation}
\begin{equation}
\propto u_{\textbf{k},n'}^{\star}(\textbf{r})\frac{d}{d x_{\alpha}}u_{\textbf{k},n}(\textbf{r})
u_{\textbf{k},n}^{\star}(\textbf{r})\frac{d}{d x_{\beta}}u_{\textbf{k},n'}(\textbf{r})
\end{equation}
the double index reveals the tensorial nature of $\epsilon_{2}(\omega)$, while $\vert u_{\textbf{k},n}\rangle$ is a
factor of the single particle Bloch function obtained by the PW's DFT calculation.
In all the cases illustrated above the non-local contribution due to the pseudopotential is neglected, actually the
correction to the matrix element that take into account the non-local part of the Hamiltonian it's not implemented.
From the previous definition of the imaginary part of the dielectric function it is easy to see that even the local-field
contributions are not implemented.\\
PW works on a plane wave set so the Bloch functions of the matrix element (\ref{nos}) are decomposed as follow:
\begin{equation}
\vert \psi_{\textbf{k},n}\rangle=e^{i\textbf{G}\cdot\textbf{r}}u_{\textbf{k},n}=\frac{1}{\sqrt{V}}\sum_{\textbf{G}}a_{n,\textbf{k},\textbf{G}}
e^{i(\textbf{k}+\textbf{G})\cdot\textbf{r}}
\end{equation}
and consequently:
\begin{equation}
\hat{\textbf{M}}_{\alpha,\beta}=\bigg(\sum_{\textbf{G}}a^{\star}_{n,\textbf{k},\textbf{G}}a_{n',\textbf{k},\textbf{G}}
G_{\alpha}\bigg) \bigg(\sum_{\textbf{G}}a^{\star}_{n,\textbf{k},\textbf{G}}a_{n',\textbf{k},\textbf{G}}
G_{\beta}\bigg)
\end{equation}
defined in this way the matrix element accounts only for interband transitions, i.e. vertical transition in which the
electron momentum $\textbf{k}$ is conserved (optical approximation). In standard optics the intraband transitions give a 
negligible contribution due to the very low momentum transferred by the incoming/outgoing photon.\\
Operating a London transformation upon $\epsilon_{2_{\alpha,\beta}}(\omega)$, it's possible to obtain the whole dielectric
tensor calculated on the imaginary frequency axis $\epsilon_{\alpha,\beta}(i\omega)$. 
\begin{equation}
\epsilon_{\alpha,\beta}(i\omega)=1+\frac{2}{\pi}\int_{0}^{\infty}\frac{\omega' \epsilon_{2_{\alpha,\beta}}(\omega')}
{\omega'^{2}+\omega^{2}}d\omega'
\end{equation}
The LOSS spectrum is proportional to the imaginary of the inverse dielectric tensor, that is:
\begin{equation}
Im\Bigg\{\frac{1}{\epsilon_{\alpha,\beta}(\omega)}\Bigg\}=
\frac{\epsilon_{2_{\alpha,\beta}}(\omega)}{\epsilon_{1_{\alpha,\beta}}^{2}(\omega)+
\epsilon_{2_{\alpha,\beta}}^{2}(\omega)}
\end{equation}
this quantity provides a useful check of the dielectric tensor calculation because it reaches its maximum at the bulk plasmon
frequency $\Omega_{p}$, where the real and imaginary parts cross their paths at higher frequency. The same quantity (in eV)
is numerically evaluated using the following sum rule:
\begin{equation}
\int_{0}^{\infty}\omega\epsilon_{2_{\alpha,\beta}}(\omega)d\omega=\frac{\pi}{2}\Omega_{p}
\end{equation}  
The result of this calculation is printed in the standard output file.
\end{document}

