Introduction

The coupling between electrons and phonons is one of the most intensively studied fermion–boson interactions in condensed matter physics. It is responsible for a number of physical phenomena in solids such as conventional superconductivity, temperature-dependent resistivity in metals and mobility in semiconductors, the formation of polarons, and phonon-assisted optical processes, to name a few1,2. Predictive non-empirical calculations of electron–phonon interactions play an essential role in elucidating a variety of materials properties and their temperature dependence.

During the past three decades, first-principles calculations of electron–phonon interactions have been made possible by the development of density functional theory (DFT)3,4 and density-functional perturbation theory (DFPT)5,6,7. However, the computational cost of these calculations is high, as they involve the evaluation of Brillouin zone integrals which typically require a very fine sampling of the crystal momenta of electrons and phonons. For instance, in DFPT calculations, every single phonon wavevector and vibrational mode requires the solution of Sternheimer-type equations that carry a computational complexity comparable to a DFT total energy calculation8. As a result, calculating properties related to the electron–phonon interaction usually entails a computational workload that is orders of magnitude more costly than standard DFT calculations, thus rendering direct ab initio calculations of these quantities challenging.

Several methods have been proposed to address this challenge1. Among those, one of the authors proposed to combine DFPT with maximally localized Wannier functions (MLWFs)9 to perform a physics-based interpolation via a generalized Fourier transformation10. This method exploits the spatial localization of the electron-phonon matrix elements in the Wannier representation and enables efficient calculations of electron–phonon matrix elements on ultra-dense momentum grids while retaining the accuracy of DFPT.

The EPW code builds upon this methodology to compute a number of properties relating to electron–phonon interactions and temperature-dependent materials properties. EPW is the first open-source ab initio software devoted to electron–phonon interactions and has been actively developed for over 16 years. It was publicly released in 2010 under a GNU General Public License (GPL)11 and is being distributed within the Quantum ESPRESSO materials simulation suite12 since 2016. In addition to EPW, several software projects have been developed in recent years to address electron–phonon interactions, including: Perturbo13, elphbolt14, Phoebe15, and EPIq16. All these packages rely on the same interpolation methodology employed by EPW10.

Two prior manuscripts17,18 describe the status of the EPW code until 2016. The present manuscript aims to describe progress on the code that has occurred since 2016 as well as ongoing efforts, leading to the latest EPW release. Added functionalities involve: a magneto-transport module for the calculation of the conductivity in metals as well as the drift and Hall mobility in semiconductors; a module for the calculation of small and large polarons without using supercells; a module for the solution of the full-band Eliashberg equations for superconductors; a module for calculations of phonon-assisted indirect optical processes; and a module for calculations of finite-temperature electronic and optical properties via the special displacement method. The code has been refactored to keep up with contemporary developments in high-performance computing (HPC) architectures, for example via hybrid two-level message passing interface (MPI19) and Open Multi-Processing (OpenMP20) parallelization, and parallel I/O via parallel Hierarchical Data Format 5 (HDF521).

The manuscript is organized as follows. In the ‘Methods’ section (located at the end of the manuscript), we describe the notation employed throughout this manuscript, we review the conceptual basis of electron–phonon interpolation using DFPT and MLWFs, and we discuss the extension of this methodology to the case of polar materials with long-range Coulomb interactions. In the ‘Results’ section, we describe the additional or expanded functionalities available in the latest release of the EPW code. In particular, we begin by discussing calculations of carrier transport within the ab initio Boltzmann transport equation. We consider both electric and magnetic fields, as well as phonon-limited and charged defect-limited transport. Then we move to calculations of the superconducting critical temperature and superconducting gap function. Here, we discuss elementary calculations based on the semi-empirical McMillan equation, the isotropic Eliashberg theory, and the fully-anisotropic full-band Eliashberg theory. Next, we outline the methodology for computing small and large polarons from DFPT without resorting to large supercells. We then proceed with the formalism for the calculation of optical absorption spectra including phonon-assisted indirect transitions. After these applications which are based on Wannier–Fourier interpolation, we describe the special displacement method, which offers an alternative and complementary strategy to computing electron–phonon properties without employing Wannier–Fourier interpolation. At the end of this section, we discuss recent advances in computational algorithms, parallelization, and I/O, and we report on parallel scaling benchmarks. In the ‘Discussion’ section we discuss possible future directions for the EPW software project.

Results

In this section, we provide an overview of additional or expanded capabilities of the EPW code. In particular, we discuss how EPW calculates carrier transport properties via the ab initio Boltzmann transport equation (aiBTE), including both carrier-phonon and carrier-impurity scattering; how the superconducting critical temperature and superconducting gap are computed via the solution of the Eliashberg equations; how we solve the ab initio polaron equations to investigate small and large polarons without using large supercells; and how we perform calculations of optical absorption spectra in indirect-gap semiconductors by including phonon-assisted optical transitions. We also describe an alternative to Wannier interpolation to study electron–phonon interactions, based on the special displacement method. Of these features, the superconducting module has been enhanced and expanded with respect to the previous release in 201618; all the other modules described in the following have been developed ex novo since the 2016 release. The notations and conventions employed below are described in detail in the ‘Methods’ section. In the same section, we provide an overview of the Wannier–Fourier interpolation of electron–phonon matrix elements.

Phonon-limited carrier transport using the ab initio Boltzmann transport equation

Background and formalism

The calculation of the electronic transport properties of metals and semiconductors is conveniently dealt with by the ab initio Boltzmann transport equation (aiBTE). The Boltzmann equation describes the non-equilibrium distribution function of electrons and holes in the presence of external electric or magnetic fields2. It carries strong predictive power as recently demonstrated for many common semiconductors22. Although the Boltzmann formalism is usually derived within the semi-classical approximation, the theory can rigorously be derived from a non-equilibrium many-body Green’s function formalism and is understood as the quasiparticle approximation to the Kadanoff–Baym theory23,24,25,26.

The EPW code implements the linearized Boltzmann transport equation, which describes the first-order response of the distribution function to external fields and is suitable for investigating the conductivity of metals and the low-field mobility of semiconductors. In this section, we focus on the case of phonon-limited transport properties. The extension to include charged defects is discussed in the next section.

We consider homogeneous extended solids held at uniform temperature, and carrier scattering by electron–phonon interactions only, for now. Within the aiBTE, the linear response \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\) of the carrier distribution function to an external electric field E is given by22,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41

$$\begin{array}{rcl}{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}&=&e{v}_{n{{{\bf{k}}}}\beta }\frac{\partial {f}_{n{{{\bf{k}}}}}^{0}}{\partial {\varepsilon }_{n{{{\bf{k}}}}}}{\tau }_{n{{{\bf{k}}}}}+\frac{2\pi {\tau }_{n{{{\bf{k}}}}}}{\hslash }\mathop{\sum}\limits_{m\nu }\,\displaystyle\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}| {g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}}){| }^{2}{\partial }_{{E}_{\beta }}{f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}\\ &\times &\left[({n}_{{{{\bf{q}}}}\nu }+1-{f}_{n{{{\bf{k}}}}}^{0})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}+\hslash {\omega }_{{{{\bf{q}}}}\nu })+({n}_{{{{\bf{q}}}}\nu }+{f}_{n{{{\bf{k}}}}}^{0})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-\hslash {\omega }_{{{{\bf{q}}}}\nu })\right].\end{array}$$
(1)

In this expression, fnk is the electron distribution function, n denotes a Kohn–Sham band index, and k is the electron wavevector. \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\) is a short-hand notation for (∂fnk/∂Eβ)∣E=0, vnkα = ℏ−1εnk/∂kα is the intra-band velocity matrix element for the Kohn–Sham eigenvalue εnk, and δ denotes the Dirac delta function. gmnν(k, q) is the electron–phonon matrix element describing the scattering from the state nk to the state mk + q via the phonon of branch ν and wavevector q (see the “Methods” section for more details). The integral is over the Brillouin zone. The temperature enters this equation via the Fermi–Dirac and Bose–Einstein equilibrium distribution functions \({f}_{n{{{\bf{k}}}}}^{0}\) and nqν, respectively. The quantity τnk in Eq. (1) is the carrier relaxation time, and is obtained from Fermi’s golden rule:

$$\begin{array}{ll}&{\tau }_{n{{{\bf{k}}}}}^{-1}=\frac{2\pi }{\hslash }\mathop{\sum}\limits_{m\nu }\,\displaystyle\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}| {g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}}){| }^{2}\\ &\times \left[({n}_{{{{\bf{q}}}}\nu }+1-{f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}^{0})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-\hslash {\omega }_{{{{\bf{q}}}}\nu })+({n}_{{{{\bf{q}}}}\nu }+{f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}^{0})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}+\hslash {\omega }_{{{{\bf{q}}}}\nu })\right].\end{array}$$
(2)

The electrical conductivity tensor σαβ, which corresponds to the variation of the current density with respect to the electric field, is computed from \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\) using:

$${\sigma }_{\alpha \beta }=-\frac{e}{{{\Omega }}}\mathop{\sum}\limits_{n}\displaystyle\int\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,{v}_{n{{{\bf{k}}}}\alpha }{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}},$$
(3)

and the drift mobility is obtained from this expression upon dividing by the carrier density nc:

$${\mu }_{\alpha \beta }=\frac{{\sigma }_{\alpha \beta }}{e\,{n}_{{{{\rm{c}}}}}}.$$
(4)

These equations are valid for metals and for electrons or holes in semiconductors taken separately. A common approximation to the aiBTE is the relaxation time approximation, which consists of neglecting the second term on the right-hand side of Eq. (1). In this case the mobility takes the simpler form:

$${\mu }_{\alpha \beta }^{{{{\rm{SERTA}}}}}=-\frac{e}{{n}_{{{{\rm{c}}}}}{{\Omega }}}\mathop{\sum}\limits_{n}\displaystyle\int\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\frac{\partial {f}_{n{{{\bf{k}}}}}^{0}}{\partial {\varepsilon }_{n{{{\bf{k}}}}}}{v}_{n{{{\bf{k}}}}\alpha }{v}_{n{{{\bf{k}}}}\beta }{\tau }_{n{{{\bf{k}}}}}.$$
(5)

We refer to this approximation as the “self-energy relaxation time approximation” (SERTA) since the transport lifetime in Eq. (2) corresponds to the quasiparticle lifetime, which is proportional to the imaginary part of the electron-phonon self-energy1,22,24.

The electrical conductivity and the drift mobility described by Eq. (1) can be measured by time-of-flight measurements or by THz photo-conductivity measurements. In the case of Hall and De Haas–Van Alphen measurements, an additional magnetic field B is applied, and the resulting Lorentz force must be taken into account in the aiBTE. In these cases, EPW solves the following aiBTE equation22,24,32,42:

$$\begin{array}{l}\left[1-\frac{e}{\hslash }{\tau }_{n{{{\bf{k}}}}}({{{{\bf{v}}}}}_{n{{{\bf{k}}}}}\times {{{\bf{B}}}})\cdot {\nabla }_{{{{\bf{k}}}}}\right]{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}({{{\bf{B}}}})=e{v}_{n{{{\bf{k}}}}\beta }\frac{\partial {f}_{n{{{\bf{k}}}}}^{0}}{\partial {\varepsilon }_{n{{{\bf{k}}}}}}{\tau }_{n{{{\bf{k}}}}}\\ +\frac{2\pi {\tau }_{n{{{\bf{k}}}}}}{\hslash }\mathop{\sum}\limits_{m\nu }\,\displaystyle\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}| {g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}}){| }^{2}{\partial }_{{E}_{\beta }}{f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}({{{\bf{B}}}})\\ \times \left[({n}_{{{{\bf{q}}}}\nu }+1-{f}_{n{{{\bf{k}}}}}^{0})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}+\hslash {\omega }_{{{{\bf{q}}}}\nu })+({n}_{{{{\bf{q}}}}\nu }+{f}_{n{{{\bf{k}}}}}^{0})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-\hslash {\omega }_{{{{\bf{q}}}}\nu })\right].\end{array}$$
(6)

The variation \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}({{{\bf{B}}}})\) is computed for magnetic fields sufficiently small that their effect on the electronic and vibrational properties can be ignored; accordingly, the Kohn–Sham energies, phonons, and their couplings in the above equation are all evaluated for B = 0. The application of a magnetic field in the direction \(\hat{{{{\bf{B}}}}}\) results in an orthogonal flow of the charge carriers which can be described by the linear response of the mobility to the field:

$${\mu }_{\alpha \beta }^{(2)}(\hat{{{{\bf{B}}}}})=-\mathop{\lim }\limits_{{{{\bf{B}}}}\to {{{\bf{0}}}}}\frac{1}{| {{{\bf{B}}}}| }\left[\frac{1}{{n}_{{{{\rm{c}}}}}{{\Omega }}}\mathop{\sum}\limits_{n}\int\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}{v}_{n{{{\bf{k}}}}\alpha }{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}({{{\bf{B}}}})-{\mu }_{\alpha \beta }\right].$$
(7)

From this expression, we obtain the Hall mobility in terms of the drift mobility as follows:

$${\mu }_{\alpha \beta }^{{{{\rm{H}}}}}(\hat{{{{\bf{B}}}}})=\mathop{\sum}\limits_{\gamma }{r}_{\alpha \gamma }^{{{{\rm{H}}}}}(\hat{{{{\bf{B}}}}}){\mu }_{\gamma \beta }\,,$$
(8)

where we have introduced the dimensionless Hall factor as22

$${r}_{\alpha \gamma }^{{{{\rm{H}}}}}(\hat{{{{\bf{B}}}}})=\mathop{\sum}\limits_{\gamma \delta }{\mu }_{\alpha \gamma }^{-1}{\mu }_{\gamma \delta }^{(2)}(\hat{{{{\bf{B}}}}}){\mu }_{\delta \beta }^{-1}.$$
(9)

Also in this case, one can simplify the solution of Eq. (6) by ignoring the second term on the right-hand side. This choice leads to the SERTA approximation in the presence of a magnetic field.

Computational considerations

EPW implements an iterative solver to obtain \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\) from Eq. (1), with the possibility of Broyden mixing43 to accelerate the convergence. The accurate evaluation of Eqs. (3) and (4) is computationally demanding because it requires the knowledge of \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\) for a dense set of k-points in an energy window of the order of a few tens of meV around the Fermi energy. In particular, since the scattering integral on the right-hand side of Eq. (1) couples linear response coefficients at k and k + q points, the k-grid and the q-grid must be commensurate. As this term is not evaluated in the SERTA approximation, SERTA calculations can instead be performed using incommensurate grids, including for example random and quasi-random sampling31. It should be noted, however, that the SERTA approximation tends to underestimate transport coefficients by up to 50% as compared to the aiBTE22.

Regardless of the approximation chosen to calculate transport coefficients, EPW exploits crystal symmetry operations to eliminate symmetry-equivalent wavevectors in the solution of Eq. (1); accordingly, \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\) is evaluated within the irreducible wedge of the Brillouin zone. Furthermore, the solution of Eq. (1) is restricted to the set of wavevectors for which both the initial and the final electronic state lie within a user-defined energy window around reference energy. In particular, the wavevectors k and q are retained only if there exists a pair of bands m and n such that ∣εnkEref∣ < Δ and ∣εmk+qEref∣ < Δ, where Eref is reference energy and Δ is the width of the window. In the case of metals, the reference energy is set to the Fermi energy. In the case of semiconductors, the Fermi energy is calculated from the user-specified temperature and carrier concentration, using the bisection method.

Magneto-transport calculations using Eq. (6) are harder to converge than calculations without magnetic fields. The iterative solution is initialized by using the result of Eq. (1) as a first approximation for \({\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}({{{\bf{B}}}})\), and the quantity \({\nabla }_{{{{\bf{k}}}}}{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}({{{\bf{B}}}})\) appearing on the left-hand side of Eq. (6) is evaluated via finite differences. The correctness of the solution is tested by checking for the conservation of the carrier density, which corresponds to the condition \({\sum }_{n{{{\bf{k}}}}}{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}({{{\bf{B}}}})=0\).

To ensure numerically accurate evaluation of transport coefficients with EPW, it is important to verify that results be converged with respect to (i) the density of the Brillouin zone grids employed in Eqs. (1) and (6); (ii) the density of the coarse grids used for the Wannier–Fourier interpolation of the DFT and DFPT data22; (iii) the Gaussian smearing employed to compute the Dirac delta functions appearing in Eq. (1); and (iv) to check for the sensitivity of results to lattice parameters, exchange and correlation functionals, and pseudopotentials. To facilitate the convergence with respect to the Gaussian smearing and the k-point sampling, EPW offers the possibility of using the adaptive smearing method of ref. 44.

Application example

To demonstrate the implementation of the transport module in EPW, we investigate the electron and hole mobilities of cubic boron nitride, as well as the associated Hall factors. We use the relativistic Perdew–Burke–Ernzerhof (PBE) parametrization45 of the generalized gradient approximation to DFT. The pseudopotentials are norm-conserving, generated using the ONCVPSP code46, and optimized via the PseudoDojo initiative47. We consider room temperature and low carrier concentrations of 1013 cm−3. c-BN is a polar wide gap semiconductor with isotropic Born effective charges \({Z}_{{{{\rm{B}}}}}^{* }=1.91\,e\) and \({Z}_{{{{\rm{N}}}}}^{* }=-{Z}_{{{{\rm{B}}}}}^{* }\); isotropic dynamical quadrupoles Qκ,αβγ = Qκϵαβγ∣ where ϵαβγ is the Levi–Civita tensor and Qκ an atom-dependent scalar with values QB = 3.46ea0 and QN = −0.63ea0, where a0 is the Bohr radius; and an isotropic high-frequency relative dielectric constant ϵ = 4.5422. As will be discussed in Fig. 9, long-range electron–phonon interactions are important in the case of c-BN. Wannier functions are calculated separately for the valence and the conduction band manifold in order to reduce the computational cost.

