%!TEX root=./user_guide.tex
\chapter{Overview of the {\tt berry} module}
\label{ch:berry}

The {\tt berry} module of {\tt postw90} is called by setting {\tt
  berry = true} and choosing one or more of the available options for
{\tt berry\_task}. The routines in the {\tt berry} module which
compute the $k$-space Berry curvature, orbital magnetization and spin Hall conductivity are
also called when {\tt kpath = true} and {\tt kpath\_task = \{curv,morb,shc\}},
or when {\tt kslice = true} and {\tt kslice\_task = \{curv,morb,shc\}}.

\section{Background: Berry connection and curvature}

The Berry connection is defined in terms of the cell-periodic Bloch
states $\vert u_{n{\bf k}}\rangle=e^{-i{\bf k}\cdot{\bf r}}\vert
\psi_{n{\bf k}}\rangle$ as
%
\begin{equation}
{\bf A}_n({\bf k})=\langle u_{n{\bf k}}\vert i\bm{\nabla}_{\bf k}\vert
u_{n{\bf k}}\rangle,
\end{equation}
%
and the Berry curvature is the curl of the connection,
%
\begin{equation}
\bm{\Omega}_n({\bf k})=\bm{\nabla}_{\bf k}\times {\bf A}_n({\bf k})=
-{\rm Im}
\langle \bm{\nabla}_{\bf k} u_{n{\bf k}}\vert \times
\vert\bm{\nabla}_{\bf k} u_{n{\bf k}}\rangle.
\end{equation}
%
These two quantities play a central role in the description of several
electronic properties of crystals~\cite{xiao-rmp10}.  In the following
we will work with a matrix generalization of the Berry connection,
%
\begin{equation}
{\bf A}_{nm}({\bf k})=\langle u_{n{\bf k}}\vert i\bm{\nabla}_{\bf k}\vert
u_{m{\bf k}}\rangle={\bf A}_{mn}^*({\bf k}),
\label{eq:berry-connection-matrix}
\end{equation}
%
and write the curvature as an antisymmetric tensor,
%
\begin{equation}
\label{eq:curv}
\Omega_{n,\alpha\beta}({\bf k}) =\epsilon_{\alpha\beta\gamma}
\Omega_{n,\gamma}({\bf k})=-2{\rm Im}\langle 
\nabla_{k_\alpha} u_{n\bf k}\vert \nabla_{k_\beta} u_{n\bf k}\rangle.
\end{equation}

\section{{\tt berry\_task=kubo}: optical conductivity and joint
  density of states }

The Kubo-Greenwood formula for the optical conductivity of a crystal
in the independent-particle approximation reads
%
\begin{equation}
\sigma_{\alpha\beta}(\hbar\omega)=\frac{ie^2\hbar}{N_k\Omega_c}
\sum_{\bf k}\sum_{n,m}
\frac{f_{m{\bf k}}-f_{n{\bf k}}}
     {\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}}
\frac{\langle\psi_{n{\bf k}}\vert v_\alpha\vert\psi_{m{\bf k}}\rangle
      \langle\psi_{m{\bf k}}\vert v_\beta\vert\psi_{n{\bf k}}\rangle}
{\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}-(\hbar\omega+i\eta)}.
\end{equation}
%
Indices $\alpha,\beta$ denote Cartesian directions, $\Omega_c$ is the
cell volume, $N_k$ is the number of $k$-points used for sampling the
Brillouin zone, and $f_{n{\bf k}}=f(\varepsilon_{n{\bf k}})$ is the
Fermi-Dirac distribution function. $\hbar\omega$ is the optical
frequency, and $\eta>0$ is an adjustable smearing parameter with units
of energy.

The off-diagonal velocity matrix elements can be expressed in terms of
the connection matrix~\cite{blount-ssp62},
%
\begin{equation}
\label{eq:velocity_mat}
\langle\psi_{n{\bf k}}\vert {\bf v} \vert\psi_{m{\bf k}}\rangle=
-\frac{i}{\hbar}(\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}})
{\bf A}_{nm}({\bf k})\,\,\,\,\,\,\,\,(m\not= n).
\end{equation}
%
The conductivity becomes
%
\begin{align}
\label{eq:sig-bz}
\sigma_{\alpha\beta}(\hbar\omega)&=
\frac{1}{N_k}\sum_{\bf k}\sigma_{{\bf k},\alpha\beta}(\hbar\omega)\\
\label{eq:sig-k}
\sigma_{{\bf k},\alpha\beta}(\hbar\omega)&=\frac{ie^2}{\hbar\Omega_c}\sum_{n,m}
(f_{m{\bf k}}-f_{n{\bf k}})
\frac{\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}}
{\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}-(\hbar\omega+i\eta)}
A_{nm,\alpha}({\bf k})A_{mn,\beta}({\bf k}).
\end{align}

