quantum-espresso/PHonon/Doc/user_guide.tex

542 lines
24 KiB
TeX
Raw Normal View History

\documentclass[12pt,a4paper]{article}
\def\version{5.2.0}
\def\qe{{\sc Quantum ESPRESSO}}
\usepackage{html}
% BEWARE: don't revert from graphicx for epsfig, because latex2html
% doesn't handle epsfig commands !!!
\usepackage{graphicx}
\textwidth = 17cm
\textheight = 24cm
\topmargin =-1 cm
\oddsidemargin = 0 cm
\def\pwx{\texttt{pw.x}}
\def\phx{\texttt{ph.x}}
\def\configure{\texttt{configure}}
\def\PWscf{\texttt{PWscf}}
\def\PHonon{\texttt{PHonon}}
\def\make{\texttt{make}}
\begin{document}
\author{}
\date{}
\def\qeImage{../../Doc/quantum_espresso.pdf}
\def\democritosImage{../../Doc/democritos.pdf}
%\begin{htmlonly}
%\def\qeImage{../../Doc/quantum_espresso.png}
%\def\democritosImage{../../Doc/democritos.png}
%\end{htmlonly}
\title{
\includegraphics[width=5cm]{\qeImage} \hskip 2cm
\includegraphics[width=6cm]{\democritosImage}\\
\vskip 1cm
% title
\Huge User's Guide for the \PHonon\ package \smallskip
\Large (version \version)
}
%\latexonly
%\title{
% \epsfig{figure=quantum_espresso.png,width=5cm}\hskip 2cm
% \epsfig{figure=democritos.png,width=6cm}\vskip 1cm
% % title
% \Huge User's Guide for \PHonon\ \smallskip
% \Large (version \version)
%}
%\endlatexonly
\maketitle
\tableofcontents
\section{Introduction}
This guide covers the usage of the \PHonon\ package, a
part of the \qe\ distribution.
Further documentation, beyond what is provided
in this guide, can be found in the directory
\texttt{PHonon/Doc/}, containing a copy of this guide.
This guide assumes that you know the contents of
the general User's Guide for \qe\ and of the User's
Guide for \PWscf. It also assumes that you have
already installed \qe\ (\PHonon\ is not a stand-alone
package: it requires \PWscf\ to be compiled and used).
If not, please locate the general User's Guide in directory
\texttt{Doc/} two levels above the one containing this guide,
and the User's Guide for \PWscf\ in \texttt{PW/Doc/};
or consult the web site:\\
\texttt{http://www.quantum-espresso.org}.
It is also assumed that you know the physics behind \qe,
the methods it implements, and in particular the physics
and the methods of \PHonon.
% People who want to modify or contribute to \PHonon\ should read
% the Developer Manual: \texttt{Doc/developer\_man.pdf}.
\PHonon\ has the following directory structure,
contained in a subdirectory \texttt{PHonon/}
of the main \qe\ tree:
\begin{tabular}{ll}
\texttt{Doc/} & : contains the user\_guide and input data description \\
\texttt{examples/} & : some running examples \\
\texttt{PH/} & : source files for phonon calculations
and analysis\\
\texttt{Gamma/} & : source files for Gamma-only phonon calculation\\
\texttt{D3/} & : source files for third-order derivative
calculations \\
\end{tabular}\\
The codes available in the \PHonon\ package can perform the following
types of calculations:
\begin{itemize}
\item phonon frequencies and eigenvectors at a generic wave vector,
using Density-Functional Perturbation Theory;
\item effective charges and dielectric tensors;
\item electron-phonon interaction coefficients for metals;
\item interatomic force constants in real space;
\item third-order anharmonic phonon lifetimes;
\item Infrared and Raman (nonresonant) cross section.
\end{itemize}
Phonons can be plotted using the \texttt{PlotPhon} package.
Calculations of the vibrational free energy in the Quasi-Harmonic
approximations can be performed using the \texttt{QHA} package.
\section{People}
The \PHonon\ package
was originally developed by Stefano Baroni, Stefano
de Gironcoli, Andrea Dal Corso (SISSA), Paolo Giannozzi (Univ. Udine),
and many others.
We quote in particular:
\begin{itemize}
\item Michele Lazzeri (Univ.Paris VI) for the 2n+1 code and Raman
cross section calculation with 2nd-order response;
\item Andrea Dal Corso for the implementation of Ultrasoft, PAW,
noncolinear, spin-orbit extensions to \PHonon.
\end{itemize}
The \texttt{PlotPhon} and \texttt{QHA} packages were contribute by the
late Prof. Eyvaz Isaev.
Other contributors include: Lorenzo Paulatto (Univ. Paris VI) for
PAW, 2n+1 code; William Parker (Argonne) for phonon terms in dielectric
tensor.
We shall greatly appreciate if scientific work done using this code will
contain an explicit acknowledgment and the following reference:
\begin{quote}
P. Giannozzi, S. Baroni, N. Bonini, M. Calandra, R. Car, C. Cavazzoni,
D. Ceresoli, G. L. Chiarotti, M. Cococcioni, I. Dabo, A. Dal Corso,
S. Fabris, G. Fratesi, S. de Gironcoli, R. Gebauer, U. Gerstmann,
C. Gougoussis, A. Kokalj, M. Lazzeri, L. Martin-Samos, N. Marzari,
F. Mauri, R. Mazzarello, S. Paolini, A. Pasquarello, L. Paulatto,
C. Sbraccia, S. Scandolo, G. Sclauzero, A. P. Seitsonen, A. Smogunov,
P. Umari, R. M. Wentzcovitch, J.Phys.:Condens.Matter {\bf 21}, 395502 (2009),
http://arxiv.org/abs/0906.2569
\end{quote}
\section{Installation}
\PHonon\ is a package tightly bound to \qe.
For instruction on how to download and compile \qe, please refer
to the general Users' Guide, available in file \texttt{Doc/user\_guide.pdf}
under the main \qe\ directory, or in web site
\texttt{http://www.quantum-espresso.org}.
Once \qe\ is correctly configured, \PHonon\ can be automatically
downloaded, unpacked and compiled by
just typing \texttt{make ph}, from the main \qe\ directory.
\subsection{Compilation}
Typing \texttt{make ph} from the root \qe\ directory, or \texttt{make}
from the \PHonon\ directory, produces the following codes:
\begin{itemize}
\item \texttt{PH/ph.x}: Calculates phonon frequencies and displacement patterns,
dielectric tensors, effective charges (uses data produced by \pwx).
\item \texttt{PH/dynmat.x}: applies various kinds of Acoustic Sum Rule (ASR),
calculates LO-TO splitting at ${\bf q} = 0$ in insulators, IR and Raman
cross sections (if the coefficients have been properly calculated),
from the dynamical matrix produced by \phx
\item \texttt{PH/q2r.x}: calculates Interatomic Force Constants (IFC) in real space
from dynamical matrices produced by \phx\ on a regular {\bf q}-grid
\item \texttt{PH/matdyn.x}: produces phonon frequencies at a generic wave vector
using the IFC file calculated by \texttt{q2r.x}; may also calculate phonon DOS,
the electron-phonon coefficient $\lambda$, the function $\alpha^2F(\omega)$
\item \texttt{PH/lambda.x}: also calculates $\lambda$ and $\alpha^2F(\omega)$,
plus $T_c$ for superconductivity using the McMillan formula
\item \texttt{PH/fqha.x}: a simple code to calculate vibrational entropy with
the quasi-harmonic approximation
\item \texttt{D3/d3.x}:
calculates anharmonic phonon lifetimes (third-order derivatives
of the energy), using data produced by \pwx\ and \phx\ (USPP
and PAW not supported).
\item \texttt{Gamma/phcg.x}:
a version of \phx\ that calculates phonons at ${\bf q} = 0$ using
conjugate-gradient minimization of the density functional expanded to
second-order. Only the $\Gamma$ (${\bf k} = 0$) point is used for Brillouin zone
integration. It is faster and takes less memory than \phx, but does
not support USPP and PAW.
\end{itemize}
Links to the main \qe\ \texttt{bin/} directory are automatically generated.
\section{Using \PHonon}
Phonon calculation is presently a two-step process.
First, you have to find the ground-state atomic and electronic configuration;
Second, you can calculate phonons using Density-Functional Perturbation Theory.
Further processing to calculate Interatomic Force Constants, to add macroscopic
electric field and impose Acoustic Sum Rules at ${\bf q}=0$ may be needed.
In the following, we will indicate by ${\bf q}$ the phonon wavevectors,
while ${\bf k}$ will indicate Bloch vectors used for summing over the
Brillouin Zone.
The main code \phx\ can be used whenever \PWscf\ can be used,
with the exceptions of: DFT+U, semiempirical VdW corrections,
nonlocal vdW and hybrid functionals, external electric fields,
constraints on magnetization, nonperiodic boundary conditions.
USPP and PAW are not implemented for higher-order response calculations.
See the header of file \texttt{PHonon/PH/phonon.f90} for a complete and
updated list of what \PHonon\ can and cannot do.
Since version 4.0 it is possible to safely stop execution of \phx\ code using
the same mechanism of the \pwx\ code, i.e. by creating a file
\texttt{prefix.EXIT} in the working directory. Execution can be resumed by
setting \texttt{recover=.true.} in the subsequent input data.
Moreover the execution can be (cleanly) stopped after a given time is elapsed,
using variable \texttt{max\_seconds}. See \texttt{example/Recover\_example/}.
\subsection{Single-{\bf q} calculation}
The phonon code \phx\ calculates normal modes at a given {\bf q}-vector,
starting from data files produced by \pwx\ with a simple SCF calculation.
NOTE: the alternative procedure in which a band-structure calculation
with \texttt{calculation='phonon'} was performed as an intermediate step is no
longer implemented since version 4.1. It is also no longer needed to
specify \texttt{lnscf=.true.} for ${\bf q}\ne 0$.
The output data files appear in the directory specified by the
variable {\tt outdir}, with names specified by the variable
{\tt prefix}. After the output file(s) has been produced (do not remove
any of the files, unless you know which are used and which are not),
you can run \phx.
The first input line of \phx\ is a job identifier. At the second line the
namelist {\tt \&INPUTPH} starts. The meaning of the variables in the namelist
(most of them having a default value) is described in file
\texttt{Doc/INPUT\_PH.*}. Variables \texttt{outdir} and \texttt{prefix}
must be the same as in the input data of \pwx. Presently
you can specify \texttt{amass(i)} (a real variable) the atomic mass
of atomic type $i$ or you can use the default one deduced from the
periodic table on the basis of the element name. If
{\tt amass(i)} is not given as input of \phx, the one given as
input in \pwx\ is used. When this is {\tt 0} the default one is used.
After the namelist you must specify the {\bf q}-vector of the phonon mode,
in Cartesian coordinates and in units of $2\pi/a$.
Notice that the dynamical matrix calculated by \phx\ at ${\bf q}=0$ does not
contain the non-analytic term occurring in polar materials, i.e. there is no
LO-TO splitting in insulators. Moreover no Acoustic Sum Rule (ASR) is
applied. In order to have the complete dynamical matrix at ${\bf q}=0$
including the non-analytic terms, you need to calculate effective charges
by specifying option \texttt{epsil=.true.} to \phx. This is however not
possible (because not physical!) for metals (i.e. any system subject to
a broadening).
At ${\bf q}=0$, use program \texttt{dynmat.x} to calculate the correct LO-TO
splitting, IR cross sections, and to impose various forms of ASR.
If \phx\ was instructed to calculate Raman coefficients,
\texttt{dynmat.x} will also calculate Raman cross sections
for a typical experimental setup.
Input documentation in the header of \texttt{PHonon/PH/dynmat.f90}.
See Example 01 for a simple phonon calculations in Si, Example 06 for
fully-relativistic calculations (LDA) on Pt, Example 07 for
fully-relativistic GGA calculations.
\subsection{Calculation of interatomic force constants in real space}
First, dynamical matrices are calculated and saved for a suitable uniform
grid of {\bf q}-vectors (only those in the Irreducible Brillouin Zone of the
crystal are needed). Although this can be done one {\bf q}-vector at the
time, a
simpler procedure is to specify variable \texttt{ldisp=.true.} and to set
variables \texttt{nq1}, \texttt{nq2}, \texttt{nq3} to some suitable
Monkhorst-Pack grid, that will be automatically generated, centered at
${\bf q}=0$.
Second, code \texttt{q2r.x} reads the dynamical matrices produced in the
preceding step and Fourier-transform them, writing a file of Interatomic Force
Constants in real space, up to a distance that depends on the size of the grid
of {\bf q}-vectors. Input documentation in the header of \texttt{PHonon/PH/q2r.f90}.
Program \texttt{matdyn.x} may be used to produce phonon modes and
frequencies at any {\bf q} using the Interatomic Force Constants file as input.
Input documentation in the header of \texttt{PHonon/PH/matdyn.f90}.
See Example 02 for a complete calculation of phonon dispersions in AlAs.
\subsection{Calculation of electron-phonon interaction coefficients}
Since v.5.0, there are two ways of calculating electron-phonon
coefficients, distinguished according to the value of variable
\texttt{electron\_phonon}. The following holds for the case
\texttt{electron\_phonon=} {\tt'interpolated'} (see also Example 03).
The calculation of electron-phonon coefficients in metals is made difficult
by the slow convergence of the sum at the Fermi energy. It is convenient to
use a coarse {\bf k}-point grid to calculate phonons on a suitable
wavevector grid;
a dense {\bf k}-point grid to calculate the sum at the Fermi energy.
The calculation
proceeds in this way:
\begin{enumerate}
\item a scf calculation for the dense ${\bf k}$-point grid (or a scf calculation
followed by a non-scf one on the dense ${\bf k}$-point grid); specify
option \texttt{la2f=.true.} to \pwx\ in order to save a file with
the eigenvalues on the dense {\bf k}-point grid. The latter MUST contain
all ${\bf k}$ and ${\bf k}+{\bf q}$ grid points used in the subsequent
electron-phonon
calculation. All grids MUST be unshifted, i.e. include ${\bf k}=0$.
\item a normal scf + phonon dispersion calculation on the coarse {\bf k}-point
grid, specifying option \texttt{electron\_phonon='interpolated'}, and
the file name where
the self-consistent first-order variation of the potential is to be
stored: variable \texttt{fildvscf}).
The electron-phonon coefficients are calculated using several
values of Gaussian broadening (see \texttt{PHonon/PH/elphon.f90})
because this quickly
shows whether results are converged or not with respect to the
{\bf k}-point grid and Gaussian broadening.
\item Finally, you can use \texttt{matdyn.x} and \texttt{lambda.x}
(input documentation in the header of \texttt{PHonon/PH/lambda.f90})
to get the $\alpha^2F(\omega)$ function, the electron-phonon coefficient
$\lambda$, and an estimate of the critical temperature $T_c$.
\end{enumerate}
See the appendix for the relevant formulae.
{\bf Important notice}: the $q\rightarrow 0$ limit of the contribution
to the electron-phonon coefficient diverges for optical modes! please
be very careful, consult the relevant literature. .
\section{Parallelism}
\label{Sec:para}
We refer to the corresponding section of the \PWscf\ guide for
an explanation of how parallelism works.
\phx\ may take advantage of MPI parallelization on images, plane waves (PW)
and on {\bf k}-points (``pools''). Currently all other MPI and explicit
OpenMP parallelizations have very limited to nonexistent implementation.
\texttt{phcg.x} implements only PW parallelization.
All other codes may be launched in parallel, but will execute
on a single processor.
In ``image'' parallelization, processors can be divided into different
``images", corresponding to one (or more than one) ``irrep'' or {\bf q}
vectors. Images are loosely coupled: processors communicate
between different images only once in a while, so image parallelization
is suitable for cheap communication hardware (e.g. Gigabit Ethernet).
Image parallelization is activated by specifying the option
\texttt{-nimage N} to \phx. Inside an image, PW and {\bf k}-point
parallelization can be performed: for instance,
\begin{verbatim}
mpirun -np 64 ph.x -ni 8 -nk 2 ...
\end{verbatim}
will run $8$ images on $8$ processors each, subdivided into $2$ pools
of $4$ processors for {\bf k}-point parallelization. In order
to run the \phx\ code with these flags the \pwx\ run has to be run with:
\begin{verbatim}
mpirun -np 8 pw.x -nk 2 ...
\end{verbatim}
without any {\tt -nimage} flag.
After the phonon calculation with images the dynmical matrices of
{\bf q}-vectors calculated in different images are not present in the
working directory. To obtain them you need to run
\phx\ again with:
\begin{verbatim}
mpirun -np 8 ph.x -nk 2 ...
\end{verbatim}
and the {\tt recover=.true.} flag. This scheme is quite automatic and
does not require any additional work by the user, but it wastes some
CPU time because all images stops when the image that requires the
largest amount of time finishes the calculation. Load balancing
between images is still at
an experimental stage. You can look into the routine {\tt image\_q\_irr}
inside {\tt PHonon/PH/check\_initial\_status} to see the present
algorithm for work distribution and modify it if you think that
you can improve the load balancing.
A different paradigm is the usage of the GRID concept, instead of MPI,
to achieve parallelization over irreps and {\bf q} vectors.
Complete phonon dispersion calculation can be quite long and
expensive, but it can be split into a number of semi-independent
calculations, using options \texttt{start\_q}, \texttt{last\_q},
\texttt{start\_irr}, \texttt{last\_irr}. An example on how to
distribute the calculations and collect the results can be found
in \texttt{examples/GRID\_example}. Reference:\\
{\it Calculation of Phonon Dispersions on the GRID using Quantum
ESPRESSO},
R. di Meo, A. Dal Corso, P. Giannozzi, and S. Cozzini, in
{\it Chemistry and Material Science Applications on Grid Infrastructures},
editors: S. Cozzini, A. Lagan\`a, ICTP Lecture Notes Series,
Vol. 24, pp.165-183 (2009).
\section{Troubleshooting}
\paragraph{ph.x stops with {\em error reading file}}
The data file produced by \pwx\ is bad or incomplete or produced
by an incompatible version of the code.
In parallel execution: if you did not set \texttt{wf\_collect=.true.}, the number
of processors and pools for the phonon run should be the same as for the
self-consistent run; all files must be visible to all processors.
\paragraph{ph.x mumbles something like {\em cannot recover} or {\em error
reading recover file}}
You have a bad restart file from a preceding failed execution.
Remove all files \texttt{recover*} in \texttt{outdir}.
\paragraph{ph.x says {\em occupation numbers probably wrong} and
continues} You have a
metallic or spin-polarized system but occupations are not set to
\texttt{`smearing'}.
\paragraph{ph.x does not yield acoustic modes with zero frequency at
${\bf q}=0$}
This may not be an error: the Acoustic Sum Rule (ASR) is never exactly
verified, because the system is never exactly translationally
invariant as it should be. The calculated frequency of the acoustic
mode is typically less than 10 cm$^{-1}$, but in some cases it may be
much higher, up to 100 cm$^{-1}$. The ultimate test is to diagonalize
the dynamical matrix with program \texttt{dynmat.x}, imposing the ASR. If you
obtain an acoustic mode with a much smaller $\omega$ (let us say
$< 1 \mbox{cm}^{-1}$ )
with all other modes virtually unchanged, you can trust your results.
``The problem is [...] in the fact that the XC
energy is computed in real space on a discrete grid and hence the
total energy is invariant (...) only for translation in the FFT
grid. Increasing the charge density cutoff increases the grid density
thus making the integral more exact thus reducing the problem,
unfortunately rather slowly...This problem is usually more severe for
GGA than with LDA because the GGA functionals have functional forms
that vary more strongly with the position; particularly so for
isolated molecules or system with significant portions of ``vacuum''
because in the exponential tail of the charge density a) the finite
cutoff (hence there is an effect due to cutoff) induces oscillations
in rho and b) the reduced gradient is diverging.''(info by Stefano de
Gironcoli, June 2008)
\paragraph{ph.x yields really lousy phonons, with bad or ``negative''
frequencies or wrong symmetries or gross ASR violations}
Possible reasons:
\begin{itemize}
\item if this happens only for acoustic modes at ${\bf q}=0$ that should
have $\omega=0$: Acoustic Sum Rule violation, see the item before
this one.
\item wrong data file read.
\item wrong atomic masses given in input will yield wrong frequencies
(but the content of file fildyn should be valid, since the force
constants, not the dynamical matrix, are written to file).
\item convergence threshold for either SCF (\texttt{conv\_thr}) or phonon
calculation (\texttt{tr2\_ph}) too large: try to reduce them.
\item maybe your system does have negative or strange phonon
frequencies, with the approximations you used. A negative frequency
signals a mechanical instability of the chosen structure. Check that
the structure is reasonable, and check the following parameters:
\begin{itemize}
\item The cutoff for wavefunctions, \texttt{ecutwfc}
\item For USPP and PAW: the cutoff for the charge density, \texttt{ecutrho}
\item The {\bf k}-point grid, especially for metallic systems.
\end{itemize}
\item For metallic systems: it has been observed that the convergence with
respect to the k-point grid and smearing is very slow in presence of
semicore states, and for phonon wave-vectors that are not commensurate i
with the k-point grid (that is, ${\bf q}\ne {\bf k}_i-{\bf k}_j$)
\end{itemize}
Note that ``negative'' frequencies are actually imaginary: the negative
sign flags eigenvalues of the dynamical matrix for which $\omega^2 <
0$.
\paragraph{{\em Wrong degeneracy} error in star\_q}
Verify the {\bf q}-vector for which you are calculating phonons. In order to
check whether a symmetry operation belongs to the small group of ${\bf q}$,
the code compares ${\bf q}$ and the rotated ${\bf q}$, with an acceptance tolerance of
$10^{-5}$ (set in routine \texttt{PW/eqvect.f90}). You may run into trouble if
your {\bf q}-vector differs from a high-symmetry point by an amount in that
order of magnitude.
\appendix
\section{Appendix: Electron-phonon coefficients}
\def\r{{\bf r}}
\def\d{{\bf d}}
\def\k{{\bf k}}
\def\q{{\bf q}}
\def\G{{\bf G}}
\def\R{{\bf R}}
\noindent The electron-phonon coefficients $g$
are defined as
\begin{equation}
g_{\q\nu}(\k,i,j) =\left({\hbar\over 2M\omega_{\q\nu}}\right)^{1/2}
\langle\psi_{i,\k}| {dV_{SCF}\over d {\hat u}_{\q\nu} }\cdot
\hat \epsilon_{\q\nu}|\psi_{j,\k+\q}\rangle.
\end{equation}
The phonon linewidth $\gamma_{\q\nu}$ is defined by
\begin{equation}
\gamma_{\q\nu} = 2\pi\omega_{\q\nu} \sum_{ij}
\int {d^3k\over \Omega_{BZ}} |g_{\q\nu}(\k,i,j)|^2
\delta(e_{\q,i} - e_F) \delta(e_{\k+\q,j} - e_F),
\end{equation}
while the electron-phonon coupling constant $\lambda_{\q\nu}$ for
mode $\nu$ at wavevector $\q$ is defined as
\begin{equation}
\lambda_{\q\nu} ={\gamma_{\q\nu} \over \pi\hbar N(e_F)\omega^2_{\q\nu}}
\end{equation}
where $N(e_F)$ is the DOS at the Fermi level.
The spectral function is defined as
\begin{equation}
\alpha^2F(\omega) = {1\over 2\pi N(e_F)}\sum_{\q\nu}
\delta(\omega-\omega_{\q\nu})
{\gamma_{\q\nu}\over\hbar\omega_{\q\nu}}.
\end{equation}
The electron-phonon mass enhancement parameter $\lambda$
can also be defined as the first reciprocal momentum of
the spectral function:
\begin{equation}
\lambda = \sum_{\q\nu} \lambda_{\q\nu} =
2 \int {\alpha^2F(\omega) \over \omega} d\omega.
\end{equation}
Note that a factor $M^{-1/2}$ is hidden in the definition of
normal modes as used in the code.
McMillan:
\begin{equation}
T_c = {\Theta_D \over 1.45} \mbox{exp} \left [
{-1.04(1+\lambda)\over \lambda(1-0.62\mu^*)-\mu^*}\right ]
\end{equation}
or (better?)
\begin{equation}
T_c = {\omega_{log}\over 1.2} \mbox{exp} \left [
{-1.04(1+\lambda)\over \lambda(1-0.62\mu^*)-\mu^*}\right ]
\end{equation}
where
\begin{equation}
\omega_{log} = \mbox{exp} \left [ {2\over\lambda} \int {d\omega\over\omega}
\alpha^2F(\omega) \mbox{log}\omega \right ]
\end{equation}
\end{document}