Figure 1a shows the convergence of calculated mobilities with the coarse grid of k-points used in the Wannierization procedure. For this test, we employ a coarse q-point grid with half the number of the k-points; and we employ identical fine grids with 503k- and q-points for the solution of Eq. (1); we use an energy window Δ = 0.3 eV around the reference energy Eref set to the band edge, and we employ adaptive smearing. This panel shows that the mobilities are converged with an accuracy of 1% when coarse grids with 183 and 143 points are employed for electrons and holes, respectively. Figure 1b shows the convergence of calculated mobilities with respect to the fine grids. We see that both electron and hole mobilities are almost converged for grids consisting of 2503 points. Generally speaking, the fine grid required to achieve converged results depends on the effective masses, with smaller masses requiring denser grids. As an example, accurate calculations of the electron mobility of GaAs require homogeneous grids of order 4003 points, while in the case of AlAs or GaP 803 points are sufficient22 (see Table 1).

Fig. 1: Calculations of phonon-limited carrier mobility using EPW.
figure 1

a Convergence test for the electron and hole mobilities of c-BN with respect to the number of k-points on the coarse grid. The number of q-points is set to half the number of k-points. b Convergence of mobilities w.r.t. the number of grid points on the fine grids. The number of q-points is set to be the same as the number of k-points. c Same as in b, but this time for calculations within the SERTA approximation. d and e Hall factors of c-BN for electrons and holes, as a function of the number of points on the fine grids, for the full aiBTE and the SERTA approximation, respectively. The number of q-points is set to be the same as the number of k-points. f Dependence of the electron drift mobility of c-BN with the Gaussian smearing.

Table 1 Typical size of fine grids employed in EPW calculations.

In Fig. 1c we show convergence curves for the mobility evaluated in the SERTA approximation. In this case, the convergence with the density of points in the fine grids is much slower than for complete aiBTE calculations. More importantly, SERTA mobilities can differ by up to a factor of two from the corresponding aiBTE results. The large difference between full aiBTE calculations and SERTA seems to be a common trend in polar materials22. For the same k- and q-point grids, the computational saving afforded by the SERTA approximation is minimal; therefore, we recommend using SERTA only when the use of commensurate grids is too demanding, for example in the case of systems with many atoms in the unit cell. Figure 1d, e show the computed Hall factors for electrons and holes in c-BN, respectively. The Hall factor in the SERTA approximation appears to be close to the full aiBTE result, which is expected since it is defined as the ratio of two mobilities (see Eq. (9))48.

In Fig. 1(f) we analyze the role of the Gaussian smearing parameter in the calculations. To this end, we compute the electron mobility of c-BN as a function of grid size, for varying smearing parameter. It is seen that the size of the grid necessary for convergence increases when decreasing the smearing in the few meV’s range. On the other hand, the use of adaptive smearing affords fast convergence even for smaller grid sizes. Based on this comparison, adaptive smearing is the computationally most convenient strategy.

Defect-limited carrier transport using the ab initio Boltzmann transport equation

Background and formalism

Electron–phonon interactions are the dominant scattering mechanism in high-purity single crystals with low defect concentration, typically up to 1015 cm−3 49. In tetrahedral semiconductors and a host of other materials, charged defects are ubiquitous since dopant elements are employed to introduce free carriers50. Donors release electrons to the conduction band, thus becoming positively charged defects; similarly, acceptors release holes into the valence band, and become negatively charged defects. In either case, the impurity generates a long-ranged Coulomb potential that scatters charge carriers. This scattering mechanism tends to dominate over electron–phonon processes at high doping concentrations.

There exist popular semi-empirical relations to estimate the effect of ionized impurity scattering on carrier transport in semiconductors, such as the Brooks–Herring51 and Conwell–Weisskopf52 formulas. However, these expressions rely on simplified parabolic band models and do not carry predictive power in the case of materials with multi-band or multi-valley band extrema. First-principles calculations offer a modern alternative to these earlier approaches, and have achieved considerable success in recent years53,54,55,56. The EPW code implements a module for charged defect scattering based on a randomized distribution of point charges. This approach is described in detail in ref. 57 and summarized below.

For convenience we rewrite the aiBTE from Eq. (1) in the more compact form:

$$-e{v}_{n{{{\bf{k}}}}\beta }\frac{\partial {f}_{n{{{\bf{k}}}}}^{0}}{\partial {\varepsilon }_{n{{{\bf{k}}}}}}=\mathop{\sum}\limits_{m}\int\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\left({\tau }_{m{{{\bf{k}}}}+{{{\bf{q}}}}\to n{{{\bf{k}}}}}^{-1}\,{\partial }_{{E}_{\beta }}{f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-{\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{-1}\,{\partial }_{{E}_{\beta }}{f}_{n{{{\bf{k}}}}}\right),$$
(10)

where the quantity \({\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{-1}\) is the partial scattering rate from the Kohn–Sham state nk to the state mk + q. In the case of electron–phonon scattering, \({\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{-1}\) is obtained from Eq. (2) by removing the summation over m and the integral over the Brillouin zone, i.e. \(\mathop{\sum}\nolimits_{m}\int d{\bf{q}}/\Omega_{\rm{BZ}}\). When both electron–phonon scattering and charged impurity scattering are taken into account, the partial scattering rate is written as the sum of the individual partial rates

$$\frac{1}{{\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}}=\frac{1}{{\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{{{{\rm{ph}}}}}}+\frac{1}{{\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{\,{{\rm{imp}}}\,}},$$
(11)

where the superscripts refer to carrier-phonon (ph) and carrier-impurity (imp) scattering, respectively. In EPW, the carrier-impurity partial scattering rate \(1/{\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{\,{{\rm{imp}}}\,}\) is calculated under the following simplifying approximations: (i) each impurity is described by an idealized point charge, embedded in the dielectric continuum of the host material; (ii) the scattering rate from each impurity is evaluated within the first Born approximation; (iii) defects are sufficiently diluted that the scattering rates from different impurities are additive; (iv) impurities are randomly distributed, and this random distribution is formally taken into account by using the Kohn and Luttinger ensemble average58. Within these approximations, the charged impurity scattering rate reads57:

$$\frac{1}{{\tau }_{n{{{\bf{k}}}}\to m{{{\bf{k}}}}+{{{\bf{q}}}}}^{\,{{\rm{imp}}}}}={N}_{{{\rm{imp}}}}\frac{2\pi }{\hslash }{\left[\frac{{e}^{2}}{4\pi {\epsilon }_{0}}\frac{4\pi Z}{{{\Omega }}}\right]}^{2}\mathop{\sum}\limits_{{{{\bf{G}}}}\ne -{{{\bf{q}}}}}\frac{\,| \langle {\psi }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}| {e}^{i({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{\bf{r}}}}}| {\psi }_{n{{{\bf{k}}}}}\rangle {| }^{2}}{| ({{{\bf{q}}}}+{{{\bf{G}}}})\cdot \,{{{{\boldsymbol{\epsilon }}}}}^{0}\,\cdot ({{{\bf{q}}}}+{{{\bf{G}}}}){| }^{2}}\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}),$$
(12)

where Nimp is the number of impurities per crystal unit cell (dimensionless), Ze is the charge of each impurity, and \({{{{\boldsymbol{\epsilon }}}}}_{}^{0}\) is the static relative dielectric constant tensor. The scattering rate in Eq. (12) takes into account the DFT electronic band structure and the lattice screening, including possible dielectric anisotropy. The main advantage of this model as compared to explicit calculations of charged defects in supercells is that it can be used systematically without requiring detailed knowledge of the defect physics and energetics in each material.

Computational considerations

In the EPW code, the scattering rate given in Eq. (12) is added to the electron–phonon scattering rate using Eqs. (11) and (10), and the aiBTE is solved as already described for the phonon-limited mobility. The computational overhead as compared to phonon-only calculations is minimal.

In Eq. (12), the sum over G-vectors is handled via a Gaussian filter, as described in the “Methods” section; the reader is referred to that section for more details. The overlap integrals between the initial and final Kohn–Sham states appearing in Eq. (12), 〈ψmk+qei(q+G)⋅rψnk〉, are evaluated by means of the unitary Wannier function matrices described in the Methods.

The integral over the scattering wavevectors q in Eq. (10) of the impurity scattering rates given in Eq. (12) contains a singular ∣q−4 term that is not integrable. This issue is resolved by introducing the screening of the defect potential by free carriers released upon ionization. To this end, we replace \({{{{\boldsymbol{\epsilon }}}}}_{}^{0}\) in Eq. (12) with the total dielectric function:

$${{{{\boldsymbol{\epsilon }}}}}_{{{{\rm{tot}}}}}^{0}={{{{\boldsymbol{\epsilon }}}}}^{0}+\frac{{q}_{{{{\rm{TF}}}}}^{2}}{{q}^{2}}{{{\boldsymbol{I}}}},$$
(13)

where \({{{{\boldsymbol{I}}}}}_{}^{}\) denotes the identity matrix, and qTF is the Thomas–Fermi wavenumber obtained from the long-wavelength limit of the Lindhard function49,56,59:

$${q}_{{{{\rm{TF}}}}}^{2}=\frac{{e}^{2}}{4\pi {\epsilon }_{0}}\frac{4\pi }{{{\Omega }}}2\mathop{\sum}\limits_{n}\int\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\left\vert \frac{\partial {f}_{n{{{\bf{k}}}}}^{0}}{\partial {\varepsilon }_{n{{{\bf{k}}}}}}\right\vert .$$
(14)

Temperature enters this expression via the equilibrium Fermi–Dirac distribution of the electrons or holes, \({f}_{n{{{\bf{k}}}}}^{0}\).

The concentration of charged defects is an external input parameter in these calculations. In the case of ionized impurities in semiconductors, it is also possible to use a simple estimate for the fraction fii of ionized impurities at a given temperature by using the impurity energy level in the gap εd49,56,60.

$${f}_{{{{\rm{ii}}}}}^{2}=\max \left(1,\frac{1}{{n}_{d}\,{{\Omega }}}\mathop{\sum}\limits_{n}\int\frac{d{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}f({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{{{{\rm{d}}}}})\right)\,,$$
(15)

where f is the Fermi–Dirac distribution and nd is the total concentration of defects that may thermally ionize.

Owing to the ∣q−4 scaling of the ionized-impurity scattering matrix elements, achieving convergence in the presence of impurities is slightly more demanding than for calculations of phonon-limited mobility. For example, in recent calculations of carrier mobilities in Si, GaP, and SiC, fine grids with 1003, 1003, and 1803 points were necessary, respectively57 (see Table 1).

Application example

To illustrate the impurity scattering capability of EPW, we calculate the mobility of electrons and holes in silicon as a function of both temperature and dopant concentration. We consider coarse Brillouin zone grids with 123k-points and 63q-points, and fine grids with 1003 points. We use the PBE functional45 and ONCV pseudopotentials46,61, and we include spin–orbit coupling for the valence bands. We account for quadrupole corrections using the procedure described in the Methods section.

Figure 2a shows the calculated electron mobility of silicon as a function of temperature. When considering phonon scattering only, our calculations are in very good with measurements on high-purity silicon62. Upon introducing ionized impurity scattering, the electron mobility at 100 K decreases from 11,813 to 4725 cm2 V−1 s−1 for a dopant concentration of 1.75 × 1016 cm−3, and to 1769 cm2 V−1 s−1 for a dopant concentration of 1.3 × 1017 cm−3. These calculations agree well with experimental data63. At higher temperatures, the reduction in the mobility due to impurity scattering is less significant since phonons provide the dominant scattering mechanism. The hole mobility in Fig. 2b exhibits a similar trend. Upon introducing ionized impurity scattering, the hole mobility at 100 K decreases from 8877 to 2884 cm2 V−1 s−1 for a dopant concentration of 2.4 × 1016 cm−3, and to 1056 cm2 V−1 s−1 for a dopant concentration of 2.0 × 1017 cm−3. Also in this case, the agreement with experimental data is very good63.

Fig. 2: Calculations of phonon- and impurity-limited carrier mobility using EPW.
figure 2

a Mobility of silicon as a function of temperature, for the following three cases: phonon scattering only (black disks and lines); phonon and ionized impurity scattering, with an impurity concentration of 1.75 × 1016 cm−3 (indigo disks and lines), and with a concentration of 1.3 × 1017 cm−3 (green disks and lines). Experimental data for the same concentrations are shown as diamonds of the same color62,63,219. b Same as in (a) but for the hole mobility of silicon. The impurity concentrations are 2.4 × 1016 cm−3 (indigo) and 2.0 × 1017 cm−3 (green), respectively. c Electron mobility of silicon at 300 K, as a function of ionized impurity concentration: black disks and lines are calculations, black diamonds are experiments64,66. d Same as in (c) but for the hole mobility.

Figure 2c shows the calculated electron mobility of silicon at 300 K, as a function of ionized impurity concentration. Up to a dopant concentration of 1016 cm−3, phonon scattering dominates and the mobility is relatively insensitive to impurity scattering. Beyond this concentration, the mobility decreases sharply and approximately as the inverse of the impurity density, in line with Eq. (12). The calculations agree well with experiments up to an impurity concentration around 1018 cm−364. Beyond this concentration, it is expected that additional mechanisms such as two-impurity scattering and plasmon scattering65 will further reduce the mobility. The hole mobility, which is shown in Fig. 2d, follows a similar trend. The calculated hole mobility at low doping, 603 cm2 V−1 s−1, slightly overestimates the experimental range 450–500 cm2 V−1 s−1; this effect can be traced to the underestimation of the heavy hole mass by DFT31. Upon increasing the impurity concentration, the mobility decreases following the same trend as for the electrons. These calculations agree well with experiments64,66 and with previous first-principles calculations56.

Phonon-mediated superconductivity using the ab initio Eliashberg theory

Background and formalism

First-principles calculations of phonon-mediated superconductors are primarily based on three approaches, namely semi-empirical methods based on the McMillan formula67, the ab initio Eliashberg theory68,69, and the density-functional theory for superconductors70,71,72,73. The EPW code implements the former two approaches. In this section, we briefly review methods based on the McMillan formula, and then we describe the Eliashberg formalism and its implementation.

The superconducting critical temperature Tc can be estimated using the semi-empirical McMillan equation in Allen–Dynes form74:

$${k}_{{{{\rm{B}}}}}{T}_{{{{\rm{c}}}}}^{{{{\rm{AD}}}}}=\frac{\hslash {\omega }_{\log }}{1.2}\exp \left[\frac{-1.04(1+\lambda )}{\lambda -{\mu }^{* }(1+0.62\lambda )}\right],$$
(16)

where kB is Boltzmann’s constant, μ* is the semi-empirical Coulomb pseudopotential, \({\omega }_{\log }\) is the logarithmic average of the phonon frequencies, and λ is the electron–phonon coupling constant, as defined in ref. 1. The parameter μ* is largely material independent, for a large class of superconductors a value in the 0.1-0.15 range being typically required to fit the experimental Tc74,75,76. Note that for very strong coupling (λ > 1.5), in ref. 74 two correction prefactors f1 and f2 are introduced in Eq. (16) to better estimate the critical temperature in this regime.

In addition, the code allows the user to calculate the critical temperature using a more recent prescription based on a machine learning approach77:

$${T}_{{{{\rm{c}}}}}^{{{{\rm{ML}}}}}={f}_{\omega }{f}_{\mu }{T}_{{{{\rm{c}}}}}^{{{{\rm{AD}}}}},$$
(17)

where the correction factors fω and fμ are given by

$${f}_{\omega }=1.92\frac{\lambda +{\omega }_{\log }/{\bar{\omega }}_{2}-{({\mu }^{* })}^{1/3}}{{\lambda }^{1/2}\exp ({\omega }_{\log }/{\bar{\omega }}_{2})}-0.08,\qquad {f}_{\mu }=\frac{6.86\exp (-\lambda /{\mu }^{* })}{{\lambda }^{-1}-{\mu }^{* }-{\omega }_{\log }/{\bar{\omega }}_{2}}+1.$$
(18)

In these expressions, \({\bar{\omega }}_{2}\) is the square root of the second moment of the normalized weight function g(ω) = 2α2F(ω)/(ωλ), with α2F being the Eliashberg spectral function, as defined in ref. 1. Equations (16) and (17) are useful for preliminary calculations but do not carry the predictive power of the ab initio Eliashberg theory.

The Eliashberg theory68,69 describes the superconducting phase transition by means of finite-temperature Green’s functions. In this theory, superconducting pairing arises from an attractive electron–electron interaction mediated by phonons, which is partly compensated by the inter-electron Coulomb repulsion. The Eliashberg theory can be formulated as a Dyson equation for a generalized 2 × 2 matrix Green’s function via the Nambu-Gor’kov formalism78,79. The off-diagonal elements of this matrix describe Cooper-pair amplitudes in the superconducting state and are related to the superconducting gap function. These elements become nonzero below the critical temperature, marking the transition to the superconducting state. It is standard practice to expand the pairing self-energy using Pauli matrices \({\hat{\tau }}_{i}\) (i = 0, …, 3) as follows75,80,81,82,83,84,85,86:

$${\hat{{{\Sigma }}}}_{n{{{\bf{k}}}}}(i{\omega }_{j})=i\hslash {\omega }_{j}\left[1-{Z}_{n{{{\bf{k}}}}}(i{\omega }_{j})\right]{\hat{\tau }}_{0}+{\chi }_{n{{{\bf{k}}}}}(i{\omega }_{j}){\hat{\tau }}_{3}+{\phi }_{n{{{\bf{k}}}}}(i{\omega }_{j}){\hat{\tau }}_{1},$$
(19)

where iωj = i(2j + 1)πT is the fermionic Matsubara frequency with j being an integer, T is the absolute temperature, Znk(iωj) is the mass renormalization function, χnk(iωj) is the energy shift, and ϕnk(iωj) is the order parameter. This self-energy is expressed in terms of the electron Green’s function using the Migdal approximation87 for the electron–phonon contribution, and the GW approximation for the electron–electron contribution88,89. Using Eq. (19) inside the Dyson equation for the electron Green’s function yields a set of coupled equations for Znk, χnk, and ϕnk:

$${Z}_{n{{{\bf{k}}}}}(i{\omega }_{j})=1+\frac{{k}_{{{{\rm{B}}}}}T}{{\omega }_{j}N({\varepsilon }_{{{{\rm{F}}}}})}\mathop{\sum}\limits_{m{j}^{{\prime} }}\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\frac{{\omega }_{{j}^{{\prime} }}{Z}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}{{\theta }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }}),$$
(20)
$${\chi }_{n{{{\bf{k}}}}}(i{\omega }_{j})=-\frac{{k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}})}\mathop{\sum}\limits_{m{j}^{{\prime} }}\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\frac{{\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-{\mu }_{{{{\rm{F}}}}}+{\chi }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}{{\theta }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }}),$$
(21)
$${\phi }_{n{{{\bf{k}}}}}(i{\omega }_{j})=\frac{{k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}})}\mathop{\sum}\limits_{m{j}^{{\prime} }}\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\frac{{\phi }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}{{\theta }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}\left[\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }})-N({\varepsilon }_{{{{\rm{F}}}}}){V}_{n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}}}\right],$$
(22)

