<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yambo-code.eu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pierre</id>
	<title>The Yambo Project - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yambo-code.eu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pierre"/>
	<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Special:Contributions/Pierre"/>
	<updated>2026-05-17T19:31:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Phonon-assisted_luminescence_by_finite_atomic_displacements&amp;diff=5909</id>
		<title>Phonon-assisted luminescence by finite atomic displacements</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Phonon-assisted_luminescence_by_finite_atomic_displacements&amp;diff=5909"/>
		<updated>2022-04-26T14:06:45Z</updated>

		<summary type="html">&lt;p&gt;Pierre: /* Calculate phonons at momentum q of the indirect transition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Representative-instantaneous-atomic-configurations-of-H2O-top-and-H3O-bottom-Also.gif|thumb| 200px|Finite atomic displacements]]&lt;br /&gt;
&lt;br /&gt;
In recent years, several articles have been published with Yambo, who calculated the phonon-assisted luminescence by means of finite atomic displacements&amp;lt;ref name=&#039;cann&#039;&amp;gt;[https://arxiv.org/abs/1807.11797 Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride], E. Cannuccia, B. Monserrat and C. Attaccalite, Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;fprl&#039;&amp;gt;[https://arxiv.org/abs/1810.08976 Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride], F. Paleari et al. PRL &#039;&#039;&#039;122&#039;&#039;&#039;, 187401(2019) &amp;lt;/ref&amp;gt;&amp;lt;ref name=strain&amp;gt;[https://arxiv.org/abs/2112.12417 Excitons under strain: light absorption and emission in strained hexagonal boron nitride],P. Lechifflart, F. Paleari and C. Attaccalite (2022). &amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;mprl&#039;&amp;gt;[https://arxiv.org/abs/2111.03518  Phonon-Assisted Luminescence in Defect Centers from Many-Body Perturbation Theory], F. Libbi, P. M. M. C. de Melo, Z. Zanolli, M. J. Verstraete, and N. Marzari, Phys. Rev. Lett. &#039;&#039;&#039;128&#039;&#039;&#039;, 167401 (2022) &amp;lt;/ref&amp;gt;.&lt;br /&gt;
In this tutorial we will show how to use [https://github.com/yambo-code/yambopy YamboPy] in combination with Yambo to perform these kind of calculations. For a general review of finite displacements calculations of vibrational properties we recommend this article&amp;lt;ref&amp;gt;Electron-phonon coupling from finite differences, Bartomeu Monserrat, J. Phys.: Condens. Matter &#039;&#039;&#039;30&#039;&#039;&#039; 083001(2018)&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
Notice that calculation of phonon-assisted luminescence by finite atomic displacements are quite involved and expensive from a computational point of view, for this reason they are limited to relatively simple systems.&amp;lt;br&amp;gt;&lt;br /&gt;
In this tutorial we will follow the approach of Ref.&amp;lt;ref name=fprl&amp;gt;&amp;lt;/ref&amp;gt;, and calculate luminescence using the Roosbroeck–Shockley (RS) relation applied to the excitonic case.&amp;lt;br&amp;gt;&lt;br /&gt;
If you use this approach to calculate luminescence or phonon-assisted absorption please cite references &amp;lt;ref name=cann&amp;gt;&amp;lt;/ref&amp;gt; and &amp;lt;ref name=fprl&amp;gt;&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; This tutorial requires that you are familiar with Bethe-Salpeter calculations with Yambo, and phonons with Quantum-Espresso, and YamboPy. If it is not the case please study the corresponding tutorial before continuing. &lt;br /&gt;
&lt;br /&gt;
== Locate the lowest indirect exciton (or indirect band gap) ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial as example we will consider the hexagonal-BN, that is an indirect insulator. The first step to calculate the phonon-assisted luminescence is to locate the lowest indirect exciton. The cleanest strategy to identify the lowest excitation would be to calculate the excitons along the whole Irreducible Brillouin zone(IBZ), then interpolate them as explained in [http://www.yambo-code.org/wiki/index.php?title=How_to_analyse_excitons#Interpolate_exciton_dispersion_(only_in_Yambo_5.x) Interpolate exciton dispersion] and find the &#039;&#039;&#039;q&#039;&#039;&#039; point that correspond to the minimum.&amp;lt;br&amp;gt;&lt;br /&gt;
A simpler approach is to use the GW (or Kohn-Sham) band structure to find the momentum responsible for the indirect band gap, in the major part of cases this correspond to the lowest exciton.&amp;lt;br&amp;gt;&lt;br /&gt;
In the h-BN case we have:&lt;br /&gt;
[[File:Bn band structure.png|1000px|center| Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
The indirect gap is between a point close to &#039;&#039;&#039;K&#039;&#039;&#039; and the &#039;&#039;&#039;M&#039;&#039;&#039; point, see panel (a) of the figure above. We will approximate the momentum responsible for the indirect emission with &#039;&#039;&#039;q=K-M&#039;&#039;&#039;. Notice  that then we should build supercells that contain this moment, so it is good to approximate it with fractions of integers that are not too large so as not to have giant supercells. In this case we get &#039;&#039;&#039;q=(1/3,-1/6, 0)&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Notice that if you have a direct band gap material, the momentum &#039;&#039;&#039;q&#039;&#039;&#039; corresponding to the lowest transition is &#039;&#039;&#039;q=0&#039;&#039;&#039; and you do not need to construct special supercells to sample the corresponding vibration, it will be sufficient to displace atoms in the primitive cell.&lt;br /&gt;
&lt;br /&gt;
== Calculate phonons at momentum &#039;&#039;&#039;q&#039;&#039;&#039; of the indirect transition ==&lt;br /&gt;
&lt;br /&gt;
Now we need to calculate all atomic vibrations compatible with the momentum of the lowest indirect transition. In order to do so we first calculate the phonons with QE, here the inputs [http://www.yambo-code.org/educational/tutorials/files/hBN_phonons.tgz hBN_phonons.tgz], then we calculate the force constants with q2r.x and now we can interpolate phonons along all the BZ as shown in panel (b) of Figure 1. Then we use matdyn.x to calculate phonons at momentum &#039;&#039;&#039;q=K-M = (1/3, -1/6, 0)&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;input&lt;br /&gt;
    asr=&#039;crystal&#039;,&lt;br /&gt;
    flfrc=&#039;bn.fc&#039;,&lt;br /&gt;
    flfrq=&#039;bn.freq&#039;,&lt;br /&gt;
    deltaE=1.d0,&lt;br /&gt;
    q_in_cryst_coord=.true.&lt;br /&gt;
    fleig=&#039;bn.eig&#039;&lt;br /&gt;
 /&lt;br /&gt;
 2&lt;br /&gt;
 0 0 0&lt;br /&gt;
 0.3333333333333333 -0.16666666666666666666 0.0&lt;br /&gt;
&lt;br /&gt;
The obtained phonon modes correspond phonons at the vertical red line in panel(b) of Fig. 1. They are written in the &#039;&#039;matdyn.modes&#039;&#039; file with the corresponding eigenvectors and will be later used to displace atoms along the phonon modes.&lt;br /&gt;
If you open the &#039;matdyn.modes&#039; file you will find phonon modes for the &#039;&#039;&#039;q=0&#039;&#039;&#039; and &#039;&#039;&#039;q=(1/3, -1/6, 0)&#039;&#039;&#039;  that in cartesian coordinates is (1/3,0,0). We copy the modes corresponding to the second &#039;&#039;&#039;q=(1/3, -1/6, 0)&#039;&#039;&#039; in a separate file, called &#039;&#039;Q2.modes&#039;&#039; that will look like:&lt;br /&gt;
&lt;br /&gt;
      diagonalizing the dynamical matrix ...&lt;br /&gt;
 &lt;br /&gt;
 q =       0.3333      0.0000      0.0000&lt;br /&gt;
 **************************************************************************&lt;br /&gt;
     freq (    1) =       5.194139 [THz] =     173.257815 [cm-1]&lt;br /&gt;
 (  0.000000  -0.000000    -0.000000  -0.000000    -0.274372  -0.475224   )&lt;br /&gt;
 ( -0.000000   0.000000    -0.000000  -0.000000    -0.445962   0.000001   )&lt;br /&gt;
 ( -0.000000  -0.000000    -0.000000  -0.000000    -0.222981  -0.386214   )&lt;br /&gt;
 (  0.000000   0.000000    -0.000000   0.000000    -0.548742   0.000000   )&lt;br /&gt;
 ...........................&lt;br /&gt;
&lt;br /&gt;
== Generate the supercell==&lt;br /&gt;
&lt;br /&gt;
Now we use YamboPy to generate the supercell corresponding to the momentum &#039;&#039;&#039;q=(1/3, -1/6, 0)&#039;&#039;&#039;.  A tutorial is already present in the file &#039;&#039;tutorial/supercell/generate_supercells.py&#039;&#039;.&lt;br /&gt;
You can edit the file to specify the momentum &#039;&#039;&#039;q&#039;&#039;&#039;, the name of the SCF initial file (uc_filnm)  and the name of the phonon mode file (mode_file).&lt;br /&gt;
&lt;br /&gt;
    .....&lt;br /&gt;
    uc_filnm = &#039;hBN.scf.in&#039; #pw input&lt;br /&gt;
    Q = [[1,-1,0],[3,6,0]] #qpoint to fold in nondiagonal supercell: Q=(1/3,-1/6,0)&lt;br /&gt;
    kpoints = [12,12,4]    #NB: these fractional crystal coordinates must exactly divide the kpoint mesh!&lt;br /&gt;
    modes_file = &#039;Q2.modes&#039; #file with phonon eigenmodes&lt;br /&gt;
    .....&lt;br /&gt;
&lt;br /&gt;
run the script to generate the supercell without displace atoms &#039;&#039;python generate_supercells.py -N&#039;&#039;. The script will generate a non-diagonal supercell&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1510.04418 Lattice dynamics and electron-phonon coupling calculations using nondiagonal supercells], J. H. Lloyd-Williams and B. Monserrat, Phys. Rev. B &#039;&#039;&#039;92&#039;&#039;&#039;, 184301(2015) &amp;lt;/ref&amp;gt; in the file &amp;quot;sc_nondiagonal.bn.scf&#039; that is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Supercell.png|500px|center| Supercell for the momentum q=(1/3, -1/6, 0) and the corresponding reciprocal space]]&lt;br /&gt;
&lt;br /&gt;
The YamboPy script automatically reduce the number of k-point in such a way to have the same sampling of the corresponding primitive cell, however we advice you to check if the new k-point grid is what you expect, and modify it in case of incorrect grid.&amp;lt;br&amp;gt;&lt;br /&gt;
In the same way you can generate the input file for non-self-consistent calculation in the supercell.&lt;br /&gt;
&lt;br /&gt;
==Calculate the optical spectra in the supercell==&lt;br /&gt;
&lt;br /&gt;
Now you have to calculate the optical spectra and exciton in the new supercell. Do not forget to increase the number of conduction bands in both the screening the Bethe-Salpeter equation. For example in the supercell shown above there are 24 atoms, 6 times more than in the original cell, so you will have to multiply the number of bands by 6, if in the base cell you have used 40 bands here you will have to put 240 to have the same convergence parameters. Then print exciton according to their energy with the command ypp -e s.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;N. B. &#039;&#039;&#039;: in order to not recalculate W for each atomic displacement you can perform calculations without symmetries in the pristine supercell and then copy the corresponding dielectric constant in the calculations with displaced atoms, this is usually a safe approximation described in Ref.&amp;lt;ref name=&amp;quot;cann&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After solving the BSE in the supecell you will find the excitons that were already present in the primary cell (within the numerical noise) and new lower energy excitons, with zero dipole matrix elements, that correspond to the indirect excitons that have now been  mapped at &#039;&#039;&#039;q=0&#039;&#039;&#039;, something like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 #    Maximum Residual Value =  0.38659E+01&lt;br /&gt;
 #   &lt;br /&gt;
 #    E [ev]             Strength           Index&lt;br /&gt;
 #&lt;br /&gt;
     5.7165937         0.47290171E-11      1.0000000         &amp;lt;-- Indirect exciton mapped at q=0&lt;br /&gt;
     5.7166047         0.58239158E-09      2.0000000         &amp;lt;-- Indirect exciton mapped at q=0&lt;br /&gt;
     5.7367945         0.31830746E-09      3.0000000         &amp;lt;-- Indirect exciton mapped at q=0&lt;br /&gt;
     5.7368207         0.33674005E-10      4.0000000         &amp;lt;-- Indirect exciton mapped at q=0&lt;br /&gt;
     5.80542803        0.100763231E-6      5.00000000        &amp;lt;-- Direct exciton&lt;br /&gt;
     5.80598068        0.384604526E-8      6.00000000        &amp;lt;-- Direct exciton&lt;br /&gt;
     5.88944197         1.00000000         7.00000000        &amp;lt;-- Direct exciton&lt;br /&gt;
     5.88967037        0.102969212E-1      8.00000000        &amp;lt;-- Direct exciton&lt;br /&gt;
     ................&lt;br /&gt;
&lt;br /&gt;
This result shows that indirect exciton without the coupling with phonon do not contribute the optical response.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Displace atoms and calculate dipoles derivatives and luminescence==&lt;br /&gt;
Now you can generate the displaced supercell for all the phonon modes compatible with the indirect band gap &#039;&#039;&#039;q&#039;&#039;&#039; point by doing:  &#039;&#039;python generate_supercells.py -S&#039;&#039;. The script will produce a set of input files for each of the 12 phonon modes at &#039;&#039;&#039;q=(1/3,-1/6,0)&#039;&#039;&#039;. You have to perform BSE calculation for each one of these modes and get exciton dipoles.&amp;lt;br&amp;gt;&lt;br /&gt;
For each phonon mode the atoms are displace along the corresponding eigenvector read from the &amp;quot;Q2.modes&amp;quot; file multiplied for 0.1 Borh (the variable Temp=0.1), see the following line in &amp;quot;generate_supercell.py&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
  ...  &lt;br /&gt;
  sc.displace(eivs,nd_atom_positions,Temp=0.1) # Generate list of displaced supercells as PwIn objects called &#039;modes_qe&#039;&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
this is usually a good value to get correct derivatives.&amp;lt;br&amp;gt;&lt;br /&gt;
Once you get dipoles for a give phonon mode you can calculate the second order dipole derivatives using a finite different formula and the fact the first order derivatives are zero by construction.&amp;lt;br&amp;gt;&lt;br /&gt;
Now you have all the information necessary to construct the emission spectra. &amp;lt;br&amp;gt;Using the formula, derived in Ref.&amp;lt;ref name=fprl&amp;gt;&amp;lt;/ref&amp;gt; you obtain the phonon-assisted luminescence as: &lt;br /&gt;
[[File:Light emission.png|center|Light emission formula]]&lt;br /&gt;
&lt;br /&gt;
in this formula:&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt; n&amp;lt;sub&amp;gt;r&amp;lt;/sub&amp;gt;(ω)&amp;lt;/span&amp;gt; is the refractive index, that usually can be approximated with a constant in the luminescence energy range.&lt;br /&gt;
* E&amp;lt;sup&amp;gt;S&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;&#039;&#039;&#039;q&#039;&#039;&#039;&amp;lt;/sub&amp;gt; are the excitonic energies in the undistorted supercell, including indirect excitons&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; B(E&amp;lt;sup&amp;gt;S&amp;lt;/sup&amp;gt;,T&amp;lt;sub&amp;gt;exc&amp;lt;/sub&amp;gt;)&amp;lt;/span&amp;gt; is the Bose occupation of excitons, that can be approximated with a Boltzman function, see Ref.&amp;lt;ref name=fprl&amp;gt;&amp;lt;/ref&amp;gt;&amp;lt;ref name=strain&amp;gt;&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;T&amp;lt;sub&amp;gt;exc&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; is the excitonic temperature that should be obtained from experimental measurements or used as a parameters, for a discussion see Ref.&amp;lt;ref name=fprl&amp;gt;&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; d&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;|T&amp;lt;sup&amp;gt;S&amp;lt;/sup&amp;gt;|&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;/dR&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;λ&#039;&#039;&#039;q&#039;&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; are the derivatives of the exciton dipole matrix elements for a given phonon mode&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:violet&amp;quot;&amp;gt;Ω&amp;lt;sub&amp;gt;λ,&#039;&#039;&#039;q&#039;&#039;&#039;&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt; are the phonon frequencies and the sum on &#039;&#039;&#039;q&#039;&#039;&#039; is on the different supercells obtained from phonon modes responsible for the luminescence, in this tutorial there is just a single &#039;&#039;&#039;q&#039;&#039;&#039; point.&lt;br /&gt;
*  &amp;lt;span style=&amp;quot;color:brown&amp;quot;&amp;gt; η &amp;lt;/span&amp;gt;  is the exciton line-width that is given as input parameter to define the broadening of the spectra&lt;br /&gt;
&lt;br /&gt;
In the h-BN example shown here, the T&amp;lt;sub&amp;gt;exc&amp;lt;/sub&amp;gt; was obtained from experimental measurements, only the lowest two excitons were included in the sum and the Bose function was replaced by a Botlzman distribution with the energy zero was fixed at the lowest excitonic energy. An appropriate scissor operator independent of the atomic displacements was added in the calculation. The final result is shown in the figure above and compared with experimental measurement at 10 Kelvin&lt;br /&gt;
[[File:Lum spectra.png|center|800px|Luminescence spectra]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Some additional considerations on luminescence calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In general due to the &#039;&#039;&#039;Bose&#039;&#039;&#039; (or &#039;&#039;&#039;Boltzmann&#039;&#039;&#039;) factor only the lower excitons (often only the lowest one) contribute to the luminescence signal&lt;br /&gt;
* The lowest excitons are  &#039;&#039;&#039;degenerate&#039;&#039;&#039; all of them have to be included in the sum, as in the h-BN example&lt;br /&gt;
* In the present formulation of luminescence spectra excitons are treated  as Bosons (or Boltzman particles), in principle it is possible to define a &#039;&#039;&#039;excitonic occupation&#039;&#039;&#039; starting from a quasi-equilibrium distribution of excited electron-hole, but this requires a rotation of the electron-hole occupations in the excitonic base for a discussion see Ref.&amp;lt;ref name=&#039;cann&#039;&amp;gt;&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;mprl&#039;&amp;gt;&amp;lt;/ref&amp;gt;&lt;br /&gt;
* In order to &#039;&#039;&#039;speed up calculations&#039;&#039;&#039; you can perform all calculation without symmetries and copy the dielectric constant (&#039;&#039;ndb.em1s*&#039;&#039; or &#039;&#039;ndb.pp*&#039;&#039; files) from the undistorted supercell to the displaced ones. In this case if you do not need to calculate GW correction, for example using a scissor, you can also reduce the number of bands in the the non-self-consistent calculation to the one required by the BSE, for a discussion see Ref&amp;lt;ref name=strain&amp;gt;&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Notice that the &#039;&#039;&#039;dipole matrix elements&#039;&#039;&#039; that will enter in optical absorption and luminescence depend form the direction of the electric field. In this example show before the luminescence has been averaged on &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; directions because we were interested in the in-place luminescence. In general is it possible to select specific directions to reproduce particular experimental setups&amp;lt;ref name=cann&amp;gt;&amp;lt;/ref&amp;gt;&amp;lt;ref name=fprl&amp;gt;&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Pierre</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5777</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5777"/>
		<updated>2022-04-08T07:37:58Z</updated>

		<summary type="html">&lt;p&gt;Pierre: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This tutorial will show you how to visualise wave-function and band-structure related information following a DFT Quantum Espresso calculation using the &amp;quot;qepy&amp;quot; module of Yambopy.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Concerning the ICTP school: recall that for the yambopy tutorials you have to load the yambo, quantum-espresso and anaconda3 modules:&#039;&#039;&#039;&lt;br /&gt;
 spack load yambo&lt;br /&gt;
 spack load quantum-espresso&lt;br /&gt;
 spack load anaconda3&lt;br /&gt;
&#039;&#039;&#039;You can copy the tutorial databases as explained in the virtual machine setup page: &#039;&#039;&#039;&lt;br /&gt;
 cp -r /media/ictpuser/smr3694/ictptutor/YAMBOPY_TUTORIALS ~/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
First enter in the folder &lt;br /&gt;
 cd databases_qepy/bn-semiconductor&lt;br /&gt;
and have a look to the &lt;br /&gt;
 vim plot-qe-bands.py&lt;br /&gt;
The qepy classes are useful both to execute Quantum Espresso and to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The qepy class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-processes the data. The class is instanced by doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. In order to plot the bands, we also define the k-points path (in crystal coordinates) using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE band calculations.&lt;br /&gt;
&lt;br /&gt;
In order to show the plot we call the &#039;&#039;&#039;plot_eigen&#039;&#039;&#039; method of the &#039;&#039;&#039;PwXML&#039;&#039;&#039; class:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automatically plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px | center |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively, we can use the function &#039;&#039;&#039;plot_eigen_ax&#039;&#039;&#039;. This functions requires as input a matplotlib &#039;&#039;&#039;figure&#039;&#039;&#039; object with given axes, as you will see in the next example.&lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic wave functions can be displayed using the class &#039;&#039;&#039;ProjwfcXML&#039;&#039;&#039;. &lt;br /&gt;
In order to make quantum espresso calculate the relevant data, we need to use the QE executable &#039;&#039;&#039;projwfc.x&#039;&#039;&#039;, which will create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. This executable projects the Kohn-Sham wavefunctions onto orthogonalized atomic orbitals, among others functionalities. The orbital indexing  and ordering are explained in the input documentation of the projwfc.x function which you are invited to check (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). We can run &#039;&#039;&#039;projwf.x&#039;&#039;&#039; directly from the python script using the qepy class &#039;&#039;&#039;ProjwfcIn&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class &#039;&#039;&#039;PwXML&#039;&#039;&#039;, we then define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the nitrogen (1) and boron (2) orbitals, which according to the projection orderings is given by&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;ProjwfcXML&#039;&#039;&#039; then runs as in this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | center | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). You see that the colormap goes from maximum &#039;&#039;&#039;selected_orbitals&#039;&#039;&#039; content (in this case nitrogen) to the maximum &#039;&#039;&#039;selected_orbitals_2&#039;&#039;&#039; content (in this case boron). &lt;br /&gt;
The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
We can also plot the band orbital charater with size variation instead of a color scale. In this case we have to pass only the variable selected_orbitals (see the next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial a small workflow example to run quantum espresso calculations from scratch. This is done using the classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py for an example. &lt;br /&gt;
Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. After doing all the calculations from scratch with the flows (flow-iron.py), we can make the band plot by running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in the QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this k-point path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. &lt;br /&gt;
Let us look first at the file &#039;&#039;&#039;plot-qe-orbitals-size&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NB: If you generated the quantum espresso databases using the flows instead of relying on the precomputed databases, you also need to rerun the quantum espresso executable projwfc.x to recompute the orbital projections. In this case, please uncomment the following lines in the script:&#039;&#039;&#039;&lt;br /&gt;
 #proj = ProjwfcIn(prefix=&#039;pw&#039;)&lt;br /&gt;
 #proj.run(folder=&#039;bands/t0&#039;)&lt;br /&gt;
&lt;br /&gt;
Now, we can use the dot size as a function of the weight of the orbitals&lt;br /&gt;
 atom_s = [8]&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
&lt;br /&gt;
and the plots are done with&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;selected_orbitals=atom_s,&amp;lt;/span&amp;gt;color=&#039;pink&#039;,color_2=&#039;black&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;selected_orbitals=atom_p,&amp;lt;/span&amp;gt;color=&#039;green&#039;,color_2=&#039;orange&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;selected_orbitals=atom_d,&amp;lt;/span&amp;gt;,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
As an example, we can select just the &#039;&#039;d&#039;&#039; orbitals by commenting the first two plots and then running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy. The plot above is in red and blue, while the default choice in your script should be pink and black. You can experiment with the colors and other &#039;&#039;matplotlib&#039;&#039; plot options and also plot the other orbital types.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script), but this time we have a different colormap for each spin polarisation.&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy can be used either to run Yambo and QE calculations, or to analyse the results of QE and Yambo by dealing with their generated databases. This is done with a variety of classes included in the qepy (for QE) or yambopy (for Yambo) modules. &lt;br /&gt;
In the case of Yambo GW quasi-particle calculations, we can use the yambopy class &#039;&#039;&#039;YamboQPDB&#039;&#039;&#039; to read the database produced by the simulation. We can use this to find the scissor operator, plot the GW bands and to interpolate the GW bands on a smoother k-path. The example runs by typing:&lt;br /&gt;
&lt;br /&gt;
 python plot-qp.py&lt;br /&gt;
&lt;br /&gt;
See below for an explanation of the tutorial. As usual, we can import the qepy and yambopy libraries:&lt;br /&gt;
&lt;br /&gt;
  from qepy import *&lt;br /&gt;
  from yambopy import *&lt;br /&gt;
  import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
We define the k-points path.&lt;br /&gt;
  npoints = 10&lt;br /&gt;
  path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
                [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
                [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&lt;br /&gt;
Importantly, the number of points is a free choice. We can increase the variable npoints as we wish, it just means that the interpolation step will take more time. In order to analyse GW results we need to have the file related to the basic data of our Yambo calculation (&#039;&#039;&#039;SAVE/ns.db1&#039;&#039;&#039;) and the netcdf file with the quasi-particle results (&#039;&#039;&#039;ndb.QP&#039;&#039;&#039;). We load the data calling the respective classes:&lt;br /&gt;
&lt;br /&gt;
 # Read Lattice information from SAVE&lt;br /&gt;
 lat  = YamboSaveDB.from_db_file(folder=&#039;SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
 # Read QP database&lt;br /&gt;
 ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;qp-gw&#039;)&lt;br /&gt;
(in the yambopy module, each class is specialised to read a specific Yambo database)&lt;br /&gt;
&lt;br /&gt;
The first option is to plot the energies and calculate the ideal Kohn-Sham to GW scissor operator. We need to select the index of the top valence band:&lt;br /&gt;
&lt;br /&gt;
 n_top_vb = 4&lt;br /&gt;
 ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&lt;br /&gt;
Yambopy displays the fitting and also the data of the slope of each fitting. Notice that this is also a test if the GW calculations are running well. &#039;&#039;&#039;If the dependence is not linear you should double-check your results!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
In this case the slope is:&lt;br /&gt;
&lt;br /&gt;
 valence bands:&lt;br /&gt;
 slope:     1.0515886598785766&lt;br /&gt;
 conduction bands:&lt;br /&gt;
 slope:     1.026524081134514&lt;br /&gt;
 scissor list (shift,c,v) [eV,adim,adim]: [1.8985204833551723, 1.026524081134514, 1.0515886598785766]&lt;br /&gt;
&lt;br /&gt;
In addition to the scissor operator, we can plot the GW (and DFT) band structure along the path. The first choice would be to plot the actual GW calculations, without interpolation, to check that the results are meaningful (or not). This plot is independent of the number of k-points (&#039;&#039;&#039;npoints&#039;&#039;&#039;) that we want to put in the interpolation. The class YamboQPDB finds the calculated points that belong to the path and plots them. Be aware that if we use coarse grids the class would not find any point and the function will not work.&lt;br /&gt;
&lt;br /&gt;
 ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
 ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
The interpolation of the DFT and GW band structures looks similar:&lt;br /&gt;
&lt;br /&gt;
 ks_bs, qp_bs = ydb.interpolate(lat,path,what=&#039;QP+KS&#039;,lpratio=20)&lt;br /&gt;
 ks_bs.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;lpratio&#039;&#039;&#039; can be increased if the interpolation does not work as well as intended. The interpolation is the same one implemented in abipy and currently requires abipy installed in order to work.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Finally, we can compare the calculated GW eigenvalues with the interpolation.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Pierre</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5766</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5766"/>
		<updated>2022-04-07T21:52:02Z</updated>

		<summary type="html">&lt;p&gt;Pierre: /* Plot atomic orbital projected Band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This tutorial will show you how to visualise wave-function and band-structure related information following a DFT Quantum Espresso calculation using the &amp;quot;qepy&amp;quot; module of Yambopy.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Concerning the ICTP school: recall that for the yambopy tutorials you have to load the yambo, quantum-espresso and anaconda3 modules:&#039;&#039;&#039;&lt;br /&gt;
 spack load yambo&lt;br /&gt;
 spack load quantum-espressp&lt;br /&gt;
 spack load anaconda3&lt;br /&gt;
&#039;&#039;&#039;You can copy the tutorial databases as explained in the virtual machine setup page: &#039;&#039;&#039;&lt;br /&gt;
 cp -r /media/ictpuser/smr3694/ictptutor/YAMBOPY_TUTORIALS ~/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful both to execute Quantum Espresso and to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The qepy class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-processes the data. The class is instanced by doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. In order to plot the bands, we also define the k-points path (in crystal coordinates) using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE band calculations.&lt;br /&gt;
&lt;br /&gt;
In order to show the plot we call the &#039;&#039;&#039;plot_eigen&#039;&#039;&#039; method of the &#039;&#039;&#039;PwXML&#039;&#039;&#039; class:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automatically plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px | center |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively, we can use the function &#039;&#039;&#039;plot_eigen_ax&#039;&#039;&#039;. This functions requires as input a matplotlib &#039;&#039;&#039;figure&#039;&#039;&#039; object with given axes, as you will see in the next example.&lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic wave functions can be displayed using the class &#039;&#039;&#039;ProjwfcXML&#039;&#039;&#039;. &lt;br /&gt;
In order to make quantum espresso calculate the relevant data, we need to use the QE executable &#039;&#039;&#039;projwfc.x&#039;&#039;&#039;, which will create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. This executable projects the Kohn-Sham wavefunctions onto orthogonalized atomic orbitals, among others functionalities. The orbital indexing  and ordering are explained in the input documentation of the projwfc.x function which you are invited to check (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). We can run &#039;&#039;&#039;projwf.x&#039;&#039;&#039; directly from the python script using the qepy class &#039;&#039;&#039;ProjwfcIn&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class &#039;&#039;&#039;PwXML&#039;&#039;&#039;, we then define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the nitrogen (1) and boron (2) orbitals, which according to the projection orderings is given by&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;ProjwfcXML&#039;&#039;&#039; then runs as in this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | center | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). You see that the colormap goes from maximum &#039;&#039;&#039;selected_orbitals&#039;&#039;&#039; content (in this case nitrogen) to the maximum &#039;&#039;&#039;selected_orbitals_2&#039;&#039;&#039; content (in this case boron). &lt;br /&gt;
The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
We can also plot the band orbital charater with size variation instead of a color scale. In this case we have to pass only the variable selected_orbitals (see the next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial a small workflow example to run quantum espresso calculations from scratch. This is done using the classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py for an example. &lt;br /&gt;
Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. After doing all the calculations from scratch with the flows (flow-iron.py), we can make the band plot by running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in the QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this k-point path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. We can use the dot size as a function of the weight of the orbitals, as we have done in this example by selecting exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script), but this time we have a different colormap for each spin polarisation.&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy can be used either to run Yambo and QE calculations, or to analyse the results of QE and Yambo by dealing with their generated databases. This is done with a variety of classes included in the qepy (for QE) or yambopy (for Yambo) modules. &lt;br /&gt;
In the case of Yambo GW quasi-particle calculations, we can use the yambopy class &#039;&#039;&#039;YamboQPDB&#039;&#039;&#039; to read the database produced by the simulation. We can use this to find the scissor operator, plot the GW bands and to interpolate the GW bands on a smoother k-path. The example runs by typing:&lt;br /&gt;
&lt;br /&gt;
 python plot-qp.py&lt;br /&gt;
&lt;br /&gt;
See below for an explanation of the tutorial. As usual, we can import the qepy and yambopy libraries:&lt;br /&gt;
&lt;br /&gt;
  from qepy import *&lt;br /&gt;
  from yambopy import *&lt;br /&gt;
  import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
We define the k-points path.&lt;br /&gt;
  npoints = 10&lt;br /&gt;
  path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
                [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
                [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&lt;br /&gt;
Importantly, the number of points is a free choice. We can increase the variable npoints as we wish, it just means that the interpolation step will take more time. In order to analyse GW results we need to have the file related to the basic data of our Yambo calculation (&#039;&#039;&#039;SAVE/ns.db1&#039;&#039;&#039;) and the netcdf file with the quasi-particle results (&#039;&#039;&#039;ndb.QP&#039;&#039;&#039;). We load the data calling the respective classes:&lt;br /&gt;
&lt;br /&gt;
 # Read Lattice information from SAVE&lt;br /&gt;
 lat  = YamboSaveDB.from_db_file(folder=&#039;SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
 # Read QP database&lt;br /&gt;
 ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;qp-gw&#039;)&lt;br /&gt;
(in the yambopy module, each class is specialised to read a specific Yambo database)&lt;br /&gt;
&lt;br /&gt;
The first option is to plot the energies and calculate the ideal Kohn-Sham to GW scissor operator. We need to select the index of the top valence band:&lt;br /&gt;
&lt;br /&gt;
 n_top_vb = 4&lt;br /&gt;
 ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&lt;br /&gt;
Yambopy displays the fitting and also the data of the slope of each fitting. Notice that this is also a test if the GW calculations are running well. &#039;&#039;&#039;If the dependence is not linear you should double-check your results!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
In this case the slope is:&lt;br /&gt;
&lt;br /&gt;
 valence bands:&lt;br /&gt;
 slope:     1.0515886598785766&lt;br /&gt;
 conduction bands:&lt;br /&gt;
 slope:     1.026524081134514&lt;br /&gt;
 scissor list (shift,c,v) [eV,adim,adim]: [1.8985204833551723, 1.026524081134514, 1.0515886598785766]&lt;br /&gt;
&lt;br /&gt;
In addition to the scissor operator, we can plot the GW (and DFT) band structure along the path. The first choice would be to plot the actual GW calculations, without interpolation, to check that the results are meaningful (or not). This plot is independent of the number of k-points (&#039;&#039;&#039;npoints&#039;&#039;&#039;) that we want to put in the interpolation. The class YamboQPDB finds the calculated points that belong to the path and plots them. Be aware that if we use coarse grids the class would not find any point and the function will not work.&lt;br /&gt;
&lt;br /&gt;
 ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
 ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
The interpolation of the DFT and GW band structures looks similar:&lt;br /&gt;
&lt;br /&gt;
 ks_bs, qp_bs = ydb.interpolate(lat,path,what=&#039;QP+KS&#039;,lpratio=20)&lt;br /&gt;
 ks_bs.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;lpratio&#039;&#039;&#039; can be increased if the interpolation does not work as well as intended. The interpolation is the same one implemented in abipy and currently requires abipy installed in order to work.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Finally, we can compare the calculated GW eigenvalues with the interpolation.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Pierre</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Optical_properties_at_finite_temperature&amp;diff=5754</id>
		<title>Optical properties at finite temperature</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Optical_properties_at_finite_temperature&amp;diff=5754"/>
		<updated>2022-04-07T11:07:03Z</updated>

		<summary type="html">&lt;p&gt;Pierre: /* Result analysis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:High low.png|thumb | 200px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to calculate optical properties including thermal effects due to the electron-phonon coupling.&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial assumes that you have completed all the steps from the previous tutorial on [[Electron Phonon Coupling]].&amp;lt;br&amp;gt;&lt;br /&gt;
The tutorial is dived into different steps first we will calculate absorption at independent particle approximation, &amp;lt;br&amp;gt;then we will include excitonic effects,&lt;br /&gt;
and finally, we will show how to analyze the data.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notice that there are two ways to include finite temperature effects in the BSE&#039;&#039;&#039;:&lt;br /&gt;
* The first is to use a full Bethe-Salpeter equation with all the coupling terms in such a way to treat complex quasi-particles that cannot be handled in standard (Hermitian) BSE, this is explained in section [[https://www.yambo-code.org/wiki/index.php?title=Optical_properties_at_finite_temperature#Bethe-Salpeter_at_finite_temperature_.28diagonalization_solver.29 Bethe-Salpeter at finite temperature (diagonalization solver)]]. This approach has the advantage that one can obtain excitonic eigenvalues and eigenfunctions at finite temperature and not only the optical spectrum.&lt;br /&gt;
 &lt;br /&gt;
* The second method is use of a standard Hermitinan (resonant) BSE plus the inversion solver &amp;lt;ref name=&#039;dbgrid&#039;&amp;gt;D. Kammerlander et al. [https://arxiv.org/abs/1209.1509 Phys. Rev. B &#039;&#039;&#039;86&#039;&#039;&#039;, 125203] &amp;lt;/ref&amp;gt;. In this case, a Lo two-particle Green&#039;s function that contains the complex quasi-particles is used in the solver to get a finite temperature spectrum. This approach has the advantage that can be used with the double-grid but it does not give access to eigenvalues and eigenfunctions of the BSE. This approach is described in the section: [[https://www.yambo-code.org/wiki/index.php?title=Optical_properties_at_finite_temperature#Bethe-Salpeter_at_finite_temperature_.28inversion_solver.29 Bethe-Salpeter at finite temperature (inversion solver)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Absorption at finite temperature ==&lt;br /&gt;
&lt;br /&gt;
Now you repeat the previous calculation but including all k-points, the last 3 valence and the first 3 conduction bands:&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|8|2|7|&lt;br /&gt;
 %&lt;br /&gt;
 ....&lt;br /&gt;
and save the results of the 0K and 300K temperature in two separate folder with the -J option. &lt;br /&gt;
Now you can use the correction to the energy levels and the induced width to calculate the optical absorption at finite temperature. Generate the input with the command  &amp;lt;code&amp;gt;yambo_ph -o c -V qp -F yambo.in_300K&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 chi                              # [R][CHI] Dyson equation for Chi.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                     # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |   &amp;lt;/span&amp;gt;                          # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2 |  7 |  &amp;lt;/span&amp;gt;                         # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.000000 | 5.000000 | &amp;lt;/span&amp;gt;        eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.0100000 | 0.0100000 | &amp;lt;/span&amp;gt;        eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ETStpsXd=  1500  &amp;lt;/span&amp;gt;                  # [Xd] Total Energy steps&lt;br /&gt;
 % LongDrXd&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;XfnQPdb= &amp;quot;E W &amp;lt; T300/ndb.QP&amp;quot; &amp;lt;/span&amp;gt;     # [EXTQP Xd] Database action&lt;br /&gt;
&lt;br /&gt;
set the path of the &#039;&#039;ndb.QP&#039;&#039; you want to read and perform the calculations. Notice that from the QP database we read two quantities the correction to the energy levels  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;E&amp;lt;/span&amp;gt; and the width  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;W&amp;lt;/span&amp;gt;. In this calculation we also included a small smearing 0.01eV to mimic the electronic smearing. Run your calculations with the command: &amp;lt;code&amp;gt;yambo_ph -F yambo.in_300K -J T300&amp;lt;/code&amp;gt; and do the same for the 0K case.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can plot the results with gnuplot using the command: &amp;lt;code&amp;gt; plot &#039;o-T300.eps_q1_ip&#039; w l t &#039;300 K&#039;, &#039;o-T0.eps_q1_ip&#039; w l t &#039;0 K&#039;&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt; Hereafter the result without and with electron-phonon coupling at two different temperatures:&lt;br /&gt;
[[File:Si absorption finite t.png|800px|center |Absorption of bulk silicon at finite temperature]]&lt;br /&gt;
&lt;br /&gt;
The temperature effect is clearly visible in the figure.&lt;br /&gt;
&lt;br /&gt;
== Bethe-Salpeter at finite temperature (diagonalization solver) ==&lt;br /&gt;
&lt;br /&gt;
In this section we will calculate the Bethe-Salpeter at finite temperature using the full-BSE.&lt;br /&gt;
&lt;br /&gt;
You can generate the input using the command &amp;lt;code&amp;gt;yambo_ph -X s -o b -k sex -y d -V qp -F yambo.in_BSE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BSEmod= &amp;quot;coupling&amp;quot;      &amp;lt;/span&amp;gt;         # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  9257            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot;  &amp;lt;/span&amp;gt;     # [EXTQP BSK BSS] Database action&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.500000 | 1.000000 | 1.000000 |  &amp;lt;/span&amp;gt;      # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] Can be any among abs/jdos/kerr/magn/dich/photolum/esrt&lt;br /&gt;
 BSEdips= &amp;quot;none&amp;quot;                  # [BSS] Can be &amp;quot;trace/none&amp;quot; or &amp;quot;xy/xz/yz&amp;quot; to define off-diagonal rotation plane&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2 |  7 |&amp;lt;/span&amp;gt;                           # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 | 5.000000 |&amp;lt;/span&amp;gt;         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.010000 | 0.010000 | &amp;lt;/span&amp;gt;        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BEnSteps= 1500    &amp;lt;/span&amp;gt;               # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 #WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
   1 | 12 |                           # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NGsBlkXs= 113                RL &amp;lt;/span&amp;gt;   # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 XTermKind= &amp;quot;none&amp;quot;                # [X] X terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze)  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this input file we asked Yambo to include finite temperature quasi-particle in the BSE with the line &amp;lt;code&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot; &amp;lt;/code&amp;gt;, notice that we also introduce an additional rigid shift of 0.5 eV to mimic the GW correction with the line &amp;lt;code&amp;gt; 0.500000 | 1.000000 | 1.000000 |  \# [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&amp;lt;/code&amp;gt;. You can now run the calculation with the command &amp;lt;code&amp;gt; yambo_ph -F yambo.in_BSE -J T0_BSE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In principle you can calculate the GW correction following the [https://www.yambo-code.org/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN this tutorial] and then merge the corresponding ndb.QP database with the one of the electron-phonon coupling using the command &amp;lt;code&amp;gt; ypp -qpdb m&amp;lt;/code&amp;gt;.&lt;br /&gt;
Notice that we changed the BSE type to &amp;quot;coupling&amp;quot; because you need the full Bethe-Salpeter to deal with complex quasi-particles.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we do the same calculation at T = 300 K. Copy the previous input file &amp;lt;code&amp;gt; cp yambo.in_BSE yambo.in_BSE_300&amp;lt;/code&amp;gt;. Then modify where the code reads the QP database :&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T300/ndb.QP&amp;quot;  &amp;lt;/span&amp;gt;     # [EXTQP BSK BSS] Database action&lt;br /&gt;
Run the command with &amp;lt;code&amp;gt;yambo_ph -F yambo.in_BSE_300 -J T300_BSE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finally, you should be able to plot the absorption spectra from the outputs in gnuplot :&lt;br /&gt;
 &amp;lt;code&amp;gt; plot &#039;o-T0_BSE.eps_q1_diago_bse&#039; w l t &#039;0 K&#039;, &#039;o-T300_BSE.eps_q1_diago_bse&#039; w l t &#039;300 K&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Si bse optics.png|800px|center |Bethe-Salpeter at finite temperature for bulk silicom]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Approximations:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In this calculation we have made different approximations:&amp;lt;br&amp;gt;&lt;br /&gt;
1) we did not include the renormalization of excitons due to the change of the screening potential W with temperature. Including electron-phonon coupling&lt;br /&gt;
in the dielectric constant by changing the line &amp;lt;code&amp;gt; XfnQPdb= &amp;quot;none&amp;quot; &amp;lt;/code&amp;gt; is unfortunately not enough, for a discussion see ref. &amp;lt;ref&amp;gt;L. Adamska and P. Umari, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.103.075201 Phys. Rev. B &#039;&#039;&#039;103&#039;&#039;&#039;, 075201 (2021)] &amp;lt;/ref&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2) The electron-phonon coupling should enter in the BSE through the exciton-phonon matrix elements and not from the single-particle self-energy, as we have done in this tutorial. The approximation used in this tutorial is valid for not too strong bound excitons, and in general it generated a finite life-time also for the lowest exciton in direct materials that is not correct. For a discussion see refs.&amp;lt;ref&amp;gt;G. Antonius, S. G. Louie [https://arxiv.org/abs/1705.04245 Phys. Rev. B &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;claudio&#039;&amp;gt; see Supp. Mat. of [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;fulvio&#039;&amp;gt;F. Paleari, [https://orbilu.uni.lu/handle/10993/41058 Phd Thesis (2019)]&amp;lt;/ref&amp;gt; and &amp;lt;ref&amp;gt;H. Chen, D. Sangalli, and M. Bernardi [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
3) we did not include scattering between exciton and phonons, therefore our results do not contain phonon-assisted absorption peaks, you can include these terms by finite difference displacements see refs. &amp;lt;ref name=&#039;fulvio&#039;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Result analysis ==&lt;br /&gt;
Results of BSE at finite temperature can be analized in the same way of standard BSE. You can plot exciton binging energy as a function of the temperature, exciton wave-function and so, see [https://www.yambo-code.org/wiki/index.php?title=How_to_analyse_excitons Exciton Plot tutorial].&lt;br /&gt;
For example if you sort exciton with the command &amp;lt;code&amp;gt; ypp_ph -e s -J T0_BSE&amp;lt;/code&amp;gt; for the case T=0K, in addition to the exciton energy now you will find its line-width in the files .&lt;br /&gt;
&amp;lt;code&amp;gt;o-T0_BSE.exc_qpt1_E_sorted&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;o-T0_BSE.exc_qpt1_I_sorted&amp;lt;/code&amp;gt;.&lt;br /&gt;
 #&lt;br /&gt;
 #    Maximum Residual Value = .77136E+05&lt;br /&gt;
 #   &lt;br /&gt;
 #    E [ev]             Strength           Index              W [meV]&lt;br /&gt;
 #&lt;br /&gt;
 ...............&lt;br /&gt;
     2.82974172        0.388171151E-1      335.000000         11.9707289&lt;br /&gt;
     2.82976580        0.110338017         334.000000         11.9676380&lt;br /&gt;
     2.82979798        0.992550552         333.000000         11.9646358&lt;br /&gt;
     2.83366466        0.177820283E-2      336.000000         6.12744808&lt;br /&gt;
     2.83368802        0.183327938E-3      338.000000         6.12689734&lt;br /&gt;
     2.83369708        0.679280609E-3      337.000000         6.12836981&lt;br /&gt;
     2.87943292        0.146849517E-3      332.000000         2.51892495&lt;br /&gt;
     2.87945318        0.295515812E-3      331.000000         2.51745558&lt;br /&gt;
     2.89804840        0.539837289E-3      330.000000         1.42265606&lt;br /&gt;
     2.93557525        0.532299697         329.000000         12.5491867&lt;br /&gt;
     2.93559408        0.214365616         391.000000         12.5504198&lt;br /&gt;
     2.93561029        0.175688639         390.000000         12.5498590&lt;br /&gt;
     2.97320676        0.158064649E-3      388.000000         9.35168839&lt;br /&gt;
     2.97321057        0.300355150E-4      408.000000         9.35530090&lt;br /&gt;
     2.97321224        0.931323011E-4      389.000000         9.35327435&lt;br /&gt;
     2.97682190        0.551215744E-4      405.000000         8.87609196&lt;br /&gt;
&lt;br /&gt;
Notice that in the files you will find many exciton with negative energy due the full-BSE nature, finally consider line-width numbers with care due to the approximation described above.&lt;br /&gt;
&lt;br /&gt;
== Excitonic Eliashberg Functions ==&lt;br /&gt;
If you run the BSE and save the excitonic wave-functions (uncomment the flag &amp;lt;code&amp;gt;WRbsWF&amp;lt;/code&amp;gt; in the BSE input file), tt is possible to plot the excitonic Eliashberg Functions with the command &amp;lt;code&amp;gt; ypp_ph -e e&amp;lt;/code&amp;gt;.&lt;br /&gt;
For an interpretation of these functions see the discussion in reference &amp;lt;ref&amp;gt;Andrea Marini&lt;br /&gt;
 [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;, 106405 (2008)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bethe-Salpeter at finite temperature (inversion solver) ==&lt;br /&gt;
&lt;br /&gt;
It is possible to take into account complex quasi-particles in the BSE solution by means of the inversion procedure.&lt;br /&gt;
The idea is to construct an Lo (Eq. 5 of Ref.&amp;lt;ref name=&#039;dbgrid&#039;&amp;gt;&amp;lt;/ref&amp;gt;) that includes the electron-phonon corrections including the imaginary part.&lt;br /&gt;
In order to generate the input you can type: &amp;lt;code&amp;gt;yambo_ph -X s -o b -k sex -y i -V qp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;i&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  9257            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;       # [EXTQP BSK BSS] Database action&lt;br /&gt;
 KfnQP_INTERP_NN= 1               # [EXTQP BSK BSS] Interpolation neighbours (NN mode)&lt;br /&gt;
 KfnQP_INTERP_shells= 20.00000    # [EXTQP BSK BSS] Interpolation shells (BOLTZ mode)&lt;br /&gt;
 KfnQP_DbGd_INTERP_mode= &amp;quot;NN&amp;quot;     # [EXTQP BSK BSS] Interpolation DbGd mode&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.500000 | 1.000000 | 1.000000 |  &amp;lt;/span&amp;gt;      # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   2 |  7 |  &amp;lt;/span&amp;gt;                         # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.00000 | 5.00000 | &amp;lt;/span&amp;gt;        eV    # [BSS] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.010000 | 0.010000 |  &amp;lt;/span&amp;gt;       eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BEnSteps= 1500  &amp;lt;/span&amp;gt;                  # [BSS] Energy steps&lt;br /&gt;
 % BLongDir &lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 #WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 XfnQPdb= &amp;quot;none&amp;quot;                  # [EXTQP Xd] Database action&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
   1 | 12 |                           # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 113              RL    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 XTermKind= &amp;quot;none&amp;quot;                # [X] X terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze)&lt;br /&gt;
&lt;br /&gt;
then if you run the job you will get the spectrum at finite temperature. Notice that with the inversion solver you can choose if you want the BSE with or without the coupling by changing the &amp;lt;code&amp;gt;BSEmod&amp;lt;/code&amp;gt; variable.&lt;br /&gt;
This approach can be combined with double-grid as explained here: [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method with Yambo ]. Yambo automatically will interpolate quasi-particle corrections on the fine grid. &amp;lt;br&amp;gt; Notice that BSE inversion can become unfeasible for large BSE matrices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Nota bene:&amp;lt;/span&amp;gt; if you use the inversion solver you just get the optical spectra, but you do not have access to the excitonic eigenvalues and eigenvectors and by consequence you cannot plot the excitonic wave-function or print the  excitonic Eliashberg functions.&lt;br /&gt;
&lt;br /&gt;
== Phonon-assisted density of states ==&lt;br /&gt;
Even if exciton-phonon scattering is not included in the BSE at finite temperature, it is possible to plot the phonon-assisted density of states (DOS) for light emission, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:Formula exc ph.png | 600px | center | Phonon-assisted JDOS ]]&lt;br /&gt;
&lt;br /&gt;
where &#039;&#039;&#039;E&amp;lt;sub&amp;gt;q&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;l&amp;lt;/sup&amp;gt;&#039;&#039;&#039; is the energy of the &#039;&#039;&#039;l&#039;&#039;&#039;-exciton at &#039;&#039;&#039;q&#039;&#039;&#039;-momentum,  &#039;&#039;&#039;ω&amp;lt;sub&amp;gt;q&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;λ&amp;lt;/sup&amp;gt;&#039;&#039;&#039; is the phonon energy, &#039;&#039;&#039;n&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&#039;&#039;&#039; is the Bose function,  exciton are weighted with a Boltzamn factor and &#039;&#039;&#039;E&amp;lt;sub&amp;gt;min&amp;lt;/sub&amp;gt;&#039;&#039;&#039; is the lowest exciton energy in the all BZ.&lt;br /&gt;
In order to calculate these DOS you need to solve BSE for all the q-points for the lowest excitons, you can use SLEPC library to speed up calculations, then you need a converged phonon calculations.&lt;br /&gt;
Then you interpolate phonon on a dense phonon grid using &amp;lt;code&amp;gt;matdyn.x&amp;lt;/code&amp;gt; utility in QE, and Yambo will interpolate exicton on the same grid.&lt;br /&gt;
Here we present an example for hBN that is an indirect semiconductor.&lt;br /&gt;
Running &amp;lt;code&amp;gt; ypp_ph -e p&amp;lt;/code&amp;gt; you will get:&lt;br /&gt;
 &lt;br /&gt;
 BoseTemp= 50 K    # Bosonic Temperature&lt;br /&gt;
 excitons                         # [R] Excitonic properties&lt;br /&gt;
 ph_ass_dos                       # [R] Phonon-assisted DOS&lt;br /&gt;
 States= &amp;quot;1 - 4&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 PHfreqF= &amp;quot;./bn.freq_54&amp;quot;            # PWscf format file containing the phonon frequencies&lt;br /&gt;
 % DOSERange&lt;br /&gt;
  5.000000 | 5.500000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DOSESteps= 1000                  # Energy steps&lt;br /&gt;
 DOS_broad= 0.004        eV    # Broadening of the DOS &lt;br /&gt;
&lt;br /&gt;
where &amp;quot;bn.freq_54&amp;quot; is the file produced by matdyn.x with the input:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;input&lt;br /&gt;
     asr=&#039;simple&#039;,&lt;br /&gt;
     flfrc=&#039;bn.fc&#039;,&lt;br /&gt;
     flfrq=&#039;bn.freq_54&#039;,&lt;br /&gt;
     dos=.true.,&lt;br /&gt;
     fldos=&#039;bn.dos&#039;,&lt;br /&gt;
     ndos=2&lt;br /&gt;
     nk1=54, nk2=54, nk3=18&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
and the BSE was calculated on a 18x18x6 grid. The final spectra will be:&lt;br /&gt;
&lt;br /&gt;
[[File:Test dos pl bulk.png| 700px | center| Phonon-assisted JDOS]]&lt;br /&gt;
&lt;br /&gt;
where the DOS has been shifted to match the experimental peaks. Notice that the peak intensities are complitely off, because of the lack of the exciton-phonon matrix elements.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Pierre</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Optical_properties_at_finite_temperature&amp;diff=5752</id>
		<title>Optical properties at finite temperature</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Optical_properties_at_finite_temperature&amp;diff=5752"/>
		<updated>2022-04-07T11:05:05Z</updated>

		<summary type="html">&lt;p&gt;Pierre: /* Result analysis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:High low.png|thumb | 200px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to calculate optical properties including thermal effects due to the electron-phonon coupling.&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial assumes that you have completed all the steps from the previous tutorial on [[Electron Phonon Coupling]].&amp;lt;br&amp;gt;&lt;br /&gt;
The tutorial is dived into different steps first we will calculate absorption at independent particle approximation, &amp;lt;br&amp;gt;then we will include excitonic effects,&lt;br /&gt;
and finally, we will show how to analyze the data.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notice that there are two ways to include finite temperature effects in the BSE&#039;&#039;&#039;:&lt;br /&gt;
* The first is to use a full Bethe-Salpeter equation with all the coupling terms in such a way to treat complex quasi-particles that cannot be handled in standard (Hermitian) BSE, this is explained in section [[https://www.yambo-code.org/wiki/index.php?title=Optical_properties_at_finite_temperature#Bethe-Salpeter_at_finite_temperature_.28diagonalization_solver.29 Bethe-Salpeter at finite temperature (diagonalization solver)]]. This approach has the advantage that one can obtain excitonic eigenvalues and eigenfunctions at finite temperature and not only the optical spectrum.&lt;br /&gt;
 &lt;br /&gt;
* The second method is use of a standard Hermitinan (resonant) BSE plus the inversion solver &amp;lt;ref name=&#039;dbgrid&#039;&amp;gt;D. Kammerlander et al. [https://arxiv.org/abs/1209.1509 Phys. Rev. B &#039;&#039;&#039;86&#039;&#039;&#039;, 125203] &amp;lt;/ref&amp;gt;. In this case, a Lo two-particle Green&#039;s function that contains the complex quasi-particles is used in the solver to get a finite temperature spectrum. This approach has the advantage that can be used with the double-grid but it does not give access to eigenvalues and eigenfunctions of the BSE. This approach is described in the section: [[https://www.yambo-code.org/wiki/index.php?title=Optical_properties_at_finite_temperature#Bethe-Salpeter_at_finite_temperature_.28inversion_solver.29 Bethe-Salpeter at finite temperature (inversion solver)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Absorption at finite temperature ==&lt;br /&gt;
&lt;br /&gt;
Now you repeat the previous calculation but including all k-points, the last 3 valence and the first 3 conduction bands:&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|8|2|7|&lt;br /&gt;
 %&lt;br /&gt;
 ....&lt;br /&gt;
and save the results of the 0K and 300K temperature in two separate folder with the -J option. &lt;br /&gt;
Now you can use the correction to the energy levels and the induced width to calculate the optical absorption at finite temperature. Generate the input with the command  &amp;lt;code&amp;gt;yambo_ph -o c -V qp -F yambo.in_300K&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 chi                              # [R][CHI] Dyson equation for Chi.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                     # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |   &amp;lt;/span&amp;gt;                          # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2 |  7 |  &amp;lt;/span&amp;gt;                         # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.000000 | 5.000000 | &amp;lt;/span&amp;gt;        eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.0100000 | 0.0100000 | &amp;lt;/span&amp;gt;        eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ETStpsXd=  1500  &amp;lt;/span&amp;gt;                  # [Xd] Total Energy steps&lt;br /&gt;
 % LongDrXd&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;XfnQPdb= &amp;quot;E W &amp;lt; T300/ndb.QP&amp;quot; &amp;lt;/span&amp;gt;     # [EXTQP Xd] Database action&lt;br /&gt;
&lt;br /&gt;
set the path of the &#039;&#039;ndb.QP&#039;&#039; you want to read and perform the calculations. Notice that from the QP database we read two quantities the correction to the energy levels  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;E&amp;lt;/span&amp;gt; and the width  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;W&amp;lt;/span&amp;gt;. In this calculation we also included a small smearing 0.01eV to mimic the electronic smearing. Run your calculations with the command: &amp;lt;code&amp;gt;yambo_ph -F yambo.in_300K -J T300&amp;lt;/code&amp;gt; and do the same for the 0K case.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can plot the results with gnuplot using the command: &amp;lt;code&amp;gt; plot &#039;o-T300.eps_q1_ip&#039; w l t &#039;300 K&#039;, &#039;o-T0.eps_q1_ip&#039; w l t &#039;0 K&#039;&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt; Hereafter the result without and with electron-phonon coupling at two different temperatures:&lt;br /&gt;
[[File:Si absorption finite t.png|800px|center |Absorption of bulk silicon at finite temperature]]&lt;br /&gt;
&lt;br /&gt;
The temperature effect is clearly visible in the figure.&lt;br /&gt;
&lt;br /&gt;
== Bethe-Salpeter at finite temperature (diagonalization solver) ==&lt;br /&gt;
&lt;br /&gt;
In this section we will calculate the Bethe-Salpeter at finite temperature using the full-BSE.&lt;br /&gt;
&lt;br /&gt;
You can generate the input using the command &amp;lt;code&amp;gt;yambo_ph -X s -o b -k sex -y d -V qp -F yambo.in_BSE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BSEmod= &amp;quot;coupling&amp;quot;      &amp;lt;/span&amp;gt;         # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  9257            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot;  &amp;lt;/span&amp;gt;     # [EXTQP BSK BSS] Database action&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.500000 | 1.000000 | 1.000000 |  &amp;lt;/span&amp;gt;      # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] Can be any among abs/jdos/kerr/magn/dich/photolum/esrt&lt;br /&gt;
 BSEdips= &amp;quot;none&amp;quot;                  # [BSS] Can be &amp;quot;trace/none&amp;quot; or &amp;quot;xy/xz/yz&amp;quot; to define off-diagonal rotation plane&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2 |  7 |&amp;lt;/span&amp;gt;                           # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 | 5.000000 |&amp;lt;/span&amp;gt;         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.010000 | 0.010000 | &amp;lt;/span&amp;gt;        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BEnSteps= 1500    &amp;lt;/span&amp;gt;               # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 #WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
   1 | 12 |                           # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NGsBlkXs= 113                RL &amp;lt;/span&amp;gt;   # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 XTermKind= &amp;quot;none&amp;quot;                # [X] X terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze)  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this input file we asked Yambo to include finite temperature quasi-particle in the BSE with the line &amp;lt;code&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot; &amp;lt;/code&amp;gt;, notice that we also introduce an additional rigid shift of 0.5 eV to mimic the GW correction with the line &amp;lt;code&amp;gt; 0.500000 | 1.000000 | 1.000000 |  \# [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&amp;lt;/code&amp;gt;. You can now run the calculation with the command &amp;lt;code&amp;gt; yambo_ph -F yambo.in_BSE -J T0_BSE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In principle you can calculate the GW correction following the [https://www.yambo-code.org/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN this tutorial] and then merge the corresponding ndb.QP database with the one of the electron-phonon coupling using the command &amp;lt;code&amp;gt; ypp -qpdb m&amp;lt;/code&amp;gt;.&lt;br /&gt;
Notice that we changed the BSE type to &amp;quot;coupling&amp;quot; because you need the full Bethe-Salpeter to deal with complex quasi-particles.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we do the same calculation at T = 300 K. Copy the previous input file &amp;lt;code&amp;gt; cp yambo.in_BSE yambo.in_BSE_300&amp;lt;/code&amp;gt;. Then modify where the code reads the QP database :&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T300/ndb.QP&amp;quot;  &amp;lt;/span&amp;gt;     # [EXTQP BSK BSS] Database action&lt;br /&gt;
Run the command with &amp;lt;code&amp;gt;yambo_ph -F yambo.in_BSE_300 -J T300_BSE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finally, you should be able to plot the absorption spectra from the outputs in gnuplot :&lt;br /&gt;
 &amp;lt;code&amp;gt; plot &#039;o-T0_BSE.eps_q1_diago_bse&#039; w l t &#039;0 K&#039;, &#039;o-T300_BSE.eps_q1_diago_bse&#039; w l t &#039;300 K&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Si bse optics.png|800px|center |Bethe-Salpeter at finite temperature for bulk silicom]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Approximations:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In this calculation we have made different approximations:&amp;lt;br&amp;gt;&lt;br /&gt;
1) we did not include the renormalization of excitons due to the change of the screening potential W with temperature. Including electron-phonon coupling&lt;br /&gt;
in the dielectric constant by changing the line &amp;lt;code&amp;gt; XfnQPdb= &amp;quot;none&amp;quot; &amp;lt;/code&amp;gt; is unfortunately not enough, for a discussion see ref. &amp;lt;ref&amp;gt;L. Adamska and P. Umari, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.103.075201 Phys. Rev. B &#039;&#039;&#039;103&#039;&#039;&#039;, 075201 (2021)] &amp;lt;/ref&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2) The electron-phonon coupling should enter in the BSE through the exciton-phonon matrix elements and not from the single-particle self-energy, as we have done in this tutorial. The approximation used in this tutorial is valid for not too strong bound excitons, and in general it generated a finite life-time also for the lowest exciton in direct materials that is not correct. For a discussion see refs.&amp;lt;ref&amp;gt;G. Antonius, S. G. Louie [https://arxiv.org/abs/1705.04245 Phys. Rev. B &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;claudio&#039;&amp;gt; see Supp. Mat. of [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;fulvio&#039;&amp;gt;F. Paleari, [https://orbilu.uni.lu/handle/10993/41058 Phd Thesis (2019)]&amp;lt;/ref&amp;gt; and &amp;lt;ref&amp;gt;H. Chen, D. Sangalli, and M. Bernardi [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
3) we did not include scattering between exciton and phonons, therefore our results do not contain phonon-assisted absorption peaks, you can include these terms by finite difference displacements see refs. &amp;lt;ref name=&#039;fulvio&#039;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Result analysis ==&lt;br /&gt;
Results of BSE at finite temperature can be analized in the same way of standard BSE. You can plot exciton binging energy as a function of the temperature, exciton wave-function and so, see [https://www.yambo-code.org/wiki/index.php?title=How_to_analyse_excitons Exciton Plot tutorial].&lt;br /&gt;
For example if you sort exciton with the command &amp;lt;code&amp;gt; ypp_ph -e s -J T0_BSE&amp;lt;/code&amp;gt; for the case T=0K, in addition to the exciton energy now you will find its line-width in the files .&lt;br /&gt;
&amp;lt;code&amp;gt;o.exc_qpt1_E_sorted&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;o.exc_qpt1_I_sorted&amp;lt;/code&amp;gt;.&lt;br /&gt;
 #&lt;br /&gt;
 #    Maximum Residual Value = .77136E+05&lt;br /&gt;
 #   &lt;br /&gt;
 #    E [ev]             Strength           Index              W [meV]&lt;br /&gt;
 #&lt;br /&gt;
 ...............&lt;br /&gt;
     2.82974172        0.388171151E-1      335.000000         11.9707289&lt;br /&gt;
     2.82976580        0.110338017         334.000000         11.9676380&lt;br /&gt;
     2.82979798        0.992550552         333.000000         11.9646358&lt;br /&gt;
     2.83366466        0.177820283E-2      336.000000         6.12744808&lt;br /&gt;
     2.83368802        0.183327938E-3      338.000000         6.12689734&lt;br /&gt;
     2.83369708        0.679280609E-3      337.000000         6.12836981&lt;br /&gt;
     2.87943292        0.146849517E-3      332.000000         2.51892495&lt;br /&gt;
     2.87945318        0.295515812E-3      331.000000         2.51745558&lt;br /&gt;
     2.89804840        0.539837289E-3      330.000000         1.42265606&lt;br /&gt;
     2.93557525        0.532299697         329.000000         12.5491867&lt;br /&gt;
     2.93559408        0.214365616         391.000000         12.5504198&lt;br /&gt;
     2.93561029        0.175688639         390.000000         12.5498590&lt;br /&gt;
     2.97320676        0.158064649E-3      388.000000         9.35168839&lt;br /&gt;
     2.97321057        0.300355150E-4      408.000000         9.35530090&lt;br /&gt;
     2.97321224        0.931323011E-4      389.000000         9.35327435&lt;br /&gt;
     2.97682190        0.551215744E-4      405.000000         8.87609196&lt;br /&gt;
&lt;br /&gt;
Notice that in the files you will find many exciton with negative energy due the full-BSE nature, finally consider line-width numbers with care due to the approximation described above.&lt;br /&gt;
&lt;br /&gt;
== Excitonic Eliashberg Functions ==&lt;br /&gt;
If you run the BSE and save the excitonic wave-functions (uncomment the flag &amp;lt;code&amp;gt;WRbsWF&amp;lt;/code&amp;gt; in the BSE input file), tt is possible to plot the excitonic Eliashberg Functions with the command &amp;lt;code&amp;gt; ypp_ph -e e&amp;lt;/code&amp;gt;.&lt;br /&gt;
For an interpretation of these functions see the discussion in reference &amp;lt;ref&amp;gt;Andrea Marini&lt;br /&gt;
 [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;, 106405 (2008)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bethe-Salpeter at finite temperature (inversion solver) ==&lt;br /&gt;
&lt;br /&gt;
It is possible to take into account complex quasi-particles in the BSE solution by means of the inversion procedure.&lt;br /&gt;
The idea is to construct an Lo (Eq. 5 of Ref.&amp;lt;ref name=&#039;dbgrid&#039;&amp;gt;&amp;lt;/ref&amp;gt;) that includes the electron-phonon corrections including the imaginary part.&lt;br /&gt;
In order to generate the input you can type: &amp;lt;code&amp;gt;yambo_ph -X s -o b -k sex -y i -V qp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;i&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  9257            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;       # [EXTQP BSK BSS] Database action&lt;br /&gt;
 KfnQP_INTERP_NN= 1               # [EXTQP BSK BSS] Interpolation neighbours (NN mode)&lt;br /&gt;
 KfnQP_INTERP_shells= 20.00000    # [EXTQP BSK BSS] Interpolation shells (BOLTZ mode)&lt;br /&gt;
 KfnQP_DbGd_INTERP_mode= &amp;quot;NN&amp;quot;     # [EXTQP BSK BSS] Interpolation DbGd mode&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.500000 | 1.000000 | 1.000000 |  &amp;lt;/span&amp;gt;      # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   2 |  7 |  &amp;lt;/span&amp;gt;                         # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.00000 | 5.00000 | &amp;lt;/span&amp;gt;        eV    # [BSS] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.010000 | 0.010000 |  &amp;lt;/span&amp;gt;       eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BEnSteps= 1500  &amp;lt;/span&amp;gt;                  # [BSS] Energy steps&lt;br /&gt;
 % BLongDir &lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 #WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 XfnQPdb= &amp;quot;none&amp;quot;                  # [EXTQP Xd] Database action&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
   1 | 12 |                           # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 113              RL    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 XTermKind= &amp;quot;none&amp;quot;                # [X] X terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze)&lt;br /&gt;
&lt;br /&gt;
then if you run the job you will get the spectrum at finite temperature. Notice that with the inversion solver you can choose if you want the BSE with or without the coupling by changing the &amp;lt;code&amp;gt;BSEmod&amp;lt;/code&amp;gt; variable.&lt;br /&gt;
This approach can be combined with double-grid as explained here: [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method with Yambo ]. Yambo automatically will interpolate quasi-particle corrections on the fine grid. &amp;lt;br&amp;gt; Notice that BSE inversion can become unfeasible for large BSE matrices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Nota bene:&amp;lt;/span&amp;gt; if you use the inversion solver you just get the optical spectra, but you do not have access to the excitonic eigenvalues and eigenvectors and by consequence you cannot plot the excitonic wave-function or print the  excitonic Eliashberg functions.&lt;br /&gt;
&lt;br /&gt;
== Phonon-assisted density of states ==&lt;br /&gt;
Even if exciton-phonon scattering is not included in the BSE at finite temperature, it is possible to plot the phonon-assisted density of states (DOS) for light emission, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:Formula exc ph.png | 600px | center | Phonon-assisted JDOS ]]&lt;br /&gt;
&lt;br /&gt;
where &#039;&#039;&#039;E&amp;lt;sub&amp;gt;q&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;l&amp;lt;/sup&amp;gt;&#039;&#039;&#039; is the energy of the &#039;&#039;&#039;l&#039;&#039;&#039;-exciton at &#039;&#039;&#039;q&#039;&#039;&#039;-momentum,  &#039;&#039;&#039;ω&amp;lt;sub&amp;gt;q&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;λ&amp;lt;/sup&amp;gt;&#039;&#039;&#039; is the phonon energy, &#039;&#039;&#039;n&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&#039;&#039;&#039; is the Bose function,  exciton are weighted with a Boltzamn factor and &#039;&#039;&#039;E&amp;lt;sub&amp;gt;min&amp;lt;/sub&amp;gt;&#039;&#039;&#039; is the lowest exciton energy in the all BZ.&lt;br /&gt;
In order to calculate these DOS you need to solve BSE for all the q-points for the lowest excitons, you can use SLEPC library to speed up calculations, then you need a converged phonon calculations.&lt;br /&gt;
Then you interpolate phonon on a dense phonon grid using &amp;lt;code&amp;gt;matdyn.x&amp;lt;/code&amp;gt; utility in QE, and Yambo will interpolate exicton on the same grid.&lt;br /&gt;
Here we present an example for hBN that is an indirect semiconductor.&lt;br /&gt;
Running &amp;lt;code&amp;gt; ypp_ph -e p&amp;lt;/code&amp;gt; you will get:&lt;br /&gt;
 &lt;br /&gt;
 BoseTemp= 50 K    # Bosonic Temperature&lt;br /&gt;
 excitons                         # [R] Excitonic properties&lt;br /&gt;
 ph_ass_dos                       # [R] Phonon-assisted DOS&lt;br /&gt;
 States= &amp;quot;1 - 4&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 PHfreqF= &amp;quot;./bn.freq_54&amp;quot;            # PWscf format file containing the phonon frequencies&lt;br /&gt;
 % DOSERange&lt;br /&gt;
  5.000000 | 5.500000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DOSESteps= 1000                  # Energy steps&lt;br /&gt;
 DOS_broad= 0.004        eV    # Broadening of the DOS &lt;br /&gt;
&lt;br /&gt;
where &amp;quot;bn.freq_54&amp;quot; is the file produced by matdyn.x with the input:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;input&lt;br /&gt;
     asr=&#039;simple&#039;,&lt;br /&gt;
     flfrc=&#039;bn.fc&#039;,&lt;br /&gt;
     flfrq=&#039;bn.freq_54&#039;,&lt;br /&gt;
     dos=.true.,&lt;br /&gt;
     fldos=&#039;bn.dos&#039;,&lt;br /&gt;
     ndos=2&lt;br /&gt;
     nk1=54, nk2=54, nk3=18&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
and the BSE was calculated on a 18x18x6 grid. The final spectra will be:&lt;br /&gt;
&lt;br /&gt;
[[File:Test dos pl bulk.png| 700px | center| Phonon-assisted JDOS]]&lt;br /&gt;
&lt;br /&gt;
where the DOS has been shifted to match the experimental peaks. Notice that the peak intensities are complitely off, because of the lack of the exciton-phonon matrix elements.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Pierre</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Optical_properties_at_finite_temperature&amp;diff=5751</id>
		<title>Optical properties at finite temperature</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Optical_properties_at_finite_temperature&amp;diff=5751"/>
		<updated>2022-04-07T11:03:04Z</updated>

		<summary type="html">&lt;p&gt;Pierre: /* Bethe-Salpeter at finite temperature (diagonalization solver) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:High low.png|thumb | 200px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will show you how to calculate optical properties including thermal effects due to the electron-phonon coupling.&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial assumes that you have completed all the steps from the previous tutorial on [[Electron Phonon Coupling]].&amp;lt;br&amp;gt;&lt;br /&gt;
The tutorial is dived into different steps first we will calculate absorption at independent particle approximation, &amp;lt;br&amp;gt;then we will include excitonic effects,&lt;br /&gt;
and finally, we will show how to analyze the data.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notice that there are two ways to include finite temperature effects in the BSE&#039;&#039;&#039;:&lt;br /&gt;
* The first is to use a full Bethe-Salpeter equation with all the coupling terms in such a way to treat complex quasi-particles that cannot be handled in standard (Hermitian) BSE, this is explained in section [[https://www.yambo-code.org/wiki/index.php?title=Optical_properties_at_finite_temperature#Bethe-Salpeter_at_finite_temperature_.28diagonalization_solver.29 Bethe-Salpeter at finite temperature (diagonalization solver)]]. This approach has the advantage that one can obtain excitonic eigenvalues and eigenfunctions at finite temperature and not only the optical spectrum.&lt;br /&gt;
 &lt;br /&gt;
* The second method is use of a standard Hermitinan (resonant) BSE plus the inversion solver &amp;lt;ref name=&#039;dbgrid&#039;&amp;gt;D. Kammerlander et al. [https://arxiv.org/abs/1209.1509 Phys. Rev. B &#039;&#039;&#039;86&#039;&#039;&#039;, 125203] &amp;lt;/ref&amp;gt;. In this case, a Lo two-particle Green&#039;s function that contains the complex quasi-particles is used in the solver to get a finite temperature spectrum. This approach has the advantage that can be used with the double-grid but it does not give access to eigenvalues and eigenfunctions of the BSE. This approach is described in the section: [[https://www.yambo-code.org/wiki/index.php?title=Optical_properties_at_finite_temperature#Bethe-Salpeter_at_finite_temperature_.28inversion_solver.29 Bethe-Salpeter at finite temperature (inversion solver)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Absorption at finite temperature ==&lt;br /&gt;
&lt;br /&gt;
Now you repeat the previous calculation but including all k-points, the last 3 valence and the first 3 conduction bands:&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|8|2|7|&lt;br /&gt;
 %&lt;br /&gt;
 ....&lt;br /&gt;
and save the results of the 0K and 300K temperature in two separate folder with the -J option. &lt;br /&gt;
Now you can use the correction to the energy levels and the induced width to calculate the optical absorption at finite temperature. Generate the input with the command  &amp;lt;code&amp;gt;yambo_ph -o c -V qp -F yambo.in_300K&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 chi                              # [R][CHI] Dyson equation for Chi.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                     # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |   &amp;lt;/span&amp;gt;                          # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2 |  7 |  &amp;lt;/span&amp;gt;                         # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.000000 | 5.000000 | &amp;lt;/span&amp;gt;        eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.0100000 | 0.0100000 | &amp;lt;/span&amp;gt;        eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ETStpsXd=  1500  &amp;lt;/span&amp;gt;                  # [Xd] Total Energy steps&lt;br /&gt;
 % LongDrXd&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;XfnQPdb= &amp;quot;E W &amp;lt; T300/ndb.QP&amp;quot; &amp;lt;/span&amp;gt;     # [EXTQP Xd] Database action&lt;br /&gt;
&lt;br /&gt;
set the path of the &#039;&#039;ndb.QP&#039;&#039; you want to read and perform the calculations. Notice that from the QP database we read two quantities the correction to the energy levels  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;E&amp;lt;/span&amp;gt; and the width  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;W&amp;lt;/span&amp;gt;. In this calculation we also included a small smearing 0.01eV to mimic the electronic smearing. Run your calculations with the command: &amp;lt;code&amp;gt;yambo_ph -F yambo.in_300K -J T300&amp;lt;/code&amp;gt; and do the same for the 0K case.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;You can plot the results with gnuplot using the command: &amp;lt;code&amp;gt; plot &#039;o-T300.eps_q1_ip&#039; w l t &#039;300 K&#039;, &#039;o-T0.eps_q1_ip&#039; w l t &#039;0 K&#039;&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt; Hereafter the result without and with electron-phonon coupling at two different temperatures:&lt;br /&gt;
[[File:Si absorption finite t.png|800px|center |Absorption of bulk silicon at finite temperature]]&lt;br /&gt;
&lt;br /&gt;
The temperature effect is clearly visible in the figure.&lt;br /&gt;
&lt;br /&gt;
== Bethe-Salpeter at finite temperature (diagonalization solver) ==&lt;br /&gt;
&lt;br /&gt;
In this section we will calculate the Bethe-Salpeter at finite temperature using the full-BSE.&lt;br /&gt;
&lt;br /&gt;
You can generate the input using the command &amp;lt;code&amp;gt;yambo_ph -X s -o b -k sex -y d -V qp -F yambo.in_BSE&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BSEmod= &amp;quot;coupling&amp;quot;      &amp;lt;/span&amp;gt;         # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  9257            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot;  &amp;lt;/span&amp;gt;     # [EXTQP BSK BSS] Database action&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.500000 | 1.000000 | 1.000000 |  &amp;lt;/span&amp;gt;      # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] Can be any among abs/jdos/kerr/magn/dich/photolum/esrt&lt;br /&gt;
 BSEdips= &amp;quot;none&amp;quot;                  # [BSS] Can be &amp;quot;trace/none&amp;quot; or &amp;quot;xy/xz/yz&amp;quot; to define off-diagonal rotation plane&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2 |  7 |&amp;lt;/span&amp;gt;                           # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 | 5.000000 |&amp;lt;/span&amp;gt;         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.010000 | 0.010000 | &amp;lt;/span&amp;gt;        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BEnSteps= 1500    &amp;lt;/span&amp;gt;               # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 #WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
   1 | 12 |                           # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NGsBlkXs= 113                RL &amp;lt;/span&amp;gt;   # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 XTermKind= &amp;quot;none&amp;quot;                # [X] X terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze)  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this input file we asked Yambo to include finite temperature quasi-particle in the BSE with the line &amp;lt;code&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot; &amp;lt;/code&amp;gt;, notice that we also introduce an additional rigid shift of 0.5 eV to mimic the GW correction with the line &amp;lt;code&amp;gt; 0.500000 | 1.000000 | 1.000000 |  \# [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&amp;lt;/code&amp;gt;. You can now run the calculation with the command &amp;lt;code&amp;gt; yambo_ph -F yambo.in_BSE -J T0_BSE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In principle you can calculate the GW correction following the [https://www.yambo-code.org/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN this tutorial] and then merge the corresponding ndb.QP database with the one of the electron-phonon coupling using the command &amp;lt;code&amp;gt; ypp -qpdb m&amp;lt;/code&amp;gt;.&lt;br /&gt;
Notice that we changed the BSE type to &amp;quot;coupling&amp;quot; because you need the full Bethe-Salpeter to deal with complex quasi-particles.&amp;lt;br&amp;gt;&lt;br /&gt;
Now we do the same calculation at T = 300 K. Copy the previous input file &amp;lt;code&amp;gt; cp yambo.in_BSE yambo.in_BSE_300&amp;lt;/code&amp;gt;. Then modify where the code reads the QP database :&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T300/ndb.QP&amp;quot;  &amp;lt;/span&amp;gt;     # [EXTQP BSK BSS] Database action&lt;br /&gt;
Run the command with &amp;lt;code&amp;gt;yambo_ph -F yambo.in_BSE_300 -J T300_BSE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finally, you should be able to plot the absorption spectra from the outputs in gnuplot :&lt;br /&gt;
 &amp;lt;code&amp;gt; plot &#039;o-T0_BSE.eps_q1_diago_bse&#039; w l t &#039;0 K&#039;, &#039;o-T300_BSE.eps_q1_diago_bse&#039; w l t &#039;300 K&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:Si bse optics.png|800px|center |Bethe-Salpeter at finite temperature for bulk silicom]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Approximations:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In this calculation we have made different approximations:&amp;lt;br&amp;gt;&lt;br /&gt;
1) we did not include the renormalization of excitons due to the change of the screening potential W with temperature. Including electron-phonon coupling&lt;br /&gt;
in the dielectric constant by changing the line &amp;lt;code&amp;gt; XfnQPdb= &amp;quot;none&amp;quot; &amp;lt;/code&amp;gt; is unfortunately not enough, for a discussion see ref. &amp;lt;ref&amp;gt;L. Adamska and P. Umari, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.103.075201 Phys. Rev. B &#039;&#039;&#039;103&#039;&#039;&#039;, 075201 (2021)] &amp;lt;/ref&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
2) The electron-phonon coupling should enter in the BSE through the exciton-phonon matrix elements and not from the single-particle self-energy, as we have done in this tutorial. The approximation used in this tutorial is valid for not too strong bound excitons, and in general it generated a finite life-time also for the lowest exciton in direct materials that is not correct. For a discussion see refs.&amp;lt;ref&amp;gt;G. Antonius, S. G. Louie [https://arxiv.org/abs/1705.04245 Phys. Rev. B &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;claudio&#039;&amp;gt; see Supp. Mat. of [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&#039;fulvio&#039;&amp;gt;F. Paleari, [https://orbilu.uni.lu/handle/10993/41058 Phd Thesis (2019)]&amp;lt;/ref&amp;gt; and &amp;lt;ref&amp;gt;H. Chen, D. Sangalli, and M. Bernardi [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
3) we did not include scattering between exciton and phonons, therefore our results do not contain phonon-assisted absorption peaks, you can include these terms by finite difference displacements see refs. &amp;lt;ref name=&#039;fulvio&#039;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Result analysis ==&lt;br /&gt;
Results of BSE at finite temperature can be analized in the same way of standard BSE. You can plot exciton binging energy as a function of the temperature, exciton wave-function and so, see [https://www.yambo-code.org/wiki/index.php?title=How_to_analyse_excitons Exciton Plot tutorial].&lt;br /&gt;
For example if you sort exciton with the command &amp;lt;code&amp;gt; ypp_ph -e s&amp;lt;/code&amp;gt; for the case T=0K, in addition to the exciton energy now you will find its line-width in the files .&lt;br /&gt;
&amp;lt;code&amp;gt;o.exc_qpt1_E_sorted&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;o.exc_qpt1_I_sorted&amp;lt;/code&amp;gt;.&lt;br /&gt;
 #&lt;br /&gt;
 #    Maximum Residual Value = .77136E+05&lt;br /&gt;
 #   &lt;br /&gt;
 #    E [ev]             Strength           Index              W [meV]&lt;br /&gt;
 #&lt;br /&gt;
 ...............&lt;br /&gt;
     2.82974172        0.388171151E-1      335.000000         11.9707289&lt;br /&gt;
     2.82976580        0.110338017         334.000000         11.9676380&lt;br /&gt;
     2.82979798        0.992550552         333.000000         11.9646358&lt;br /&gt;
     2.83366466        0.177820283E-2      336.000000         6.12744808&lt;br /&gt;
     2.83368802        0.183327938E-3      338.000000         6.12689734&lt;br /&gt;
     2.83369708        0.679280609E-3      337.000000         6.12836981&lt;br /&gt;
     2.87943292        0.146849517E-3      332.000000         2.51892495&lt;br /&gt;
     2.87945318        0.295515812E-3      331.000000         2.51745558&lt;br /&gt;
     2.89804840        0.539837289E-3      330.000000         1.42265606&lt;br /&gt;
     2.93557525        0.532299697         329.000000         12.5491867&lt;br /&gt;
     2.93559408        0.214365616         391.000000         12.5504198&lt;br /&gt;
     2.93561029        0.175688639         390.000000         12.5498590&lt;br /&gt;
     2.97320676        0.158064649E-3      388.000000         9.35168839&lt;br /&gt;
     2.97321057        0.300355150E-4      408.000000         9.35530090&lt;br /&gt;
     2.97321224        0.931323011E-4      389.000000         9.35327435&lt;br /&gt;
     2.97682190        0.551215744E-4      405.000000         8.87609196&lt;br /&gt;
&lt;br /&gt;
Notice that in the files you will find many exciton with negative energy due the full-BSE nature, finally consider line-width numbers with care due to the approximation described above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Excitonic Eliashberg Functions ==&lt;br /&gt;
If you run the BSE and save the excitonic wave-functions (uncomment the flag &amp;lt;code&amp;gt;WRbsWF&amp;lt;/code&amp;gt; in the BSE input file), tt is possible to plot the excitonic Eliashberg Functions with the command &amp;lt;code&amp;gt; ypp_ph -e e&amp;lt;/code&amp;gt;.&lt;br /&gt;
For an interpretation of these functions see the discussion in reference &amp;lt;ref&amp;gt;Andrea Marini&lt;br /&gt;
 [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;, 106405 (2008)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bethe-Salpeter at finite temperature (inversion solver) ==&lt;br /&gt;
&lt;br /&gt;
It is possible to take into account complex quasi-particles in the BSE solution by means of the inversion procedure.&lt;br /&gt;
The idea is to construct an Lo (Eq. 5 of Ref.&amp;lt;ref name=&#039;dbgrid&#039;&amp;gt;&amp;lt;/ref&amp;gt;) that includes the electron-phonon corrections including the imaginary part.&lt;br /&gt;
In order to generate the input you can type: &amp;lt;code&amp;gt;yambo_ph -X s -o b -k sex -y i -V qp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;i&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  9257            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E W &amp;lt; T0/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;       # [EXTQP BSK BSS] Database action&lt;br /&gt;
 KfnQP_INTERP_NN= 1               # [EXTQP BSK BSS] Interpolation neighbours (NN mode)&lt;br /&gt;
 KfnQP_INTERP_shells= 20.00000    # [EXTQP BSK BSS] Interpolation shells (BOLTZ mode)&lt;br /&gt;
 KfnQP_DbGd_INTERP_mode= &amp;quot;NN&amp;quot;     # [EXTQP BSK BSS] Interpolation DbGd mode&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.500000 | 1.000000 | 1.000000 |  &amp;lt;/span&amp;gt;      # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   2 |  7 |  &amp;lt;/span&amp;gt;                         # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.00000 | 5.00000 | &amp;lt;/span&amp;gt;        eV    # [BSS] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.010000 | 0.010000 |  &amp;lt;/span&amp;gt;       eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BEnSteps= 1500  &amp;lt;/span&amp;gt;                  # [BSS] Energy steps&lt;br /&gt;
 % BLongDir &lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 #WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 XfnQPdb= &amp;quot;none&amp;quot;                  # [EXTQP Xd] Database action&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
   1 | 12 |                           # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 113              RL    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 XTermKind= &amp;quot;none&amp;quot;                # [X] X terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze)&lt;br /&gt;
&lt;br /&gt;
then if you run the job you will get the spectrum at finite temperature. Notice that with the inversion solver you can choose if you want the BSE with or without the coupling by changing the &amp;lt;code&amp;gt;BSEmod&amp;lt;/code&amp;gt; variable.&lt;br /&gt;
This approach can be combined with double-grid as explained here: [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method with Yambo ]. Yambo automatically will interpolate quasi-particle corrections on the fine grid. &amp;lt;br&amp;gt; Notice that BSE inversion can become unfeasible for large BSE matrices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Nota bene:&amp;lt;/span&amp;gt; if you use the inversion solver you just get the optical spectra, but you do not have access to the excitonic eigenvalues and eigenvectors and by consequence you cannot plot the excitonic wave-function or print the  excitonic Eliashberg functions.&lt;br /&gt;
&lt;br /&gt;
== Phonon-assisted density of states ==&lt;br /&gt;
Even if exciton-phonon scattering is not included in the BSE at finite temperature, it is possible to plot the phonon-assisted density of states (DOS) for light emission, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:Formula exc ph.png | 600px | center | Phonon-assisted JDOS ]]&lt;br /&gt;
&lt;br /&gt;
where &#039;&#039;&#039;E&amp;lt;sub&amp;gt;q&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;l&amp;lt;/sup&amp;gt;&#039;&#039;&#039; is the energy of the &#039;&#039;&#039;l&#039;&#039;&#039;-exciton at &#039;&#039;&#039;q&#039;&#039;&#039;-momentum,  &#039;&#039;&#039;ω&amp;lt;sub&amp;gt;q&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;λ&amp;lt;/sup&amp;gt;&#039;&#039;&#039; is the phonon energy, &#039;&#039;&#039;n&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&#039;&#039;&#039; is the Bose function,  exciton are weighted with a Boltzamn factor and &#039;&#039;&#039;E&amp;lt;sub&amp;gt;min&amp;lt;/sub&amp;gt;&#039;&#039;&#039; is the lowest exciton energy in the all BZ.&lt;br /&gt;
In order to calculate these DOS you need to solve BSE for all the q-points for the lowest excitons, you can use SLEPC library to speed up calculations, then you need a converged phonon calculations.&lt;br /&gt;
Then you interpolate phonon on a dense phonon grid using &amp;lt;code&amp;gt;matdyn.x&amp;lt;/code&amp;gt; utility in QE, and Yambo will interpolate exicton on the same grid.&lt;br /&gt;
Here we present an example for hBN that is an indirect semiconductor.&lt;br /&gt;
Running &amp;lt;code&amp;gt; ypp_ph -e p&amp;lt;/code&amp;gt; you will get:&lt;br /&gt;
 &lt;br /&gt;
 BoseTemp= 50 K    # Bosonic Temperature&lt;br /&gt;
 excitons                         # [R] Excitonic properties&lt;br /&gt;
 ph_ass_dos                       # [R] Phonon-assisted DOS&lt;br /&gt;
 States= &amp;quot;1 - 4&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 PHfreqF= &amp;quot;./bn.freq_54&amp;quot;            # PWscf format file containing the phonon frequencies&lt;br /&gt;
 % DOSERange&lt;br /&gt;
  5.000000 | 5.500000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DOSESteps= 1000                  # Energy steps&lt;br /&gt;
 DOS_broad= 0.004        eV    # Broadening of the DOS &lt;br /&gt;
&lt;br /&gt;
where &amp;quot;bn.freq_54&amp;quot; is the file produced by matdyn.x with the input:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;input&lt;br /&gt;
     asr=&#039;simple&#039;,&lt;br /&gt;
     flfrc=&#039;bn.fc&#039;,&lt;br /&gt;
     flfrq=&#039;bn.freq_54&#039;,&lt;br /&gt;
     dos=.true.,&lt;br /&gt;
     fldos=&#039;bn.dos&#039;,&lt;br /&gt;
     ndos=2&lt;br /&gt;
     nk1=54, nk2=54, nk3=18&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
and the BSE was calculated on a 18x18x6 grid. The final spectra will be:&lt;br /&gt;
&lt;br /&gt;
[[File:Test dos pl bulk.png| 700px | center| Phonon-assisted JDOS]]&lt;br /&gt;
&lt;br /&gt;
where the DOS has been shifted to match the experimental peaks. Notice that the peak intensities are complitely off, because of the lack of the exciton-phonon matrix elements.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Pierre</name></author>
	</entry>
</feed>