Let us decompose it into Hermitian (dissipative) and anti-Hermitean
(reactive) parts. Note that
%
\begin{equation}
\label{eq:lorentzian}
\overline{\delta}(\varepsilon)=\frac{1}{\pi}{\rm Im}
\left[\frac{1}{\varepsilon-i\eta}\right],
\end{equation}
%
where $\overline{\delta}$ denotes a ``broadended''
delta-function. Using this identity we find for the Hermitean part
%
\begin{equation}
\label{eq:sig-H}
\sigma_{{\bf k},\alpha\beta}^{\rm H}(\hbar\omega)=-\frac{\pi e^2}{\hbar\Omega_c}
\sum_{n,m}(f_{m{\bf k}}-f_{n{\bf k}})
(\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}})
A_{nm,\alpha}({\bf k})A_{mn,\beta}({\bf k})
\overline{\delta}(\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}-\hbar\omega).
\end{equation}
%
Improved numerical accuracy can be achieved by replacing the
Lorentzian (\ref{eq:lorentzian}) with a Gaussian, or other shapes. The
analytical form of $\overline{\delta}(\varepsilon)$ is controlled by
the keyword {\tt [kubo\_]smr\_type}.

The anti-Hermitean part of Eq.~(\ref{eq:sig-k}) is given by
%
\begin{equation}
\label{eq:sig-AH}
\sigma_{{\bf k},\alpha\beta}^{\rm AH}(\hbar\omega)=\frac{ie^2}{\hbar\Omega_c}
\sum_{n,m}(f_{m{\bf k}}-f_{n{\bf k}})
{\rm Re}\left[ \frac{\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}}
                    {\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}
                     -(\hbar\omega+i\eta)}
\right]
A_{nm,\alpha}({\bf k})A_{mn,\beta}({\bf k}).
\end{equation}
%
Finally the joint density of states is
%
\begin{equation}
\label{eq:jdos}
\rho_{cv}(\hbar\omega)=\frac{1}{N_k}\sum_{\bf k}\sum_{n,m}
f_{n{\bf k}}(1-f_{m{\bf k}})
\overline{\delta}(\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}}-\hbar\omega).
\end{equation}

Equations~(\ref{eq:lorentzian}--\ref{eq:jdos}) contain the parameter
$\eta$, whose value can be chosen using the keyword\\ {\tt
  [kubo\_]smr\_fixed\_en\_width}. Better results can often be achieved
by adjusting the value of $\eta$ for each pair of states, i.e.,
$\eta\rightarrow \eta_{nm\bf k}$. This is done as follows (see
description of the keyword {\tt adpt\_smr\_fac})
%
\begin{equation}
\eta_{nm{\bf k}}=\alpha\vert \bm{\nabla}_{\bf k}
(\varepsilon_{m{\bf k}}-\varepsilon_{n{\bf k}})\vert \Delta k.
\end{equation}

The energy eigenvalues $\varepsilon_{n\bf k}$, band velocities
$\bm{\nabla}_{\bf k}\varepsilon_{n{\bf k}}$, and off-diagonal Berry
connection ${\bf A}_{nm}({\bf k})$ entering the previous four
equations are evaluated over a $k$-point grid by Wannier
interpolation, as described in Refs.~\cite{wang-prb06,yates-prb07}.
After averaging over the Brillouin zone, the Hermitean and
anti-Hermitean parts of the conductivity are assembled into the
symmetric and antisymmetric tensors
%
\begin{align}
\sigma^{\rm S}_{\alpha\beta}&=
{\rm Re}\sigma^{\rm H}_{\alpha\beta}+i{\rm Im}\sigma^{\rm AH}_{\alpha\beta}\\
\sigma^{\rm A}_{\alpha\beta}&=
{\rm Re}\sigma^{\rm AH}_{\alpha\beta}+i{\rm Im}\sigma^{\rm H}_{\alpha\beta},
\end{align}
%
whose independent components are written as a function of frequency
onto nine separate files.