having defined the auxiliary function:

$${\theta }_{n{{{\bf{k}}}}}(i{\omega }_{j})={\left[\hslash {\omega }_{j}{Z}_{n{{{\bf{k}}}}}(i{\omega }_{j})\right]}^{2}+{\left[{\varepsilon }_{n{{{\bf{k}}}}}-{\mu }_{{{{\rm{F}}}}}+{\chi }_{n{{{\bf{k}}}}}(i{\omega }_{j})\right]}^{2}+{\left[{\phi }_{n{{{\bf{k}}}}}(i{\omega }_{j})\right]}^{2}.$$
(23)

In Eqs. (20)–(23), N(εF) is the density of states (DOS) per spin at the Fermi level, μF is the chemical potential, and the quantities Vnk,mk+q denote the matrix elements of the screened Coulomb interaction W between electron pairs, as given in refs. 90,91. The anisotropic electron–phonon coupling parameters \(\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }})\) appearing in these equations are calculated as

$$\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }})=\frac{N({\varepsilon }_{{{{\rm{F}}}}})}{\hslash }\mathop{\sum}\limits_{\nu }{\left\vert {g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})\right\vert }^{2}\frac{2{\omega }_{{{{\bf{q}}}}\nu }}{{({\omega }_{j}-{\omega }_{{j}^{{\prime} }})}^{2}+{\omega }_{{{{\bf{q}}}}\nu }^{2}}.$$
(24)

Equations (20)–(23) are supplemented by a statement of particle number conservation, which determines the chemical potential84:

$${N}_{{{{\rm{e}}}}}=\mathop{\sum}\limits_{n}\int\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\left[1-2{k}_{{{{\rm{B}}}}}T\mathop{\sum}\limits_{j}\frac{{\varepsilon }_{n{{{\bf{k}}}}}-{\mu }_{{{{\rm{F}}}}}+{\chi }_{n{{{\bf{k}}}}}(i{\omega }_{j})}{{\theta }_{n{{{\bf{k}}}}}(i{\omega }_{j})}\right],$$
(25)

where Ne is the number of electrons per unit cell. Equations (20)–(25) are referred to as the anisotropic full-bandwidth (FBW) Eliashberg equations92 since they explicitly take into account scattering processes involving electrons with energies and momenta that are not restricted to the vicinity of the Fermi surface. To find the temperature-dependent superconducting gap, in EPW these equations are solved iteratively for different temperatures; the highest temperature for which a non-trivial solution exists (ϕnk ≠ 0) is the superconducting critical temperature Tc. Below this temperature, the superconducting gap Δnk is given by

$${{{\Delta }}}_{n{{{\bf{k}}}}}(i{\omega }_{j})={\phi }_{n{{{\bf{k}}}}}(i{\omega }_{j})/{Z}_{n{{{\bf{k}}}}}(i{\omega }_{j})\,.$$
(26)

The numerical solution of Eqs. (20)–(25) is computationally demanding. A common simplification of these equations consists of restricting the energy range close to the Fermi level75,80,81,82,83,84,85,86,93. In this approach, it is assumed that the DOS within this energy window is constant. It can be shown that, within these approximations, the energy shift χnk vanishes and the requirement in Eq. (25) is automatically satisfied. As a result, only two equations for Znk and ϕnk need to be solved self-consistently:

$$\begin{array}{lll}{Z}_{n{{{\bf{k}}}}}(i{\omega }_{j})&=&1+\frac{\pi {k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}}){\omega }_{j}}\mathop{\sum}\limits_{m{j}^{{\prime} }}\displaystyle\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\frac{{\omega }_{{j}^{{\prime} }}}{\sqrt{{\hslash }^{2}{\omega }_{{j}^{{\prime} }}^{2}+{{{\Delta }}}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}^{2}(i{\omega }_{{j}^{{\prime} }})}}\\ &\times &\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}\,-\,{\omega }_{{j}^{{\prime} }})\delta ({\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}\,-\,{\varepsilon }_{{{{\rm{F}}}}}),\end{array}$$
(27)
$$\begin{array}{lll}{Z}_{n{{{\bf{k}}}}}(i{\omega }_{j}){{{\Delta }}}_{n{{{\bf{k}}}}}(i{\omega }_{j})&=&\frac{\pi {k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}})}\mathop{\sum}\limits_{m{j}^{{\prime} }}\displaystyle\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\frac{{{{\Delta }}}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}(i{\omega }_{{j}^{{\prime} }})}{\sqrt{{\hslash }^{2}{\omega }_{{j}^{{\prime} }}^{2}+{{{\Delta }}}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}^{2}(i{\omega }_{{j}^{{\prime} }})}}\\ && \times\, \left[\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }})-N({\varepsilon }_{{{{\rm{F}}}}}){V}_{n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}}}\right]\delta ({\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-{\varepsilon }_{{{{\rm{F}}}}}).\end{array}$$
(28)

These equations are referred to as the anisotropic Fermi surface restricted (FSR) Eliashberg equations18,85.

To extract physical quantities of interest, such as the tunneling density of states and the heat capacity, the gap function on the real frequency axis is required75,81,82. In the EPW code, the continuation of Δnk(iωj) from the imaginary to the real axis is performed either using Padé approximants94,95, or using the exact analytic continuation of ref. 96, as described in ref. 85.

Accounting for the Coulomb repulsion in the Eliashberg equations requires the evaluation of the matrix elements Vnk,mk+q. While this is feasible in principle, it is common practice to replace the product N(εF)Vnk,mk+q with the semi-empirical Morel–Anderson pseudopotential \({\mu }_{{{{\rm{c}}}}}^{* }\)97. In this approach, the value of \({\mu }_{{{{\rm{c}}}}}^{* }\) is linked to the cutoff frequency ωc for the Matsubara summation on the imaginary axis, with ωc typically set to ten times the maximum phonon frequency ωph. Note that when converting between the μ* in Allen–Dynes formula in Eq. (16) and \({\mu }_{{{{\rm{c}}}}}^{* }\), a ratio ωc/ωph of ten is often used74. In EPW, \({\mu }_{{{{\rm{c}}}}}^{* }\) is specified by the user as an external parameter, and in many applications, values in the range \({\mu }_{{{{\rm{c}}}}}^{* }=0.1\)-0.2 yield reasonable agreement with experiments. More recently, first-principles calculations of \({\mu }_{{{{\rm{c}}}}}^{* }\) as a Fermi surface average of Vnk,mk+q have been used in conjunction with EPW91,98,99,100.

In the case of simple superconductors which do not exhibit significant anisotropy, it may be a good approximation to neglect the band and momentum dependence of the superconducting gap. In these cases, instead of Eqs. (20)–(25), it is possible to solve a simplified version of the equations where all properties are averaged over the Fermi surface76,101,102,103. The relations are referred to as the isotropic Eliashberg equations:

$$Z(i{\omega }_{j})=\,1+\frac{{k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}}){\omega }_{j}}\int\,{\rm {d}}\varepsilon N(\varepsilon )\mathop{\sum}\limits_{{j}^{{\prime} }}\frac{{\omega }_{{j}^{{\prime} }}Z(i{\omega }_{{j}^{{\prime} }})}{\theta (\varepsilon ,i{\omega }_{{j}^{{\prime} }})}\lambda ({\omega }_{j}-{\omega }_{{j}^{{\prime} }}),$$
(29)
$$\chi (i{\omega }_{j})=\,-\frac{{k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}})}\int\,{\rm {d}}\varepsilon N(\varepsilon )\mathop{\sum}\limits_{{j}^{{\prime} }}\frac{\varepsilon -{\mu }_{{{{\rm{F}}}}}+\chi (i{\omega }_{{j}^{{\prime} }})}{\theta (\varepsilon ,i{\omega }_{{j}^{{\prime} }})}\lambda ({\omega }_{j}-{\omega }_{{j}^{{\prime} }}),$$
(30)
$$\phi (i{\omega }_{j})=\,\frac{{k}_{{{{\rm{B}}}}}T}{N({\varepsilon }_{{{{\rm{F}}}}})}\int\,{\rm {d}}\varepsilon N(\varepsilon )\mathop{\sum}\limits_{{j}^{{\prime} }}\frac{\phi (i{\omega }_{{j}^{{\prime} }})}{\theta (\varepsilon ,i{\omega }_{{j}^{{\prime} }})}\left[\lambda ({\omega }_{j}-{\omega }_{{j}^{{\prime} }})-{\mu }_{{\rm {c}}}^{* }\right],$$
(31)
$${N}_{{{{\rm{e}}}}}=\,\int\,{\rm {d}}\varepsilon N(\varepsilon )\left[1-2{k}_{{{{\rm{B}}}}}T\mathop{\sum}\limits_{j}\frac{\varepsilon -{\mu }_{{{{\rm{F}}}}}+\chi (i{\omega }_{j})}{\theta (\varepsilon ,i{\omega }_{j})}\right],$$
(32)

where the counterpart of Eq. (23) is

$$\theta (\varepsilon ,i{\omega }_{j})={\left[\hslash {\omega }_{j}Z(i{\omega }_{j})\right]}^{2}+{\left[\varepsilon -{\mu }_{{{{\rm{F}}}}}+\chi (i{\omega }_{j})\right]}^{2}+{\left[\phi (i{\omega }_{j})\right]}^{2}.$$
(33)

In Eqs. (29)–(31), \(\lambda ({\omega }_{j}-{\omega }_{{j}^{{\prime} }})\) is a momentum-averaged version of Eq. (24):

$$\lambda ({\omega }_{j}-{\omega }_{{j}^{{\prime} }})=\frac{1}{{\left[N({\varepsilon }_{{{{\rm{F}}}}})\right]}^{2}}\mathop{\sum}\limits_{m,n}\int\,\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\lambda (n{{{\bf{k}}}},m{{{\bf{k}}}}+{{{\bf{q}}}},{\omega }_{j}-{\omega }_{{j}^{{\prime} }})\delta ({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{{{{\rm{F}}}}})\delta ({\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-{\varepsilon }_{{{{\rm{F}}}}}).$$
(34)

Similar to the anisotropic case, Eqs. (29)–(31) can also be reduced to a set of two equations for Z(iωj) and ϕ(iωj), under the same conditions as discussed for Eqs. (27) and (28).

Computational considerations

Solving Eqs. (20)–(25) or the simplified version Eqs. (27) and (28) is computationally demanding because a fine sampling of electron-phonon processes near the Fermi surface is required. In addition, due to the implicit form of these equations, the k- and q-point grids must be commensurate. To accelerate calculations, EPW exploits crystal symmetries so that the gap function and related quantities are only computed for k-points in the irreducible wedge of the Brillouin zone, and only electronic states within a small energy window centered at the Fermi energy are considered. Numerical tests show that converged results are obtained when this energy window is of the order of a few times the maximum phonon energy. In general, grids with an average point density Δk ~ 0.02 Å−1 and Δq ~ 0.04 Å−1 are sufficient to converge the superconducting gap85,91,104, but denser meshes may be required for superconductors with complex Fermi surfaces. As an example, 1202 and 403k-point grids and 602 and 203q-point grids were used to describe the two-gap structure of bilayer C6CaC6 and the single-gap structure of bulk CaC6, respectively91 (see Table 1).

One further complication in the solution of the Eliashberg equations is that all quantities depend on Matsubara frequencies. The Matsubara frequencies are proportional to the absolute temperature, therefore superconductors with low Tc require a larger number of frequencies within the same energy range. While it is common to set the Matsubara frequency cutoff to ten times the maximum phonon frequency85,86,101,105,106, we recommend always performing convergence tests with respect to this parameter. In EPW, the number of Matsubara frequencies can be reduced using a sparse sampling scheme whereby only a subset of frequencies is retained with a density that decreases logarithmically with the Matsubara index. The grid density is controlled by an adjustable parameter; using the default setting for this parameter, EPW yields a ~30% reduction of Matsubara frequencies, while keeping all the lowest ~40% of frequencies. Numerical tests show that this approach preserves the accuracy of more expensive full-grid calculations.

FBW Eliashberg calculations are computationally more demanding than FSR calculations. In particular, to determine the chemical potential from Eq. (25) one needs a Matsubara frequency cutoff of at least a few times the Kohn–Sham energy window, leading to a considerable increase in computational cost. To circumvent this issue, the default behavior of EPW is to keep the chemical potential fixed at the Fermi level unless it is instructed by the user to solve Eq. (25). In this case, careful convergence tests with respect to the Matsubara frequency cutoff are warranted.

Application example

To demonstrate the implementation of the superconducting module in EPW, we investigate the superconducting properties of hexagonal niobium diselenide (2H-NbSe2). 2H-NbSe2 exhibits a superconducting phase transition and a charge density wave instability below 7.2 and 33 K, respectively; both phases are driven by a strong momentum-dependent electron-phonon coupling107,108,109,110,111,112. For brevity, in this section, we focus on superconductivity and ignore the lattice instability.

We employ the PBE exchange and correlation functional45 and the optB86b-vdW van der Waals functional113,114,115,116, as well as ONCV pseudopotentials46,61 including semi-core electrons for Nb. We use a plane waves kinetic energy cutoff of 80 Ry, Γ-centered 24 × 24 × 12 k-point and 6 × 6 × 4 q-point coarse grids, and Methfessel–Paxton smearing117 of 0.025 Ry. The optimized lattice parameters are a = 3.46 Å and c = 12.57 Å, in good agreement with the experimental data a = 3.43 Å and c = 12.55 Å108.

The Eliashberg equations are solved on a uniform 60 × 60 × 40 k-point and 30 × 30 × 20 q-point fine grids. We consider energy windows of 0.4 and 0.8 eV, Matsubara frequency cutoffs of 0.4, 0.8, and 1.2 eV, and a Coulomb pseudopotential of \({\mu }_{{{{\rm{c}}}}}^{* }=0.2\). The Dirac deltas in the FSR approach are replaced by Gaussians of width 50 meV.

Figure 3a shows the band structure and DOS of 2H-NbSe2. Three bands cross the Fermi level. This system exhibits soft phonons along the ΓM direction109,111,112, which are stabilized by anharmonic effects109. Here, for simplicity, we avoid soft phonons by slightly increasing the electronic smearing to 0.025 Ry in phonon calculations, as shown in Fig. 3b. The same panel also shows the distribution of the electron–phonon coupling strength as described by the Eliashberg spectral function α2F. Figure 3c shows the anisotropic gap function color-coded on the Fermi surface of 2H-NbSe2. We find a highly anisotropic two-gap structure: the high-gap region corresponds to the Fermi arcs around the K point, and the low-gap region corresponds to the Γ-centered pockets. These results are similar to previous calculations for the related compound NbS298. Figure 3d shows the energy distribution of the superconducting gap function Δnk for various temperatures. The gap is seen to close gradually with increasing temperature, vanishing at the critical temperature Tc = 19 K. The calculated critical temperature overestimates the experimental value of 7.2 K, consistent with prior calculations for bulk and monolayer transition metal dichalcogenides98,109,112,118,119,120. The calculations in Fig. 3d are performed within the FBW Eliashberg approach, with the chemical potential set to the Fermi energy. Calculated gap values for energy windows of 0.4 and 0.8 eV are very similar, therefore in the following we only consider the former. Figure 3e shows the sensitivity of the superconducting gap to the chemical potential: by requiring particle number conservation via Eq. (25), the chemical potential shifts by 25 meV with respect to the Fermi energy, and the critical temperature slightly increases, by <1 K. In Fig. 3f we perform the same test, but this time with a wider energy window, obtaining similar results.

Fig. 3: Eliashberg calculations for phonon-mediated superconductors in EPW.
figure 3

a Band structure and DOS of 2H-NbSe2. b Phonon dispersion relations, phonon density of states (blue line), Eliashberg spectral function α2F (solid red line), and cumulative electron-phonon coupling strength λ (dashed red line) of 2H-NbSe2. In (a), the bands obtained by Wannier interpolation are shown in dashed red lines. c Momentum-resolved superconducting gap of 2H-NbSe2, color-coded on the Fermi surface220 and evaluated at 2 K [same dataset as in (d)]. d Energy distribution of the superconducting gap of 2H-NbSe2 as a function of temperature, calculated using the FBW Eliashberg approach, chemical potential set to the Fermi energy, and a Matsubara frequency cutoff of 0.4 eV. The energy window is 0.4 eV for the black line, and 0.8 eV for the red line. e Gap function of 2H-NbSe2 obtained from the FBW approach using fixed chemical potential (black line) and variable chemical potential (blue line). The energy window and Matsubara cutoff are both 0.4 eV. f Same as in (e), but using a Matsubara cutoff of 1.2 eV. g Comparison between the gap functions obtained with the FBW approach (black line) and the FSR approach (blue). Both the energy window and the Matsubara cutoff are 0.4 eV. h Same as in (g), but using a sparse Matsubara frequency grid. The dashed lines in dh represent averages of the gap distributions.

In Fig. 3g we also compare the FBW Eliashberg approach with the FSR approach, which is approximately 30% faster for the system under consideration. The critical temperatures calculated from these approaches agree within 0.5 K. This finding relates to the DOS of 2H-NbSe2 being slowly varying within a few hundred meV’s around the Fermi energy. Larger differences are expected for systems with rapidly varying DOS, such as for example the high-Tc hydride superconductors105.

When using a logarithmic Matsubara frequency grid, the results are essentially unaffected as shown in Fig. 3h. At the same time, the sparse Matsubara grids afford a significant computational saving of almost a factor of two.

Polarons and electron self-trapping

Background and formalism

An important manifestation of electron-phonon interactions is the formation of polarons. The polaron is a quasiparticle consisting of an electron or a hole dressed by a distortion of the crystal lattice. The lattice distortion can be interpreted as a cloud of virtual phonons accompanying the electron or hole. In the presence of strong electron–phonon coupling, the electron or hole can become trapped in the lattice distortion that it produced; this configuration is referred to as a self-trapped polaron121,122,123.

In the context of first-principles calculations, the formation of polarons has generally been investigated by means of DFT calculations of an excess charge added to a large supercell. When the calculation is initialized with a localized distortion of the crystal lattice, it may be energetically favorable for the electron or hole to localize around this distortion, leading to the formation of a polaron124,125,126,127,128,129,130. This approach faces two challenges: first, the existence of polaronic states and their formation energy are very sensitive to the choice of the exchange and correlation functional; second, the size of the supercells required to obtain converged energies and wavefunctions may be prohibitive.

In the EPW code, these challenges are overcome by recasting the polaron problem into the solution of a coupled nonlinear system of equations for the energy, wavefunction, and atomic displacements associated with the polaron131,132,133,134. The founding principle of this methodology is that the DFT formation energy of the polaron can be expressed as a self-interaction-free functional of the polaron wavefunction ψ(r) and the atomic displacements in the polaronic state Δτκαp132 (all symbols are defined in the ‘Methods’ section):

$${{\Delta }}{E}_{{{{\rm{f}}}}}=\int{\rm {d}}{{{\bf{r}}}}\,{\psi }^{* }({{{\bf{r}}}}){\hat{H}}_{{{{\rm{KS}}}}}^{0}\psi ({{{\bf{r}}}})+\mathop{\sum}\limits_{\kappa \alpha p}\int{\rm {d}}{{{\bf{r}}}}\,\frac{\partial {V}_{{{{\rm{KS}}}}}^{0}}{\partial {\tau }_{\kappa \alpha p}}| \psi ({{{\bf{r}}}}){| }^{2}{{\Delta }}{\tau }_{\kappa \alpha p}+\frac{1}{2}\mathop{\sum}\limits_{\begin{array}{c}\kappa \alpha p\\ {\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }\end{array}}\!\!{C}_{\kappa \alpha p,{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }}^{0}{{\Delta }}{\tau }_{\kappa \alpha p}{{\Delta }}{\tau }_{{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }},$$
(35)

where \({\hat{H}}_{{{{\rm{KS}}}}}^{0}\) and \({C}_{\kappa \alpha p,{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }}^{0}\) are the Kohn–Sham Hamiltonian and the matrix of interatomic force constants in the ground-state structure without the polaron, and the integrals are over the Born–von Kármán (BvK) supercell. Variational minimization of this energy functional leads to the coupled system of equations:

$${\hat{H}}_{{{{\rm{KS}}}}}^{0}\,\psi ({{{\bf{r}}}})+\mathop{\sum}\limits_{\kappa \alpha p}\frac{\partial {V}_{{{{\rm{KS}}}}}^{0}({{{\bf{r}}}})}{\partial {\tau }_{\kappa \alpha p}}{{\Delta }}{\tau }_{\kappa \alpha p}\,\psi ({{{\bf{r}}}})=\varepsilon \,\psi ({{{\bf{r}}}})\,,$$
(36)
$${{\Delta }}{\tau }_{\kappa \alpha p}=-\mathop{\sum}\limits_{{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }}{({C}^{0})}_{\kappa \alpha p,{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }}^{-1}\,\int\,\,\,{\rm {d}}{{{\bf{r}}}}\,\frac{\partial {V}_{{{{\rm{KS}}}}({{{\bf{r}}}})}^{0}}{\partial {\tau }_{{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }}}\,| \psi ({{{\bf{r}}}}){| }^{2}\,,$$
(37)

where \({V}_{{{{\rm{KS}}}}}^{0}\) is the Kohn–Sham potential in the ground-state structure without polaron, and ε represents the quasiparticle excitation energy of the polaron133,134. To avoid performing calculations in large supercells, in EPW Eqs. (36) and (37) are rewritten more conveniently in terms of Kohn–Sham states, phonons, and electron–phonon matrix elements evaluated in the primitive unit cell of the crystal. To this aim, the wavefunction is expanded on the basis of Kohn–Sham states:

$$\psi ({{{\bf{r}}}})=\frac{1}{\sqrt{{N}_{{{{\rm{uc}}}}}}}\mathop{\sum}\limits_{n{{{\bf{k}}}}}{A}_{n{{{\bf{k}}}}}{\psi }_{n{{{\bf{k}}}}}\,,$$
(38)

and the atomic displacements are expanded on the basis of lattice vibrational eigenmodes:

$${{\Delta }}{\tau }_{\kappa \alpha p}=-\frac{2}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{{{{\bf{q}}}}\nu }{B}_{{{{\bf{q}}}}\nu }^{* }\sqrt{\frac{\hslash }{2{M}_{\kappa }{\omega }_{{{{\bf{q}}}}\nu }}}\,{{\rm {e}}}_{\kappa \alpha ,\nu }({{{\bf{q}}}}){{\rm {e}}}^{i{{{\bf{q}}}}\cdot {{{{\bf{R}}}}}_{p}}.$$
(39)

With these definitions, Eqs. (36) and (37) become a nonlinear system of equations for the polaron coefficients Ank and Bqν:

$$\frac{2}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{{{{\bf{q}}}}m\nu }{B}_{{{{\bf{q}}}}\nu }\,{g}_{mn\nu }^{* }({{{\bf{k}}}},{{{\bf{q}}}})\,{A}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}=({\varepsilon }_{n{{{\bf{k}}}}}-\varepsilon ){A}_{n{{{\bf{k}}}}}\,,$$
(40)
$${B}_{{{{\bf{q}}}}\nu }=\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{mn{{{\bf{k}}}}}{A}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}^{* }\frac{{g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})}{\hslash {\omega }_{{{{\bf{q}}}}\nu }}{A}_{n{{{\bf{k}}}}}\,.$$
(41)

