Part 2: Electron-phonon interactions from statistical sampling¶
By the end of this tutorial, you will be able to:
- Create structures, including special configurations, via the one-shot method.
- Interpret the effects of electron-phonon interactions on the bandgap.
4.1 Task¶
An electron-phonon calculation via the one-shot method is set up and calculated for diamond.
An observable $O(T)$ at a given temperature $T$ can be calculated as the statistical average of the observable sampled at different coordinate sets $x_{T}^{\textrm{MC},i}$ with sample size $n$. In a full Monte-Carlo (MC) sampling of each set $i$ is obtained from the equilibrium atomic positions $x_{\textrm{eq}}$ as
$$\tag{4.1} x_{T}^{\textrm{MC,i}} = x_{\textrm{eq}} + \Delta \tau^{\textrm{MC,i}} $$
with the displacement $\Delta \tau$ determined by the Cartesian coordinates (as well as the atom number), the mass $M_{\kappa}$, phonon eigenmode $\nu$ on atom $\kappa$, phonon eigenfrequency $\omega_{\nu}$, and a normally distributed random variable $\mathcal{N}$, respectively. The phonon eigenmodes and eigenfrequencies are calculated within the harmonic approximation.
However, Monte Carlo requires many calculations to obtain the sets of displacements and so it is computationally expensive. Motivated by the empirical observation that for increasing supercell sizes the number of required structures in the MC method can be decreased, M. Zacharias and F. Giustino proposed a one-shot (OS) method (ZG-configuration) where only a single set of displacements is used [Phys. Rev. B 94 (2016) 075125]:
$$\tag{4.2} \Delta \tau^{\textrm{OS}} = \sqrt{\frac{1}{M_{\kappa}}} \sum\limits_{\nu}^{3(N-1)} (-1)^{\nu-1} \varepsilon_{\kappa,\nu} \sigma_{\nu,T}, $$
where the summation over the eigenmodes runs in an ascending order with respect to the values of the eigenfrequencies, $T$ is temperature, $\varepsilon_{\kappa,\nu}$ is the unit vector of eigenmode $\nu$ on atom $\kappa$, and the magnitude of each displacement $\sigma$ is given by
$$\tag{4.3} \sigma_{\nu,T} = \sqrt{(2 n_{\nu,T}+1) \frac{\hbar}{2 \omega_{\nu}}} $$
and $$\tag{4.4} n_{\nu,T}=[\mathrm{exp}(\hbar \omega_{\nu} /k_{B}T)-1]^{-1} $$ denotes the Bose-Einstein occupation number. Using the one-shot method the Monte-Carlo sum for the observable $\langle O(T)\rangle$ is reduced to a single calculation [New J. Phys. 20 (2018) 123008].
For a given supercell, the dynamical matrix is calculated and its eigenvectors are used to calculate a POSCAR where the positions of the atoms are displaced according to the one-shot method) [New J. Phys. 20 (2018) 123008]. Then, a standard ground-state DFT calculation is carried out for the original and the new "one-shot" structure. The one-shot structure contains electron-phonon effects in the harmonic approximation. To visualize the effect of the electron-phonon couplings, symmetry-breaking of the eigenstates is examined.
4.2 Input¶
Diamond
1.00000000000000
0.00000000 3.56698600 3.56698600
3.56698600 0.00000000 3.56698600
3.56698600 3.56698600 0.00000000
C
16
Direct
0.00000000 0.00000000 0.00000000
0.50000000 0.00000000 0.00000000
0.00000000 0.50000000 0.00000000
0.50000000 0.50000000 0.00000000
0.00000000 0.00000000 0.50000000
0.50000000 0.00000000 0.50000000
0.00000000 0.50000000 0.50000000
0.50000000 0.50000000 0.50000000
0.37500000 0.37500000 0.37500000
0.87500000 0.37500000 0.37500000
0.37500000 0.87500000 0.37500000
0.87500000 0.87500000 0.37500000
0.37500000 0.37500000 0.87500000
0.87500000 0.37500000 0.87500000
0.37500000 0.87500000 0.87500000
0.87500000 0.87500000 0.87500000
INCAR for the PBE ground-state calculations (INCAR.dft).
System = diamond
ALGO = Normal
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
NCORE = 2
INCAR to obtain the one-shot configuration (INCAR.os_disp).
System = diamond
ALGO = FAST
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
IBRION = 6
PHON_LMC = .TRUE.
PHON_NSTRUCT = 0
PHON_NTLIST = 1
PHON_TLIST = 0.0
PHON_NWRITE = -2
PHON_DOS = 1
To obtain eigenvectors of the dynamical matrix IBRION=6 needs to be set. PHON_LMC=.TRUE. enables the one-shot and Monte-Carlo calculations. PHON_NSTRUCT>0 sets the number of structures in the Monte-Carlo calculations. For PHON_NSTRUCT=0 then the code switches to one-shot calculations. The POSCARs obtained from the one-shot method can be obtained at different temperatures at the same time (the dynamical matrix needs to be calculated only once). The number of temperatures that are considered is set by PHON_NTLIST. The list of temperatures corresponding to this number is given by PHON_TLIST. PHON_NWRITE and PHON_DOS are used to plot the phonon density of states.
auto k-points
0
g
1 1 1
0 0 0
Pseudopotentials of C.
auto k-points
0
g
2 2 2
0 0 0
The QPOINTS file is only required within the calculation of the phonon density of states and not necessary for electron-phonon calculations using the one-shot method or stochastic sampling.
4.3 Calculation¶
Open a terminal, navigate to this example's directory and run VASP by entering the following:
cd $TUTORIALS/electron-phonon/e04_*
cp POSCAR.2x2x2 POSCAR
cp INCAR.os_disp INCAR
mpirun -np 4 vasp_gam
This calculation creates the POSCAR file including displacements according to the one-shot method at 0 K, POSCAR.T=0.. By inspecting the new POSCAR, one can see that only the positions are moved. The phonon density of states is also calculated within the same calculation. To visualize the phonon density of states, please execute the following:
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e04_SIMPLE_ONE-SHOT_C" )
mycalc.phonon.dos.plot()
Why are the peaks in the density of states plot important for the one-shot method?
Expand for answer here!
The peaks show the eigenenergies of the corresponding eigenmodes $\varepsilon_{\kappa,\nu}$ which are used in the calculation of the displacements
$$
\Delta \tau^{\textrm{OS}} = \sqrt{\frac{1}{M_{\kappa}}} \sum\limits_{\nu}^{3(N-1)} (-1)^{\nu-1} \varepsilon_{\kappa,\nu} \sigma_{\nu,T},
$$
within the one-shot method.
Next, the effect of electron-phonon interactions on the electronic eigenvalues is investigated. For that, perform a standard DFT calculation on the pristine cell first:
cp INCAR.dft INCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.2x2x2
Similarly, perform a standard DFT calculation on the dislocated cell from the one-shot method:
cp POSCAR.T\=0. POSCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.2x2x2_T0
To look at the eigenstates of the pristine cell in the OUTCAR.2x2x2 file, search for the following entries:
k-point 1 : 0.0000 0.0000 0.0000
band No. band energies occupation
1 -11.5168 2.00000
2 -5.6943 2.00000
3 -5.6943 2.00000
... ... ...
... ... ...
30 10.1362 2.00000
31 10.1362 2.00000
32 10.1362 2.00000
33 14.6771 0.00000
34 14.6771 0.00000
35 14.6771 0.00000
36 14.6772 0.00000
37 14.6772 0.00000
38 14.6772 0.00000
We see that at the bandgap (where the occupation changes from 2.0 to 0.0), the eigenenergies show strong degeneracies due to the symmetry of the structure. The bandgap is around 4.54 eV.
The eigenstates of the one-shot configuration (OUTCAR.2x2x2_T0) look like the following, with the occupation numbers defined using the Bose-Einstein distribution, cf. Eq. (4.4). Note that your calculated band energies will be slightly different from the ones written here.
k-point 1 : 0.0000 0.0000 0.0000
band No. band energies occupation
... ... ...
... ... ...
30 9.7513 2.00000
31 10.3766 2.00000
32 10.5125 2.00000
33 14.0795 0.00000
34 14.1262 0.00000
35 14.3971 0.00000
36 14.5255 0.00000
37 14.7291 0.00000
38 14.9811 0.00000
The previously degenerate states are now all different due to broken symmetry. Also, the bandgap of 3.57 eV is almost 1 eV lower than the bandgap of the pristine cell.
In the literature, the difference between the highest energy valence band and the lowest energy conduction band is often not used to calculate the bandgap [New J. Phys. 20 (2018) 123008]. Instead, to improve comparison with experiment, the difference between the mean band energy of the formerly degenerate valence bands (band No. 30-32) and the conduction bands (band No. 33-38) is calculated. For the sake of simplicity, we have chosen not to calculate this in this exercise.
4.4 Questions¶
- Why does one need to solve the dynamical matrix for the one-shot method?
- What distribution is used to calculate the occupation numbers in the one-shot method?
- What do electron-phonon interactions do to the eigenstates around the bandgap?
- Why did we use the QPOINTS file in the calculations and is it necessary for electron-phonon calculations?
By the end of this tutorial, you will be able to:
- Know how to conduct very simple convergence tests.
- Get a feeling for the importance of sufficiently large supercells for the one-shot and stochastic sampling methods.
5.1 Task¶
Compute the zero-point bandgap renormalization with respect to the supercell size for diamond.
The $\textbf{q}$-mesh of the phonons needs to be large enough to include all phonons in the cell. The one-shot and Monte-Carlo methods for electron-phonons in VASP control the $\textbf{q}$-mesh size by the size of the supercell. One could just start with a large supercell, but the calculation grows rapidly with increasing supercell size. Hence, it is useful to conduct convergence tests and only take the minimally required size of the supercell.
In this example, we perform three supercell calculations, increasing in size from 2x2x2, to 3x3x3, to 4x4x4. The first calculation is there to determine the bandgap for the pristine supercell. The second calculation determines the new POSCAR, including the positions from the one-shot method. In the third calculation, the renormalized bandgap is calculated for this POSCAR. The bandgap renormalization is then calculated between the pristine supercell and the supercell from the one-shot method. These calculations are repeated for increasing cell sizes and the convergence of the bandgap renormalization is monitored.
5.2 Input¶
The input files to run this example are prepared at $TUTORIALS/electron-phonon/e05_C_supercell_convergence.
The starting point for the calculations is the pristine (primitive) cell of diamond. A 2x2x2, 3x3x3 and 4x4x4 supercell of this primitive cell is prepared in this directory and labelled as POSCAR.2x2x2, POSCAR.3x3x3 and POSCAR.4x4x4.
Diamond
1.00000000000000
0.0000000000000000 1.783493 1.783493
1.783493 0.0000000000000000 1.783493
1.783493 1.783493 0.0000000000000000
C
2
Direct
0.0000000000000000 0.0000000000000000 0.0000000000000000
0.7500000000000000 0.7500000000000000 0.7500000000000000
0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
A single k-point is used in the calculations.
Click here to see the POSCAR!
Diamond
1.00000000000000
0.00000000 3.56698600 3.56698600
3.56698600 0.00000000 3.56698600
3.56698600 3.56698600 0.00000000
C
16
Direct
0.00000000 0.00000000 0.00000000
0.50000000 0.00000000 0.00000000
0.00000000 0.50000000 0.00000000
0.50000000 0.50000000 0.00000000
0.00000000 0.00000000 0.50000000
0.50000000 0.00000000 0.50000000
0.00000000 0.50000000 0.50000000
0.50000000 0.50000000 0.50000000
0.37500000 0.37500000 0.37500000
0.87500000 0.37500000 0.37500000
0.37500000 0.87500000 0.37500000
0.87500000 0.87500000 0.37500000
0.37500000 0.37500000 0.87500000
0.87500000 0.37500000 0.87500000
0.37500000 0.87500000 0.87500000
0.87500000 0.87500000 0.87500000
Click here to see the POSCAR!
Diamond
1.00000000000000
0.00000000 5.35047900 5.35047900
5.35047900 0.00000000 5.35047900
5.35047900 5.35047900 0.00000000
C
54
Direct
0.00000000 0.00000000 0.00000000
0.33333333 0.00000000 0.00000000
0.66666667 0.00000000 0.00000000
0.00000000 0.33333333 0.00000000
0.33333333 0.33333333 0.00000000
0.66666667 0.33333333 0.00000000
0.00000000 0.66666667 0.00000000
0.33333333 0.66666667 0.00000000
0.66666667 0.66666667 0.00000000
0.00000000 0.00000000 0.33333333
0.33333333 0.00000000 0.33333333
0.66666667 0.00000000 0.33333333
0.00000000 0.33333333 0.33333333
0.33333333 0.33333333 0.33333333
0.66666667 0.33333333 0.33333333
0.00000000 0.66666667 0.33333333
0.33333333 0.66666667 0.33333333
0.66666667 0.66666667 0.33333333
0.00000000 0.00000000 0.66666667
0.33333333 0.00000000 0.66666667
0.66666667 0.00000000 0.66666667
0.00000000 0.33333333 0.66666667
0.33333333 0.33333333 0.66666667
0.66666667 0.33333333 0.66666667
0.00000000 0.66666667 0.66666667
0.33333333 0.66666667 0.66666667
0.66666667 0.66666667 0.66666667
0.25000000 0.25000000 0.25000000
0.58333333 0.25000000 0.25000000
0.91666667 0.25000000 0.25000000
0.25000000 0.58333333 0.25000000
0.58333333 0.58333333 0.25000000
0.91666667 0.58333333 0.25000000
0.25000000 0.91666667 0.25000000
0.58333333 0.91666667 0.25000000
0.91666667 0.91666667 0.25000000
0.25000000 0.25000000 0.58333333
0.58333333 0.25000000 0.58333333
0.91666667 0.25000000 0.58333333
0.25000000 0.58333333 0.58333333
0.58333333 0.58333333 0.58333333
0.91666667 0.58333333 0.58333333
0.25000000 0.91666667 0.58333333
0.58333333 0.91666667 0.58333333
0.91666667 0.91666667 0.58333333
0.25000000 0.25000000 0.91666667
0.58333333 0.25000000 0.91666667
0.91666667 0.25000000 0.91666667
0.25000000 0.58333333 0.91666667
0.58333333 0.58333333 0.91666667
0.91666667 0.58333333 0.91666667
0.25000000 0.91666667 0.91666667
0.58333333 0.91666667 0.91666667
0.91666667 0.91666667 0.91666667
Click here to see the POSCAR!
Diamond
1.00000000000000
0.00000000 7.13397200 7.13397200
7.13397200 0.00000000 7.13397200
7.13397200 7.13397200 0.00000000
C
128
Direct
0.00000000 0.00000000 0.00000000
0.25000000 0.00000000 0.00000000
0.50000000 0.00000000 0.00000000
0.75000000 0.00000000 0.00000000
0.00000000 0.25000000 0.00000000
0.25000000 0.25000000 0.00000000
0.50000000 0.25000000 0.00000000
0.75000000 0.25000000 0.00000000
0.00000000 0.50000000 0.00000000
0.25000000 0.50000000 0.00000000
0.50000000 0.50000000 0.00000000
0.75000000 0.50000000 0.00000000
0.00000000 0.75000000 0.00000000
0.25000000 0.75000000 0.00000000
0.50000000 0.75000000 0.00000000
0.75000000 0.75000000 0.00000000
0.00000000 0.00000000 0.25000000
0.25000000 0.00000000 0.25000000
0.50000000 0.00000000 0.25000000
0.75000000 0.00000000 0.25000000
0.00000000 0.25000000 0.25000000
0.25000000 0.25000000 0.25000000
0.50000000 0.25000000 0.25000000
0.75000000 0.25000000 0.25000000
0.00000000 0.50000000 0.25000000
0.25000000 0.50000000 0.25000000
0.50000000 0.50000000 0.25000000
0.75000000 0.50000000 0.25000000
0.00000000 0.75000000 0.25000000
0.25000000 0.75000000 0.25000000
0.50000000 0.75000000 0.25000000
0.75000000 0.75000000 0.25000000
0.00000000 0.00000000 0.50000000
0.25000000 0.00000000 0.50000000
0.50000000 0.00000000 0.50000000
0.75000000 0.00000000 0.50000000
0.00000000 0.25000000 0.50000000
0.25000000 0.25000000 0.50000000
0.50000000 0.25000000 0.50000000
0.75000000 0.25000000 0.50000000
0.00000000 0.50000000 0.50000000
0.25000000 0.50000000 0.50000000
0.50000000 0.50000000 0.50000000
0.75000000 0.50000000 0.50000000
0.00000000 0.75000000 0.50000000
0.25000000 0.75000000 0.50000000
0.50000000 0.75000000 0.50000000
0.75000000 0.75000000 0.50000000
0.00000000 0.00000000 0.75000000
0.25000000 0.00000000 0.75000000
0.50000000 0.00000000 0.75000000
0.75000000 0.00000000 0.75000000
0.00000000 0.25000000 0.75000000
0.25000000 0.25000000 0.75000000
0.50000000 0.25000000 0.75000000
0.75000000 0.25000000 0.75000000
0.00000000 0.50000000 0.75000000
0.25000000 0.50000000 0.75000000
0.50000000 0.50000000 0.75000000
0.75000000 0.50000000 0.75000000
0.00000000 0.75000000 0.75000000
0.25000000 0.75000000 0.75000000
0.50000000 0.75000000 0.75000000
0.75000000 0.75000000 0.75000000
0.18750000 0.18750000 0.18750000
0.43750000 0.18750000 0.18750000
0.68750000 0.18750000 0.18750000
0.93750000 0.18750000 0.18750000
0.18750000 0.43750000 0.18750000
0.43750000 0.43750000 0.18750000
0.68750000 0.43750000 0.18750000
0.93750000 0.43750000 0.18750000
0.18750000 0.68750000 0.18750000
0.43750000 0.68750000 0.18750000
0.68750000 0.68750000 0.18750000
0.93750000 0.68750000 0.18750000
0.18750000 0.93750000 0.18750000
0.43750000 0.93750000 0.18750000
0.68750000 0.93750000 0.18750000
0.93750000 0.93750000 0.18750000
0.18750000 0.18750000 0.43750000
0.43750000 0.18750000 0.43750000
0.68750000 0.18750000 0.43750000
0.93750000 0.18750000 0.43750000
0.18750000 0.43750000 0.43750000
0.43750000 0.43750000 0.43750000
0.68750000 0.43750000 0.43750000
0.93750000 0.43750000 0.43750000
0.18750000 0.68750000 0.43750000
0.43750000 0.68750000 0.43750000
0.68750000 0.68750000 0.43750000
0.93750000 0.68750000 0.43750000
0.18750000 0.93750000 0.43750000
0.43750000 0.93750000 0.43750000
0.68750000 0.93750000 0.43750000
0.93750000 0.93750000 0.43750000
0.18750000 0.18750000 0.68750000
0.43750000 0.18750000 0.68750000
0.68750000 0.18750000 0.68750000
0.93750000 0.18750000 0.68750000
0.18750000 0.43750000 0.68750000
0.43750000 0.43750000 0.68750000
0.68750000 0.43750000 0.68750000
0.93750000 0.43750000 0.68750000
0.18750000 0.68750000 0.68750000
0.43750000 0.68750000 0.68750000
0.68750000 0.68750000 0.68750000
0.93750000 0.68750000 0.68750000
0.18750000 0.93750000 0.68750000
0.43750000 0.93750000 0.68750000
0.68750000 0.93750000 0.68750000
0.93750000 0.93750000 0.68750000
0.18750000 0.18750000 0.93750000
0.43750000 0.18750000 0.93750000
0.68750000 0.18750000 0.93750000
0.93750000 0.18750000 0.93750000
0.18750000 0.43750000 0.93750000
0.43750000 0.43750000 0.93750000
0.68750000 0.43750000 0.93750000
0.93750000 0.43750000 0.93750000
0.18750000 0.68750000 0.93750000
0.43750000 0.68750000 0.93750000
0.68750000 0.68750000 0.93750000
0.93750000 0.68750000 0.93750000
0.18750000 0.93750000 0.93750000
0.43750000 0.93750000 0.93750000
0.68750000 0.93750000 0.93750000
0.93750000 0.93750000 0.93750000
POSCAR.2x2x2_T0
Click here to see the POSCAR!
0.
1.00000000000000
0.0000000000000000 3.5669860000000000 3.5669860000000000
3.5669860000000000 0.0000000000000000 3.5669860000000000
3.5669860000000000 3.5669860000000000 0.0000000000000000
C
16
Direct
0.0097732275070181 0.0161694603892942 -0.0184816351008904
0.5002119137956710 -0.0146407809779072 0.0091820552837432
-0.0046480001916160 0.5022434150540100 0.0116157195460382
0.4997400708074718 0.5000893845305159 0.0028671866642492
0.0025400657042687 -0.0073965368838915 0.5000569217453958
0.4992303684572657 -0.0045325730290243 0.5028893507264722
0.0107009762513276 0.5023627382496194 0.4982243849758265
0.4840455317726468 0.5207074657614073 0.5005300413291828
0.3774390890648117 0.3803798364193784 0.3741310271760228
0.8735042063418395 0.3842388186466072 0.3831247873661087
0.3627621544541481 0.8800742974800208 0.3841977110155304
0.8809567719050079 0.8725998561586684 0.3717040614898028
0.3771000770864463 0.3471534416180013 0.8948516819738398
0.8788178563063902 0.3782945793856772 0.8645538850667492
0.3679562827365888 0.8659560619884146 0.8671426928100487
0.8798694080007139 0.8763005352092088 0.8534101279318783
POSCAR.3x3x3_T0
Click here to see the POSCAR!
0.
1.00000000000000
0.0000000000000000 5.3504790000000000 5.3504790000000000
5.3504790000000000 0.0000000000000000 5.3504790000000000
5.3504790000000000 5.3504790000000000 0.0000000000000000
C
54
Direct
0.0051791915204812 -0.0130270069673200 0.0047399377395049
0.3280440497225119 0.0044715550239962 0.0006326958104085
0.6583018460061889 0.0022431579000235 0.0010203523940664
-0.0032961588220416 0.3298636596208809 0.0048620864084296
0.3434664033380129 0.3260767037997478 0.0037924905834732
0.6686175658489905 0.3351467783208888 0.0039760721154686
-0.0152918041669599 0.6706145300523996 -0.0003200784727166
0.3215959326499348 0.6804420872547191 0.0023387425666392
0.6603556500066158 0.6724596024968722 0.0019591293943362
0.0092868123418902 -0.0023199013639796 0.3254421706177412
0.3269916561513621 0.0072117751905972 0.3262134667676932
0.6636691966401794 0.0030693773638060 0.3258265292872912
-0.0066679352219352 0.3329511812287594 0.3320194217865636
0.3387501420516573 0.3290730234578561 0.3331378190203092
0.6618520727919057 0.3329206283776270 0.3324027402093073
0.0043867534331043 0.6599876134237115 0.3409379690353603
0.3373310804884108 0.6642918511149232 0.3343261625991680
0.6657540869790032 0.6661874010399891 0.3379456262296968
-0.0148690505496559 0.0126740271294805 0.6647313594127703
0.3278157862208626 0.0009562113364635 0.6676754871025886
0.6597617933352233 -0.0078529960250777 0.6819045080988166
0.0043961113530513 0.3164550447868354 0.6778688351059939
0.3343268943964051 0.3387909722375625 0.6701046354508106
0.6714950539807726 0.3378950243971403 0.6540180254163932
-0.0000103262161298 0.6654661148731602 0.6611715732153827
0.3322579715288432 0.6685982639091850 0.6701769555990561
0.6843846386047931 0.6707867704809870 0.6520133377168739
0.2594911786746521 0.2537137015673204 0.2389112774086501
0.5915855638790969 0.2522014379498941 0.2397645395628899
0.9123822494212642 0.2480704769629119 0.2491303580791383
0.2633721446002975 0.5779280723090833 0.2430398148748172
0.5785483112420592 0.5827275751204304 0.2538791354988573
0.9140807136001705 0.5756366454706719 0.2615175359817167
0.2430537110569654 0.9281242311828843 0.2403392948435697
0.5815086361415024 0.9200538505175833 0.2431884212745204
0.9293193480437005 0.9109244614421498 0.2496714097204314
0.2511777390033832 0.2525676627533670 0.5925015718070082
0.5845152446435133 0.2490442190535122 0.5810335879707890
0.9184049446817648 0.2507901389509776 0.5877766524622087
0.2497373039210428 0.5835206748286560 0.5894772747703381
0.5864323332461453 0.5888360875679924 0.5861110312184181
0.9221149820718422 0.5683670118198189 0.5935581421319568
0.2562977390179250 0.9226829236972808 0.5796327094080876
0.5978197297175141 0.9221096462705537 0.5678581046587809
0.9219364523158368 0.9170877029888417 0.5802332763714341
0.2501215330001381 0.2438573483178008 0.9196344406771508
0.5792426533450986 0.2499168598824152 0.9203879154041411
0.9159202789127371 0.2495698228631944 0.9164587081370806
0.2509491883830008 0.5822016619432934 0.9114416240135583
0.5718648474748211 0.5842341957016340 0.9224885622894794
0.9096971796752610 0.5814592048638664 0.9198500915199941
0.2470499619193913 0.9132789317089186 0.9175219535872183
0.5809477142606551 0.9118001298171895 0.9238371931367231
0.9145429033367418 0.9238618739865272 0.9098373219796212
POSCAR.4x4x4_T0
Click here to see the POSCAR!
0.
1.00000000000000
0.0000000000000000 7.1339720000000000 7.1339720000000000
7.1339720000000000 0.0000000000000000 7.1339720000000000
7.1339720000000000 7.1339720000000000 0.0000000000000000
C
128
Direct
0.0089233036907088 -0.0089808011950101 -0.0120881857517305
0.2542563748947262 -0.0059493861310627 0.0031684672274274
0.5049939281705179 -0.0009320308342600 0.0085500763994042
0.7538962733198368 -0.0010673665038422 -0.0045778432593858
-0.0099976666331624 0.2524645710674913 0.0017814115445645
0.2539348964823898 0.2505786701545821 -0.0001312624265755
0.5002890811659133 0.2491386603442826 0.0004308419994802
0.7479400942595196 0.2405007233952176 -0.0026330770506263
-0.0101520478665354 0.5105513608987893 -0.0029813184400641
0.2481111522050667 0.5020927386239203 -0.0025900251214983
0.4994289837372900 0.4916937069186850 0.0010349658677333
0.7548263466025531 0.4968190154494886 -0.0049151527262705
0.0005973491415358 0.7499813824108146 0.0046114353962845
0.2516588914340576 0.7484445991922370 -0.0004645439473799
0.4960643722995686 0.7495723245992325 0.0071395137979666
0.7574566484718589 0.7410442335776913 0.0016685758957070
0.0005897298866931 0.0021065884873743 0.2451118420352015
0.2474004425452451 -0.0012149603953715 0.2540695216004372
0.5001867020093153 -0.0009767342041247 0.2461724594197054
0.7490173701642361 0.0045102119698941 0.2443537925393514
0.0034381141770564 0.2448325882656626 0.2514077004385115
0.2402638763376731 0.2493644347711302 0.2629752046201770
0.5079295988092581 0.2395580729149751 0.2479743310871308
0.7507248201257584 0.2507090478597030 0.2498895172850586
-0.0041880258254104 0.5033756501788315 0.2501680169335971
0.2482300333483492 0.5041926377486272 0.2467704328383050
0.4985735719698739 0.4955624925615164 0.2517603640084828
0.7493397976415400 0.4984406624033791 0.2497244982896993
0.0039997124120988 0.7454176820513856 0.2450749598573617
0.2506620639613246 0.7512990116877346 0.2530655583570730
0.5031260439419261 0.7555573773374302 0.2459130456356662
0.7493629540324075 0.7493878520178964 0.2530081092957188
-0.0008707645449930 0.0057142659499367 0.4995690214732560
0.2509372241837129 -0.0045400806882636 0.5049283241719521
0.5043997042626885 0.0062436402771403 0.4943899990120175
0.7516337193902159 0.0018276315679515 0.4973751564433305
0.0097914816374395 0.2472165574110016 0.5028188265463938
0.2598215717551528 0.2452171547155177 0.4992728990362242
0.4991099178743594 0.2446419978402740 0.4975153346090033
0.7557383681539237 0.2500984405092512 0.4978318351062297
0.0002838052690960 0.4963119243195789 0.4990679702736801
0.2471001429075222 0.5045169264718735 0.5020395912887982
0.4989217252307074 0.4980768203795166 0.5017977359485569
0.7565267174986544 0.5005022330962602 0.4985425142555348
-0.0129961861737433 0.7516641960037833 0.5092661215230154
0.2518571055101690 0.7412502942269661 0.5006336604215931
0.5009260283694000 0.7516086084213464 0.4986332338954608
0.7476304105976975 0.7563059028547281 0.4961400848737244
-0.0018008666552700 0.0034201715576720 0.7480307197583587
0.2470464112995234 0.0024324905379243 0.7476285611912499
0.4992920212874942 0.0025491005520565 0.7553478496330639
0.7447514396137989 -0.0006815204862266 0.7475251637614718
-0.0000306097179502 0.2486207878199869 0.7494782557218941
0.2416815675752340 0.2501836137092119 0.7566483535655866
0.4973819901918974 0.2561270323566024 0.7439389970517759
0.7506271230029158 0.2448858072091228 0.7496559882275541
0.0005901632563819 0.4961198130793875 0.7508805127216648
0.2580802123945041 0.4898689193894369 0.7565258642235407
0.4935164374318430 0.5115803429441154 0.7490835625628551
0.7493319072272241 0.4994823189478116 0.7528618110433135
-0.0031253247251858 0.7418839258160728 0.7574037545020847
0.2427803073150871 0.7495013175055382 0.7576104928029577
0.5005631031524900 0.7592987872606709 0.7435750948653934
0.7544917755478256 0.7551167330599581 0.7395830745526629
0.1885455624452419 0.1815290793414949 0.1940003394930495
0.4404534639790245 0.1887065315673394 0.1867735157960146
0.6939732129965329 0.1963611811209620 0.1745552086318547
0.9365561448709243 0.1815720718817007 0.1943318712967364
0.1822448236633585 0.4360749220027585 0.1953240460821565
0.4420826287428232 0.4398325616894213 0.1817754607661111
0.6773675554027192 0.4436076798895969 0.1907669243520301
0.9365736036780038 0.4321668765974305 0.1888032969573642
0.1845286782331451 0.6938468703074411 0.1861523699276037
0.4386276310366207 0.6844429865851636 0.1876448816407245
0.6909941269423605 0.6845700603378605 0.1845728319504844
0.9328366392852008 0.6881514142668359 0.1970939845742381
0.1902093055796304 0.9378599902550989 0.1902646488400390
0.4360620839385358 0.9368085073144145 0.1877631781792679
0.6827132810411936 0.9340586393737794 0.1926633108260006
0.9351629519190724 0.9345673905651544 0.1885721779433871
0.1885749399158245 0.1891867776967978 0.4362631816038605
0.4391784213604978 0.1968092803516070 0.4265016538170613
0.6913557993468696 0.1886521282288503 0.4369487798606840
0.9347138842185192 0.1954978730360832 0.4422986585392782
0.1902003053693502 0.4346321973538929 0.4349082227364918
0.4390875828662619 0.4337635926866180 0.4384704005271707
0.6880589155895079 0.4341313797248017 0.4383244608593471
0.9344919635777114 0.4340425774432345 0.4457535809160619
0.1779010474030443 0.6819846612062898 0.4400603618458679
0.4383446778350505 0.6893488250722651 0.4333407286088803
0.6955562888267615 0.6910485429525812 0.4400129316094245
0.9364413976295304 0.6891990784307380 0.4428055267189752
0.1901826591585116 0.9283736950833101 0.4431234314680239
0.4381332454122973 0.9420524757404961 0.4368860665230512
0.6799787599148314 0.9435883362100254 0.4382881913883615
0.9415404659116072 0.9386809252569889 0.4377651188843102
0.1894221393702280 0.1905374626711252 0.6836490038829850
0.4292621635149272 0.1855829463147688 0.6947771866184880
0.6830799095523474 0.1870701058165644 0.6925571802176541
0.9409345984914126 0.1821684999155332 0.6869741610871656
0.1816990649842447 0.4319424887136837 0.6946995309373996
0.4382717499355981 0.4440910435986135 0.6810000986574141
0.6859940659506858 0.4357988032467458 0.6860912660111343
0.9375070320656286 0.4356678321950610 0.6901018268977755
0.1868873642346583 0.6921111191572186 0.6896307848836021
0.4331413284157306 0.6905343931818814 0.6974677641330632
0.6834659993938307 0.6934503422468229 0.6816956731153347
0.9438120238047294 0.6810516384593465 0.6886355973609669
0.1841469995427224 0.9408571364145167 0.6931589339948335
0.4352001410765307 0.9472226239811106 0.6818885011055125
0.6923009286283491 0.9434568453614305 0.6825144094103880
0.9346768847686682 0.9389765662781188 0.6875837416883435
0.1931155246465623 0.1840278278495075 0.9307258856692139
0.4392946462991653 0.1952638880384817 0.9277073673338124
0.6900029469995153 0.1830714213650011 0.9309819898141148
0.9365695478348970 0.1845382496661274 0.9318700609294338
0.1877275550002322 0.4400871545848588 0.9378392951901560
0.4424121842978867 0.4374740166160819 0.9308904655067558
0.6830339087867249 0.4463020365865134 0.9362832232653390
0.9360794084654579 0.4390546054348028 0.9255982101661174
0.1884513224639557 0.6849933878557340 0.9433453688358964
0.4411514063433420 0.6906058403019191 0.9332259090746351
0.6945173798273193 0.6897066683413491 0.9352579762177107
0.9363029365912636 0.6858751371022351 0.9406116114918726
0.1954807428352480 0.9310676340969739 0.9294266125981594
0.4326751232097614 0.9414722145999377 0.9363538256660688
0.6909559803263576 0.9381891390764924 0.9452842831296830
0.9328815272184346 0.9374806491199106 0.9383193132343434
auto k-points
0
g
1 1 1
0 0 0
INCAR for the PBE ground-state calculations (INCAR.dft).
System = diamond
ALGO = Normal
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
INCAR to obtain the one-shot configuration (INCAR.os_disp).
System = diamond
ALGO = FAST
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
IBRION = 6
PHON_LMC = .TRUE.
PHON_NTLIST = 1
PHON_TLIST = 0.0
PHON_NSTRUCT = 0
Pseudopotentials of C.
gap_vs_supercell_size_ref.dat
2x2x2 -0.287
3x3x3 -0.27407
4x4x4 -0.37323
5x5x5 -0.3262
6x6x6 -0.3232
5.3 Calculation¶
Open a terminal, navigate to this example's directory by entering the following command:
cd $TUTORIALS/electron-phonon/e05_*
and run the following in this directory:
bash ./run_calcs.sh
Click here to reveal the script!
for i in "2x2x2" "3x3x3" "4x4x4"
do
cp POSCAR.${i} POSCAR
cp INCAR.dft INCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.${i}
cp INCAR.os_disp INCAR
mpirun -np 4 vasp_gam
#cp POSCAR.T\=0. POSCAR.${i}_T0
cp POSCAR.${i}_T0 POSCAR
cp INCAR.dft INCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.${i}_T0
done
This script runs all calculations for each supercell (2x2x2, 3x3x3, 4x4x4):
1) Ground-state calculation for pristine supercell (OUTCAR.2x2x2, ...).
2) Calculation to obtain one-shot structure at T=0 (POSCAR.2x2x2_T0, ...).
3) Ground-state calculation for new POSCARS with atoms displaced according to one-shot method (OUTCAR.2x2x2_T0, ...).
Important: When running a calculation, it is critical to converge your input settings. The test should be your property of interest, e.g., bandgap, forces, phonon modes. Usually, the bandgap converges more quickly than the energy. When a derivative is taken, the errors from the derived quantity are magnified. For the first derivative of the energy e.g., the forces, and the second derivative of the energy, e.g., the dynamical matrix, the error will be compounded, as well as any dependent properties, i.e, the phonon modes. In the one-shot method, the old POSCAR.NxNxN is displaced to create a new POSCAR.NxNxN_T0. We use very loose settings to make the calculations very quick, meaning that initial small errors due to the number of cores or the machine used can quickly compound to create small differences in the POSCAR.NxNxN_T0 structure on the order of 10 mÅ. When the zero-point renormalization (ZPR) is calculated, this will therefore be different (~0.05 eV). To obtain a converged ZPR, it is not sufficient to only converge the bandgap using the initial POSCAR.NxNxN, instead. The phonon modes also need to be converged to ensure that POSCAR.NxNxN_T0 does not change. Small differences in POSCAR.NxNxN_T0 make large differences in the ZPR.
A discussion is included at the end of Example 4 on how to bridge the gap between these practice calculations and the literature. We provide an INCAR as an example of ways to improve convergence, i.e., increasing the cutoff ENCUT or the precision PREC, using a better electronic minimization algorithm ALGO, or tightening the global energetic break condition EDIFF. Due to the use of a small $\textbf{k}$-mesh and low energy cutoff, the Pulay stress is large, i.e., the basis set is incomplete, and so the forces are not converged and therefore neither are the phonon modes. Try grepping for the Pulay stress with grep "external pressure" OUTCAR.*.
Click here to reveal the example INCAR!
Note how the energy cutoff ENCUT has been increased, the precision PREC increased, the electronic minimization algorithm ALGO changed from Fast to Normal, and the global energetic break condition EDIFF tightened.
System = diamond
PREC = Accurate
ALGO = Normal
ENCUT = 600
EDIFF = 1E-8
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
IBRION = 6
POTIM = 0.01
PHON_LMC = .TRUE.
PHON_NTLIST = 1
PHON_TLIST = 0.0
PHON_NSTRUCT = 0
During this exercise, you will calculate the difference between the mean band energy of the formerly degenerate valence bands and the conduction bands to calculate the bandgap renormalization. This improves the reproducibility and convergence with experiment.
Before looking at the bandgap renormalization, take a look at how the positions change in the one-shot method with the following script. The original (pristine) 2x2x2 supercell is shown in red and the displaced supercell in cyan:
from ase.io.vasp import read_vasp
from ase.visualize.plot import plot_atoms
import matplotlib.pyplot as plt
# Load pristine and displaced POSCARs
pristine = read_vasp("./e05_C_supercell_convergence/POSCAR.2x2x2")
displaced = read_vasp("./e05_C_supercell_convergence/POSCAR.2x2x2_T0")
fig, ax = plt.subplots()
plot_atoms(pristine, ax, radii=0.4, colors=['#35CABF']*len(pristine))
plot_atoms(displaced, ax, radii=0.4, colors=['#A82C35']*len(displaced))
plt.title("Pristine (cyan) and Displaced (red) 2x2x2 supercells")
plt.show()
To get the bandgap, one can type grep 'fundamental gap' OUTCAR.xxx into the terminal. The bandgap renormalization is calculated as the difference between the bandgap of the displaced structure and the pristine structure. The users can either do this by themselves for each supercell size or type the following:
bash ./evaluate_gap.sh
Click here to reveal the script!
This script takes the average energy of the three degenerate occupied bands and the six degenerate conduction bands, then finds the difference in energy between these two to calculate the bandgap. This is standard in the literature and necessary for converging to experimental values [New J. Phys. 20 (2018) 123008]..
rm -f gap_vs_supercell_size.dat
for i in "2x2x2" "3x3x3" "4x4x4"
do
nions=`grep NIONS OUTCAR.${i} | awk '{print $12}'`
occ_pristine=`grep -A $((nions * 2)) " band energies" OUTCAR.${i} | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_pristine=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.${i} | tail -6 | awk '{sum += $2} END {print sum/NR}'`
occ_oneshot=`grep -A $((nions * 2)) " band energies" OUTCAR.${i}_T0 | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_oneshot=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.${i}_T0 | tail -6 | awk '{sum += $2} END {print sum/NR}'`
gap_pristine=$(awk -v con="$con_pristine" -v occ="$occ_pristine" 'BEGIN {print con - occ}')
gap_oneshot=$(awk -v con="$con_oneshot" -v occ="$occ_oneshot" 'BEGIN {print con - occ}')
gap_diff=`awk -v gpris=$gap_pristine -v gonesh=$gap_oneshot 'BEGIN{print gonesh-gpris}'`
echo $i $gap_diff >> gap_vs_supercell_size.dat
echo $i $gap_diff
done
%%bash
cd e05_*
bash evaluate_gap.sh
cd ..
The output should look something like this:
2x2x2 -0.287
3x3x3 -0.27407
4x4x4 -0.37323
The output is also stored in gap_vs_supercell_size.dat, which you can plot with the following script, which compares to reference data:
import py4vasp
import numpy as np
import plotly.graph_objects as go
# Load data with string column
data = np.genfromtxt("./e05_C_supercell_convergence/gap_vs_supercell_size.dat", dtype=None, encoding=None)
ref_data = np.genfromtxt("./e05_C_supercell_convergence/gap_vs_supercell_size_ref.dat", dtype=None, encoding=None)
# Extract string and numerical data
x_data = [row[0] for row in data]
y_data = [row[1] for row in data]
x_ref = [row[0] for row in ref_data]
y_ref = [row[1] for row in ref_data]
# Create Plotly figure
fig = go.Figure()
fig.add_trace(go.Scatter(
x=x_ref,
y=y_ref,
mode='lines+markers',
name='Ref.',
line=dict(color='#A82C35'),
marker=dict(symbol='x', size=10)
))
fig.add_trace(go.Scatter(
x=x_data,
y=y_data,
mode='lines+markers',
name='Calc.',
line=dict(color='#3E70EA')
))
# Update layout
fig.update_layout(
xaxis_title='Supercell size (NxNxN)',
yaxis_title='ZPR (eV)',
title='ZPR vs supercell size'
)
# Show plot
fig.show()
The bandgap renormalization converges slowly with respect to supercell size and is not necessarily monotonic. Looser settings have been used in this example to make the calculations run quickly. With a higher energy cutoff ENCUT, increased precision PREC, improved electronic minimization algorithm ALGO, and tighter global energetic break condition EDIFF, convergence can be seen for the indirect gap (note that we have investigated the direct gap) in Table 2 for diamond, and for a selection of other compounds in Table 3 [New J. Phys. 20 (2018) 123008].
5.4 Questions¶
- Why is it good to make convergence tests?
- How many calculations are required to get the bandgap renormalization?
By the end of this tutorial, you will be able to:
- Calculate the temperature-dependent bandgap renormalization of a material.
- Fit the temperature-dependence of the bandgap renormalization to a suitable curve.
6.1 Task¶
Compute the temperature dependence of the bandgap in diamond due to electron-phonon interactions from 0 to 700 K.
The electron-phonon impact on the bandgap varies with temperature. We take the 4x4x4 supercell as a starting point. POSCARs including electron-phonon effects at different temperatures from the one-shot method are created in a single calculation. This can be achieved by setting PHON_NTLIST to the number of required structures and by providing the list of temperatures for each structure via PHON_TLIST. For each of the structures, we will carry out a ground-state calculation and obtain the bandgap this way. After that, we plot the temperature dependence of the bandgap and compare it to empirical models [Physica 34 (1967) 14990062-6)].
6.2 Input¶
The input files to run this example are prepared at $TUTORIALS/electron-phonon/e06_C_temperature_dependence.
POSCAR.pristine
Click here to expand!
Diamond
1.00000000000000
0.00000000 7.13397200 7.13397200
7.13397200 0.00000000 7.13397200
7.13397200 7.13397200 0.00000000
C
128
Direct
0.00000000 0.00000000 0.00000000
0.25000000 0.00000000 0.00000000
0.50000000 0.00000000 0.00000000
0.75000000 0.00000000 0.00000000
0.00000000 0.25000000 0.00000000
0.25000000 0.25000000 0.00000000
0.50000000 0.25000000 0.00000000
0.75000000 0.25000000 0.00000000
0.00000000 0.50000000 0.00000000
0.25000000 0.50000000 0.00000000
0.50000000 0.50000000 0.00000000
0.75000000 0.50000000 0.00000000
0.00000000 0.75000000 0.00000000
0.25000000 0.75000000 0.00000000
0.50000000 0.75000000 0.00000000
0.75000000 0.75000000 0.00000000
0.00000000 0.00000000 0.25000000
0.25000000 0.00000000 0.25000000
0.50000000 0.00000000 0.25000000
0.75000000 0.00000000 0.25000000
0.00000000 0.25000000 0.25000000
0.25000000 0.25000000 0.25000000
0.50000000 0.25000000 0.25000000
0.75000000 0.25000000 0.25000000
0.00000000 0.50000000 0.25000000
0.25000000 0.50000000 0.25000000
0.50000000 0.50000000 0.25000000
0.75000000 0.50000000 0.25000000
0.00000000 0.75000000 0.25000000
0.25000000 0.75000000 0.25000000
0.50000000 0.75000000 0.25000000
0.75000000 0.75000000 0.25000000
0.00000000 0.00000000 0.50000000
0.25000000 0.00000000 0.50000000
0.50000000 0.00000000 0.50000000
0.75000000 0.00000000 0.50000000
0.00000000 0.25000000 0.50000000
0.25000000 0.25000000 0.50000000
0.50000000 0.25000000 0.50000000
0.75000000 0.25000000 0.50000000
0.00000000 0.50000000 0.50000000
0.25000000 0.50000000 0.50000000
0.50000000 0.50000000 0.50000000
0.75000000 0.50000000 0.50000000
0.00000000 0.75000000 0.50000000
0.25000000 0.75000000 0.50000000
0.50000000 0.75000000 0.50000000
0.75000000 0.75000000 0.50000000
0.00000000 0.00000000 0.75000000
0.25000000 0.00000000 0.75000000
0.50000000 0.00000000 0.75000000
0.75000000 0.00000000 0.75000000
0.00000000 0.25000000 0.75000000
0.25000000 0.25000000 0.75000000
0.50000000 0.25000000 0.75000000
0.75000000 0.25000000 0.75000000
0.00000000 0.50000000 0.75000000
0.25000000 0.50000000 0.75000000
0.50000000 0.50000000 0.75000000
0.75000000 0.50000000 0.75000000
0.00000000 0.75000000 0.75000000
0.25000000 0.75000000 0.75000000
0.50000000 0.75000000 0.75000000
0.75000000 0.75000000 0.75000000
0.18750000 0.18750000 0.18750000
0.43750000 0.18750000 0.18750000
0.68750000 0.18750000 0.18750000
0.93750000 0.18750000 0.18750000
0.18750000 0.43750000 0.18750000
0.43750000 0.43750000 0.18750000
0.68750000 0.43750000 0.18750000
0.93750000 0.43750000 0.18750000
0.18750000 0.68750000 0.18750000
0.43750000 0.68750000 0.18750000
0.68750000 0.68750000 0.18750000
0.93750000 0.68750000 0.18750000
0.18750000 0.93750000 0.18750000
0.43750000 0.93750000 0.18750000
0.68750000 0.93750000 0.18750000
0.93750000 0.93750000 0.18750000
0.18750000 0.18750000 0.43750000
0.43750000 0.18750000 0.43750000
0.68750000 0.18750000 0.43750000
0.93750000 0.18750000 0.43750000
0.18750000 0.43750000 0.43750000
0.43750000 0.43750000 0.43750000
0.68750000 0.43750000 0.43750000
0.93750000 0.43750000 0.43750000
0.18750000 0.68750000 0.43750000
0.43750000 0.68750000 0.43750000
0.68750000 0.68750000 0.43750000
0.93750000 0.68750000 0.43750000
0.18750000 0.93750000 0.43750000
0.43750000 0.93750000 0.43750000
0.68750000 0.93750000 0.43750000
0.93750000 0.93750000 0.43750000
0.18750000 0.18750000 0.68750000
0.43750000 0.18750000 0.68750000
0.68750000 0.18750000 0.68750000
0.93750000 0.18750000 0.68750000
0.18750000 0.43750000 0.68750000
0.43750000 0.43750000 0.68750000
0.68750000 0.43750000 0.68750000
0.93750000 0.43750000 0.68750000
0.18750000 0.68750000 0.68750000
0.43750000 0.68750000 0.68750000
0.68750000 0.68750000 0.68750000
0.93750000 0.68750000 0.68750000
0.18750000 0.93750000 0.68750000
0.43750000 0.93750000 0.68750000
0.68750000 0.93750000 0.68750000
0.93750000 0.93750000 0.68750000
0.18750000 0.18750000 0.93750000
0.43750000 0.18750000 0.93750000
0.68750000 0.18750000 0.93750000
0.93750000 0.18750000 0.93750000
0.18750000 0.43750000 0.93750000
0.43750000 0.43750000 0.93750000
0.68750000 0.43750000 0.93750000
0.93750000 0.43750000 0.93750000
0.18750000 0.68750000 0.93750000
0.43750000 0.68750000 0.93750000
0.68750000 0.68750000 0.93750000
0.93750000 0.68750000 0.93750000
0.18750000 0.93750000 0.93750000
0.43750000 0.93750000 0.93750000
0.68750000 0.93750000 0.93750000
0.93750000 0.93750000 0.93750000
A single k point is used in the calculations.
auto k-points
0
g
1 1 1
0 0 0
INCAR for the PBE ground-state calculations (INCAR.dft).
System = diamond
ALGO = Normal
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
NCORE = 2
INCAR to obtain the one-shot configuration (INCAR.os_disp).
System = diamond
ALGO = FAST
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
IBRION = 6
POTIM = 0.015
PHON_LMC = .TRUE.
PHON_NTLIST = 13
PHON_TLIST = 0 100 200 250 300 350 400 450 500 550 600 650 700
PHON_NSTRUCT = 0
gap_vs_temp_ref.dat
0 -0.36877
100 -0.36877
200 -0.36937
250 -0.3707
300 -0.3733
350 -0.37763
400 -0.38357
450 -0.39113
500 -0.4004
550 -0.41117
600 -0.423
650 -0.4359
700 -0.44987
Pseudopotentials of C.
6.3 Calculation¶
Open a terminal, navigate to this example's directory by entering the following command:
cd $TUTORIALS/electron-phonon/e06_*
and run the following
cp INCAR.os_disp INCAR
cp POSCAR.pristine POSCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.pristine
These commands create the input structures at different temperatures (POSCAR.T=xxx), which may be used for the one-shot method.
Next, run the following script to calculate the bandgap renormalization:
cd $TUTORIALS/electron-phonon/e06_*
bash ./run_calcs.sh
Click here to reveal the script!
We have commented out a lot of temperatures to save time.
cp POSCAR.pristine POSCAR
cp INCAR.os_disp INCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.pristine
cp INCAR.dft INCAR
for i in 0 200 400 #0 100 200 250 300 350 400 450 500 550 600 650 700
do
cp POSCAR.T\=${i}. POSCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.${i}
done
This runs standard DFT calculations for each POSCAR and saves the result to OUTCAR.xxx.
To calculate the bandgap renormalization from the OUTCAR files at each temperature, please run the following:
bash ./evaluate_gap.sh
Click here to reveal the script!
rm -f gap_vs_temp.dat
for i in 0 200 400 #250 300 350 400 450 500 550 600 650 700
do
nions=`grep NIONS OUTCAR.${i} | awk '{print $12}'`
occ_pristine=`grep -A $((nions * 2)) " band energies" OUTCAR.pristine | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_pristine=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.pristine | tail -6 | awk '{sum += $2} END {print sum/NR}'`
occ_oneshot=`grep -A $((nions * 2)) " band energies" OUTCAR.${i} | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_oneshot=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.${i} | tail -6 | awk '{sum += $2} END {print sum/NR}'`
gap_pristine=$(awk -v con="$con_pristine" -v occ="$occ_pristine" 'BEGIN {print con - occ}')
gap_oneshot=$(awk -v con="$con_oneshot" -v occ="$occ_oneshot" 'BEGIN {print con - occ}')
gap_diff=`awk -v gpris=$gap_pristine -v gonesh=$gap_oneshot 'BEGIN{print gonesh-gpris}'`
echo $i $gap_diff >> gap_vs_temp.dat
done
This will produce the file gap_vs_temp.dat containing the bandgap renormalization at each temperature.
In semiconductors and insulators, the temperature dependence of the bandgap renormalization is often described by the modified-Varshni relation [Physica 34 (1967) 14990062-6)]:
$$\tag{6.1} E_{\textrm{GAP}}(T) = E_{\textrm{GAP}}(0) -\frac{AT^{4}}{\left(B+T\right)^{2}}, $$
where $A$ and $B$ are fitting parameters for a given material.
To fit this function to our data and plot it against out data, please execute the following:
import py4vasp
import numpy as np
import scipy.optimize as sci
import plotly.graph_objects as go
# Load data
x_data, y_data = np.loadtxt("./e06_C_temperature_dependence/gap_vs_temp.dat", unpack=True)
x_ref, y_ref = np.loadtxt("./e06_C_temperature_dependence/gap_vs_temp_ref.dat", unpack=True)
# Define Varshni function
def varshni(x, A, B):
return y_ref[0] - A * x**4 / (B + x)**2
# Fit the curve
params, covariance = sci.curve_fit(varshni, x_ref, y_ref)
x_fit = np.linspace(0,700,20)
y_varshni = varshni(x_fit, params[0], params[1])
# Create Plotly figure
fig = go.Figure()
# Add original data
fig.add_trace(go.Scatter(
x=x_data,
y=y_data,
mode='lines+markers',
name='Calculated',
line=dict(color='#A82C35')
))
fig.add_trace(go.Scatter(
x=x_ref,
y=y_ref,
mode='lines',
name='Reference data',
line=dict(color='#808080')
))
# Add Varshni fit
fig.add_trace(go.Scatter(
x=x_fit,
y=y_varshni,
mode='lines',
name='Varshni fit',
line=dict(color='#3E70EA', dash='dash')
))
# Layout settings
fig.update_layout(
xaxis_title='Temperature (K)',
yaxis_title='Renormalized bandgap (eV)',
title='Renormalized bandgap vs temperature with Varshni fit',
)
fig.show()
We can see that the calculated bandgaps can be quite closely described by the Varshni relation.
Nevertheless, an important effect is missing in this plot. What effect is that?
Expand for answer here!
Effects due to volume expansion are missing. They can be obtained by quasi-harmonic calculations.
6.4 Questions¶
- By which relation is the temperature dependence of the bandgap in semiconductors/insulators described?
- What would we need for a full description of the temperature dependence of the bandgap of a material?
By the end of this tutorial, you will be able to:
- Compute the bandgap using Monte Carlo sampling for electron-phonon interactions.
- Compare the result to the one-shot method.
7.1 Task¶
Compute the bandgap with Monte Carlo sampling for diamond.
We will compute the bandgap from full Monte Carlo sampling and compare the results to those obtained from the one-shot method. Using the density matrix of a harmonic distribution, we will create 30 random structures [Physica Status Solidi A 188 (2001) 1209188:4<1209::AID-PSSA1209>3.0.CO;2-2)]. For each of these structures, we will carry out a ground-state calculation. The Monte Carlo bandgap is then calculated as the arithmetic mean of the bandgap for each structure [New J. Phys. 20 (2018) 123008].
7.2 Input¶
The input files to run this example are prepared at $TUTORIALS/electron-phonon/e07_C_Monte_Carlo_sampling.
POSCAR.pristine
Click here to expand!
Diamond
1.00000000000000
0.00000000 7.13397200 7.13397200
7.13397200 0.00000000 7.13397200
7.13397200 7.13397200 0.00000000
C
128
Direct
0.00000000 0.00000000 0.00000000
0.25000000 0.00000000 0.00000000
0.50000000 0.00000000 0.00000000
0.75000000 0.00000000 0.00000000
0.00000000 0.25000000 0.00000000
0.25000000 0.25000000 0.00000000
0.50000000 0.25000000 0.00000000
0.75000000 0.25000000 0.00000000
0.00000000 0.50000000 0.00000000
0.25000000 0.50000000 0.00000000
0.50000000 0.50000000 0.00000000
0.75000000 0.50000000 0.00000000
0.00000000 0.75000000 0.00000000
0.25000000 0.75000000 0.00000000
0.50000000 0.75000000 0.00000000
0.75000000 0.75000000 0.00000000
0.00000000 0.00000000 0.25000000
0.25000000 0.00000000 0.25000000
0.50000000 0.00000000 0.25000000
0.75000000 0.00000000 0.25000000
0.00000000 0.25000000 0.25000000
0.25000000 0.25000000 0.25000000
0.50000000 0.25000000 0.25000000
0.75000000 0.25000000 0.25000000
0.00000000 0.50000000 0.25000000
0.25000000 0.50000000 0.25000000
0.50000000 0.50000000 0.25000000
0.75000000 0.50000000 0.25000000
0.00000000 0.75000000 0.25000000
0.25000000 0.75000000 0.25000000
0.50000000 0.75000000 0.25000000
0.75000000 0.75000000 0.25000000
0.00000000 0.00000000 0.50000000
0.25000000 0.00000000 0.50000000
0.50000000 0.00000000 0.50000000
0.75000000 0.00000000 0.50000000
0.00000000 0.25000000 0.50000000
0.25000000 0.25000000 0.50000000
0.50000000 0.25000000 0.50000000
0.75000000 0.25000000 0.50000000
0.00000000 0.50000000 0.50000000
0.25000000 0.50000000 0.50000000
0.50000000 0.50000000 0.50000000
0.75000000 0.50000000 0.50000000
0.00000000 0.75000000 0.50000000
0.25000000 0.75000000 0.50000000
0.50000000 0.75000000 0.50000000
0.75000000 0.75000000 0.50000000
0.00000000 0.00000000 0.75000000
0.25000000 0.00000000 0.75000000
0.50000000 0.00000000 0.75000000
0.75000000 0.00000000 0.75000000
0.00000000 0.25000000 0.75000000
0.25000000 0.25000000 0.75000000
0.50000000 0.25000000 0.75000000
0.75000000 0.25000000 0.75000000
0.00000000 0.50000000 0.75000000
0.25000000 0.50000000 0.75000000
0.50000000 0.50000000 0.75000000
0.75000000 0.50000000 0.75000000
0.00000000 0.75000000 0.75000000
0.25000000 0.75000000 0.75000000
0.50000000 0.75000000 0.75000000
0.75000000 0.75000000 0.75000000
0.18750000 0.18750000 0.18750000
0.43750000 0.18750000 0.18750000
0.68750000 0.18750000 0.18750000
0.93750000 0.18750000 0.18750000
0.18750000 0.43750000 0.18750000
0.43750000 0.43750000 0.18750000
0.68750000 0.43750000 0.18750000
0.93750000 0.43750000 0.18750000
0.18750000 0.68750000 0.18750000
0.43750000 0.68750000 0.18750000
0.68750000 0.68750000 0.18750000
0.93750000 0.68750000 0.18750000
0.18750000 0.93750000 0.18750000
0.43750000 0.93750000 0.18750000
0.68750000 0.93750000 0.18750000
0.93750000 0.93750000 0.18750000
0.18750000 0.18750000 0.43750000
0.43750000 0.18750000 0.43750000
0.68750000 0.18750000 0.43750000
0.93750000 0.18750000 0.43750000
0.18750000 0.43750000 0.43750000
0.43750000 0.43750000 0.43750000
0.68750000 0.43750000 0.43750000
0.93750000 0.43750000 0.43750000
0.18750000 0.68750000 0.43750000
0.43750000 0.68750000 0.43750000
0.68750000 0.68750000 0.43750000
0.93750000 0.68750000 0.43750000
0.18750000 0.93750000 0.43750000
0.43750000 0.93750000 0.43750000
0.68750000 0.93750000 0.43750000
0.93750000 0.93750000 0.43750000
0.18750000 0.18750000 0.68750000
0.43750000 0.18750000 0.68750000
0.68750000 0.18750000 0.68750000
0.93750000 0.18750000 0.68750000
0.18750000 0.43750000 0.68750000
0.43750000 0.43750000 0.68750000
0.68750000 0.43750000 0.68750000
0.93750000 0.43750000 0.68750000
0.18750000 0.68750000 0.68750000
0.43750000 0.68750000 0.68750000
0.68750000 0.68750000 0.68750000
0.93750000 0.68750000 0.68750000
0.18750000 0.93750000 0.68750000
0.43750000 0.93750000 0.68750000
0.68750000 0.93750000 0.68750000
0.93750000 0.93750000 0.68750000
0.18750000 0.18750000 0.93750000
0.43750000 0.18750000 0.93750000
0.68750000 0.18750000 0.93750000
0.93750000 0.18750000 0.93750000
0.18750000 0.43750000 0.93750000
0.43750000 0.43750000 0.93750000
0.68750000 0.43750000 0.93750000
0.93750000 0.43750000 0.93750000
0.18750000 0.68750000 0.93750000
0.43750000 0.68750000 0.93750000
0.68750000 0.68750000 0.93750000
0.93750000 0.68750000 0.93750000
0.18750000 0.93750000 0.93750000
0.43750000 0.93750000 0.93750000
0.68750000 0.93750000 0.93750000
0.93750000 0.93750000 0.93750000
A single k point is used in the calculations.
auto k-points
0
g
1 1 1
0 0 0
INCAR for the PBE ground-state calculations (INCAR.dft).
System = diamond
ALGO = Normal
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
NCORE = 2
INCAR to obtain the one-shot configuration (INCAR.elphon_oneshot).
System = diamond
ALGO = FAST
ISMEAR = 0; SIGMA = 0.1; EFERMI = MIDGAP;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
IBRION = 6
POTIM = 0.015
PHON_LMC = .TRUE.
PHON_NTLIST = 1
PHON_TLIST = 0
PHON_NSTRUCT = 0
INCAR to obtain the one-shot configuration (INCAR.elphon_mc).
System = diamond
ALGO = FAST
ISMEAR = 0; SIGMA = 0.1;
LREAL = A
LWAVE = .FALSE.
LCHARG = .FALSE.
IBRION = 6
POTIM = 0.015
PHON_LMC = .TRUE.
TEBEG = 0
PHON_NSTRUCT = 30
PHON_NSTRUCT selects the number of POSCAR's created for Monte Carlo sampling. In contrast to the one-shot method, the temperature is selected via TEBEG in the Monte Carlo method.
Pseudopotentials of C.
7.3 Calculation¶
Open a terminal, navigate to this example's directory by entering the following command:
cd $TUTORIALS/electron-phonon/e07_*
and run the following:
cp INCAR.elphon_oneshot INCAR
cp POSCAR.pristine POSCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.pristine
This will create the one-shot structure at 0 K. Next, run a ground-state calculation for the one-shot structure (a reference POSCAR.oneshot_T0 is used):
cp INCAR.dft INCAR
cp POSCAR.T=0. POSCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.oneshot_T0
Please save the OUTCAR's exactly as written here because they will be needed for the evaluation script. Next, create the Monte-Carlo structures by entering the following:
cp INCAR.elphon_mc INCAR
cp POSCAR.pristine POSCAR
mpirun -np 4 vasp_gam
This will create 30 numbered structures at 0 K (POSCAR.T=0.X). To run ground-state calculations for each of them, run the following script:
bash ./run_calc.sh
Click here to reveal the script!
for i in {1..30}
do
echo "-------------------------------------------------"
echo "MC ground state" ${i}
cp INCAR.dft INCAR
cp POSCAR.T\=0.${i} POSCAR
mpirun -np 4 vasp_gam
cp OUTCAR OUTCAR.${i}
done
To calculate the averaged bandgap for the Monte Carlo sampling and the bandgap for the one-shot method, execute the following bash script:
bash ./evaluate_gap.sh
Click here to reveal the script!
rm -f zpr_vs_conf.dat
nions=`grep NIONS OUTCAR.pristine | awk '{print $12}'`
occ_pristine=`grep -A $((nions * 2)) " band energies" OUTCAR.pristine | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_pristine=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.pristine | tail -6 | awk '{sum += $2} END {print sum/NR}'`
gap_pristine=$(awk -v con="$con_pristine" -v occ="$occ_pristine" 'BEGIN {print con - occ}')
occ_oneshot=`grep -A $((nions * 2)) " band energies" OUTCAR.oneshot_T0 | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_oneshot=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.oneshot_T0 | tail -6 | awk '{sum += $2} END {print sum/NR}'`
gap_oneshot=$(awk -v con="$con_oneshot" -v occ="$occ_oneshot" 'BEGIN {print con - occ}')
gap_diff=`awk -v gpris=$gap_pristine -v gonesh=$gap_oneshot 'BEGIN{print gonesh-gpris}'`
echo $gap_diff >> oneshot.dat
for i in {1..30}
do
nions=`grep NIONS OUTCAR.${i} | awk '{print $12}'`
occ_mc=`grep -A $((nions * 2)) " band energies" OUTCAR.${i} | tail -3 | awk '{sum += $2} END {print sum/NR}'`
con_mc=`grep -A $((nions * 2 + 6)) " band energies" OUTCAR.${i} | tail -6 | awk '{sum += $2} END {print sum/NR}'`
gap_mc=$(awk -v con="$con_mc" -v occ="$occ_mc" 'BEGIN {print con - occ}')
gap_diff_mc=`awk -v gpris=$gap_pristine -v gonesh=$gap_mc 'BEGIN{print gonesh-gpris}'`
echo $gap_diff_mc >> zpr_vs_conf.dat
done
awk 'BEGIN{n=0;sum=0.0} {n=n+1;sum=sum+$1;
if (n==10){print "average ZPR for 10 structures",sum/n};
if (n==15){print "average ZPR for 15 structures",sum/n};
if (n==20){print "average ZPR for 20 structures",sum/n};
if (n==25){print "average ZPR for 25 structures",sum/n};
if (n==30){print "average ZPR for 30 structures",sum/n};}' zpr_vs_conf.dat
awk -v go=$gap_diff 'BEGIN{print "ZPR oneshot:",go}'
%%bash
cd e07_*
bash ./evaluate_gap.sh
cd ..
Your result should look similar to this:
Average ZPR for 10 structures -0.363619
Average ZPR for 15 structures -0.36149
Average ZPR for 20 structures -0.357181
Average ZPR for 25 structures -0.361705
Average ZPR for 30 structures -0.358359
ZPR oneshot: -0.3509
We can see that with 20 structures, the Monte Carlo calculations are converged to the second digit, relative to the converged 30 structures. We can also see that the bandgap of the one-shot method is very close to the averaged gap from Monte Carlo sampling. The two values converge towards each other with increasing size of the supercell (we can't show this here because it would involve too much computational time) [New J. Phys. 20 (2018) 123008].
Since most of the time, full Monte Carlo sampling and the one-shot method give very similar results for sufficiently large cells, we advise to always use the one-shot method. The Monte Carlo sampling should be used only in special cases. For instance, when multiple POSCAR's sampled from a harmonic oscillator at finite temperature are needed as starting points for a molecular dynamics run or something similar.
7.4 Questions¶
- What are the computational steps to get the bandgap including electron-phonon interactions from Monte Carlo sampling?
- When do the results from one-shot and Monte Carlo sampling converge towards each other?