\section{{\tt berry\_task=ahc}: anomalous Hall conductivity}

The antisymmetric tensor $\sigma^{\rm A}_{\alpha\beta}$ is odd under
time reversal, and therefore vanishes in non-magnetic systems, while
in ferromagnets with spin-orbit coupling it is generally nonzero.  The
imaginary part ${\rm Im}\sigma^{\rm H}_{\alpha\beta}$ describes
magnetic circular dichroism, and vanishes as $\omega\rightarrow
0$. The real part ${\rm Re}\sigma^{\rm AH}_{\alpha\beta}$ describes
the anomalous Hall conductivity (AHC), and remains finite in the
static limit.

The intrinsic dc AHC is obtained by setting $\eta=0$ and $\omega=0$ in
Eq.~(\ref{eq:sig-AH}). The contribution from point ${\bf k}$ in the
Brillouin zone is
%
\begin{equation}
\sigma^{\rm AH}_{{\bf k},\alpha\beta}(0)=\frac{2e^2}{\hbar\Omega_c}
\sum_{n,m}f_{n\bf k}(1-f_{m\bf k})
{\rm Im}\langle \nabla_{k_\alpha} u_{n\bf k}\vert u_{m\bf k}\rangle
\langle u_{m\bf k}\vert\nabla_{k_\beta} u_{n\bf k}\rangle,
\end{equation}
%
where we replaced $f_{n\bf k}-f_{m\bf k}$ with 
$f_{n\bf k}(1-f_{m\bf k})-f_{m\bf k}(1-f_{n\bf k})$.

This expression is not the most convenient for {\it ab initio}
calculations, as the sums run over the complete set of occupied and
empty states. In practice the sum over empty states can be truncated,
but a relatively large number should be retained to obtain accurate
results. Using the resolution of the identity $1=\sum_m \vert u_{m\bf
  k}\rangle \langle u_{m\bf k}\vert$ and noting that the term
$\sum_{n,m}f_{n\bf k}f_{m\bf k}(\ldots)$ vanishes identically, we
arrive at the celebrated formula for the intrinsic AHC in terms of the
Berry curvature,
%
\begin{align}
\label{eq:ahc}
\sigma^{\rm AH}_{\alpha\beta}(0)&=\frac{e^2}{\hbar}
\frac{1}{N_k\Omega_c}\sum_{\bf k}(-1)\Omega_{\alpha\beta}({\bf k}),\\
%\sum_n (-1)f_{n\bf k}\Omega_{n,\alpha\beta}({\bf k}).
\label{eq:curv-occ}
\Omega_{\alpha\beta}({\bf k})&=\sum_n f_{n\bf k}\Omega_{n,\alpha\beta}({\bf k}).
\end{align}
%
Note that only {\it occupied} states enter this expression.  Once we
have a set of Wannier functions spanning the valence bands (together
with a few low-lying conduction bands, typically) Eq.~(\ref{eq:ahc})
can be evaluated by Wannier interpolation as described in
Refs.~\cite{wang-prb06,lopez-prb12}, with no truncation involved.


\section{{\tt berry\_task=morb}: orbital magnetization}

The ground-state orbital magnetization of a crystal is given
by~\cite{xiao-rmp10,ceresoli-prb06}
%
\begin{align}
\label{eq:morb}
{\bf M}^{\rm orb}&=\frac{e}{\hbar}
%\int_{\rm BZ}\frac{d{\bf k}}{(2\pi)^3}
\frac{1}{N_k\Omega_c}\sum_{\bf k}{\bf M}^{\rm orb}({\bf k}),\\
\label{eq:morb-k}
{\bf M}^{\rm orb}({\bf k})&=
\sum_n\,\frac{1}{2}f_{n{\bf k}}\,
{\rm Im}\,\langle \bm{\nabla}_{\bf k}u_{n{\bf k}}\vert
\times
\left(H_{\bf k}+\varepsilon_{n{\bf k}}-2\varepsilon_F\right)
\vert \bm{\nabla}_{\bf k}u_{n{\bf k}}\rangle,
\end{align}
%
where $\varepsilon_F$ is the Fermi energy. The Wannier-interpolation
calculation is described in Ref.~\cite{lopez-prb12}. Note that the
definition of ${\bf M}^{\rm orb}({\bf k})$ used here differs by a
factor of $-1/2$ from the one in Eq.~(97) and Fig.~2 of that work.