These relations are referred to as the ab initio polaron equations. The polaron formation energy in Eq. (35) can be expressed in terms of the polaron coefficients Ank and Bqν as132

$${{\Delta }}{E}_{{{{\rm{f}}}}}=\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{n{{{\bf{k}}}}}| {A}_{n{{{\bf{k}}}}}{| }^{2}({\varepsilon }_{n{{{\bf{k}}}}}-{\varepsilon }_{{{{\rm{CBM}}}}})-\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{{{{\bf{q}}}}\nu }| {B}_{{{{\bf{q}}}}\nu }{| }^{2}\hslash {\omega }_{{{{\bf{q}}}}\nu }\,,$$
(42)

where εCBM is the Kohn–Sham eigenvalue of the conduction band minimum. This expression holds for electron polarons; in the case of hole polarons, εCBM is replaced by the eigenvalue of the valence band maximum, and the first term on the right-hand side of Eq. (42) acquires a minus sign. Equations (38), (39), and (42) provide the real-space wavefunction of the polaron, the accompanying atomic displacements, and its formation energy.

Computational considerations

The solution of Eqs. (40) and (41) require the knowledge of the Kohn-Sham energies εnk, the phonon frequencies ωqν, and the electron-phonon matrix elements gmnν(k, q). All of these quantities are calculated by EPW using Wannier–Fourier interpolation as described in the Methods. The solution of the coupled system of equations is performed using an iterative procedure as follows. First, Ank is initialized in order to compute Bqν via Eq. (41). Then, Eq. (40) is solved by constructing and diagonalizing the effective Hamiltonian

$${H}_{n{{{\bf{k}}}},{n}^{{\prime} }{{{{\bf{k}}}}}^{{\prime} }}={\varepsilon }_{n{{{\bf{k}}}}}{\delta }_{n{{{\bf{k}}}},{n}^{{\prime} }{{{{\bf{k}}}}}^{{\prime} }}-\frac{2}{{N}_{{{{\rm{uc}}}}}}{\sum }_{\nu }{B}_{{{{\bf{{k}}}^{{\prime} }-k}}\nu }\,{g}_{{n}^{{\prime} }n\nu }^{* }({{{\bf{k}}}},{{{\bf{{k}}}^{{\prime} }-\; k}})\,.$$
(43)

The set of solution coefficients Ank is used again in Eq. (41), and the process is repeated until convergence is achieved.

The initialization of the coefficients Ank is achieved by using a Gaussian function in reciprocal space centered around the band extremum. Alternatively, a polaron solution from a previous calculation can be used. In the construction of the effective Hamiltonian matrix in Eq. (43), we set the gauge condition \({e}_{\kappa \alpha ,\nu }(-{{{\bf{q}}}})={e}_{\kappa \alpha ,\nu }^{* }({{{\bf{q}}}})\)135. This condition ensures that \({B}_{-{{{\bf{q}}}}\nu }={B}_{{{{\bf{q}}}}\nu }^{* }\), so only half of the Bqν coefficients need to be evaluated at each iteration. In addition, for parallel execution, we set a global gauge for all interpolated Kohn–Sham wavefunctions and vibrational eigenmodes. The diagonalization of the effective Hamiltonian is performed via the Davidson method136 as implemented in Quantum ESPRESSO. The convergence of the iterative procedure is tested by evaluating the atomic displacements in real space via Eq. (39) and comparing these real-valued vectors between successive iterations. In the case of polaron calculations, choosing a fine Brillouin zone grid with N × N × N points implies that one is studying polarons in a periodic BvK supercell consisting of N × N × N unit cells. The formation energy of an isolated polaron is obtained by taking the limit of N → . For large enough N, we observe that the formation energy scales as 1/N, which is consistent with the Makov–Payne asymptotic expansion of the energy of a point charge in a periodic cell132,137. Based on this observation, to obtain the energy of an isolated polaron, we perform a Makov-Payne extrapolation to the limit of infinite supercell size. Generally speaking, we find that for small polarons the wavefunction shape is converged already for BvK supercells of the order of 5 × 5 × 5 unit cells, while for large polarons it is necessary to use supercells that are large enough to fully contain the polaron density. While there is no formal upper limit to this size, the largest BvK supercell sizes that we employed are up to 50 × 50 × 50 for the large electron polaron in NaCl (see Table 1).

To visualize the polaron, EPW expresses the wavefunction as a linear combination of maximally localized Wannier functions:

$$\psi ({{{\bf{r}}}})=\mathop{\sum}\limits_{mp}{A}_{mp}{{{{\rm{w}}}}}_{m}({{{\bf{r}}}}-{{{{\bf{R}}}}}_{p}),$$
(44)

where the coefficients Amp are obtained from the solution vectors Ank via the Wannier–Fourier transformation:

$${A}_{mp}=\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{n{{{\bf{k}}}}}{{\rm {e}}}^{i{{{\bf{k}}}}\cdot {{{{\bf{R}}}}}_{p}}{U}_{mn{{{\bf{k}}}}}^{{\dagger} }{A}_{n{{{\bf{k}}}}}\,,$$
(45)

and Umnk is the unitary matrix that generates the smooth Bloch gauge [Eq. (64) of the “Methods” section]. The inversion of this last relation also allows one to interpolate the coefficients Ank throughout the Brillouin zone, which is useful to visualize how specific bands contribute to the polaron wavefunction (Fig. 4).

Fig. 4: Calculation of small and large polarons with EPW.
figure 4

a Isosurface plot of the wavefunction of the electron polaron in NaCl. Na atoms are in silver, Cl atoms are in green. b Displacements of the Cl atoms associated with the electron polaron shown in (a). The displacements are exaggerated for clarity. c Isosurface plot of the hole polaron in NaCl, and associated atomic displacements. The displacements are exaggerated for clarity. d Spectral weights of the electron (blue) and hole (orange) polaron of NaCl, superimposed to the band structure. The size of the circles is proportional to ∣Ank2. e Spectral weights of the electron (blue) and hole (orange) polaron of NaCl, superimposed to the phonon dispersion relations. The size of the circles is proportional to ∣Bqν2.

Application example

To demonstrate the implementation of the polaron module in EPW, we investigate the electron and hole polarons in rocksalt NaCl, a prototypical polar insulator that hosts small hole polarons called VK centers138,139. We perform calculations using the PBE exchange and correlation functional45, ONCV pseudopotentials47, and a planewaves kinetic energy cutoff of 150 Ry. Ground-state and lattice-dynamical calculations are performed using a 12 × 12 × 12 uniform and unshifted Brillouin zone mesh for both k- and q-points. The Kohn–Sham states, phonons, and electron-phonon matrix elements that are needed to solve Eqs. (40) and (41) are generated on Brillouin zone grids with up to 50 × 50 × 50 points by Wannier–Fourier interpolation. To this end, we use three Wannier functions to describe the Cl-3p states in the valence band, and one Wannier function to describe a single conduction band formed by the Na-3s states. The use of additional valence or conduction bands only brings negligible changes to the polaron formation energy. In order to obtain the polaron formation energies in the limit of infinite supercell size, we solve Eqs. (40) and (41) for N × N × Nk- and q-point grids with increasing N, and we perform a linear extrapolation of the energy vs. 1/N curve. Figure 4a shows an isosurface of the calculated wavefunction of the electron polaron in NaCl. The formation energy of this polaron in the infinite supercell limit is 37 meV; with a radius of 147 Å, this polaron spans several tens of crystalline unit cells. The wavefunction is isotropic and can be described as a combination of Na-3s orbitals modulated by an approximately Gaussian envelope.

In Fig. 4b we show the atomic displacements associated with the electron polaron of Fig. 4a. For clarity we only show the displacement of the Cl ions. The ions tend to move away from the center of the electron wavefunction, consistent with the fact that the electron polaron tends to repel anions. Figure 4c shows an isosurface of the calculated hole polaron of NaCl. The formation energy in the dilute limit is 820 meV, indicating a strongly bound polaron. Consistent with the large formation energy, we find a very small polaron of radius 6 Å, which is comparable to the lattice parameter of 5.69 Å. This polaron consists primarily of a single 3p orbital centered on Cl and oriented along the [100] direction. The accompanying atomic displacements are shown in the same panel. As expected from the negative charge of the polaron, the largest displacements are found for the Na cations which tend to move away from the polaron center.

In Fig. 4d we overlay the coefficients ∣Ank2 with the band structure in order to determine which electronic states contribute to the electron (blue) and hole (orange) polaron. In the case of the electron polaron, only electrons near the bottom of the conduction band contribute; the narrow distribution of Ank near k = 0 is consistent with the large spatial extent of the electron polaron in real space. Conversely, the hole polaron draws weight from the entire Brillouin zone, in line with the strong localization in real space. Similarly, in Fig. 4e we show the coefficients ∣Bqν2 on the phonon dispersion relations. The electron polaron is primarily driven by long-wavelength longitudinal-optical phonons and longitudinal acoustic phonons, while the hole polaron is driven mostly by short-range optical modes. These spectral weight distributions suggest that the electron polaron in NaCl should be classified as a Fröhlich-type140 polaron, while the hole polaron should be classified as a Holstein-type polaron141.

Phonon-assisted indirect absorption

Background and formalism

The EPW code has the capability to compute, from first principles, optical absorption spectra in indirect band gap semiconductors by including phonon-assisted optical transitions within second-order time-dependent perturbation theory. Phonon-assisted transitions involve two virtual processes, namely the absorption of a photon, and the absorption or emission of a phonon, in either order. In this section, we outline the general formalism to describe these processes142,143.

We consider a linearly polarized electromagnetic wave with vector potential of amplitude A0, frequency ω, and polarization vector e. In the following equations, the long-wavelength limit and the corresponding electric dipole approximation are understood. Second-order time-dependent perturbation theory states that the transition rate of an electron from an initial Kohn–Sham state nk to a final state mk + q involving a photon and a phonon qν is142:

$$\begin{array}{lll}{W}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}};\omega ) &=& \frac{2\pi }{\hslash }{e}^{2}{A}_{0}^{2}\mathop{\sum}\limits_{\beta =\pm 1}{\left\vert {{{\bf{e}}}}\cdot [{{{{\bf{S}}}}}_{1,mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})+{{{{\bf{S}}}}}_{2,mn\nu \beta }({{{\bf{k}}}},{{{\bf{q}}}})]\right\vert }^{2}\\ && \times \,\delta ({\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-{\varepsilon }_{n{{{\bf{k}}}}}-\hslash \omega +\beta \hslash {\omega }_{{{{\bf{q}}}}\nu }).\end{array}$$
(46)

In this equation, β = +1 and −1 represent phonon emission and absorption processes, respectively. S1,mnν(k, q) and S2,mnνβ(k, q) are the transition amplitudes for the processes illustrated in Fig. 5a: S1,mnν(k, q) refers to a process whereby the electron absorbs a photon, and then absorbs or emits a phonon; S2,mnνβ(k, q) describes a process whereby phonon absorption/emission takes place, followed by the absorption of a photon. Explicit expressions for these amplitudes are:

$${{{{\bf{S}}}}}_{1,mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})=\mathop{\sum}\limits_{j}\frac{{g}_{mj\nu }({{{\bf{k}}}},{{{\bf{q}}}}){{{{\bf{v}}}}}_{jn}({{{\bf{k}}}})}{{\varepsilon }_{j{{{\bf{k}}}}}-{\varepsilon }_{n{{{\bf{k}}}}}-\hslash \omega +i\eta },$$
(47)
$${{{{\bf{S}}}}}_{2,mn\nu \beta }({{{\bf{k}}}},{{{\bf{q}}}})=\mathop{\sum}\limits_{j}\frac{{{{{\bf{v}}}}}_{mj}({{{\bf{k}}}}+{{{\bf{q}}}}){g}_{jn\nu }({{{\bf{k}}}},{{{\bf{q}}}})}{{\varepsilon }_{j{{{\bf{k}}}}+{{{\bf{q}}}}}-{\varepsilon }_{n{{{\bf{k}}}}}+\beta \hslash {\omega }_{{{{\bf{q}}}}\nu }+i\eta },$$
(48)

where vmn denotes velocity matrix elements between the Kohn–Sham states and the sum extends to all possible occupied and unoccupied states. The energy η is a small parameter to avoid singular denominators. From the transition rates Wmnν(k, q; ω), we obtain the imaginary part of the dielectric function by summing over all possible transitions in the Brillouin zone and in the band manifold142,143:

