Boltzmann transport equation¶
24/10/2026
(2024)
Note
Hands-on based on Quantum ESPRESSO v7.6 and EPW v6.1.
Introduction¶
In this tutorial, we will show how to compute the Drift and Hall mobility of semiconductors and the resistivity of metals in both non magnetic and collinear magnetic case using the EPW code.
Prerequisites¶
This tutorial assumes that Quantum ESPRESSO and EPW have already been downloaded and compiled.
If you have not yet completed these steps,
please follow the Installation and setup tutorial before continuing.
The examples below also assume that the environment variables used to run the executables
(such as $QE, $RUN_PW, $RUN_PH, and $RUN_EPW) have been defined as described in the setup tutorial.
Note that variables defined with export only apply to the current terminal session.
If you compiled the code previously but are starting a new session,
you may need to redefine the run variables following the instructions in Defining run commands.
If the setup tutorial has been followed in the current session, the commands below should work directly in your terminal.
This tutorial builds on the standard DFT, DFPT, and electron-phonon interpolation workflow. If you are not already familiar with that workflow, we recommend completing the Interpolation of electron-phonon matrix elements tutorial first.
Download input files¶
All input files are given explicitly throughout the tutorial. For convenience, they can also be downloaded here, and extract them in your working directory before continuing. You may download them via the browser, or directly from the terminal:
pip install gdown
gdown https://drive.google.com/uc?id=1LkXMIDNXw9xqShbRPLodstRFqbztTieJ && tar -xzf tutorial07.tar.gz
cd tutorial07
We recomend to do Exercise 1 first and then proceed with either of the two other exercises depending on your particular intrest.
Exercise 1: Carrier mobiltiy in 3D semiconductors (BN)
Exercise 2: Carrier mobility in 2D semiconductors (MoS\(_2\))
Exercise 3: Electrical conductivity in magnetic and non magnetic metals (Fe)
Exercise 1: Carrier mobility in 3D semiconductors¶
In this exercise, we will calculate the Drift and Hall mobility as well as ionized impurity scattering effects on c-BN. Starting from the ground-state DFT and DFPT calculations. We will construct the hamiltonian and the electron-phonon matrix elements in the Wannier representation, interpolate them onto fine momentum grids, and solve the Boltzmann Transport Equation (BTE) with EPW.
Move to the exercise1 directory:
cd exercise1
and get the B anb N pseudopotential files from the Pseudo Dojo repository:
wget https://www.pseudo-dojo.org/pseudos/nc-sr-05_pbe_standard/B.upf.gz && gunzip B.upf.gz
wget https://www.pseudo-dojo.org/pseudos/nc-sr-05_pbe_standard/N.upf.gz && gunzip N.upf.gz
Step 1¶
Following the workflow introduced in the
Interpolation of electron-phonon matrix elements tutorial,
run a self-consistent calculation on an \(8\times8\times8\) \(\mathbf{k}\)-point grid using pw.x,
followed by a DFPT phonon calculation on a \(4\times4\times4\) \(\mathbf{q}\)-point grid using ph.x.
These calculations provide the quantities required for the subsequent electron-phonon calculations.
Use the following input files:
scf.in
&control
calculation = 'scf'
prefix = 'bn'
restart_mode = 'from_scratch'
pseudo_dir = './'
outdir = './'
/
&system
ibrav = 2
celldm(1) = 6.833
nat = 2
ntyp = 2
ecutwfc = 40
/
&electrons
diagonalization = 'david'
mixing_beta = 0.7
conv_thr = 1.0d-13
/
ATOMIC_SPECIES
B 10.811 B.upf
N 14.0067 N.upf
ATOMIC_POSITIONS {crystal}
B 0.00 0.00 0.00
N -0.25 0.75 -0.25
K_POINTS automatic
8 8 8 0 0 0
ph.in
&inputph
tr2_ph=1.0d-17,
prefix='bn',
amass(1)=10.811,
amass(2)=14.0067,
outdir='./',
fildyn='bn.dyn.xml',
fildvscf='dvscf'
ldisp=.true.,
epsil=.true.,
nq1 = 4,
nq2 = 4,
nq3 = 4
/
The calculations can be launched with the following commands:
$RUN_PW < scf.in > scf.out
$RUN_PH < ph.in > ph.out
Note: In practice the \(\mathbf{k}\)- and \(\mathbf{q}\)-point grids need to be fairly large in order to get converged dielectric function and Born effective charges during the phonon calculation.
The keyword fildvscf tells ph.x to write the variations in the self-consistent potential
needed by EPW to compute the electron-phonon matrix elements
(see the PH input documentation).
As in the interpolation tutorial,
bn.dyn0 lists the 8 irreducible \(\mathbf{q}\) points,
while the bn.dynX and bn.dvscf1 files contain
the corresponding dynamical matrices and potential variations.
epsil=.true. which computes the macroscopic dielectric constant in non-metallic systems. If you add .xml after the name of the dynamical matrix file, it will produce the data in XML format (preferred).tr2_ph threshold parameter on the self-consistent first-order perturbed wavefunction. This is crucial to obtain good vibrational properties.During the run, notice the IBZ q-point grid:
Dynamical matrices for ( 4, 4, 4) uniform grid of q-points
( 8 q-points):
N xq(1) xq(2) xq(3)
1 0.000000000 0.000000000 0.000000000
2 -0.250000000 0.250000000 -0.250000000
3 0.500000000 -0.500000000 0.500000000
4 0.000000000 0.500000000 0.000000000
5 0.750000000 -0.250000000 0.750000000
6 0.500000000 0.000000000 0.500000000
7 0.000000000 -1.000000000 0.000000000
8 -0.500000000 -1.000000000 0.000000000
as well as the dielectric function and Born effective charge tensor:
Dielectric constant in cartesian axis
( 4.597202520 0.000000000 -0.000000000 )
( -0.000000000 4.597202520 -0.000000000 )
( -0.000000000 0.000000000 4.597202520 )
Effective charges (d Force / dE) in cartesian axis without acoustic sum rule applied (asr)
atom 1 B Mean Z*: 1.89176
Ex ( 1.89176 0.00000 0.00000 )
Ey ( 0.00000 1.89176 0.00000 )
Ez ( 0.00000 -0.00000 1.89176 )
atom 2 N Mean Z*: -1.89376
Ex ( -1.89376 -0.00000 0.00000 )
Ey ( -0.00000 -1.89376 -0.00000 )
Ez ( 0.00000 -0.00000 -1.89376 )
Step 2¶
Gather the .dyn and .dvscf files into a new save/ directory which EPW will read.
The files in _ph0/bn.phsave/ containing the displacement patterns are also needed.
This can be done using the pp.py Python script included in the EPW/bin distribution:
$ python3 $QE/../EPW/bin/pp.py
The script will ask you to enter the prefix used for the calculation. (in this case, bn):
Enter the prefix used for PH calculations (e.g. diam)
bn
Step 3¶
Run a non self-consistent calculation on a 4\(\times\)4\(\times\)4 uniform and \(\Gamma\)-centered \(\mathbf{k}\)-point grid with crystal coordinates in the interval [0,1).
Such a grid can be for example generated with the wannier90 utility with kmesh.pl 4 4 4. The script is located in $QE/../external/wannier90/utility
The nscf.in file is as follow:
nscf.in
&control
calculation = 'bands'
prefix = 'bn'
pseudo_dir = './'
outdir = './'
/
&system
ibrav = 2
celldm(1) = 6.833
nat = 2
ntyp = 2
ecutwfc = 40
/
&electrons
diagonalization = 'david'
mixing_beta = 0.7
conv_thr = 1.0d-13
/
ATOMIC_SPECIES
B 10.811 B.upf
N 14.0067 N.upf
ATOMIC_POSITIONS {crystal}
B 0.00 0.00 0.00
N -0.25 0.75 -0.25
K_POINTS crystal
64
0.00000000 0.00000000 0.00000000 1.562500e-02
0.00000000 0.00000000 0.25000000 1.562500e-02
0.00000000 0.00000000 0.50000000 1.562500e-02
...
Note: The \(\mathbf{k}\)-point list shown above is abbreviated.
The downloaded nscf.in file contains the complete grid.
Launch the calculation with:
$RUN_PW < nscf.in > nscf.out
The reason for the non-self consistent calculation is that EPW needs the wavefunctions on the full BZ on a grid between 0 and 1.
Note: Since we are also interested in electron mobility, we will need the conduction bands. Notice that we added the input nbnd = 20 in nscf.in
Step 4¶
Perform an EPW calculation to Fourier-transform the electron-phonon matrix element from a coarse 4\(\times\)4\(\times\)4 \(\mathbf{k}\)-point and \(\mathbf{q}\)-point grids to real space and then interpolate the electronic band structure and phononic dispersion along the \(L-\Gamma-X-K-\Gamma\) high symmetry line by reading the file LGXKG.txt. This file can be obtained from the downloaded packaged.
epw1.in
&inputepw
prefix = 'bn'
outdir = './'
elph = .true.
epbwrite = .true.
epbread = .false.
epwwrite = .true.
epwread = .false.
etf_mem = 1
lpolar = .true. ! polar material
vme = 'wannier'
nbndsub = 3
bands_skipped = 'exclude_bands = 1'
wannierize = .true.
num_iter = 50000
iprint = 2
dis_win_max = 12.0
dis_win_min = -1.0
proj(1) = 'N:p'
wdata(1) = 'bands_plot = .true.'
wdata(2) = 'begin kpoint_path'
wdata(3) = ' L 0.500 0.500 0.500 G 0.000 0.000 0.000 '
wdata(4) = ' G 0.000 0.000 0.000 X 0.500 0.000 0.500 '
wdata(5) = ' X 0.500 0.000 0.500 K 0.375 0.375 0.750 '
wdata(6) = ' K 0.375 0.375 0.750 G 0.000 0.000 0.000 '
wdata(7) = 'end kpoint_path'
wdata(8) = 'bands_plot_format = gnuplot'
wdata(9) = 'guiding_centres = .true.'
wdata(10) = 'dis_num_iter = 5000'
wdata(11) = 'num_print_cycles = 10'
wdata(12) = 'dis_mix_ratio = 1.0'
wdata(13) = 'conv_tol = 1E-12'
wdata(14) = 'conv_window = 4'
wdata(15) = 'use_ws_distance = T'
fsthick = 100
degaussw = 0.001
dvscf_dir = './save'
band_plot = .true.
filkf = './LGXKG.txt'
filqf = './LGXKG.txt'
nk1 = 4
nk2 = 4
nk3 = 4
nq1 = 4
nq2 = 4
nq3 = 4
/
Launch the calculation with:
$RUN_EPW < epw1.in > epw1.out
Note that the code should have detected the presence of the quadrupole.fmt file and correclty read the quadrupole tensor. Look in the output for the line Quadrupole tensor is correctly read:. In this hands-on we will not cover how to obtain the quadrupole tensor and they are simply given here. There are two ways to obtain them:
Using perturbation theory. This is implemented in a recent version of the Abinit software.
Fitting the perturbed density or the electron-phonon matrix elements in the long wavelength limit obtained by direct DFPT calculations. You can use the
multipole.pyscript located in$QE/../test-suite/ph_multipolefor convenience
= .true., the code should produce the band.eig and phband.freq files that contain the electronic band structure and phononic dispersion along a path given in the filkf and filqf files. If you want to have files in an easy gnuplot format, you can use the plotband.x tool by doing$QE/plotband.x
Step 5¶
Do a restart calculation (restarting from the bn.epmatwp1 file) and compute the hole mobility of c-BN.
epw2.in
&inputepw
prefix = 'bn'
outdir = './'
elph = .true.
epwwrite = .false.
epwread = .true.
etf_mem = 3 ! generate k-points within fsthick
lpolar = .true.
vme = 'dipole'
mp_mesh_k = .true.
nbndsub = 3
bands_skipped = 'exclude_bands = 1'
scattering = .true.
scattering_serta = .true.
int_mob = .false.
carrier = .true.
ncarrier = -1E15
iterative_bte = .true.
epmatkqread = .false.
mob_maxiter = 300
broyden_beta= 1.0
bfieldx = 0.0d0
bfieldy = 0.0d0
bfieldz = 1.0d-10 ! Apply a magnetic field along Cart. z
nstemp = 1
temps = 300
restart = .true.
restart_step = 1000
wannierize = .false.
num_iter = 50000
iprint = 2
dis_win_max = 12.0
dis_win_min = -1.0
proj(1) = 'N:p'
elecselfen = .false.
phonselfen = .false.
a2f = .false.
fsthick = 0.4 ! 0.3 eV
degaussw = 0.01
efermi_read = .true
fermi_energy = 11.246840
dvscf_dir = './save'
nkf1 = 40
nkf2 = 40
nkf3 = 40
nqf1 = 40
nqf2 = 40
nqf3 = 40
nk1 = 4
nk2 = 4
nk3 = 4
nq1 = 4
nq2 = 4
nq3 = 4
/
Launch the calculation with:
$RUN_EPW < epw2.in > epw2.out
Notes:
The value of fermi energy was obtained from the output of the previous calculation
epw1.inepwread allows for the restart from the
bn.epmatwp1fileint_mob allows to perform both electron and hole calculations at the same time but is not recommanded for efficiency reasons.
carrier and ncarrier define the carrier concentration. If carrier
= .true.then the intrinsic mobility with ncarrier concentration (in cm\(^{-3}\)) is computed. If ncarrier is positive it will compute the electron mobility and if it is negative it will compute the hole mobility. The resulting mobility should be independent of the choice of carrier concentration in reasonable ranges 10\(^{10}\) - 10\(^{16}\) cm\(^{-3}\).iterative_bte asks for the iterative solution of the BTE in addition to SERTA.
nstemp and temps define the lattice temperature at which the mobility is evaluated.
restart and restart_step will create restart point every (in this case) 1000 \(\mathbf{q}\)-points. You can try breakin the run after a restart point and restart to test this feature.
bfieldzadds a (small) finite magnetic field along a cartisian direction (in unit of Tesla) . This will automatically trigger the calculation of the Hall factor.mob_maxiter is the maximum number of iterations for the BTE solution.
degaussw
= 0.01means finite smearing is used. Positive values give Gaussian smearing.
= 4 and temps = 100, 200, 400, 500). You should remove the restart_0.fmt file before doing so. Try filling the table below for the hole mobility:
T (K)
hole \(\varepsilon_F\) (eV)
drift SERTA \(\mu\) (cm\(^2\)/Vs)
drift BTE \(\mu\) (cm\(^2\)/Vs)
Hall BTE \(\mu\) (cm\(^2\)/Vs)
100
200
300
400
500
At convergence you should get:
where the room temperature values with SOC should be around 319 cm\(^2\)/Vs for the drift BTE and 281 cm\(^2\)/Vs for the Hall mobility with a Hall factor of 0.88. More details can be found in the sections about the Boltzmann Transport equation, Carrier transport, and Hall transport of the Theory page
Optional: (1) Try to increase the fine grids and add a few more temperatures and see if you can get a result closer to convergence. (2) include SOC. (3) remove or rename the file quadrupole.fmt to do the interpolation with dipole only and see the impact on the results.
Step 6¶
Obtain the hole spectral decomposition of c-BN with a restart calculation (restarting from the bn.epmatwp1 file). You should remove the restart_0.fmt file.
$RUN_EPW < epw3.in > epw3.out
epw3.in
&inputepw
iverbosity = 3
mob_maxfreq = 160
mob_nfreq = 640 ! To have 0.25 meV intervals
nkf1 = 60
nkf2 = 60
nkf3 = 60
nqf1 = 60
nqf2 = 60
nqf3 = 60
/
inv_tau_freq_0.fmt. You should open the file and look for the maximum number of \(\mathbf{k}\)-points within the fsthick, here you should have 149. You should also look for the number of bands, here you should find 3.Edit the gaussian-h.py python script to correspond to the calculation you have been doing. This script will compute the scattering rate density and the integrated scattering rate.
gaussian-h.py
###################################################################################
# Script to produce the spectral decomposition and integrated scattering rate.
# The spectral decomposition is computed at an energy 3/2 k_B T away from the band edge.
# Samuel Poncé
# Version1 - Fall 2018
# Version2 - Fall 2020
# Version3 - November 2022
# If you are using this script, please consider citing S. Ponc\'e et al, Phys. Rev. Research 3, 043022 (2021)
###################################################################################
import numpy as np
#####################################
# This needs to be manually updated and corresponds to the EPW calculation
mob_maxfreq = 160 # meV
mob_nfreq = 640
T = 300 # K
c = 1.0 # Gaussian broadening in meV. Should be smaller in practice.
file1 = 'inv_tau_freq_0.fmt' # File name
nkpt = 149 # Number of k-points - same as in file1
nbnd = 3 # Number of bands - same as in file1
tol = 10.0 # meV. This means we are taking states around 3/2kbT +- tol in meV. In practice it should be quite small.
#####################################
#Constants
kb = 8.617333262145E-5 # eV/K
Ry2meV = 13605.6980659
hbar = 6.582119514E-16 # eVs
fact = 1.0 / (1000 * hbar * 1E12 ) # to get in THz
inv_tau_freq_tmp = np.zeros((nkpt, nbnd, mob_nfreq, 2))
inv_tau_freq_tmp[:,:,:,0] = -1000.0
step = mob_maxfreq / mob_nfreq # in meV
with open(file1,'r') as W:
for lines in W:
tmp = lines.split()
if (tmp[0] == '#'):
continue
ikpt = int(tmp[0]) - 1
ibnd = int(tmp[1]) - 1
freq = float(tmp[3])
ifreq = int(freq / step) - 1
inv_tau_freq_tmp[ikpt, ibnd, ifreq, 0] = float(tmp[2])
inv_tau_freq_tmp[ikpt, ibnd, ifreq, 1] = float(tmp[4])
# Put the energies in eV
inv_tau_freq_tmp[:, :, :, 0] = inv_tau_freq_tmp[:, :, :, 0] * Ry2meV
inv_tau_freq_tmp[:, :, :, 1] = inv_tau_freq_tmp[:, :, :, 1] * Ry2meV
# Find VBM
vbm = np.max(inv_tau_freq_tmp[:, :, :, 0])
print('VBM is located at ',vbm, ' meV')
# Rescale the energies to the VBM
inv_tau_freq_tmp[:, :, :, 0] = inv_tau_freq_tmp[:, :, :, 0] - vbm
# Find the energy that is at 3/2 kbT away
energy = 1000 * kb * T * 3.0 / 2 # in meV
print('Energy at 3/2 k_BT = ',energy,' meV')
# Create the final inv_tau_freq
inv_tau_freq = np.zeros((mob_nfreq))
ndegen = np.zeros((mob_nfreq))
for ikpt in np.arange(nkpt):
for ibnd in np.arange(nbnd):
for ifreq in np.arange(mob_nfreq):
if (np.abs(inv_tau_freq_tmp[ikpt, ibnd, ifreq, 0] + energy) < tol):
inv_tau_freq[ifreq] += inv_tau_freq_tmp[ikpt, ibnd, ifreq, 1]
ndegen[ifreq] += 1
# Average the values
for ifreq in np.arange(mob_nfreq):
if (ndegen[ifreq] > 0):
inv_tau_freq[ifreq] = inv_tau_freq[ifreq]/ndegen[ifreq]
# Sanity check
integral = 0.0
for ifreq in np.arange(mob_nfreq):
integral += inv_tau_freq[ifreq] #* (step * 1E-3) # To get step in eV
print('Integrated scattering rate: tau^-1 = ',integral * fact, ' Thz')
# Now compute the cumulative integrals:
cum = np.zeros((mob_nfreq))
for ii in np.arange(mob_nfreq):
# print ' Processing ',ii
for jj in np.arange(ii):
cum[ii] += inv_tau_freq[jj] #* step
# Gaussian broadening
# a = hight
# b = position
# c = width
def gauss(x,a,b,c):
prefactor = a * step / (c*np.sqrt(2*np.pi))
return prefactor * np.exp(- 0.5 * ((x-b)/c)**2 )
tau_gauss = np.zeros((mob_nfreq))
for ii in np.arange(mob_nfreq):
for jj in np.arange(mob_nfreq):
tau_gauss[ii] += gauss(ii * step, inv_tau_freq[jj] * fact, jj * step, c)
with open(file1+'-gaussian'+str(c),'w') as W:
W.write('# Freq [meV] d tau^(-1) / d omega \int_0^max domega tau^(-1)(omega) [THz] \n ')
for ii in np.arange(mob_nfreq):
W.write(str(ii * step)+' '+str(tau_gauss[ii])+' '+str(cum[ii] * fact)+' \n')
Then run it with:
python3 gaussian-h.py
The script should produce a file named inv_tau_freq.fmt-gaussian1.0 which you can plot with your favorite software. Note that the results are not converged but it should be clear that acoustic scattering is dominating in c-BN. At convergence you should get
Step 7¶
Investigate the effect of including ionized impurity scattering when computing the mobility.
In addition to the usual electron-phonon scattering, we can also consider the ionized-impurity scattering. This scattering mechanisms originates as an extrinsic effect due to the impurities that can be introduced when doping a semiconductor. This mechanism is quite important since it reduces the carrier mobility. In EPW ionized-impurity scattering is added together with the electron phonon scattering. The definition of the ionized-impurity scattering rate is given in Eq. (103) in Ionized impurity scattering of the Theory page
Prepare the EPW input file epw4.in (we show only the difference w.r.t. epw2.in)
epw4.in
&inputepw
ncarrier = -1Ed17
ii_g = .true.
ii_charge = 1.0d0
ii_n = 1.0d17 ! must match ncarrier, keep positive for both holes and electrons
ii_scattering = .true.
ii_only = .false.
/
Notes:
ii_g
= .true.tellsEPWto calculate ionized impurity matrix elements.ii_charge
= 1.0d0is the charge of the ionized impurities in the unit of the elementary charge.ii_n
= 1.0d17is the density of ionized impurities in unit of cm\(^{-3}\). For bulk, typical doping values range from 10\(^{15}\) to 10\(^{19}\) cm\(^{-3}\). Higher concentration leads to degenerate doping.ii_scattering
= .true.requiresEPWto calculate the ionized impurity scattering rates.ii_only
= .false.if.true., only ionized impurity scatterings is considered.
You should remove the restart_0.fmt file
Run EPW calculation for hole mobility of c-BN including ionized impurity scattering:
$RUN_EPW < epw4.in > epw4.out
In the output file ``epw4.out`` you can see the low-frequency (static) dielectric tensor is calculated and printed out
Low-frequency (static) dielectric tensor for ionized-impurity scattering
6.6296745525 0.0000000000 0.0000000000
0.0000000000 6.6296745525 0.0000000000
0.0000000000 0.0000000000 6.6296745525
ecutwfc = 40 Ry. Calculations with converged ecutwfc = 100 Ry in combination with spin-orbit coupling effect give a better result of 6.9.ii_n = 1.0d17 cm\(^{-3}\) is obtained around 84 cm\(^2\)/V\(\cdot\)s.Iteration number: 50
=============================================================================================
Temp Fermi Hole density Population SR Drift Hole mobility
[K] [eV] [cm^-3] [h per cell] [cm^2/Vs]
=============================================================================================
300.000 11.4498 0.10000E+18 -0.51486E-18 0.845068E+02 0.109733E-09 0.205569E-14
0.24214E-18 -0.109732E-09 0.845068E+02 -0.662203E-15
0.38535E-18 0.140718E-14 0.813676E-15 0.845068E+02
0.000000E+00 Max error
You can vary the carrier density ncarrier and ionized impurity density ii_n = absolute(ncarrier) in the input file epw4.in from 10\(^{15}\) to 10\(^{19}\) cm\(^{-3}\) and save data. Compare with the mobility obtained with epw2.in
Exercise 2: Carrier mobility in 2D semiconductors¶
We will here mostly highlight the specificity of 2D calculations and it is therefore advised to first do Exercise 1.
Go into exercise2 folder:
cd exercise2
and get the Mo and S pseudopotential files from the Pseudo Dojo repository:
wget https://www.pseudo-dojo.org/pseudos/nc-sr-05_pbe_standard/Mo.upf.gz && gunzip Mo.upf.gz
wget https://www.pseudo-dojo.org/pseudos/nc-sr-05_pbe_standard/S.upf.gz && gunzip S.upf.gz
Step 1¶
Following the workflow introduced in the Interpolation of electron-phonon matrix elements tutorial, make a self-consistent calculation for monolayer MoS\(_2\) and a phonon calculation on a homogeneous 6\(\times\)6\(\times\)1 \(\mathbf{q}\)-point grid. Run the calculation with the following commands
$RUN_PW < scf.in > scf.out
$RUN_PH < ph.in > ph.out
The input files are the following:
scf.in
&control
calculation='scf'
prefix='mos2'
outdir='./'
pseudo_dir = './'
verbosity = 'high',
/
&system
ibrav= 4,
celldm(1) = 6.02019
celldm(3) = 5.33626
ntyp = 2,
nat = 3,
ecutwfc = 40,
noncolin=.false.
lspinorb=.false.
assume_isolated='2D',
/
&electrons
diagonalization='david'
mixing_beta = 0.7
conv_thr = 1.0d-14
/
ATOMIC_SPECIES
Mo 95.962 Mo.upf
S 32.065 S.upf
ATOMIC_POSITIONS crystal
Mo 0.33333333333333333333 0.66666666666666666667 0.0
S 0.66666666666666666667 0.33333333333333333333 -0.0919442350
S 0.66666666666666666667 0.33333333333333333333 0.0919442350
K_POINTS automatic
6 6 1 0 0 0
assume_isolated=’2D’ truncate the Coulomb interaction out-of plane. This means that the out-of-plane distance, here 32 Bohr does not need to be too big (see PW input documentation).lspinorb = .false. in preparation for the phonon calculation to reduce the computational time but has also been shown to be a good approximation. The SOC will later be activated for the EPW calculation.ph.in
&inputph
tr2_ph=1.0d-18,
prefix='mos2',
outdir = './'
fildyn='mos2.dyn.xml',
fildvscf='dvscf'
ldisp=.true.,
epsil=.true.,
nq1=6,
nq2=6,
nq3=1
/
During the run, notice the IBZ \(\bf{q}\)-point grid:
Dynamical matrices for ( 6, 6, 1) uniform grid of q-points
( 7 q-points):
N xq(1) xq(2) xq(3)
1 0.000000000 0.000000000 0.000000000
2 0.000000000 0.192450090 0.000000000
3 0.000000000 0.384900179 0.000000000
4 0.000000000 -0.577350269 0.000000000
5 0.166666667 0.288675135 0.000000000
6 0.166666667 0.481125224 0.000000000
7 0.333333333 0.577350269 0.000000000
Step 2¶
We need to post-process some of the data to make it ready for EPW. To do so, we can use a python script.
Run the python post-processing to create the save/ folder
python3 $QE/../EPW/bin/pp.py
The script will ask you to enter the prefix used for the calculation. In this case enter “mos2”.
Enter the prefix used for PH calculations (e.g. diam)
mos2
The script will create a new folder called “save” that contains the dvscf potential files, pattern files, and dynamical matrices on the IBZ.
Step 3¶
Do a self-consistent and non self-consistent calculation on a homogeneous 6\(\times\)6\(\times\)1 uniform and \(\Gamma\)-centered grid between [0,1) in crystal coordinates with the following inputs:
scf_epw.in
&control
calculation='scf'
prefix='mos2'
outdir='./'
pseudo_dir = './'
verbosity = 'high',
/
&system
ibrav= 4,
celldm(1) = 6.02019
celldm(3) = 5.33626
ntyp = 2,
nat = 3,
ecutwfc = 40,
noncolin=.true.
lspinorb=.true.
assume_isolated='2D',
/
&electrons
diagonalization='cg'
mixing_beta = 0.7
conv_thr = 1.0d-14
/
ATOMIC_SPECIES
Mo 95.962 Mo.upf
S 32.065 S.upf
ATOMIC_POSITIONS crystal
Mo 0.33333333333333333333 0.66666666666666666667 0.0
S 0.66666666666666666667 0.33333333333333333333 -0.0919442350
S 0.66666666666666666667 0.33333333333333333333 0.0919442350
K_POINTS automatic
6 6 1 0 0 0
nscf_epw.in
&control
calculation='nscf'
prefix='mos2'
outdir='./'
pseudo_dir = './'
verbosity = 'high',
/
&system
ibrav= 4,
celldm(1) = 6.02019
celldm(3) = 5.33626
ntyp = 2,
nat = 3,
ecutwfc = 40,
noncolin=.true.
lspinorb=.true.
assume_isolated='2D',
nbnd = 34
/
&electrons
diagonalization='david'
mixing_beta = 0.7
conv_thr = 1.0d-12
/
ATOMIC_SPECIES
Mo 95.962 Mo.upf
S 32.065 S.upf
ATOMIC_POSITIONS crystal
Mo 0.33333333333333333333 0.66666666666666666667 0.0
S 0.66666666666666666667 0.33333333333333333333 -0.0919442350
S 0.66666666666666666667 0.33333333333333333333 0.0919442350
K_POINTS crystal
36
0.00000000 0.00000000 0.00000000 2.777778e-02
0.00000000 0.16666667 0.00000000 2.777778e-02
0.00000000 0.33333333 0.00000000 2.777778e-02
...
Note: The SOC has been activated and the number of bands double.
Launch the calculations with:
$RUN_PW < scf_epw.in > scf_epw.out
$RUN_PW < nscf_epw.in > nscf_epw.out
Step 4¶
Use EPW to interpolate the electron and phonon dispersions from a coarse 6\(\times\)6\(\times\)1 grid to a high-symmetry path \(\Gamma -M-K-\Gamma\) path given in the file GMKGM.txt.
epw1.in
&inputepw
prefix = 'mos2'
outdir = './'
elph = .true.
epbwrite = .true.
epbread = .false.
epwwrite = .true.
epwread = .false.
etf_mem = 1
lpolar = .true.
vme = 'wannier'
use_ws = .true.
lifc = .false.
nbndsub = 10
bands_skipped = 'exclude_bands = 1-24'
system_2d = 'quadrupole'
wannierize = .true.
num_iter = 5000
iprint = 2
dis_win_max = -0.8
dis_win_min = -6.8
dis_froz_max= -3.6
proj(1) = 'Mo:d'
wdata(1) = 'bands_plot = .true.'
wdata(2) = 'begin kpoint_path'
wdata(3) = 'G 0.00 0.00 0.00 M 0.50 0.00 0.00'
wdata(4) = 'M 0.50 0.00 0.00 K 0.333333333333 0.333333333333 0.00'
wdata(5) = 'K 0.333333333333 0.333333333333 0.00 G 0.0 0.0 0.00'
wdata(6) = 'end kpoint_path'
wdata(7) = 'bands_plot_format = gnuplot'
wdata(8) = 'dis_num_iter = 5000'
wdata(9) = 'num_print_cycles = 10'
wdata(10) = 'dis_mix_ratio = 1.0'
wdata(11) = 'conv_tol = 1E-12'
wdata(12) = 'conv_window = 4'
fsthick = 20 ! eV
nstemp = 1
temps = 300
degaussw = 0.01 ! eV
dvscf_dir = './save'
band_plot = .true.
filkf = './GMKG.txt'
filqf = './GMKG.txt'
nk1 = 6
nk2 = 6
nk3 = 1
nq1 = 6
nq2 = 6
nq3 = 1
/
= ’quadrupole’ with lpolar = .true. tells the code to account for long range dipole, quadrupole and Berry connection in a 2D formulation. The quadrupole.fmt must be present in the same folder as the running folder and contains the quadrupoles value that can be computed by fitting or using the Abinit software. If you do not want to include quadrupole, you can use system_2d = ’dipole_sp’.= ’wannier’ is used.$RUN_EPW < epw1.in > epw1.out
Inspect the output and in particular:
Spin CASE ( non-collinear )
which tells you that SOC has been included,
------------------------------------
Quadrupole tensor is correctly read:
------------------------------------
atom dir Qxx Qyy Qzz Qyz Qxz Qxy
1 x 0.00000 0.00000 0.00000 -0.00000 -0.00000 -5.53266
1 y -5.53266 5.53266 0.00000 -0.00000 -0.00000 0.00000
1 z 0.00000 0.00000 -0.00000 0.00000 0.00000 0.00000
2 x 0.00000 0.00000 0.00000 0.00000 -0.17419 -0.39121
2 y -0.39122 0.39121 0.00000 -0.17419 -0.00000 0.00000
2 z 7.85763 7.85763 -0.29698 0.00000 0.00000 0.00000
3 x 0.00000 0.00000 0.00000 0.00000 0.17419 -0.39121
3 y -0.39122 0.39121 0.00000 0.17419 0.00000 0.00000
3 z -7.85763 -7.85763 0.29698 0.00000 0.00000 0.00000
which tells you that the provided quadrupole.fmt file was correctly read,
Find optimal range separation length L
L 53.66667 Bohr with IFC = 0.103072712898
L 44.88889 Bohr with IFC = 0.103072643517
L 39.03704 Bohr with IFC = 0.103072407660
L 35.13580 Bohr with IFC = 0.103072269566
L 37.73663 Bohr with IFC = 0.103072287795
L 36.00274 Bohr with IFC = 0.103072116832
L 37.15866 Bohr with IFC = 0.103072219566
...
which automatically computes the optimal range separation function between the short-range dynamical matrice and the long-range one. The optimal length is obtained by taking the value of \(L\) that minimizes the sum of the real-space short-range IFC (\(\Phi^{\mathcal{S}}\))
Finaly, the code reports the in-plane and out-of-plane macroscopic polarizabilities computed over a unit cell with size \(c\) along the out-of-plane direction. (see More details in Phys. Rev. B 107, 155424 (2023))
In-plane polarizability in cartesian axis
13.6414712046877 0.000000000000000E+000
-1.135291893468965E-015 13.6414712046858
Out-of-plane polarizability in cartesian axis 0.766020624178405
Importantly, the code creates two files band.eig and phband.freq which contains the Wannierized electronic bandstructure and phonon bandstructure along the user-defined high-symmetry path.
To extract easily the data to plot, you can run the plotband.x program from the Quantum ESPRESSO package and enter the input file (band.eig or phband.freq), the energy range (for example, -1 20), the output file with the data to plot (band.dat or freq.dat). The other inputs are not relevant and simply push the ENTER key when asked:
$QE/plotband.x
Input file > band.eig
Reading 10 bands at 315 k-points
Range: -6.8949 -1.0603eV Emin, Emax, [firstk, lastk] > -7 -2
high-symmetry point: 0.0000 0.0000 0.0000 x coordinate 0.0000
high-symmetry point: 0.5000 0.2887 0.0000 x coordinate 0.5774
high-symmetry point: 0.3333 0.5774 0.0000 x coordinate 0.9107
high-symmetry point: 0.0000 0.0000 0.0000 x coordinate 1.5773
output file (gnuplot/xmgr) > band.dat
bands in gnuplot/xmgr format written to file band.dat
output file (ps) >
stopping ...
$QE/plotband.x
Input file > phband.freq
Reading 9 bands at 315 k-points
Range: -0.2012 56.9710eV Emin, Emax, [firstk, lastk] > 0 60
high-symmetry point: 0.0000 0.0000 0.0000 x coordinate 0.0000
high-symmetry point: 0.5000 0.2887 0.0000 x coordinate 0.5774
high-symmetry point: 0.3333 0.5774 0.0000 x coordinate 0.9107
high-symmetry point: 0.0000 0.0000 0.0000 x coordinate 1.5773
output file (gnuplot/xmgr) > freq.dat
bands in gnuplot/xmgr format written to file freq.dat
output file (ps) >
stopping ...
You can then visualize your bandstructure with gnuplot for example:
gnuplot
gnuplot> set terminal x11 enhanced
gnuplot> set encoding utf8
gnuplot> set ylabel "Energy (Ry)"
gnuplot> set xtics ("{/Symbol G}" 0, "M" 0.5774, "K" 0.9157, "{/Symbol G}" 1.5773)
gnuplot> set arrow from 0.5774, graph 0 to 0.5774, graph 1 nohead
gnuplot> set arrow from 0.9107, graph 0 to 0.9107, graph 1 nohead
gnuplot> plot "band.dat" u 1:2 w l title "EPW"
We can also compare the phonon bandstructures:
gnuplot
gnuplot> set terminal x11 enhanced
gnuplot> set encoding utf8
gnuplot> set ylabel "{/Symbol w} (meV)"
gnuplot> set xtics ("{/Symbol G}" 0, "M" 0.5774, "K" 0.9157, "{/Symbol G}" 1.5773)
gnuplot> set arrow from 0.5774, graph 0 to 0.5774, graph 1 nohead
gnuplot> set arrow from 0.9107, graph 0 to 0.9107, graph 1 nohead
gnuplot> plot "freq.dat" u 1:2 w l title "EPW"
where you can notice the small imaginary phonon close to \(\Gamma\) due to unconverged results. Interestingly, you can zoom on the LO and TO modes around 45 meV. In 2D they are degenerate at \(\bf{q} = \Gamma\) but with a linear slope discontinuity.
At convergence you should get a phonon dispersion similar to this where DD means dipole-dipole, DQ means dipole-quadrupole and QQ means quadrupole-quadrupole interaction:
Step 5¶
Perform a restart calculation to obtain the electron-phonon matrix element at \(\bf{k}=\Gamma\) and for \(\bf{q}\) along the same high-symmetry path with the following input file:
epw2.in
&inputepw
prefix = 'mos2'
outdir = './'
elph = .true.
epbwrite = .false.
epbread = .false.
epwwrite = .false.
epwread = .true.
etf_mem = 1
lpolar = .true.
vme = 'wannier'
use_ws = .true.
lifc = .false.
nbndsub = 10
bands_skipped = 'exclude_bands = 1-24'
system_2d = 'quadrupole'
wannierize = .false.
num_iter = 5000
iprint = 2
dis_win_max = -0.8
dis_win_min = -6.8
dis_froz_max= -3.6
proj(1) = 'Mo:d'
wdata(1) = 'bands_plot = .true.'
wdata(2) = 'begin kpoint_path'
wdata(3) = 'G 0.00 0.00 0.00 M 0.50 0.00 0.00'
wdata(4) = 'M 0.50 0.00 0.00 K 0.333333333333 0.333333333333 0.00'
wdata(5) = 'K 0.333333333333 0.333333333333 0.00 G 0.0 0.0 0.00'
wdata(6) = 'end kpoint_path'
wdata(7) = 'bands_plot_format = gnuplot'
wdata(8) = 'dis_num_iter = 5000'
wdata(9) = 'num_print_cycles = 10'
wdata(10) = 'dis_mix_ratio = 1.0'
wdata(11) = 'conv_tol = 1E-12'
wdata(12) = 'conv_window = 4'
fsthick = 20 ! eV
nstemp = 1
temps = 300
degaussw = 0.01 ! eV
dvscf_dir = './save'
prtgkk = .true.
nkf1 = 1
nkf2 = 1
nkf3 = 1
filqf = './GMKG.txt'
nk1 = 6
nk2 = 6
nk3 = 1
nq1 = 6
nq2 = 6
nq3 = 1
/
Run the EPW calculation with
$RUN_EPW < epw2.in > epw2.out
Step 6¶
Perform a restart calculation to obtain the electron drift and Hall mobility on an interpolated 60\(\times\)60\(\times\)1 fine \(\bf{k}\)-point and \(\bf{q}\)-point grids.
We suggest working in a different directory for each restart calculations to avoid potential data conflict. For this, you can move in the restart folder and perform a soft link of all the required file for a restart:
cd restart
ln -s ../crystal.fmt ../epwdata.fmt ../mos2.bvec ../mos2.chk ../mos2.kgmap ../mos2.mmn ../mos2.nnkp ../mos2.ukk ../mos2.epmatwp ../vmedata.fmt ../save ../quadrupole.fmt ../dmedata.fmt .
then run the calculation with:
$RUN_EPW < epw3.in > epw3.out
epw3.in
&inputepw
prefix = 'mos2'
outdir = './'
elph = .true.
epbwrite = .false.
epbread = .false.
epwwrite = .false.
epwread = .true.
etf_mem = 3
mp_mesh_k = .true.
lpolar = .true.
vme = 'wannier'
use_ws = .true.
lifc = .false.
nbndsub = 10
bands_skipped = 'exclude_bands = 1-24'
system_2d = 'quadrupole'
scattering = .true.
scattering_serta = .true.
int_mob = .false.
carrier = .true.
ncarrier = 1E10
iterative_bte = .true.
epmatkqread = .false.
mob_maxiter = 100
broyden_beta= 1.0
bfieldx = 0.0d0
bfieldy = 0.0d0
bfieldz = 1.0d-10
nstemp = 2
temps = 300 500
restart = .true.
selecqread = .false.
wannierize = .false.
num_iter = 5000
iprint = 2
dis_win_max = -0.8
dis_win_min = -6.8
dis_froz_max= -3.6
proj(1) = 'Mo:d'
wdata(1) = 'bands_plot = .true.'
wdata(2) = 'begin kpoint_path'
wdata(3) = 'G 0.00 0.00 0.00 M 0.50 0.00 0.00'
wdata(4) = 'M 0.50 0.00 0.00 K 0.333333333333 0.333333333333 0.00'
wdata(5) = 'K 0.333333333333 0.333333333333 0.00 G 0.0 0.0 0.00'
wdata(6) = 'end kpoint_path'
wdata(7) = 'bands_plot_format = gnuplot'
wdata(8) = 'dis_num_iter = 5000'
wdata(9) = 'num_print_cycles = 10'
wdata(10) = 'dis_mix_ratio = 1.0'
wdata(11) = 'conv_tol = 1E-12'
wdata(12) = 'conv_window = 4'
degaussw = 0.01
dvscf_dir = './save'
fsthick = 0.4 ! eV
efermi_read = .true
fermi_energy = -4.391448 ! CBM = -4.291448
nkf1 = 60
nkf2 = 60
nkf3 = 1
nqf1 = 60
nqf2 = 60
nqf3 = 1
nk1 = 6
nk2 = 6
nk3 = 1
nq1 = 6
nq2 = 6
nq3 = 1
/
= 3 is an important input to reduce computational cost by considering momentum within the thickness window.= 1E10 indicates the electron mobility calculation with a concentration of 1E10 cm\(^{-2}\).= 0.01 means we are using gaussian smearing.Valence band maximum = -5.893225 eV
Conduction band minimum = -4.291448 eV
At the end, you should obtain a 134 cm\(^2\)/Vs room temperature SERTA and 129 cm\(^2\)/Vs IBTE drift mobility. The associated Hall factor is also reported.
Step 7¶
Perform a restart calculation to obtain the hole drift and Hall mobility on an interpolated 60\(\times\)60\(\times\)1 fine \(\bf{k}\)-point and \(\bf{q}\)-point grids. Run the calculation as follows
$ rm restart_0.fmt
$RUN_EPW < epw4.in > epw4.out
The input file is as follow (we show only the difference wrt epw3.in):
epw4.in
&inputepw
ncarrier = -1E10
fermi_energy = -5.793225 ! VBM = -5.893225
/
where here you should obtain a room temperature hole drift SERTA and IBTE mobility of 33 cm\(^2\)/Vs and 35 cm\(^2\)/Vs, respectively. However here the Hall factor is quite big.
At convergence you should get a temperature dependent Hall mobility and Hall factor similar to this:
Exercise 3: Electrical resistivity in magnetic and non-magnetic metals¶
In this example we are going to calculate the electrical resistivity of bcc Fe using the BTE. Fe is a ferromagnetic metal and we will consider 2 cases. A non-magnetic calculation and a collinear magnetic calculation. In the non magnetic case the conductivity is obtained with Eq. (99) in the section Carrier transport from the Theory page
Go in the third exercise folder:
cd exercise3
You will find two folders. One for the non-magnetic calculation, and another one for the ferromagnetic case. Lets start with the non magnetic case:
cd NM
and get the Fe pseudopotential file from the Pseudo Dojo repository:
wget https://www.pseudo-dojo.org/pseudos/nc-sr-04_pw_standard/Fe.upf.gz && gunzip Fe.upf.gz
Step 1¶
Make a self-consistent calculation for Fe and a phonon calculation on a homogeneous 3x3x3 \(\bf{q}\)-point grid.
Note: The ecutwfc and \(\mathbf{k}\)-mesh grid needs to be larger for converged calculations.
$RUN_PW < scf.in > scf.out
$RUN_PH < ph.in > ph.out
scf.in
&CONTROL
outdir='./'
calculation='scf',
restart_mode='from_scratch',
prefix='fe',
pseudo_dir = './'
/
&SYSTEM
ibrav=3,
celldm(1)=5.0929838463,
nat=1,
ntyp=1,
nspin = 2,
starting_magnetization(1)=2,
ecutwfc=60.0,
occupations='smearing',
smearing='mv',
degauss=0.025,
/
&ELECTRONS
mixing_beta=0.7,
conv_thr=1d-8,
/
ATOMIC_SPECIES
Fe 55.8457 Fe.upf
ATOMIC_POSITIONS (alat)
Fe 0 0 0
K_POINTS automatic
8 8 8 0 0 0
ph.in
&inputph
tr2_ph=1.0d-16,
prefix='fe',
amass(1)=55.8457,
outdir='./',
fildyn='fe.dyn.xml',
fildvscf='dvscf'
ldisp=.true.,
nq1 = 3,
nq2 = 3,
nq3 = 3
/
fildvscf as it will tell the code to write to file the change of potential due to ionic displacement \(\partial_{\mathbf{q}\nu}V^\mathrm{scf}\). The ldisp input allows to calculate phonons for a grid of \(\mathbf{q}\)-points specified by nq1, nq2, and nq3.tr2_ph variable is the threshold on the perturbed wavefunction obtained by solving the Sternheimer equation and should be very small.XXX.xml at the end of the fildyn as it will force the code to write the output in XML format.Dynamical matrices for ( 3, 3, 3) uniform grid of q-points
( 4 q-points):
N xq(1) xq(2) xq(3)
1 0.000000000 0.000000000 0.000000000
2 0.000000000 -0.333333333 0.333333333
3 -0.333333333 0.666666667 -0.333333333
4 0.000000000 0.000000000 0.666666667
fe.dynX.xml file containing the dynamical matrix has been produced. The pb.dvscf files are located inside the _ph0 folder.Step 2¶
Gather the .dynX.xml, .dvscf and patterns files into a new save/ directory. This can easily be done using the pp.py python script.
python3 $QE/../EPW/bin/pp.py
prefix of your calculation (here “fe”).Enter the prefix used for PH calculations (e.g. diam)
fe
Step 3¶
Do a non self-consistent calculation on a homogeneous 3\(\times\)3\(\times\)3 uniform and \(\Gamma\)-centered grid in the interval [0,1) in crystal coordinates.
$RUN_PW < nscf.in -nk 8 1> nscf.out
nscf.in
&CONTROL
outdir='./'
calculation='bands',
prefix='fe',
pseudo_dir = './'
/
&SYSTEM
ibrav=3,
celldm(1)=5.0929838463,
nat=1,
ntyp=1,
ecutwfc=60.0,
occupations='smearing',
smearing='mv',
degauss=0.025,
/
&ELECTRONS
mixing_beta=0.7,
conv_thr=1d-8,
/
ATOMIC_SPECIES
Fe 55.8457 Fe.upf
ATOMIC_POSITIONS (alat)
Fe 0 0 0
K_POINTS crystal
27
0.00000000 0.00000000 0.00000000 3.703704e-02
0.00000000 0.00000000 0.33333333 3.703704e-02
0.00000000 0.00000000 0.66666667 3.703704e-02
0.00000000 0.33333333 0.00000000 3.703704e-02
...
Note : The \(\mathbf{k}\)-point grid from nscf.in and the \(\mathbf{q}\)-point grid from ph.in have to be commensurate with each other. The \(\mathbf{k}\)-point grid in scf.in can be arbitrary.
$RUN_PW < nscf.in > nscf.out
Step 4¶
Prepare the EPW input file. Here we will interpolate the matrix elements from a coarse 3\(\times\)3\(\times\)3 to a dense 30\(\times\)30\(\times\)30 \(\mathbf{k}\)-point and \(\mathbf{q}\)-point grids. Then we compute the conductivity of non magnetic Fe using the BTE.
$RUN_EPW < epw1.in > epw1.out
epw1.in
&inputepw
prefix = 'fe',
amass(1) = 55.8457
dvscf_dir = 'save'
etf_mem = 1
elph = .true.
epwwrite = .true.
epwread = .false.
wannierize = .true.
bands_skipped = 'exclude_bands = 1-4'
nbndsub = 9
num_iter = 800
dis_win_max = 65
dis_froz_max= 35
proj(1) = 'Fe:sp3d2'
proj(2) = 'Fe:dxz,dyz,dxy'
use_ws = .false.
wdata(1) = 'bands_plot = .true.'
wdata(2) = 'begin kpoint_path'
wdata(3) = 'G 0.000 0.000 0.000 H 0.500 -0.500 -0.500'
wdata(4) = 'H 0.500 -0.500 -0.500 P 0.750 0.250 -0.250'
wdata(5) = 'P 0.750 0.250 -0.250 G 0.000 0.000 0.000'
wdata(6) = 'G 0.000 0.000 0.000 N 0.000 0.000 -0.500'
wdata(7) = 'end kpoint_path'
wdata(9) = 'bands_num_points = 50'
wdata(10) = 'dis_num_iter = 800'
wdata(11) = 'num_print_cycles = 10'
wdata(12) = 'conv_tol = 1E-12'
wdata(13) = 'conv_window = 4'
wdata(14) = 'bands_plot_format = gnuplot'
fsthick = 0.3
degaussw = 0.005
assume_metal = .true.
ngaussw = -99
int_mob = .false.
iterative_bte = .true.
scattering = .true.
carrier = .false.
mp_mesh_k = .true.
epmatkqread = .false
mob_maxiter = 200
restart_step = 100
selecqread = .false.
nstemp = 2
temps = 200 300
nkf1 = 30
nkf2 = 30
nkf3 = 30
nqf1 = 30
nqf2 = 30
nqf3 = 30
nq1 = 3
nq2 = 3
nq3 = 3
nk1 = 3
nk2 = 3
nk3 = 3
/
= .true. and carrier = .false.= .true. and epwread = .true. with bands_plot = .true. to verify the band interpolation and prtgkk = .true. for the matrix element interpolation. Then we would do a restart calculation with epwwrite = .false. and epwread = .true. and all the BTE related input flags.= XXX. If degaussw = 0.0 we use adaptative smearing, we recommend to use a fixed but small smearing.Step 5¶
Extract the conductivity values for different temperatures and try to make a plot. Increase the temperature to get more data points.
We can verify this with q2r.x and matdyn.x
$RUN_Q2R < q2r.in > q2r.out
$RUN_MATDYN < matdyn.in > matdyn.out
q2r.in
&input
fildyn='fe.dyn.xml',
zasr='crystal',
flfrc='fe.fc',
/
matdyn.in
&input
asr='crystal',
amass(1)=55.845,
flfrc='fe.fc.xml',
flfrq='fe.freq',
flvec='fe.modes'
q_in_band_form = .true.
q_in_cryst_coord = .false.
/
5
0.000000 0.000000 0.000000 50 ! G
0.000000 1.000000 0.000000 50 ! H
0.500000 0.500000 0.500000 50 ! P
0.000000 0.000000 0.000000 50 ! G
0.500000 0.500000 0.000000 50 ! N
Step 6¶
We now repeat the procedure but in this case using the ferromagnetic calculation at collinear level.
cd ../FM
copy the pseudopotential file used in the non magnetic calculation to this folder
cp ../NM/Fe.upf .
Make a self-consistent calculation for ferromagnetic Fe and a phonon calculation on a homogeneous 3x3x3 \(\bf{q}\)-point grid.
scf.in
&CONTROL
outdir='./'
calculation='scf',
prefix='fe',
pseudo_dir = './'
/
&SYSTEM
ibrav=3,
celldm(1)=5.201879033248,
nat=1,
ntyp=1,
nspin = 2,
starting_magnetization(1)=2.0,
ecutwfc=60.0,
occupations='smearing',
smearing='mv',
degauss=0.025,
/
&ELECTRONS
mixing_beta=0.7,
conv_thr=1d-8,
/
ATOMIC_SPECIES
Fe 55.8457 Fe.upf
ATOMIC_POSITIONS (alat)
Fe 0 0 0
K_POINTS automatic
8 8 8 0 0 0
ph.in
&inputph
tr2_ph=1.0d-16,
prefix='fe',
amass(1)=55.8457,
outdir='./',
fildyn='fe.dyn.xml',
fildvscf='dvscf'
ldisp=.true.,
nq1 = 3,
nq2 = 3,
nq3 = 3
/
Note
For collinear magnetism we need the input flags
nspin = 2andstarting_magnetization(1) = XX.Xto non zero value to set the magnetization of a given atomic species in thescf.in. In the case of insulators we would also need to providetot_magnetization = XX.Xto fix the total magnetization (see PW input documentation).The
scf.inhas different cell parametercelldm(1)=5.201879than those in the non magnetic case. Each magnetic configuration needs its own cell parameters. In practice, one needs to relax for each magnetic order.
fe.dynX.xml file containing the dynamical matrix has been produced. The fe.dvscf files are located inside the _ph0 folder.Step 7¶
Gather the .dynX.xml, .dvscf and patterns files into a new save directory. This can easily be done using the pp.py python script.
python3 $QE/../EPW/bin/pp.py
We can now verify that the phonons are stable in the ferromagnetic case, the q2r.in and matdyn.in inputs are the same as in the non magnetic case
$RUN_Q2R < q2r.in > q2r.out
$RUN_MATDYN < matdyn.in > matdyn.out
Step 8¶
Make a non self-consistent calculation
$RUN_PW < nscf.in > nscf.out
nscf.in
&CONTROL
outdir='./'
calculation='bands',
prefix='fe',
pseudo_dir = './'
/
&SYSTEM
ibrav=3,
celldm(1)=5.201879033248,
nat=1,
ntyp=1,
nspin = 2,
starting_magnetization(1)=2,
ecutwfc=60.0,
occupations='smearing',
smearing='mv',
degauss=0.025,
/
&ELECTRONS
mixing_beta=0.7,
conv_thr=1d-8,
/
ATOMIC_SPECIES
Fe 55.8457 Fe.upf
ATOMIC_POSITIONS (alat)
Fe 0 0 0
K_POINTS crystal
27
0.00000000 0.00000000 0.00000000 3.703704e-02
0.00000000 0.00000000 0.33333333 3.703704e-02
0.00000000 0.00000000 0.66666667 3.703704e-02
0.00000000 0.33333333 0.00000000 3.703704e-02
...
Step 8¶
Create two separate folders: one for spin up and another one for spin down. We need to link the fe.save and the save folders inside here
mkdir up dn
ln -s ../fe.save ../save up
ln -s ../fe.save ../save dn
EPW requires to first perform the unfolding and wannierizing procedure of the two spin channels first without interpolating. Then one can compute any interpolated property.Copy the epw1_lsda.in input file to each of the two folders.
cp epw1_lsda.in up
cp epw1_lsda.in dn
epw1_lsda.in
&inputepw
prefix = 'fe',
amass(1) = 55.8457
dvscf_dir = 'save'
etf_mem = 1
elph = .true.
epwwrite = .true.
epwread = .false.
interpolate = .false.
lsda = 'up' ! 'up' or 'down' depending on each spin channel
wannierize = .true.
bands_skipped = 'exclude_bands = 1-4'
nbndsub = 9
num_iter = 500
dis_win_max = 60
dis_froz_max= 30
proj(1) = 'Fe:sp3d2'
proj(2) = 'Fe:dxz,dyz,dxy'
use_ws = .false.
wdata(1) = 'bands_plot = .true.'
wdata(2) = 'begin kpoint_path'
wdata(3) = 'G 0.000 0.000 0.000 H 0.500 -0.500 -0.500'
wdata(4) = 'H 0.500 -0.500 -0.500 P 0.750 0.250 -0.250'
wdata(5) = 'P 0.750 0.250 -0.250 G 0.000 0.000 0.000'
wdata(6) = 'G 0.000 0.000 0.000 N 0.000 0.000 -0.500'
wdata(7) = 'end kpoint_path'
wdata(9) = 'bands_num_points = 50'
wdata(10) = 'dis_num_iter = 800'
wdata(11) = 'num_print_cycles = 10'
wdata(12) = 'conv_tol = 1E-12'
wdata(13) = 'conv_window = 4'
wdata(14) = 'bands_plot_format = gnuplot'
nkf1 = 1
nkf2 = 1
nkf3 = 1
nqf1 = 1
nqf2 = 1
nqf3 = 1
nq1 = 3
nq2 = 3
nq3 = 3
nk1 = 3
nk2 = 3
nk3 = 3
/
Step 9¶
Edit the input files setting the input flag lsda = ’up’ or lsda = ’down’ to set the spin channel.
Notes:
In
EPWwe activate the LSDA module by providing the input flag lsda= ’up’or lsda= ’down’. The default is non magnetic lsda= ’none’In the LSDA workflow, we need first to unfold the two spin channels before interpolating. This is controlled with the input flag interpolate
= .false.. The default is interpolate= .true.The input flag interpolate is not exclusive to the LSDA module. It can be used in non magnetic case to just wannierize and made the unfolding procedure. This is useful if one just needs
EPWto interface with other codes.In the unfolding procedure we set epwwrite
= .true.and epwread= .false.The LSDA module is currently tested with both LDA and GGA type of density functionals.
Step 10¶
Run EPW and unfold both spin channels.
cd up
$RUN_EPW < epw1_lsda.in > epw1.out
cd ../dn
$RUN_EPW < epw1_lsda.in > epw1.out
This calculation should have generated several .fmt files and the .epmatwp files. In the case of lsda = ’down’ you would notice that the files contain the string .down in their name, i.e.XXX.down.XXX.
Action: Link the .fmt files that contain the name crystal, epwdata or wigner of the opposite spin channel.
ln -s ../dn/crystal.down.fmt ../dn/epwdata.down.fmt ../dn/wigner.down.fmt up
ln -s ../up/crystal.fmt ../up/epwdata.fmt ../up/wigner.fmt dn
EPW and interpolate the quantity that we are interested in. In this tutorial we are interested in the resistivity of ferromagnetic Fe. In particular, EPW computes the spin resolved conductivity as defined in Eq. (107) in Spin resolved transport of the Theory pageStep 11¶
Copy the epw2_lsda.in input file to each folder up or dn and modify the lsda input flag accordingly lsda = ’up’ or lsda = ’down’.
cp epw2_lsda.in up
cp epw2_lsda.in dn
Step 12¶
Run EPW to compute the spin resolved conductivity with the BTE for each spin channel.
cd up
$RUN_EPW < epw2_lsda.in > epw2.out
cd ../dn
$RUN_EPW < epw2_lsda.in > epw2.out
epw2_lsda.in
&inputepw
prefix = 'fe',
amass(1) = 55.8457
dvscf_dir = 'save'
etf_mem = 1
elph = .true.
epwwrite = .false.
epwread = .true.
wannierize = .false.
bands_skipped = 'exclude_bands = 1-4'
nbndsub = 9
use_ws = .false.
fsthick = 0.3
degaussw = 0.005
assume_metal = .true.
ngaussw = -99
int_mob = .false.
iterative_bte = .true.
scattering = .true.
carrier = .false.
mp_mesh_k = .true.
epmatkqread = .false
mob_maxiter = 200
restart_step = 100
selecqread = .false.
nstemp = 9
temps = 100 500
nkf1 = 30
nkf2 = 30
nkf3 = 30
nqf1 = 30
nqf2 = 30
nqf3 = 30
nq1 = 3
nq2 = 3
nq3 = 3
nk1 = 3
nk2 = 3
nk3 = 3
/
fe.epmatwp or fe.down.epmatwp files.scf.in.= .true. input parameter, if you want to do a clean restart, you need to remove the restart file by doing rm restart_0.fmt or rm restart.down_0.fmt.Extract the SERTA and BTE conductivity as a function of temperature from the output file. You should obtain something like:
Use Eq. (109) to compute the total conductivity and invert it to obtain the resistivity, at convergence you should get:
You can try changing the pseudo from LDA to GGA and see the effect on the resistivity. Check the difference between SERTA and BTE. Usually in metals is not very pronouced
Notes:
In magnetic systems apart from electron-phonon scattering we would also have electron-magnon scattering which we neglect here, see Phys. Rev. B 114, 074411 (2026). Hence we generally underestimate the resistivity
Using the LSDA module for mobility instead of resistivity is also possible using the same workflow and modifying the inputs accordingly. In the case of the mobility it is advised to provide an extra input gap_energy such that \(\varepsilon_\mathrm{VBM} <\)
gap_energy\(< \varepsilon_\mathrm{CBM}\) in the case of wannierizing both part of the valence and conduction band manifoldsFor semiconductors
EPWcomputes the spin resolved mobility as defined in Eq. (108) of the Spin resolved transport in the Theory page. In practice one can use different values for ncarrier for each spin channel but extract from the output the effective \(\frac{n^\sigma_c}{n_c}\) ratio and use Eq. (110) of the Spin resolved transport in the Theory page to compute the total mobility.Not all
EPWmodules are compatible with LSDA yet.Compatible modules with LSDA beyond transport are spectral functions using the flags a2f
= .true., phonselfen= .true.and elecselfen= .true.which can be used to calculate spin resolved \(\Pi^\sigma_{\mathbf{q}\nu}\), \(\lambda^\sigma_{\mathbf{q}\nu}\), \(\alpha^2F^\sigma(\omega)\) and \(\Sigma^\sigma_{n\mathbf{k}}\). The LSDA module is compatible with 2D systems as well. In this case it might be useful to set use_ws= .true.specially for insulators.