\section{{\tt berry\_task=shc}: spin Hall conductivity}

The Kubo-Greenwood formula for the intrinsic spin Hall conductivity (SHC) of a crystal
in the independent-particle approximation reads \cite{qiao-prb2018,guo-prl2008}
%
\begin{equation}
\label{eq:kubo_shc}
\sigma_{\alpha\beta}^{\text{spin}\gamma}(\omega) =  \frac{\hbar}{\Omega_c N_k}
\sum_{\bm{k}}\sum_{n} f_{n\bm{k}} \\
\sum_{m \neq n}
\frac{2\operatorname{Im}[\langle n\bm{k}| \hat{j}_{\alpha}^{\gamma}|m\bm{k}\rangle
	\langle m\bm{k}| -e\hat{v}_{\beta}|n\bm{k}\rangle]}
{(\epsilon_{n\bm{k}}-\epsilon_{m\bm{k}})^2-(\hbar\omega +i\eta)^2}.
\end{equation}
%
The spin current operator 
$\hat{j}_{\alpha}^{\gamma}=
\frac{1}{2}\{\hat{s}_{\gamma},\hat{v}_{\alpha}\}$ where the spin operator $\hat{s}_{\gamma}=\frac{\hbar}{2}\hat{\sigma}_{\gamma}$. Indices $\alpha,\beta$ denote Cartesian directions, $\gamma$ denotes the direction of spin, commonly $\alpha = x, \beta = y, \gamma = z$.  $\Omega_c$ is the
cell volume, $N_k$ is the number of $k$-points used for sampling the
Brillouin zone, and $f_{n{\bf k}}=f(\varepsilon_{n{\bf k}})$ is the
Fermi-Dirac distribution function. $\hbar\omega$ is the optical
frequency, and $\eta>0$ is an adjustable smearing parameter with unit
of energy.

The velocity matrix element in the numerator is the same as   Eq.~(\ref{eq:velocity_mat}), 
so the only unknown quantity is the spin current matrix $\langle n\bm{k}| \hat{j}_{\alpha}^{\gamma}|m\bm{k}\rangle$. 
We can use Wannier interpolation technique to efficiently calculate this matrix, for a full derivation please refer to Ref.~\cite{qiao-prb2018}. 

The Eq.~(\ref{eq:kubo_shc}) can be further separated into 
band-projected Berry curvature-like term
\begin{equation}
\label{eq:kubo_shc_berry}
\Omega_{n,\alpha\beta}^{\text{spin}\gamma}(\bm{k}) = {\hbar}^2 \sum_{
	m\ne n}\frac{-2\operatorname{Im}[\langle n\bm{k}| 
	\frac{1}{2}\{\hat{\sigma}_{\gamma},\hat{v}_{\alpha}\}|m\bm{k}\rangle
	\langle m\bm{k}| \hat{v}_{\beta}|n\bm{k}\rangle]}
{(\epsilon_{n\bm{k}}-\epsilon_{m\bm{k}})^2-(\hbar\omega+i\eta)^2},
\end{equation}
$k$-resolved term which sums over occupied bands
\begin{equation}
\label{eq:kubo_shc_berry_sum}
\Omega_{\alpha\beta}^{\text{spin}\gamma}(\bm{k}) = \sum_{n}
f_{n\bm{k}} \Omega_{n,\alpha\beta}^{\text{spin}\gamma}(\bm{k}),
\end{equation}
and the SHC is 
\begin{equation}
\sigma_{\alpha\beta}^{\text{spin}\gamma}(\omega) = 
-\frac{e^2}{\hbar}\frac{1}{\Omega_c N_k}\sum_{\bm{k}}
\Omega_{\alpha\beta}^{\text{spin}\gamma}(\bm{k}).
\end{equation}
The unit of the $\Omega_{n,\alpha\beta}^{\text{spin}\gamma}(\bm{k})$ 
is $\text{length}^{2}$ (Angstrom$^2$ or Bohr$^2$, depending on your 
choice of {\tt berry\_curv\_unit} in the input file), 
and the unit of  $\sigma_{\alpha\beta}^{\text{spin}\gamma}$ 
is $(\hbar/e)$S/cm (the unit is written in the header of the output file). 
The case of $\omega=0$ corresponds to 
direct current (dc) SHC while that of $\omega\ne0$ 
corresponds to alternating current (ac) SHC or frequency-dependent SHC. 
Note in some papers Eq.~(\ref{eq:kubo_shc_berry}) is called as 
spin Berry curvature. However, it was pointed out by 
Ref.~\cite{Gradhand_2012} that this 
name is misleading, so we use a somewhat awkward name 
``Berry curvature-like term'' to refer to Eq.~(\ref{eq:kubo_shc_berry}). 
The $k$-resolved term Eq.~(\ref{eq:kubo_shc_berry_sum}) can be 
used to draw {\tt kslice} plot, and the band-projected Berry curvature-like term 
Eq.~(\ref{eq:kubo_shc_berry})
can be used to color the {\tt kpath} plot. 