$$\begin{array}{lll}\,{{\mbox{Im}}}\,[\epsilon (\omega )] &=& 2\frac{\pi {e}^{2}}{{\epsilon }_{0}{{\Omega }}}\frac{1}{{\omega }^{2}}\mathop{\sum}\limits_{mn\nu ,\beta =\pm 1}\displaystyle\int\,\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\displaystyle\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,\left\vert \right.{{{\bf{e}}}}\cdot [{{{{\bf{S}}}}}_{1,mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})+{{{{\bf{S}}}}}_{2,mn\nu \beta }({{{\bf{k}}}},{{{\bf{q}}}})]{\left\vert \right.}^{2}\\ &&\times \,{P}_{mn\nu \beta }({{{\bf{k}}}},{{{\bf{q}}}})\delta ({\varepsilon }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}-{\varepsilon }_{n{{{\bf{k}}}}}-\hslash \omega +\beta \hslash {\omega }_{{{{\bf{q}}}}\nu }),\end{array}$$
(49)

where the factor of two results from the electron spin in the case of spin-unpolarized systems; this factor is omitted in the case of calculations including spin–orbit coupling. The quantities Pmnνβ(k, q) contain the temperature-dependent Fermi–Dirac and Bose–Einstein distributions as follows:

$${P}_{mn\nu \beta }({{{\bf{k}}}},{{{\bf{q}}}})=\left({n}_{{{{\bf{q}}}}\nu }+\frac{1+\beta }{2}\right){f}_{n{{{\bf{k}}}}}(1-{f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}})-\left({n}_{{{{\bf{q}}}}\nu }+\frac{1-\beta }{2}\right)(1-{f}_{n{{{\bf{k}}}}}){f}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}.$$
(50)

In Eq. (49), the scalar quantity ϵ(ω) represents the projection of the dielectric tensor along the polarization direction e of the electric field. For easier comparison with experimental measurements, after we obtain the imaginary part of the dielectric function from EPW, we calculate the absorption coefficient using142:

$${\alpha }^{{{{\rm{abs}}}}}(\omega )=\frac{\omega \,{{{\rm{Im}}}}[\epsilon (\omega )]}{c\,n(\omega )},$$
(51)

where n(ω) is the real part of the refractive index and c is the speed of light. n(ω) can be calculated from the standard relations between the dielectric function and the refractive index144. In this case, the real part of the dielectric function can be obtained by performing a Kramers–Kronig transformation of Im[ϵ(ω)] and applying a rigid shift to match the value of ϵ(ω = 0) computed from DFPT using Quantum ESPRESSO. Alternatively, n(ω) can be taken from experiments143.

Fig. 5: Indirect phonon-assisted optical absorption spectra with EPW.
figure 5

a Calculated band structure of silicon including GW quasiparticle corrections (lines). The energy is referred to the top of the valence bands. The marks are measured energies of critical points: cross: ref. 158; diamond: ref. 89; filled triangle: ref. 221; filled square: ref. 222; open triangle: ref. 157. b Calculated phonon dispersion relations of silicon (lines). Neutron scattering data are shown as disks160 and filled triangles161. c Calculated imaginary part of the dielectric function of silicon (line) including phonon-assisted processes. The squares represent experimental data from ref. 223. d Calculated absorption coefficient of silicon. The circles are measurements from ref. 224.

Computational considerations

In the optics module of EPW, the imaginary part of the dielectric function is calculated using Eq. (49). The summation over virtual states in Eqs. (47) and (48) are restricted to the manifold of valence and conduction bands included in the Wannierization procedure. The Dirac delta functions appearing in Eq. (49) are replaced by Gaussian functions or Lorentzian functions with a finite broadening. The small parameter η in Eqs. (47) and (48) are used to avoid singular denominators which arise if, for a given photon energy ℏω, direct transitions are resonant with indirect transitions. These situations are encountered, for example, at the onset of direct transitions, i.e. when the photon energy matches the direct gap. In these situations, the dielectric function and the absorption spectrum become sensitive to the choice of η: too small an η leads to a divergence of the spectrum, and too large an η leads to an excessive broadening. To probe the sensitivity of the spectra to this parameter, the optics module of EPW calculates Im[ϵ(ω)] for a range of broadening parameters between 1 meV and 0.5 eV. Efforts are currently ongoing to eliminate these spurious singularities: we believe that they arise from an intrinsic limitation of second-order perturbation theory when direct and indirect transitions are in resonance; a more general theory that correctly describes these resonances is under development145.

In Eqs. (47) and (48), the velocity matrix elements are sensitive to the details of the electronic structure. For accurate calculations, it is preferable to include GW quasiparticle corrections to the Kohn–Sham eigenvalues89. These corrections require a renormalization of the velocity matrix elements to preserve the f-sum rule of optical transitions146,147. In the EPW code, this renormalization is carried out by evaluating the velocity via finite differences. To this end, we consider quasiparticle energies and Kohn–Sham eigenvalues evaluated on k-point grids slightly offset along the Cartesian directions. The renormalized velocity matrix elements are given by147

$${v}_{mn,\alpha }^{{{{\rm{QP}}}}}({{{\bf{k}}}})=\frac{{\varepsilon }_{m{{{{\bf{k+\delta q}}}}}_{{{{\boldsymbol{\alpha }}}}}}^{{{{\rm{QP}}}}}-{\varepsilon }_{n{{{{\bf{k-\delta q}}}}}_{\alpha }}^{{{{\rm{QP}}}}}}{{\varepsilon }_{m{{{{\bf{k+\delta q}}}}}_{\alpha }}^{{{{\rm{KS}}}}}-{\varepsilon }_{n{{{{\bf{k-\delta q}}}}}_{\alpha }}^{{\rm {KS}}}}{v}_{mn,\alpha }^{{{{\rm{KS}}}}}({{{\bf{k}}}}),$$
(52)

where δqα is a small wavevector along the Cartesian direction α, of magnitude 10−3 × 2π/a (a is the lattice parameter).

To achieve convergence in calculations of indirect phonon-assisted optical absorption spectra, Brillouin zone grids with 40 × 40 × 40 points have been employed in previous work on silicon143, as well as in more recent work on silicon and diamond145 (see Table 1). In addition, convergence of the phonon-assisted optical spectra for cubic boron arsenide148 and cubic silicon carbide149 was achieved with Brillouin zone grids of 32 × 32 × 32. When free-carrier absorption is considered, denser grids are required for converged spectra. For example, a grid of 48 × 48 × 48 is needed for converged phonon-assisted free-carrier absorption spectra in silicon150.

Application example

To demonstrate the implementation of the optics module in EPW, we examine phonon-assisted optical absorption in silicon. Gound-state DFT calculations are performed using the PBE exchange and correlation functional45, ONCV pseudopotentials46,61, a planewaves kinetic energy cutoff of 60 Ry, and a 6 × 6 × 6 Brillouin zone sampling of both the k-point grid and the q-point grid. The optimized DFT lattice parameter is a = 5.478 Å, similar to previous studies151,152,153.

We evaluate quasiparticle corrections on a 6 × 6 × 6 k-point grid within the GW method using the BerkeleyGW code154. The GW-corrected band gap is 1.31 eV, which slightly overestimates the experimental value of 1.12 eV at room temperature155, but agrees well with prior work using similar settings89. The resulting quasiparticle band structure is shown in Fig. 5a. Our calculations agree well with experimental measurements at several critical points89,156,157,158, shown by marks in the figure. In Fig. 5a we also show representative optical transitions leading to the amplitudes in Eqs. (47) and (48). The fundamental gap is indirect, between the top of the valence band at the Γ point and the bottom of the conduction band near the X point. To correctly describe optical transitions near the fundamental gap, it is essential to include phonon-assisted processes. Figure 5b shows calculated phonon dispersion relations, which agree well with prior calculations by us18 and other groups159, as well as experimental data160,161 (solid symbols). Figure 5c shows the imaginary part of the dielectric function, as obtained from Eq. (49) using 32 × 32 × 32 fine k- and q-point grids. The temperature is set to 300 K, and the Dirac delta functions in Eq. (49) are approximated via Gaussians of width 50 meV. In this plot, a rigid shift of −0.19 eV is applied in order to match the GW band gap to the measured gap of silicon at room temperature (1.12 eV)155. Figure 5d shows the related optical absorption coefficient from Eq. (51). This calculation requires the real part of the frequency-dependent refractive index, for which we used experimentally measured values from ref. 162 for simplicity.

Our calculated spectra agree very well with experiments in the photon energy range between the indirect gap and the direct gap at 3.3 eV. Beyond the lineshape, the magnitude also agrees well with the experiment over several orders of magnitude, with the theory underestimating the experimental data by 50% at most. This residual underestimation might be related to the rigid shift of the band gap, which we did not include in the velocity renormalization expressed by Eq. (52), and to the fact that electron–phonon matrix elements are slightly too weak in DFT as a result of the band gap problem1,163.

Special displacement method

Background and formalism

The EPW package contains a set of standalone modules, the ZG toolkit, for calculating finite-temperature properties including quantum zero-point effects via the special displacement method (SDM)164,165,166. The special displacement method is a supercell-based approach that is distinct from and complementary to the Wannier–Fourier interpolation method employed in all previous sections. The founding principle of this method is that the effects of electron–phonon couplings on the electronic and optical properties of extended solids can be captured by performing calculations for a large supercell where the atoms have been displaced away from their equilibrium crystallographic sites. The displacements are chosen in such a way that the corresponding atomic configuration represents the best single-point approximant to the quantum thermal distribution of the atomic coordinates165.

Under the approximations of adiabatic Born–Oppenheimer decoupling and harmonic lattice, the quantum thermal average of an electronic or optical property described by the observable O can be written as165

$$O(T)=\mathop{\prod}\limits_{{{{\bf{q}}}}\nu }\,\int\,\frac{{\rm {d}}{x}_{{{{\bf{q}}}}\nu }{\rm {d}}{y}_{{{{\bf{q}}}}\nu }}{\pi {u}_{{{{\bf{q}}}}\nu }^{2}}{e}^{-| {z}_{{{{\bf{q}}}}\nu }{| }^{2}/{u}_{{{{\bf{q}}}}\nu }^{2}}O(\{{\tau }_{\kappa \alpha p}\}),$$
(53)

where q runs over the set of wavevectors in a uniform Brillouin zone grid which excludes time-reversal invariant points and time-reversal partners. In Eq. (53), zqν denote normal mode coordinates with real part xqν and imaginary part yqν. \({u}_{{{{\bf{q}}}}\nu }^{2}=(\hslash /2{M}_{0}{\omega }_{{{{\bf{q}}}}\nu })(2{n}_{{{{\bf{q}}}}\nu }+1)\) is the mean-square displacement for the oscillator qν with Bose–Einstein occupation nqν; O({τ}) is the property of interest, such as for example the Kohn–Sham eigenvalues, density of states, or optical absorption spectrum, calculated for the set of atomic coordinates {τκαp}. The relation between these coordinates and the normal coordinates zqν, which is required to carry out the integral in Eq. (53), is provided in ref. 165.

In the special displacement method, the configurational average expressed by Eq. (53) is approximated by a single calculation for an optimum configuration:

$$O(T)\simeq O(\{{\tau }_{\kappa \alpha p}^{0}+{{\Delta }}{\tau }_{\kappa \alpha p}^{{{{\rm{ZG}}}}}\}),$$
(54)

where \({\tau }_{\kappa \alpha p}^{0}\) represent atomic coordinates in the DFT ground-state at zero temperature, and the optimum ‘ZG’ displacement is given by165

$$\Delta {\tau }_{\kappa \alpha p}^{{{{\rm{ZG}}}}}=\sqrt{\frac{{M}_{0}}{{N}_{p}{M}_{\kappa }}}2\,\mathop{\sum}\limits_{{{{\bf{q}}}}\nu }\,{S}_{{{{\bf{q}}}}\nu }{u}_{{{{\bf{q}}}}\nu }\,{{{\rm{Re}}}}\left[{{\rm {e}}}^{i{{{\bf{q}}}}\cdot {{{{\bf{R}}}}}_{p}}{e}_{\kappa \alpha ,\nu }({{{\bf{q}}}})\right].$$
(55)

As in Eq. (53), the summation is restricted to q-points from a uniform Brillouin zone grid which are not time-reversal invariant and are not time-reversal partners. This partitioning is described in Appendix B of ref. 1. The quantities Sqν appearing in Eq. (55) are signs (±1) determined by the ZG module so as to guarantee that the resulting displacements make \(O(\{{\tau }_{\kappa \alpha p}^{0}+{{\Delta }}{\tau }_{\kappa \alpha p}^{{{{\rm{ZG}}}}}\})\) the best possible approximant to Eq. (53). In the thermodynamic limit of a large supercell, the ZG displacements reproduce the exact mean-square anisotropic displacement tensors, which are given by167

$${U}_{\kappa ,\alpha {\alpha }^{{\prime} }}(T)=\frac{\hslash }{2{M}_{\kappa }{\omega }_{{{{\bf{q}}}}\nu }}\mathop{\sum}\limits_{\nu }\int\,\frac{{\rm {d}}{{{\bf{q}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}\,{e}_{\kappa \alpha ,\nu }({{{\bf{q}}}}){e}_{\kappa {\alpha }^{{\prime} },\nu }^{* }({{{\bf{q}}}})\,(2{n}_{{{{\bf{q}}}}\nu }+1).$$
(56)

In the same limit, a single evaluation of the property \(O(\{{\tau }_{\kappa \alpha p}^{0}+{{\Delta }}{\tau }_{\kappa \alpha p}^{{{{\rm{ZG}}}}}\})\) tends to the exact thermal average in Eq. (53). In the case of non-periodic systems, such as for example nanocrystals and quantum dots, these equations are replaced by their Γ-point only versions164,168,169.

The special displacement method is similar in spirit to computing thermodynamic averages using path-integral molecular dynamics170, but it differs insofar as a single calculation is required to evaluate the average instead of many molecular dynamics snapshots. In this method, electron–phonon couplings are included non-perturbatively through the changes of the Kohn–Sham energies and wavefunctions caused by the ZG displacements. The method can be applied to compute any property that can be expressed by means of a Fermi Golden Rule, such as for example temperature-dependent band structures, density of states, and optical spectra. The main limitation of this approach as compared to the Wannier–Fourier interpolation method employed in the preceding sections is that, being an adiabatic theory, fine spectral features on the scale of the phonon energy are averaged out. Conversely, its main advantage is that it is easy to use as it requires a single DFT calculation.

The Kohn–Sham energy eigenvalues generated by the special displacement method capture temperature renormalization and quantum zero-point effects at the same level as the adiabatic Allen–Heine theory of temperature-dependent band structures171. The calculation of the imaginary part of the dielectric function including temperature effects, zero-point corrections, and phonon-assisted indirect processes, is performed by evaluating:

$${{{\rm{Im}}}}[\epsilon (\omega )]=\frac{2\pi {e}^{2}}{{\epsilon }_{0}{m}_{{{{\rm{e}}}}}^{2}{{{\Omega }}}_{{{{\rm{sc}}}}}}\frac{1}{\,{\omega }^{2}}\mathop{\sum}\limits_{cv}\int\frac{{\rm {d}}{{{\bf{K}}}}}{{{{\Omega }}}_{{{{\rm{BZ,sc}}}}}}| \langle {\psi }_{c{{{\bf{K}}}}}| {{{\bf{e}}}}\cdot \hat{{{{\bf{p}}}}}| {\psi }_{v{{{\bf{K}}}}}\rangle {| }^{2}\delta ({\varepsilon }_{c{{{\bf{K}}}}}-{\varepsilon }_{v{{{\bf{K}}}}}-\hslash \omega ),$$
(57)

where Ωsc and ΩBZ,sc are the volumes of the supercell and the supercell Brillouin zone, respectively, the summations over v, c refer to valence and conduction states, and K is a wavevector of the supercell Brillouin zone. This expression contains both direct and indirect optical transitions: the indirect transitions are hidden in the dependence of the wavefunctions ψvK and ψcK on the ZG displacement. Similarly, this expression includes temperature renormalization via the dependence of the energies εvK and εcK on the ZG displacements164.

Computational considerations

Calculations using the special displacement method proceed as follows. First, one performs phonon calculations for the crystalline unit cell (not the supercell) using standard DFPT on a coarse uniform Brillouin zone grid. From this calculation, the phonon frequencies and eigenmodes are computed on a finer Brillouin-zone grid with N1 × N2 × N3q-points using standard interpolation of the force constant matrix8. Then the ZG displacement within a supercell consisting of N1 × N2 × N3 unit cells is evaluated at the temperature T via Eq. (55). The desired property is finally computed with this supercell, with the atoms displaced according to \(\Delta {\tau }_{\kappa \alpha p}^{{{{\rm{ZG}}}}}\). The special displacements are generated by the ZG module; the procedure is computationally inexpensive and is performed serially.

The ZG toolkit provides several codes to analyze the results of supercell calculations performed with special displacements, for example, Brillouin-zone unfolding of temperature-dependent band structures from the supercell to the unit cell, the density of states, electronic spectra, and vibrational spectra.

Band unfolding is performed using the procedure outlined in ref. 172, which consists of determining the spectral function in the primitive Brillouin zone by projecting the wavefunctions of the supercell into the wavefunctions of the unit cell. In practice, the spectral density for the wavevector k at the energy ε is obtained as

$${A}_{{{{\bf{k}}}}}(\varepsilon )=\mathop{\sum}\limits_{m{{{\bf{K}}}}}{P}_{m{{{\bf{K}}}},{{{\bf{k}}}}}\,\delta (\varepsilon -{\varepsilon }_{m{{{\bf{K}}}}}),$$
(58)

where the spectral weights PmK,k are given by

$${P}_{m{{{\bf{K}}}},{{{\bf{k}}}}}=\mathop{\sum}\limits_{{{{{\bf{G}}}}}_{{{{\rm{sc}}}}}}| {c}_{m{{{\bf{K}}}}}({{{{\bf{G}}}}}_{{{{\rm{sc}}}}}+{{{\bf{k}}}}-{{{\bf{K}}}}){| }^{2}.$$
(59)

Here, cmK denotes planewaves coefficients of supercell wavefunctions, and Gsc denotes reciprocal lattice vectors of the supercell. Equation (59) refers to norm-conserving pseudopotential implementations. The ZG module includes additional terms that are required in this expression when using ultrasoft and PAW (projector augmented-wave) pseudopotentials165,169. A similar unfolding strategy is employed to analyze lattice dynamics, as well as X-ray and neutron diffuse scattering intensities accounting for multiphonon interactions173.

The supercell size required to achieve converged results in calculations employing the special displacement method depends on the target property. For example, to compute optical spectra over a broad photon energy range, supercells of size 4 × 4 × 4 unit cells are typically sufficient. However, to obtain accurate phonon-induced band gap renormalization, say within a 10 meV accuracy, supercells as large as 10 × 10 × 10 may be required165 (see Table 1).

Application example

To demonstrate the implementation of the ZG module, we investigate the temperature-dependent band structure renormalization and phonon-assisted optical absorption spectra of silicon and BaSnO3. We perform calculations using the local density approximation (LDA) for the exchange and correlation174,175 and ONCV pseudopotentials46,61. We use a planewaves kinetic energy cutoff of 40 Ry for silicon and 120 Ry for BaSnO3, and 6 × 6 × 6 uniform k-point grids for ground-state calculations. With these settings, we obtain indirect and direct band gaps of 0.49 and 2.56 eV for silicon, respectively, and indirect and direct band gaps of 1.06 and 1.55 eV for BaSnO3, respectively. We perform calculations of dynamical matrices on 4 × 4 × 4 q-point grids in both cases and use the ZG module to generate displacements in 3 × 3 × 3 supercells. The signs Sqν appearing in Eq. (55) are determined by minimizing the error descriptor in Eq. (54) of ref. 165 with a dimensionless threshold η = 0.1, after enforcing a smooth Berry connection between vibrational eigenmodes across the Brillouin zone165. Kohn–Sham energies in the structures with ZG displacements are calculated using a 12 × 12 × 12 uniform K-point grid in the supercell Brillouin zone, and 108 unoccupied states. For calculations of dielectric functions, we use up to 200 randomly generated K-points in the supercell Brillouin zone, as well as 27 and 135 conduction bands for silicon and BaSnO3, respectively. All Dirac deltas are replaced by Gaussians of width 30 meV.

Figure 6a shows the joint density of states (JDOS) of silicon at 0 K (red) and 300 K (blue), as calculated using the special displacement method. For comparison, the JDOS computed for the DFT ground state structure is also shown in green. We see that, upon including electron-phonon interactions via the special displacements, even at 0 K the JDOS is red-shifted with respect to the DFT ground state. This is a manifestation of the zero-point band gap renormalization176. Upon increasing temperature, the onset of the JDOS further red-shifts. This temperature-induced band gap narrowing is referred to as the Varshni effect177. The horizontal offset between the JDOS for the DFT ground state structure and the JDOS computed with special displacements at 0 K yields a zero-point renormalization of 50 meV, in good agreement with prior work178,179. More accurate values can be calculated by increasing the supercell size164,165. The band gap renormalization can also be computed without using the JDOS; to this end, one needs to evaluate the Kohn–Sham eigenvalues at the supercell K-points that unfold onto the wavevectors of the band extrema in the Brillouin zone of the unit cell.

Fig. 6: Applications of the special displacement method implemented in the ZG module.
figure 6

a Square root of the JDOS of silicon evaluated with atoms in the DFT ground-state structure (red); using special displacements at 0 K (blue); and using special displacements at 300 K (green). The red-shift of the JDOS with respect to the ground-state structure signals the quantum zero-point correction to the band gap (0 K curve) and its temperature renormalization (300 K curve), respectively. b Electron spectral function of silicon calculated with the special displacement method at 0 K, along the ΓX path in the Brillouin zone. The black disks indicate the band structures calculated in the crystalline unit cell with the DFT ground-state geometry. c Electron spectral function of BaSnO3 was calculated with the special displacement method at 0 K, along the ΓR path in the Brillouin zone. The black disks indicate the band structures calculated in the crystalline unit cell with the DFT ground-state geometry. d Convergence of the imaginary part of the dielectric function of silicon at 0 K with respect to the number of random K-points used to sample the Brillouin zone of the supercell. e Imaginary part of the dielectric function of silicon calculated with the atoms in the DFT ground-state structure (red), and by using special displacements at 0 K (blue). A scissor shift of 0.64 eV is employed to match the experimental gap225. f Imaginary part of the dielectric function of BaSnO3 calculated with the atoms in the DFT ground-state structure (red), and by using special displacements at 0 K (blue) and 300 K (green). The vertical dashed lines indicate the direct and indirect band gap energies. A scissor shift of 1.91 eV is employed to match the experimental gap226.

Figure 6b and c report color maps of the electronic spectral functions of silicon and BaSnO3 at 0 K calculated using the special displacement method. For comparison, the band structures in the DFT ground state are overlaid with these color maps. These maps can directly be compared to angle-resolved photoelectron spectroscopy data. From these images, we identify numerically the quasiparticle band structures by extracting the spectral peaks. In the case of silicon, the valence band maximum blue-shifts by 32 meV with respect to ground-state DFT, and the conduction band red-shifts by 18 meV. The resulting gap renormalization of 50 meV is in agreement with the value determined in Fig. 6a via the JDOS. In the case of BaSnO3, Fig. 6 shows a zero-point renormalization of the band gap of 10 meV; however, we emphasize that this value is not fully converged, and larger supercells, as well as corrections for Fröhlich couplings180, are necessary to obtain accurate data.

Figure 6d reports a convergence test of the imaginary part of the dielectric function of silicon, as computed with the special displacement method. In this calculation, we keep the supercell fixed, and we increase the number of random K-points in the supercell Brillouin zone. It is seen that the dielectric function converges relatively rapidly with the number of points and full convergence is achieved with 200 points when the Dirac delta functions in Eq. (57) are replaced by Gaussians with 30 meV width. Clearly, a larger smearing would require fewer K-points.

In Fig. 6e we compare the imaginary part of the dielectric function of silicon computed in the DFT ground state structure (red) with the special displacement method (blue). We see that the special displacements correctly capture phonon-assisted indirect optical transitions in the energy range between the indirect gap and direct gap of silicon. This approach provides an alternative strategy for computing optical spectra to Eq. (49) implemented in the indirect optics module of EPW. In the special displacement method, both temperature-dependent band structure renormalization and phonon-assisted processes are included on the same footing. Figure 6f shows the imaginary part of the dielectric function of BaSnO3 at 0 K (blue) and 300 K (green), including phonon-assisted processes. For comparison, we also show the calculation using the DFT ground-state structure (red), which misses phonon-assisted transitions. The spectra compare well with prior work using the special displacement method181.

Implementation and HPC benchmarks

In this section, we describe some of the implementation and parallel programming models of EPW. We first outline the computational workflow and basic capabilities of EPW. Then we describe our recent efforts to prepare EPW for exascale HPC systems with a focus on an explorative implementation of a highly scalable parallelization scheme, hybrid two-level MPI, and OpenMP parallelization. We present benchmarking results which demonstrate that, with this improved parallelization strategy, EPW can run at nearly full scale on the pre-exascale HPC system Frontera at the Texas Advanced Computing Center (TACC). Finally, we describe the I/O strategy employed in this explorative implementation, which is based on XML (eXtensible Markup Language) and HDF5 file formats. We emphasize that EPW continues to evolve with changes and improvements, and the reader is referred to the EPW website for its most up-to-date features and functionalities182.

Computational workflow and basic capabilities

The EPW code is logically partitioned into two components. The first component serves as an interface to the PWscf and PHonon codes of Quantum ESPRESSO. The code imports ground-state charge density and wavefunctions with computational parameters from prior runs with pw.x, and dynamical matrices, variations of the Kohn–Sham potentials, and vibrational mode pattern files from a prior phonon calculation with ph.x. All these quantities are evaluated on coarse k- and q-points grids, and the phonon wavevectors are restricted to the irreducible wedge of the Brillouin zone. Then the code calls Wannier90 in library mode to calculate the unitary rotation matrices Umnk [Eq. (64) of the “Methods” section] needed to transform Bloch states into maximally localized Wannier functions. Subsequently, the code unfolds the irreducible wedge of the phonon Brillouin zone into the full zone, evaluates electron–phonon matrix elements on coarse k- and q-point grids, and it transforms the Hamiltonian, dynamical matrices, and electron–phonon matrix elements into the Wannier representation. At this point, the code can print relevant quantities for subsequent runs with epw.x, and it can continue to the interpolation part. The interpolation engine of EPW carries out Wannier interpolation of the Hamiltonian, dynamical matrices, and electron–phonon matrix elements on fine k- and q-point grids after reading these quantities in the Wannier representation, and then it calculates electron–phonon-related properties on these grids.

The current snapshot of the code supports spin-unpolarized and non-magnetic spin–orbit calculations; work is currently in progress to extend the code to the cases of spin-polarized and non-collinear magnetic cases. Regarding pseudopotentials (PPs), norm-conserving (NC) PPs are supported. Since both ultrasoft PPs and the PAW method violate fundamental symmetry relations that the electron–phonon matrix elements must fulfill183, extending the current NCPP implementation to these cases poses some challenges. We will proceed to these extensions in future releases.

Parallelization

At the time of writing of this manuscript, we witness the launch of the first supercomputer entering the exascale computing era, namely Frontier at Oak Ridge National Laboratory; additional exascale systems are currently being deployed worldwide. Exascale HPC systems are characterized by many-core and heterogeneous architectures. Since 2020, we have made efforts to ready EPW for the exascale transition. In the following, we describe one strategy that we are currently exploring, a hybrid two-level MPI/OpenMP parallelization scheme, which makes EPW work seamlessly and efficiently on many-core architectures.

Historically EPW has adopted a one-level parallelization over the electron wavevectors (k-point parallelization) via MPI. This strategy has three shortcomings, which lead to an early saturation of the speedup with the number of cores in large-scale calculations: (i) There is an upper bound for the number of total MPI tasks which guarantees good scalability; this bound is determined by the number of k-points. (ii) As the number of MPI tasks increases, the overhead cost associated with MPI communications, in particular collective communications, increases. (iii) Due to the internal buffers of MPI, the memory overhead also increases with the number of MPI tasks. To address these issues, we are exploring the extension of the one-level parallelization over k-points to the hybrid two-level MPI and OpenMP parallelization over both k- and q-points.

In the hierarchical two-level MPI and OpenMP parallelization strategy, the total MPI tasks are partitioned into two levels of MPI groups, each consisting of a set of MPI tasks; in the lowest level, OpenMP parallelization is employed within each MPI task. For example, the total MPI tasks are first divided into k- or q-point pools, and each pool is further divided into q- and k-point pools, respectively. Each q- or k-point pool contains a set of MPI tasks, and OpenMP parallelization is employed within each MPI task. The parallelization option employed in the upper-level pool (over k-points or q-points) is chosen so as to maximize the calculation efficiency.

As compared to the one-level parallelization, the hierarchical two-level MPI and OpenMP parallelization can reduce the number of MPI tasks in each MPI communicator group, thereby reducing the overhead cost for collective MPI communication as well as the memory footprint due to the internal buffers of the MPI library. OpenMP parallelization can further reduce the memory footprint associated with replicated memory allocations in the code. This strategy enables increased flexibility in distributing the computational workload over a large number of cores.

To demonstrate the scaling behavior of EPW, we perform strong-scaling tests for the two-gap superconductor MgB2. We evaluate electron-phonon matrix elements on 150 × 150 × 150 k- and q-point grids (Fig. 7). These calculations are performed on the Frontera supercomputer at TACC. Frontera consists of 8368 nodes, each equipped with two Intel Xeon Platinum 8280 ("Cascade Lake”) processors with 28 cores per processor. To minimize statistical fluctuations in these benchmarks, we execute each calculation four times, and we average the resulting Wall times. Figure 7 shows that using this parallelization scheme, we achieve ~92% of the ideal speedup up to 448,000 cores in the evaluation of the electron–phonon matrix elements.

Fig. 7: Extreme scaling benchmarks of EPW.
figure 7

Strong-scaling test for the evaluation of the electron–phonon matrix elements of MgB2. These tests were performed using EPW v6-alpha available at ref. 227.

The hybrid two-level MPI and OpenMP parallelization scheme is controlled by three parameters that can be optimized to achieve maximum parallel scaling efficiency: the number of upper-level MPI tasks, the number of lower-level MPI tasks, and the number of OpenMP threads per MPI task. In the benchmarks shown in Fig. 7, we fix the number of k-point pools to 250, by varying the number of q-point pools depending on the number of cores. With this choice, we are able to achieve near-ideal speedup on extreme scaling tests; we expect that a speedup even superior to 92% could be achieved upon further optimization of the parallelization parameters We also point out that, in large-scale runs, I/O time dominates the total Wall time. To overcome this I/O bottleneck, we employ a low-I/O mode whereby memory is exploited as much as possible and minimum usage of storage media is made.

Our strategy for OpenMP parallelization is to use threaded versions of scientific libraries such as Intel MKL and Cray LibSci, rather than explicitly using OpenMP directives throughout the code. For the benchmarks reported in Fig. 7, we find that exceeding 7 OpenMP threads per MPI task worsens the performance. Therefore we use 4 OpenMP threads per MPI task, and we make all threads belonging to the same MPI task reside in the same non-uniform memory access (NUMA) domain.

Structured I/O

Recently we have been investigating the use of XML and the HDF5 data formats. Both formats can describe hierarchical data and are self-describing, flexible, and portable. For small to medium-sized data, the XML format is used; for large binary data, the HDF5 file format is used in parallel. In previous versions of EPW, several large arrays were read or written via per-process I/O or parallel MPI I/O. The former quickly overwhelms the file systems in large-scale calculations by generating a large number of files; the latter is not easily portable. Both issues can be addressed for large-size binary data by employing parallel I/O via parallel HDF5.

We note that parallel I/O performance heavily depends on the details of file systems and the parallelization settings. For instance, in the case of the LUSTRE file system, the number and size of stripes play an essential role in achieving high performance. In the case of the ROMIO implementation of MPI-IO, identifying optimum parameters in large-scale runs is nontrivial and requires systematic experimentation on HPC systems.

Discussion

Since the last technical paper in 201618, the EPW code has considerably expanded in scope, to the point of becoming a robust and efficient software platform for developing, testing, and deploying methods addressing electron–phonon physics and related materials properties. It is then natural to ask which components and functionalities are still in need of improvement, what are emerging directions in this area, and more generally what comes next for the EPW project.

On the functionality front, we expect to continue expanding the capabilities for transport, superconductivity, polarons, and optics described in the ‘Results’ section. For example, the transport module is based on the steady-state linearized Boltzmann transport equation; here, it would be desirable to generalize the methodology to high-field transport and to time-dependent driving fields. Similarly, in the superconductivity module, the treatment of electron–electron repulsion could be improved by seamlessly integrating EPW with standard GW codes. The study of polaron physics from an ab initio many-body perspective is just beginning, therefore we can expect a number of developments in this area, from the study of polaron transport to their optical properties and their relation with the theory of band structure renormalization. Calculations of phonon-assisted optical transitions are currently restricted to optical absorption spectra, but the formalism can just as well be employed for investigating related phenomena such as for example Auger–Meitner recombination184. Beyond these core modules of the EPW project, we anticipate growth in the calculation of electronic and optical properties using the special displacement method within the EPW/ZG code; for example, the current implementation focuses on harmonic systems, but generalizations to strongly anharmonic systems have recently been proposed185.

On the accuracy front, we anticipate that future work will focus on improving the precision of the Wannier interpolation method that is the basis for EPW. For example, methods that take dimensionality into account in the interpolation of the electron–phonon matrix elements will be essential to perform predictive and reliable calculations of transport, optics, superconductivity, and polarons in 2D materials186,187. Furthermore, it would be highly desirable to improve the predictive power of the DFPT electron–phonon matrix elements before even proceeding to Wannier–Fourier interpolation; a recent proposal to employ the GW method to calculate many-body corrections to the DFPT matrix elements offers a promising path toward this goal188.

On the front of HPC, we envision continuing the current effort to enable EPW for exascale computing architectures. In addition to the hybrid MPI/OpenMP parallelization, it will be necessary to leverage diverse GPU architectures and to enable the code for large-scale runs that will become possible with the exascale supercomputers that are being deployed worldwide.

Another important direction will be to enhance the interoperability of EPW with other major electronic structure software packages such as Abinit189, VASP190, Siesta191, and GPAW192. As several codes currently use the information generated by EPW for a variety of post-processing tasks, it will make sense to develop standardized data structures that adhere to the FAIR data principles.

Regarding the programming model, transitioning toward object-oriented programming (OOP) will be useful due to the potential for high modularity, extensibility, and reusability, which will facilitate flexible and sustained software development193. We expect that targeted use of OOP will greatly increase the efficiency and productivity in the development and maintenance of code194.

Alongside these developments, we anticipate increased attention to the issue of automation and the capability of performing electron–phonon calculations at scale for high-throughput approaches, data science, and artificial intelligence/machine learning (AI/ML) applications.

In summary, in this manuscript, we provided a comprehensive update on the current status, functionalities, and performance of the EPW code, we offered an overview of possible future directions for this and similar codes. We hope that, beyond capturing a snapshot of the current status of the EPW project, the present manuscript will contribute to making advanced electron–phonon calculations more accessible and more widely used in computational materials discovery and design.

Methods

The key element of any calculation of electron-phonon interactions and related materials properties is the electron–phonon matrix element. The EPW code employs physics-based Wannier–Fourier interpolation to compute electron-phonon matrix elements accurately and efficiently and uses these matrix elements as the starting point for advanced many-body calculations of electronic, optical, and transport properties of solids including temperature dependence and phonon-assisted quantum processes.

In the following we introduce the notations and conventions employed throughout the manuscript, we provide a brief overview of the general principles of Wannier–Fourier interpolation of electron–phonon matrix elements, and we outline the extension of this interpolation scheme to the case of polar materials. A more comprehensive description of this methodology including detailed derivations can be found in ref. 10.

Notation and definitions

In the study of the electronic structure and lattice dynamics of crystalline solids, infinitely extended crystals are described by considering a periodic BvK supercell. This supercell consists of Nuc = N1 × N2 × N3 primitive unit cells of the crystal and is subject to periodic boundary conditions. The pth unit cell within the BvK supercell is identified by the direct lattice vector Rp, with p = 1, …, Nuc. The dual lattice of the direct lattice vectors Rp in reciprocal space defines a uniform grid of Nuc = N1 × N2 × N3 wavevectors in the Brillouin zone. Throughout the manuscript, we use k and q to denote electron and phonon wavevectors in the crystal Brillouin zone, respectively, and K to denote electron wavevectors in the Brillouin zone of the BvK supercell.

We use ψnk to indicate the eigenfunctions of the DFT Kohn-Sham Hamiltonian \({\hat{H}}_{{{{\rm{KS}}}}}\), and εnk the corresponding eigenvalues. This wavefunction is periodic and normalized over the BvK supercell, and can be expressed in the Bloch form:

$${\psi }_{n{{{\bf{k}}}}}({{{\bf{r}}}})=\frac{1}{\sqrt{{N}_{{{{\rm{uc}}}}}}}{u}_{n{{{\bf{k}}}}}({{{\bf{r}}}}){{\rm {e}}}^{i{{{\bf{k}}}}\cdot {{{\bf{r}}}}},$$
(60)

with unk being a lattice-periodic function normalized in the primitive unit cell of volume Ω. The position vector of the atomic nucleus κ belonging to the unit cell identified by Rp is \({{{{\boldsymbol{\tau }}}}}_{\kappa p}^{}={{{{\bf{R}}}}}_{p}+{{{{\boldsymbol{\tau }}}}}_{\kappa }^{}\), with \({{{{\boldsymbol{\tau }}}}}_{\kappa }^{}\) being the position vector within the primitive unit cell. The components of this vector along the Cartesian directions α = 1, 2, 3 are denoted by τκαp.

Vibrational eigenmodes and eigenfrequencies are obtained by diagonalizing the dynamical matrix, which is computed via DFPT using Quantum ESPRESSO12. In turn, the dynamical matrix is the Fourier transform of the interatomic force constants \({C}_{\kappa \alpha p,{\kappa }^{{\prime} }{\alpha }^{{\prime} }{p}^{{\prime} }}\), that is the Hessian of the DFT total energy in the atomic coordinates. The relation between interatomic force constants and dynamical matrix is135

$${D}_{\kappa \alpha ,{\kappa }^{{\prime} }{\alpha }^{{\prime} }}({{{\bf{q}}}})=\frac{1}{\sqrt{{M}_{\kappa }{M}_{{\kappa }^{{\prime} }}}}\mathop{\sum}\limits_{p}{{\rm {e}}}^{i{{{\bf{q}}}}\cdot {{{{\bf{R}}}}}_{p}}{C}_{\kappa \alpha 0,{\kappa }^{{\prime} }{\alpha }^{{\prime} }p},$$
(61)

where Mκ is the mass of the κth nucleus. The eigenvalues and eigenvectors of the dynamical matrix are denoted by \({\omega }_{{{{\bf{q}}}}\nu }^{2}\) and eκα,ν(q), respectively, and the index ν runs from 1 to 3M where M is the number of atoms in the primitive cell. ωqν corresponds to the vibrational frequency, and eκα,ν(q) is the normal mode of vibration or polarization vector.

The electron–phonon matrix element is defined by1,10

$${g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})=\langle {u}_{m{{{\bf{k}}}}+{{{\bf{q}}}}}| {{{\Delta }}}_{{{{\bf{q}}}}\nu }{v}^{{{{\rm{KS}}}}}| {u}_{n{{{\bf{k}}}}}\rangle ,$$
(62)

where the integral is evaluated over the unit cell, and the lattice-periodic component of the variation of the Kohn–Sham potential is given by

$${{{\Delta }}}_{{{{\bf{q}}}}\nu }{v}^{{{{\rm{KS}}}}}=\sqrt{\frac{\hslash }{2{M}_{0}{\omega }_{{{{\bf{q}}}}\nu }}}\,\mathop{\sum}\limits_{\kappa \alpha p}{{\rm {e}}}^{-i{{{\bf{q}}}}\cdot ({{{\bf{r}}}}-{{{{\bf{R}}}}}_{p})}\,\,\sqrt{\frac{{M}_{0}}{{M}_{\kappa }}}\,\,{e}_{\kappa \alpha ,\nu }({{{\bf{q}}}})\,\frac{\partial \,{V}^{{{{\rm{KS}}}}}({{{\bf{r}}}})}{\partial {\tau }_{\kappa \alpha p}}.$$
(63)

In this expression, M0 is an arbitrary reference mass introduced for convenience. MLWFs are defined in terms of Bloch states as9

$${{{{\rm{w}}}}}_{mp}({{{\bf{r}}}})={{{{\rm{w}}}}}_{m0}({{{\bf{r}}}}-{{{{\bf{R}}}}}_{p})=\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{n{{{\bf{k}}}}}{{\rm {e}}}^{i{{{\bf{k}}}}\cdot ({{{\bf{r}}}}-{{{{\bf{R}}}}}_{p})}\,{U}_{nm{{{\bf{k}}}}}\,{u}_{n{{{\bf{k}}}}}({{{\bf{r}}}}),$$
(64)

where Unmk is a unitary matrix in the indices m and n.

Throughout the manuscript, we used interchangeably the notation

$$\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{{{{\bf{k}}}}}\qquad \,{{\mbox{or}}}\,\qquad \int\frac{{\rm {d}}{{{\bf{k}}}}}{{{{\Omega }}}_{{{{\rm{BZ}}}}}}$$
(65)

to indicate summations or integrals over the Brillouin zone. The quantity ΩBZ on the right indicates the Brillouin zone volume.

The unitary matrix Unmk appearing in Eq. (64) is determined by requiring that the functions wmp(r) be as localized as possible195, i.e. MLWFs9. The computation of these unitary matrices is performed by minimizing the spatial spread of the resulting Wannier functions9. This procedure is notoriously challenging since the spread functional exhibits multiple local minima, especially in the case of entangled electron bands. In practice, the construction of optimal MLWFs often requires fine-tuning of several computational parameters, such as the inner and outer energy windows, and the projections used to initialize the minimization algorithm. Historically, this optimization has often been performed by using chemical intuition, and sometimes a trial-and-error approach.

In an effort to enable more systematic construction of MLWFs for high-throughput calculations and data-driven materials research, several strategies have been developed, such as for example those of refs. 196,197. These strategies fall into two categories, one relying on the projectability concept198, and the other on the selected-columns-of-the-density-matrix (SCDM) method199,200. The former approach relies on the projectability of Bloch states on pseudo-atomic orbitals associated with the pseudopotentials; the projectability metric of each Bloch state is used to downselect the band manifold for subsequent minimization of the spread functional. The latter approach does not rely on the pseudo-atomic orbitals or other choice of initial projections but generates an optimal set of states from the columns of the density matrix via QR decomposition with column pivoting.

Both approaches are very promising and bring Wannier functions one step closer to complete automation. Nevertheless, some challenges remain. For example, to automatically construct Wannier functions and achieve high-quality Wannier interpolation, both strategies require the use of all the occupied valence bands (except for low-lying semi-core states) as well as a few empty conduction bands for metallic or semi-metallic systems. In systems with medium-sized to large unit cells, the number of bands thus identified may be relatively large, and this will make EPW calculations more demanding because the number of operations required to obtain electron-phonon matrix elements scales with the square of the number of Wannier functions. Therefore, more work will be needed in the future to achieve automation whilst preserving calculation efficiency.

General principles of Wannier interpolation of electron–phonon matrix elements

The localized nature of MLWFs provides the basis for accurate and efficient interpolation of Kohn–Sham wavefunctions and energies201. This is achieved by expressing the Kohn–Sham Hamiltonian in the Wannier representation, and noting that the Hamiltonian matrix elements decrease rapidly with the distance between the Wannier function centers. The Hamiltonian matrix elements in the Wannier representation are195

$${H}_{mn}({{{{\bf{R}}}}}_{p})=\langle {{{{\rm{w}}}}}_{m0}| \hat{H}| {{{{\rm{w}}}}}_{np}\rangle \,={\int}_{{{{\rm{sc}}}}}{\rm {d}}{{{\bf{r}}}}\,{{{{\rm{w}}}}}_{m0}^{* }({{{\bf{r}}}})\hat{H}{{{{\rm{w}}}}}_{n0}({{{\bf{r}}}}-{{{{\bf{R}}}}}_{p})\,.$$
(66)

Using Eq. (64), these matrix elements can be expressed in terms of the Kohn–Sham Hamiltonian in the Bloch representation \({H}_{{m}^{{\prime} }{n}^{{\prime} }}({{{\bf{k}}}})\):

$${H}_{mn}({{{{\bf{R}}}}}_{p})=\frac{1}{{N}_{{{{\rm{uc}}}}}}\mathop{\sum}\limits_{{m}^{{\prime} }{n}^{{\prime} }{{{\bf{k}}}}}{{\rm {e}}}^{-i{{{\bf{k}}}}\cdot {{{{\bf{R}}}}}_{p}}{U}_{m{m}^{{\prime} }{{{\bf{k}}}}}^{{\dagger} }{H}_{{m}^{{\prime} }{n}^{{\prime} }}({{{\bf{k}}}}){U}_{{n}^{{\prime} }n{{{\bf{k}}}}}\,,$$
(67)

where the matrix Umnk is the same as in Eq. (64). Once Hmn(Rp) has been determined, Eq. (67) can be inverted to generate \({H}_{{m}^{{\prime} }{n}^{{\prime} }}({{{\bf{k}}}})\) anywhere in the Brillouin zone.

Similarly to the electronic case, the dynamical matrix can be expressed in the phonon Wannier representation as10

$${D}_{\kappa \alpha ,{\kappa }^{{\prime} }{\alpha }^{{\prime} }}({{{{\bf{R}}}}}_{p})=\frac{1}{{N}_{p}}\mathop{\sum}\limits_{{{{\bf{q}}}}\mu \nu }{{\rm {e}}}^{-i{{{\bf{q}}}}\cdot {{{{\bf{R}}}}}_{p}}{e}_{\kappa \alpha ,\mu }^{{\dagger} }({{{\bf{q}}}}){D}_{\mu \nu }({{{\bf{q}}}}){e}_{{\kappa }^{{\prime} }{\alpha }^{{\prime} },\nu }({{{\bf{q}}}})\,,$$
(68)

where Dμν(q) is the matrix element of the dynamical matrix in the Bloch representation for phonons. Once \({D}_{\kappa \alpha ,{\kappa }^{{\prime} }{\alpha }^{{\prime} }}({{{{\bf{R}}}}}_{p})\) has been determined, this relation can be inverted to obtain the phonon eigenvectors and eigenvalues anywhere in the Brillouin zone; this is a standard procedure employed to compute phonon dispersion relations7,202.

Equations (67) and (68) can be generalized to the case of electron–phonon matrix elements by considering Fourier transforms for both the Kohn–Sham states and for the vibrational eigenmodes. The resulting electron–phonon matrix elements in the Wannier representation are given by10:

$${g}_{mn\kappa \alpha }({{{{\bf{R}}}}}_{p},{{{{\bf{R}}}}}_{{p}^{{\prime} }})=\frac{1}{{N}_{{{{\rm{uc}}}}}^{2}}\mathop{\sum}\limits_{{{{\bf{k}}}},{{{\bf{q}}}}}{{\rm {e}}}^{-i({{{\bf{k}}}}\cdot {{{{\bf{R}}}}}_{p}+{{{\bf{q}}}}\cdot {{{{\bf{R}}}}}_{{p}^{{\prime} }})}\mathop{\sum}\limits_{{m}^{{\prime} }{n}^{{\prime} }\nu }\sqrt{\frac{2{M}_{\kappa }{\omega }_{{{{\bf{q}}}}\nu }}{\hslash }}{e}_{\kappa \alpha ,\nu }^{{\dagger} }({{{\bf{q}}}}){U}_{m{m}^{{\prime} }{{{\bf{k}}}}+{{{\bf{q}}}}}^{{\dagger} }{g}_{{m}^{{\prime} }{n}^{{\prime} }\nu }({{{\bf{k}}}},{{{\bf{q}}}}){U}_{{n}^{{\prime} }n{{{\bf{k}}}}}\,.$$
(69)

Once the \({g}_{mn\kappa \alpha }({{{{\bf{R}}}}}_{p},{{{{\bf{R}}}}}_{{p}^{{\prime} }})\) have been computed, this relation can be inverted to generate electron-phonon matrix elements anywhere in the Brillouin zone.

Equations (67)–(69) constitute the backbone of the interpolation engine of EPW. In practice, the interpolation module of EPW reads in the DFT electron density, dynamical matrices, and variations of the Kohn–Sham potential evaluated by Quantum ESPRESSO on a coarse Brillouin zone grid; computes the Kohn–Sham wavefunctions and electron–phonon matrix elements on this grid; calls the Wannier90 code in library mode to obtain the Wannier matrices in Eq. (64); transforms Hamiltonian, dynamical matrix, and electron–phonon matrix elements in the Wannier representation; and interpolates all these quantities onto arbitrarily dense k- and q-point grids. A qualitative schematic of this process is shown in Fig. 8.

Fig. 8: Schematic overview of the interpolation engine of EPW and its relation to the Quantum ESPRESSO and Wannier90 codes.
figure 8

The EPW/ZG module is a stand-alone supercell-based set of codes, as described in the “Results” section.

Treatment of long-range electron–phonon interactions

In semiconductors and insulators, the ionic displacements associated with a phonon can induce a variation of the Kohn–Sham potential that is long-ranged in nature. As a result, the electron–phonon matrix element gmnν(k, q) associated with longitudinal–optical (LO) phonons becomes singular in the long-wavelength limit q → 0. More specifically, in any material exhibiting non-vanishing Born effective charges, the matrix elements associated with LO phonons diverge as q/∣q2 at small q. In these cases, the assumption of locality that underpins the methodology described in the previous section ceases to hold, and the Wannier interpolation procedure needs to be modified to correctly capture the singularity.

The singularity in the matrix element can be dealt with by considering a multipole expansion of the Kohn–Sham potentials resulting from individual atomic displacements. The first order in this expansion is the dipole potential203, which scales as q/∣q2 and is responsible for the well-known Fröhlich electron–phonon interaction204. The modification of the electron–phonon interpolation method to include long-range effects consists of separating short-range and long-range parts in the matrix elements, as follows:

$${g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})={g}_{mn\nu }^{{{{\mathcal{S}}}}}({{{\bf{k}}}},{{{\bf{q}}}})+{g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})+{g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {Q}}}({{{\bf{k}}}},{{{\bf{q}}}}),$$
(70)