Same as the case of optical conductivity, the parameter
$\eta$ contained in the Eq.~(\ref{eq:kubo_shc_berry}) can be chosen using the keyword {\tt[kubo\_]smr\_fixed\_en\_width}. Also, adaptive smearing can 
be employed by the keyword {\tt [kubo\_]adpt\_smr} 
(see Examples 29 and 30 in the Tutorial). 

Please cite the following paper~\cite{qiao-prb2018} when publishing SHC results obtained using this method:
\begin{quote}
	Junfeng Qiao, Jiaqi Zhou, Zhe Yuan, and Weisheng Zhao, \\
	\emph{Calculation of intrinsic spin Hall conductivity by Wannier interpolation},\\
	Phys. Rev. B. 98, 214402 (2018), DOI:10.1103/PhysRevB.98.214402.
\end{quote}

\section{Needed matrix elements}

%The basic idea of the implementation in the {\tt berry} module is to
%calculate the needed Berry-type quantities very efficiently at
%arbitrarily points in the BZ by Wannier interpolation, once certain
%Wannier matrix elements have been tabulated.

All the quantities entering the formulas for the optical conductivity
and AHC can be calculated by Wannier interpolation once the
Hamiltonian and position matrix elements $\langle {\bf 0}n\vert H\vert
{\bf R}m\rangle$ and $\langle {\bf 0}n\vert {\bf r}\vert {\bf
  R}m\rangle$ are known~\cite{wang-prb06,yates-prb07}.  Those matrix
elements are readily available at the end of a standard MLWF
calculation with {\tt wannier90}. In particular, $\langle {\bf
  0}n\vert {\bf r}\vert {\bf R}m\rangle$ can be calculated by Fourier
transforming the overlap matrices in Eq.~(1.7),
%
$$\langle u_{n{\bf k}}\vert u_{m{\bf k}+{\bf b}}\rangle.
$$
%
Further Wannier matrix elements are needed for the orbital
magnetization~\cite{lopez-prb12}. In order to calculate them using
Fourier transforms, one more piece of information must be taken from
the $k$-space {\it ab-initio} calculation, namely, the matrices
%
$$\langle u_{n{\bf k}+{\bf b}_1}\vert
H_{\bf k}\vert u_{m{\bf k}+{\bf b}_2}\rangle
$$
%
over the {\it ab-initio} $k$-point mesh~\cite{lopez-prb12}.  These are
evaluated by {\tt pw2wannier90}, the interface routine between {\tt
  pwscf} and {\tt wannier90}, by adding to the input file {\tt
  seedname.pw2wan} the line
%
$${\tt
%\begin{quote}
write\_uHu = .true.
%\end{quote}
}
$$
The calculation of spin Hall conductivity needs the 
spin matrix elements
%
$$\langle u_{n{\bf k}}\vert \sigma_\gamma \vert u_{m{\bf k}}\rangle, 
\gamma = x, y, z
$$
% 
from the {\it ab-initio} $k$-point mesh. These are also 
evaluated by {\tt pw2wannier90} by adding to the input file {\tt
seedname.pw2wan} the line
%
$${\tt
	%\begin{quote}
	write\_spn = .true.
	%\end{quote}
}
$$
 


%A note on the implementation: the optical conductivity and orbital
%magnetization are implemented in the {\tt berry} module in the manner
%described in Refs.~\cite{yates-prb07} and \cite{lopez-prb12}
%respectively. As for the AHC, it is currently implemented using the
%``trace formulation'' of Ref.~\cite{lopez-prb12}, rather than the
%original formulation of Ref.~\cite{wang-prb06} (the two are
%equivalent, and should produce identical results to within numerical
%accuracy).