where the first term on the right-hand side is the short-range component, the second term is the dipole component, and the third term is the quadrupole component. Additional multipoles could be considered, but the dipole and quadrupole terms already lead to very accurate results. The dipole matrix element \({g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})\) was derived in refs. 205,206 and reads:

$${g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})=i\,\frac{4\pi }{{{\Omega }}}\frac{{e}^{2}}{4\pi {\epsilon }_{0}}\mathop{\sum}\limits_{\kappa }{\left(\frac{\hslash }{2{M}_{\kappa }{\omega }_{{{{\bf{q}}}}\nu }}\right)}^{1/2}\mathop{\sum}\limits_{{{{\bf{G}}}}\ne -{{{\bf{q}}}}}{{\rm {e}}}^{-i({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{{\boldsymbol{\tau }}}}}_{\kappa }}\frac{{\sum }_{p}{U}_{mp{{{\bf{k+q+G}}}}}{U}_{pn{{{\bf{k}}}}}^{{\dagger} }}{({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{{\boldsymbol{\epsilon }}}}}^{\infty }\cdot ({{{\bf{q}}}}+{{{\bf{G}}}})} ({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{\bf{{Z}}}_{\kappa }^{* }}}\cdot {{{{\bf{e}}}}}_{\kappa \nu }({{{\bf{q}}}}).$$
(71)

In this expression, ϵ0 is the vacuum permittivity, \({{{{\boldsymbol{\epsilon }}}}}_{}^{\infty }\) is the high-frequency dielectric tensor of the material, G represents a reciprocal lattice vector, \({{{\bf{{Z}}}_{\kappa }^{* }}}\) is the Born effective charge tensor of the atom κ, the bracket indicates the integral over the BvK supercell, and we use the notation a ⋅ B ⋅ c = ∑αβaαBαβcβ. The unitary matrices Umnk in Eq. (71) are the Wannier transformation obtained following the standard procedure207,208 and coming from the q + G → 0 limit of the overlap integrals between Kohn–Sham wavefunctions \(\langle {\psi }_{m{{{\bf{k}}}}+{{{\bf{q}}}}}| {{\rm {e}}}^{i{{{\bf{q}}}}\cdot {{{\bf{r}}}}}| {\psi }_{n{{{\bf{k}}}}}\rangle ={\sum }_{p}{U}_{mp{{{\bf{k}}}}+{{{\bf{q}}}}}{U}_{pn{{{\bf{k}}}}}^{{\dagger} }+{{{\mathcal{O}}}}({{{\bf{q}}}})\). This matrix element reduces to the standard Fröhlich interaction204 when one considers parabolic electron bands and a dispersionless LO mode in a cubic material186,205. This term is of the order of ∣q−1. The quadrupole contribution is the second term of the multipole expansion of the Kohn–Sham potential and is of the order of ∣q0. The corresponding matrix element \({g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {Q}}}({{{\bf{k}}}},{{{\bf{q}}}})\) was derived in refs. 40,41,187,209,210 and reads:

$$\begin{array}{ll}{g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {Q}}}({{{\bf{k}}}},{{{\bf{q}}}})=\frac{4\pi }{{{\Omega }}}\frac{{e}^{2}}{4\pi {\epsilon }_{0}}\mathop{\sum}\limits_{\kappa \alpha }{\left(\frac{\hslash }{2{M}_{\kappa }{\omega }_{{{{\bf{q}}}}\nu }}\right)}^{1/2}\mathop{\sum}\limits_{{{{\bf{G}}}}\ne -{{{\bf{q}}}}}\frac{{{\rm {e}}}^{-i({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{{\boldsymbol{\tau }}}}}_{\kappa }}{e}_{\kappa \alpha ,\nu }({{{\bf{q}}}})}{({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{{\boldsymbol{\epsilon }}}}}^{\infty }\cdot ({{{\bf{q}}}}+{{{\bf{G}}}})}\\ \qquad\qquad\qquad\times \mathop{\sum}\limits_{\beta \gamma }\left[\frac{1}{2}{Q}_{\kappa ,\alpha \beta \gamma }({q}_{\beta }+{G}_{\beta })({q}_{\gamma }+{G}_{\gamma })\,\mathop{\sum}\limits_{p}{U}_{mp{{{\bf{k+q+G}}}}}{U}_{pn{{{\bf{k}}}}}^{{\dagger} }\right.\\ \qquad\qquad\qquad-\,\left.{Z}_{\kappa ,\alpha \beta }^{* }({q}_{\beta }+{G}_{\beta })\mathop{\sum}\limits_{sp}{U}_{ms{{{\bf{k+q+G}}}}}({q}_{\gamma }+{G}_{\gamma })\left({A}_{sp{{{\bf{k}}}},\gamma }^{\,{{\rm{W}}}\,}+\langle {u}_{s{{{\bf{k}}}}}^{\,{{\rm{W}}}}| {V}^{{{\mbox{Hxc}}},{{{{\mathcal{E}}}}}_{\gamma }}| {u}_{p{{{\bf{k}}}}}^{\,{{\rm{W}}}\,}\rangle \right){U}_{pn{{{\bf{k}}}}}^{{\dagger} }\right].\end{array}$$
(72)

In this expression, Qκ is the dynamical quadrupole tensor211, \({V}^{{{\rm{Hxc}}},{{{{\mathcal{E}}}}}_{\gamma }}({{{\bf{r}}}})\) is the self-consistent potential induced by a uniform electric field \({{{{\mathcal{E}}}}}_{\gamma }\) along the Cartesian direction γ41,187, \({A}_{sp{{{\bf{k}}}},\gamma }^{\,{{\rm{W}}}\,}=-i\langle \partial {u}_{s{{{\bf{k}}}}}^{\,{{\rm{W}}}\,}/\partial {k}_{\gamma }| {u}_{p{{{\bf{k}}}}}^{\,{{\rm{W}}}\,}\rangle\) is the Berry connection, and \({u}_{p{{{\bf{k}}}}}^{\,{{\mbox{W}}}\,}\) is the smooth Bloch basis187. In EPW, the calculation of the Berry connection term is automatically activated for quadrupole calculations when the velocity matrix is computed in the Wannier representation, cf. Eq. (27) of ref. 22. This term can be non-negligible in particular for materials where the quadrupole tensor Qκ vanishes by symmetry, such as SrO187. The \({V}_{}^{\,{{\rm{Hxc}}}\,,{{{\boldsymbol{{{{\mathcal{E}}}}}}}}}\) term has been implemented in Abinit40,41,212 and EPW187,213 and has been tested for Si, GaP, GaAs, SrO, h-BN monolayer, MoS2 monolayer, and InSe monolayer. In all these cases, it was found that the contribution from this term represents <0.1% of the total quadrupole correction41,187. Since this term is very small and its implementation is rather cumbersome, it has not been included in public releases of these codes.

The calculation strategy employed by EPW is as follows. First, the complete matrix elements gmnν(k, q) are evaluated on coarse k and q grids using DFPT. Second, the long-range contributions \({g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})\) and \({g}_{mn\nu }^{{{{\mathcal{L}}}},Q}({{{\bf{k}}}},{{{\bf{q}}}})\) are subtracted from the DFPT matrix elements using Eqs. (71) and (72), leaving out the short-range component \({g}_{mn\nu }^{{{{\mathcal{S}}}}}({{{\bf{k}}}},{{{\bf{q}}}})\) on the coarse grids. Third, the standard Wannier electron–phonon interpolation of ref. 10 is applied to the short-range component only. And fourth, the long-range contributions are added back using Eqs. (71) and (72) on the fine k and q grids.

The infinite sum over the G vectors in Eqs. (71) and (72) ensure the periodicity of the matrix elements in reciprocal space. In practical calculations, this sum might be computationally demanding to converge. In principle, periodicity could be enforced by including only one reciprocal lattice vector in the sum, namely \({\tilde{{{{\bf{G}}}}}}_{{{{\bf{q}}}}}\) such that \(| {{{\bf{q}}}}+{\tilde{{{{\bf{G}}}}}}_{{{{\bf{q}}}}}| =\mathop{\min }\nolimits_{{{{\bf{G}}}}}| {{{\bf{q}}}}+{{{\bf{G}}}}|\). However, this choice introduces derivative discontinuities in \({g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})\) at the Brillouin zone boundaries, which in turn cause spurious oscillations in the interpolation of \({g}_{mn\nu }^{{{{\mathcal{S}}}}}({{{\bf{k}}}},{{{\bf{q}}}})\). We illustrate this point in Fig. 9a–d, focusing on the longitudinal-optical (LO) phonon of cubic boron nitride (c-BN).

Fig. 9: Accurate computation of long-range electron–phonon matrix elements with EPW.
figure 9

a Brillouin zone of c-BN, the system used in this example. bd Full, long-range and short-range electron–phonon matrix elements, respectively, for the LO phonon mode along the q-path shown by the green line in (a). The red lines are for the choice of including only the dominant reciprocal lattice vector in the G sums. The dark blue lines correspond to the choice of applying a Gaussian filter, the procedure implemented in EPW. Circles are the reference data from explicit DFPT calculations. e Sensitivity of the interpolation on the α parameter of the Gaussian filter. f Number of G vectors included in the sum as a function of α, and g corresponding maximum relative error with respect to DFPT reference data. h Comparison between the descriptor Dν(k = 0, q) obtained from direct DFPT calculations (white circles) and from Wannier interpolation: without including long-range contributions (red line); including the dipole term (orange line); and including both dipole and quadrupole terms (blue line). In each case, the corresponding corrections to the phonon dynamical matrix are also included. i Zoom over the area highlighted in (h), focusing on the LA phonon mode.

An alternative strategy to avoid the sum over G is to cut off the interaction range in Eqs. (71) and (72) using a Gaussian filter, \(\exp [-({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{{\boldsymbol{\epsilon }}}}}^{\infty }\cdot ({{{\bf{q}}}}+{{{\bf{G}}}})/4\alpha ]\). This choice finds motivation in the Ewald summation method that is commonly employed to evaluate the non-analytic contribution to the dynamical matrix in polar materials7,8,202. It was employed in previous versions of EPW as well as in other codes13,40,206, and it avoids derivative discontinuity. However, it does not preserve the periodicity of the matrix elements in reciprocal space, which is required by the periodic gauge. In EPW, to maintain the periodicity of the matrix elements, we sum over a shell of G vectors centered around \({\tilde{{{{\bf{G}}}}}}_{{{{\bf{q}}}}}\), and then apply the Gaussian filter. Figure 9c shows how this procedure yields periodic and smooth long-range matrix elements with the correct behavior next to the singularities, and enables accurate interpolation of the complete matrix elements, as shown in Fig. 9b.

The α parameter in the Gaussian filter is chosen in such a way as to ensure accurate interpolation (which requires large α) whilst using as few G vectors as possible in Eqs. (71) and (72) (which requires small α). In Fig. 9e we compare the interpolated matrix element gmnν(k, q) to explicit DFPT calculations, for different values of α, with the reciprocal space summation restricted to those G vectors such that \(({{{\bf{q}}}}+{{{\bf{G}}}})\cdot {{{{\boldsymbol{\epsilon }}}}}_{}^{\infty }\cdot ({{{\bf{q}}}}+{{{\bf{G}}}}) < 56\alpha\). With this choice, only G-vectors yielding a value of the Gaussian filter larger than \(\exp (-14)\simeq 1{0}^{-6}\) are included in the sum. We find that when α is chosen to match the size of the Brillouin zone [α = 1 (2π/a)2, a is the lattice parameter], good interpolation is achieved. We note that, for layered materials, more G vectors are automatically included in the sum along the perpendicular direction due to the anisotropy of the dielectric tensor. For completeness, in Fig. 9f we show how the number of required G vectors increases with α, and in Fig. 9g we show the interpolation error in the matrix elements as a function of α. We emphasize that, since EPW implements this Gaussian filter, caution should be used when extracting dipolar and quadrupolar matrix elements from EPW for separate post-processing, because \({g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})\) and \({g}_{mn\nu }^{{{{\mathcal{L}}}},{\rm {Q}}}({{{\bf{k}}}},{{{\bf{q}}}})\) have the expected q-dependence only at long wavelength.

Figure 9h, i illustrate the importance of describing dipole and quadrupole interactions using Eqs. (71) and (72), for the case of c-BN. To facilitate the comparison between the interpolation results and explicit DFPT calculations for long-wavelength acoustic modes, we use the following descriptor which removes the factor \({\omega }_{{{{\bf{q}}}}\nu }^{-1/2}\) from the matrix element and averages over electronic degeneracies:

$${D}_{\nu }({{{\bf{k}}}},{{{\bf{q}}}})=\frac{1}{\hslash {N}_{{{{\rm{W}}}}}}{\left[2\rho {{\Omega }}\hslash {\omega }_{{{{\bf{q}}}}\nu }{\sum }_{mn}| {g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}}){| }^{2}\right]}^{1/2}\,.$$
(73)

Here, the sum over bands is carried over the NW states in the Wannier manifold and ρ is the mass density of the crystal. Dν(k, q) has units of energy divided by length and can be thought of as a deformation potential of sort. In Fig. 9h, i, we choose the manifold composed by the top three valence bands of c-BN, and set k = 0. We see that the dipole term is necessary to correctly describe the singular behavior of the LO phonon at long wavelength, and the quadrupole term is necessary to correctly describe the discontinuous behavior of the longitudinal acoustic (LA) phonons at a long wavelength [see expanded view in Fig. 9i]. The inclusion of both terms guarantees a high-quality interpolation of the electron-phonon matrix elements across the entire Brillouin zone. In particular, in this example, we find that the deformation potential calculated by including dipole and quadrupole terms agrees with direct DFPT calculations within 0.01 eV/Bohr (<1% of the maximum value) for the LA mode of c-BN along the ΓL line near the zone center. In refs. 22,187 a number of additional comparisons between the present method and direct DFPT calculations are discussed for standard three-dimensional (3D) and two-dimensional (2D) semiconductors.

The EPW code also implements long-range corrections for the phonon dynamical matrix by computing dipole–dipole, dipole–quadrupole, and quadrupole–quadrupole terms as discussed in refs. 7,8,202,211. Systematic tests of the interpolation procedure described in this section are provided in ref. 22.

The expressions for the long-range dipole and quadrupole contributions to the electron–phonon matrix elements are given in Eqs. (71) and (72) are for 3D bulk crystals. Several generalizations of these expressions to the case of 2D materials and the transition from 3D to 2D have been proposed during the past few years186,187,213,214,215,216. In the first of such generalizations214, the authors obtain the long-wavelength limit of polar electron–phonon couplings in 2D by evaluating the average dielectric polarization of a 2D slab enclosing the layer and removing the interaction between periodic replicas via Coulomb truncation. In ref. 215, the authors additionally consider the contributions to the polar matrix elements arising from out-of-plane dipoles and demonstrate an improvement in the interpolation accuracy. In addition to these studies, more recent work by some of us focused on including quadrupole corrections for 2D materials187 and on establishing the connection between polar matrix elements in 3D and 2D materials186. In particular, in ref. 187, the 2D long-range matrix elements to quadrupolar order are given by

$${g}_{mn\nu }^{{{{\mathcal{L}}}},2{\rm {D}}}({{{\bf{k}}}},{{{\bf{q}}}})={\left(\frac{\hslash }{2{\omega }_{{{{\bf{q}}}}\nu }}\right)}^{\frac{1}{2}}\mathop{\sum}\limits_{\kappa \alpha }\frac{{e}_{\kappa \alpha ,\nu }({{{\bf{q}}}})}{\sqrt{{M}_{\kappa }}}\mathop{\sum}\limits_{{{{\bf{G}}}}\ne -{{{\bf{q}}}}}\mathop{\sum}\limits_{sp}{U}_{ms{{{\bf{k+q+G}}}}}\langle {u}_{s{{{\bf{k+q+G}}}}}^{{{{\rm{W}}}}}| {V}_{{{{\bf{q}}}}+{{{\bf{G}}}}\kappa \alpha }^{{{{\mathcal{L}}}},2{\rm {D}}}| {u}_{p{{{\bf{k}}}}+{{{\bf{q}}}}}^{{{{\rm{W}}}}}\rangle {U}_{pn{{{\bf{k}}}}}^{{\dagger} },$$
(74)

where the 2D long-range scattering potential to first order in q is

$$\begin{array}{lll}{V}_{{{{\bf{q}}}}\kappa \alpha }^{{{{\mathcal{L}}}},2{\rm {D}}}({{{\bf{r}}}})&=&\frac{\pi e}{S}\frac{f(| {{{\bf{q}}}}| )}{| {{{\bf{q}}}}| }{{\rm {e}}}^{-i{{{\bf{q}}}}\cdot {{{{\boldsymbol{\tau }}}}}_{\kappa }}\left[\frac{1}{{\tilde{\epsilon }}^{\parallel }({{{\bf{q}}}})}\mathop{\sum}\limits_{\beta }\left\{2i{q}_{\beta }{Z}_{\kappa ,\alpha \beta }^{* }+\mathop{\sum}\limits_{\gamma }{q}_{\beta }{q}_{\gamma }{Q}_{\kappa ,\alpha \beta \gamma }-| {{{\bf{q}}}}{| }^{2}{Q}_{\kappa ,\alpha zz}\right.\right.\\ &-&\left.\left.2{q}_{\beta }{Z}_{\kappa ,\alpha \beta }^{* }{q}_{\gamma }{V}^{{{{\rm{Hxc}}}},{{{{\mathcal{E}}}}}_{\gamma }}({{{\bf{r}}}})\right\}+\frac{1}{{\tilde{\epsilon }}^{\perp }({{{\bf{q}}}})}\left\{2| {{{\bf{q}}}}{| }^{2}{Z}_{\kappa ,\alpha z}\left[z+{V}^{{{{\rm{Hxc}}}},{{{{\mathcal{E}}}}}_{z}}({{{\bf{r}}}})\right]\right\}\right],\end{array}$$
(75)

where S is the unit-cell area, and the dielectric functions appearing at the denominators are

$${\tilde{\epsilon }}^{\parallel }({{{\bf{q}}}})=1+\frac{2\pi f(| {{{\bf{q}}}}| )}{| {{{\bf{q}}}}| }{{{\bf{q}}}}\cdot {{{{\boldsymbol{\alpha }}}}}^{\parallel }\cdot {{{\bf{q}}}},$$
(76)
$${\tilde{\epsilon }}^{\perp }({{{\bf{q}}}})=1-2\pi | {{{\bf{q}}}}| f(| {{{\bf{q}}}}| )\,{\alpha }^{\perp }.$$
(77)

In these expressions, \({{{{\boldsymbol{\alpha }}}}}_{}^{\parallel }\) and α are macroscopic polarizabilities in- and out-of-plane, respectively, and \(f(q)=1-\tanh (qL/2)\) is a range-separation function and the distance L is determined according to Eq. (63) of ref. 187. The 2D extension of the overlap integral is provided in Eqs. (46) and (47) of ref. 187. This formulation also uses Coulomb truncation and generalizes the previous approaches of refs. 214,215 to the case of quadrupole corrections. In the approach of Ref. 186, the authors propose a unified formulation of polar electron–phonon interactions in 3D and 2D that reduces to the approach of refs. 206,217 in 3D, and to the approach of refs. 214,215 in 2D. The theory is developed along the same lines as in ref. 217, by evaluating the potential of point dipoles resulting from the atomic displacements. The key difference is that, in this case, the dipoles belong to a supercell consisting of a dielectric stack where one component is the material under consideration, and the other is a homogeneous dielectric (or vacuum). By solving this electrostatic problem, the authors obtain the following matrix element:

$$\begin{array}{lll}{g}_{mn\nu }({{{\bf{k}}}},{{{\bf{q}}}})&=&\frac{{e}^{2}}{2{\epsilon }_{0}{\epsilon }_{\infty ,{{{\rm{env}}}}}{{\Omega }}}{\left(\frac{\hslash }{2{\omega }_{{{{\bf{q}}}}\nu }}\right)}^{1/2}\,\,\mathop{\sum}\limits_{{{{\bf{G}}}}\ne -{{{\bf{q}}}}}\frac{\langle {u}_{m{{{\bf{k}}}}+{{{\bf{q}}}}+{{{\bf{G}}}}}| {u}_{n{{{\bf{k}}}}}\rangle }{\left\vert {{{{\bf{q}}}}}_{\parallel }\,+\,{{{{\bf{G}}}}}_{\parallel }\right\vert }\mathop{\sum}\limits_{\kappa }{M}_{\kappa }^{-1/2}{{\rm {e}}}^{-i({{{{\bf{q}}}}}_{\parallel }+{{{{\bf{G}}}}}_{\parallel })\cdot {{{{\boldsymbol{\tau }}}}}_{\kappa \parallel }}\\ &\times &\mathop{\sum}\limits_{\alpha \beta }{Z}_{\kappa ,\alpha \beta }^{* }{e}_{\kappa \beta ,\nu }({{{\bf{q}}}})\left[{\delta }_{\alpha ,\parallel }\,i{({{{\bf{q}}}}+{{{\bf{G}}}})}_{\alpha }K({{{\bf{q}}}}\,+\,{{{\bf{G}}}},{\tau }_{\kappa z})-{\delta }_{\alpha ,z}\,\frac{\partial K({{{\bf{q}}}}\,+\,{{{\bf{G}}}},{\tau }_{\kappa z})}{\partial {\tau }_{\kappa z}}\right],\end{array}$$
(78)

where ϵ,env is the dielectric constant of the homogeneous dielectric surrounding the 2D material, and K(q + G, τκz) is a kernel that depends on the thickness of the 2D layer and the surrounding medium, as well as their dielectric constants. The expression for K is given by Eq. (A1) of ref. 186. The main practical difference between this formulation and other approaches is that it can be used without the need for Coulomb truncation.