<?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=Claudio</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=Claudio"/>
	<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Special:Contributions/Claudio"/>
	<updated>2026-05-17T16:08:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Real_time_Bethe-Salpeter_Equation_(TDSE)&amp;diff=4122</id>
		<title>Real time Bethe-Salpeter Equation (TDSE)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Real_time_Bethe-Salpeter_Equation_(TDSE)&amp;diff=4122"/>
		<updated>2021-01-14T08:20:21Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* The Real Time Collisions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
This tutorial will show how to perform a real-time calculation with Yambo on hBN monolayer. We will go through different approximations for the many body self--energy (HXC potential in the yambo language) up to the HSEX approximation which captures the physics of the exciton. For approximations local in space, like &amp;quot;TD-HARTREE&amp;quot; and &amp;quot;TD-DFT&amp;quot;, the HXC potential can be evaluated directly during the simulation from real space quantities. On the contrary for approximations non local in space, one first need to compute the &amp;quot;real time collisions&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The same DFT inputs used to generate the [http://www.yambo-code.org/educational/tutorials/files/hBN-2D-RT.tar.gz hBN-2D-RT.tar.gz], are sufficient to converge the energy of the first exciton. You will need to increase the number of k-points to converge higher energy excitons. &lt;br /&gt;
&lt;br /&gt;
==TD Hartree and TD DFT==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== TD Hartree===&lt;br /&gt;
 yambo_rt -n p -v hartree -F  Inputs_rt/02_td_hartree.in&lt;br /&gt;
&lt;br /&gt;
  negf                           # [R] Real-Time dynamics&lt;br /&gt;
  HXC_Potential= &amp;quot;HARTREE&amp;quot;       # [SC] SC HXC Potential&lt;br /&gt;
  HARRLvcs= 1000        mHa      # [HA] Hartree RL components&lt;br /&gt;
  VXCRLvcs= 0.          mHa      # [HA] DFT     RL components&lt;br /&gt;
  % RTBands&lt;br /&gt;
    3 | 5 |                     # [RT] Bands&lt;br /&gt;
  %&lt;br /&gt;
  Integrator= &amp;quot;RK2&amp;quot;              # [RT] Integrator. Use keywords space separated  ( &amp;quot;EULER/EXPn/INV&amp;quot; &amp;quot;SIMPLE/RK2/RK4/HEUN&amp;quot; &amp;quot;RWA&amp;quot;)&lt;br /&gt;
  PhLifeTime= 100.0000   fs      # [RT] Dephasing Time&lt;br /&gt;
  RTstep=10.000000       as      # [RT] Real Time step length&lt;br /&gt;
  NETime= 20.00000       fs      # [RT] Simulation Time&lt;br /&gt;
  % IOtime&lt;br /&gt;
   0.01     | 1.00     | 0.01     |  fs    # [RT] Time between to consecutive I/O (OBSERVABLEs,CARRIERs - GF - OUTPUT)&lt;br /&gt;
  %&lt;br /&gt;
  % Field1_Freq&lt;br /&gt;
   0.00     | 0.00     | eV      # [RT Field1] Frequency&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Int= 1.E3   kWLm2   # [RT Field1] Intensity&lt;br /&gt;
  Field1_Width= 0.000000 fs      # [RT Field1] Width&lt;br /&gt;
  Field1_kind= &amp;quot;DELTA&amp;quot;            # [RT Field1] Kind(SIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
  Field1_pol= &amp;quot;linear&amp;quot;             # [RT Field1] Pol(linear|circular)&lt;br /&gt;
  % Field1_Dir&lt;br /&gt;
   0.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
  % Field1_Dir_circ&lt;br /&gt;
   0.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor_circ&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Tstart= 0.000000fs      # [RT Field1] Initial Time&lt;br /&gt;
&lt;br /&gt;
We set the cut-off on the Hartree potential to 1000 mHa. This defines the cutoff used to evaluate the Hartree potential at each time step.&lt;br /&gt;
Notice also the need of setting the cutoff to Vxc to zero.&lt;br /&gt;
This time we will propagate for just 20 fs. It is useful to run the simulation in background and then monitor the output file&lt;br /&gt;
&lt;br /&gt;
  nohup yambo_rt -F Inputs_rt/02_td_hartree.in -J TD-HARTREE_1000mHa -C  TD-HARTREE_1000mHa &amp;amp;&lt;br /&gt;
  tail -f TD-HARTREE_1000mHa/o-TD-HARTREE_1000mHa.polarization&lt;br /&gt;
&lt;br /&gt;
We can even have check the output on the fly.&lt;br /&gt;
To interrupt &amp;lt;code&amp;gt;tail -f &amp;lt;/code&amp;gt;&lt;br /&gt;
  ctrl+C &lt;br /&gt;
Then&lt;br /&gt;
  gnuplot&lt;br /&gt;
  plot &amp;quot;TD-IP_rt/o-TD-IP_rt.polarization&amp;quot; u 1:3 w l&lt;br /&gt;
  set xrange [0:20]&lt;br /&gt;
  rep &amp;quot;TD-HARTREE_1000mHa/o-TD-HARTREE_1000mHa.polarization&amp;quot; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:TD-Hartree Pol along y.png|thumb|center|900px|Time dependent polarization of hBN obtained within time depndent hartree]]&lt;br /&gt;
&lt;br /&gt;
We can already see from the output that the polarization is not very different from the IP one.&lt;br /&gt;
The major difference is indeed due to the presence of a damping (or dephasing term) in the output (&amp;lt;code&amp;gt;PhLifeTime&amp;lt;/code&amp;gt;, i.e. the life-time of the phase).&lt;br /&gt;
If we check the timing of the simulation we see that most of the time is spent in the following subroutines:&lt;br /&gt;
                        el_density_matrix :    7.5074 s CPU (    4002 calls,    0.0019 s avg)&lt;br /&gt;
                                V_Hartree :    1.0405 s CPU (    4002 calls,    0.0003 s avg)&lt;br /&gt;
                        V_real_space_to_H :   23.8210 s CPU (  220220 calls,    0.0001 s avg)&lt;br /&gt;
                           RT Hamiltonian :   32.5007 s CPU (    4001 calls,    0.0081 s avg)&lt;br /&gt;
The evaluation of the Hartree potential by itself does not take too much time. It is more consuming to evaluate the real space density.&lt;br /&gt;
However it is the projection of the potential into the transition space (V_real_space_to_H) which takes most of the time.&lt;br /&gt;
RT_Hamiltonian is just (roughly) the sum of the two previous subroutines. You can see how these timings change if you increase the cutoff on the Hartree potential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thus we can expect that also the absorption will be quite similar. Indeed hBN is uniform in the plane.&lt;br /&gt;
As previously you can now to a post-processing of the polarization. The input file is exactly the same&lt;br /&gt;
  ypp_rt -F  Inputs_rt/ypp_abs.in -J TD-HARTREE_1000mHa -C TD-HARTREE_1000mHa&lt;br /&gt;
  gnuplot&lt;br /&gt;
  plot &amp;quot;TD-IP_rt/o-TD-IP_rt.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
  rep &amp;quot;TD-HARTREE_1000mHa/o-TD-HARTREE_1000mHa.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
  set xrange [2:10]&lt;br /&gt;
  rep&lt;br /&gt;
&lt;br /&gt;
[[File:Absorption along y.png|thumb|center|900px|hBN absorption within time dependent hartree]]&lt;br /&gt;
&lt;br /&gt;
The situation would be completely different if we computed the polarization out of plane at both the TD-IP and the TD-Hartree level.&lt;br /&gt;
You can try if you wish, but remember that you have to go back to the original SAVE folder and remove the symmetries not consistent with a field along the z direction this time:&lt;br /&gt;
(see [[Prerequisites_for_Real_Time_propagation_with_Yambo|Prerequisites]]))&lt;br /&gt;
&lt;br /&gt;
=== TD DFT===&lt;br /&gt;
You can now try to perform a TDDFT simulation.&lt;br /&gt;
Let&#039;s use the previous input file&lt;br /&gt;
  cp Inputs_rt/02_td_hartree.in Inputs_rt/03_td_dft.in&lt;br /&gt;
and modify it&lt;br /&gt;
  vim Input_rt/03_td_dft.in&lt;br /&gt;
&lt;br /&gt;
  negf                            # [R] Real-Time dynamics&lt;br /&gt;
  HXC_Potential= &amp;quot;HARTREE+GS_XC&amp;quot;  # [SC] SC HXC Potential&lt;br /&gt;
  HARRLvcs= 1.E3       mHa        # [HA] Hartree     RL components&lt;br /&gt;
  VXCRLvcs= 1.E3       mHa&lt;br /&gt;
&lt;br /&gt;
We can now run the TD-DFT simulation&lt;br /&gt;
  nohup yambo_rt -F Inputs_rt/03_td_dft.in -J TD-DFT_1000mHA -C TD-DFT_1000mHA &amp;amp;&lt;br /&gt;
  tail -f TD-DFT_1000mHA/o-TD-DFT_1000mHA.polarization&lt;br /&gt;
&lt;br /&gt;
and once it is over do the post processing&lt;br /&gt;
  ctrl+C&lt;br /&gt;
  ypp_rt_4.5_gpl -F Inputs_rt/ypp_abs.in -J TD-DFT_1000mHA -C TD-DFT_1000mHA&lt;br /&gt;
  gnuplot&lt;br /&gt;
  gnuplot&amp;gt; plot &amp;quot;TD-HARTREE_1000mHa/o-TD-HARTREE_1000mHa.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
  gnuplot&amp;gt; rep &amp;quot;TD-DFT_1000mHA/o-TD-DFT_1000mHA.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
&lt;br /&gt;
[[File:Absorpion hBN TDDFT.png|center|900px|thumb|Absorption of hBN in plane. Comparison between TD-HARTREE and TDDFT]]&lt;br /&gt;
&lt;br /&gt;
As expected TDDFT does not improve much over TD-HARTREE in extended systems&lt;br /&gt;
&lt;br /&gt;
==The Real Time Collisions==&lt;br /&gt;
&lt;br /&gt;
We next move to the evaluation of the collisions. (see [[Introduction to Real Time propagation in Yambo]] to remember what are the collisions)&lt;br /&gt;
This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Then generate the input file to calculate the collisions (see appendix of Ref. &amp;lt;ref name=&amp;quot;prb88&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;) use the command :&lt;br /&gt;
  yambo_rt -X s -e -v hsex -F Inputs/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -b will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;HARTREE+SEX&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
The you can run&lt;br /&gt;
  yambo_rt -F Inputs/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation will take about 1 minute in serial.&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
Notice that, if you want, you can also compute simple HARTREE collisions and use them in a TD-HARTREE simulation.&lt;br /&gt;
&lt;br /&gt;
=== TD-HARTREE with collisions (facultative) ===&lt;br /&gt;
Then generate the input file to calculate the collisions (see appendix of Ref. &amp;lt;ref name=&amp;quot;prb88&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;) use the command :&lt;br /&gt;
  yambo_rt -e -v h -F Inputs/03_coll_hartree.in&lt;br /&gt;
&lt;br /&gt;
with a simpler input file&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4  &amp;lt;/span&amp;gt; | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5   &amp;lt;/span&amp;gt; |                 # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
&lt;br /&gt;
  yambo_rt -F Inputs/03_coll_hartree.in -J COLL_HARTREE -C COLL_HARTREE&lt;br /&gt;
  yambo_rt -F Inputs_rt/02_td_hartree.in -J &amp;quot;TD-HARTREE_COLL,COLL_HARTREE&amp;quot; -C TD-HARTREE_COLL&lt;br /&gt;
&lt;br /&gt;
and compare the run with the simulation without collision.&lt;br /&gt;
One major difference, is that, when the collisions are used, yambo does not need to load the wave--function anymore and the simulation is much faster.&lt;br /&gt;
The drawback is that for big systems the folder COLL_HARTREE may become huge, thus requiring a lot of disk space.&lt;br /&gt;
&lt;br /&gt;
==Time dependent Bethe Salpeter equation==&lt;br /&gt;
&lt;br /&gt;
=== Approach based on the density matrix ===&lt;br /&gt;
&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 yambo_rt -n p -v hsex -V qp -F Inputs_rt/04_td_hsex.in&lt;br /&gt;
&lt;br /&gt;
As you can see this time the extra verbosity for quasi-particles is used &amp;lt;code&amp;gt;-V qp&amp;lt;/code&amp;gt;&lt;br /&gt;
The reason is that, to be consistent with the TD-HSEX, simulation we need to apply quasi-particles corrections.&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
  negf                           # [R] NEQ Real-time dynamics&lt;br /&gt;
  HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;   # [SC] SC HXC Potential&lt;br /&gt;
  % RTBands&lt;br /&gt;
    3 | 5 |                     # [RT] Bands&lt;br /&gt;
  %&lt;br /&gt;
  Integrator= &amp;quot;RK2&amp;quot;              # [RT] Integrator. Use keywords space separated  ( &amp;quot;EULER/EXPn/INV&amp;quot; &amp;quot;SIMPLE/RK2/RK4/HEUN&amp;quot; &amp;quot;RWA&amp;quot;)&lt;br /&gt;
  PhLifeTime= 100.0000   fs      # [RT] Dephasing Time&lt;br /&gt;
  RTstep=10.000000       as      # [RT] Real Time step length&lt;br /&gt;
  NETime= 30.00000       fs      # [RT] Simulation Time&lt;br /&gt;
  % IOtime&lt;br /&gt;
   0.01     | 1.00     | 0.05     |  fs    # [RT] Time between to consecutive I/O (OBSERVABLEs,CARRIERs - GF - OUTPUT)&lt;br /&gt;
  %&lt;br /&gt;
  HARRLvcs= 1000       mHa      # [HA] Hartree     RL components&lt;br /&gt;
  EXXRLvcs= 1000       mHa      # [XX] Exchange    RL components&lt;br /&gt;
  CORRLvcs= 1000       mHa      # [GW] Correlation RL components&lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |       # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
  % Field1_Freq&lt;br /&gt;
   0.00     | 0.00     | eV      # [RT Field1] Frequency&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Int= 1.E3   kWLm2   # [RT Field1] Intensity&lt;br /&gt;
  Field1_Width= 0.000000 fs      # [RT Field1] Width&lt;br /&gt;
  Field1_kind= &amp;quot;DELTA&amp;quot;            # [RT Field1] Kind(SIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
  Field1_pol= &amp;quot;linear&amp;quot;             # [RT Field1] Pol(linear|circular)&lt;br /&gt;
  % Field1_Dir&lt;br /&gt;
   0.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
  % Field1_Dir_circ&lt;br /&gt;
   0.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor_circ&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Tstart= 0.000000fs      # [RT Field1] Initial Time&lt;br /&gt;
&lt;br /&gt;
and then run the code. Notice the presence of the &amp;lt;code&amp;gt;COLL_SEX&amp;lt;/code&amp;gt; among the options after &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 nohup yambo_rt -F Inputs_rt/04_td_hsex.in -J &amp;quot;TD-SEX_rt,COLL_SEX&amp;quot; -C TD-SEX_rt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Approach based on the Berry Phase ===&lt;br /&gt;
&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 yambo_nl -u -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 DIP_Threads=0                  # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 NL_Threads=0                   # [OPENMP/NL] Number of threads for nl-optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
   4 |  5 |                     # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;low&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLstep=   0.0100       fs      # [NL] Real Time step length&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  0.200000 | 8.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 &amp;lt;/span&amp;gt;                  # [NL] Energy steps&lt;br /&gt;
 NLDamping=  0.10000    eV      # [NL] Damping&lt;br /&gt;
 #UseDipoles                    # [NL] Use Covariant Dipoles (just for test purpose)&lt;br /&gt;
 #FrSndOrd                      # [NL] Force second order in Covariant Dipoles&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 HARRLvcs= 1000         mHa     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000         mHa     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
 % ExtF_Dir&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 | 1.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # [NL ExtF] Versor&lt;br /&gt;
 %&lt;br /&gt;
 ExtF_Int= 1000.        kWLm2   # [NL ExtF] Intensity&lt;br /&gt;
 ExtF_Width= 0.000000   fs      # [NL ExtF] Field Width&lt;br /&gt;
 ExtF_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DELTA&amp;lt;/span&amp;gt;&amp;quot;             # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 ExtF_Tstart=   0.0100  fs      # [NL ExtF] Initial Time&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Notice that we introduced a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift. Run this calculation and then analyze the result in the same way of linear response tutorial, you will get a nice exciton in hBN, as the one plotted below in the old tutorial. You can repeat the same kind of calculations for the non-linear response.&lt;br /&gt;
Notice that in the calculation we decreased the number of G-vectors in the Hartree term,  [[Variables#HARRLvcs|HARRLvcs]]  to speed up the calculation, in case of BN this does not change the result because local field effects are very small in h-BN along the plane.&lt;br /&gt;
&lt;br /&gt;
 nohup yambo_nl -F Inputs_nl/04_td_hsex.in -J &amp;quot;TD-SEX_nl,COLL_SEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
=== Final post processing ===&lt;br /&gt;
&lt;br /&gt;
Now you can analyze the response with &lt;br /&gt;
 ypp_rt -F Inputs_rt/ypp_abs.in -J TD-sex_rt -C TD-SEX_rt&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
as it was done the linear response tutorial and compare with the TD-IP run (and eventually against the standard Bethe-Salpeter): &lt;br /&gt;
&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-HSEX_rt/o-TD-HSEX_rt.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 gnuplot&amp;gt; rep &amp;quot;TD-HSEX_nl/o-TD-HSEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; rep &amp;quot;TD-IP_rt/o-TD-IP_rt.YPP-eps_along_E&amp;quot; u ($1+3):2 w l &lt;br /&gt;
&lt;br /&gt;
[[File:HBN HSEX absorption.png|thumb|900px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption]]&lt;br /&gt;
&lt;br /&gt;
Linear response results can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &lt;br /&gt;
Notice that you can use the SEX approximation for the non-linear response too (see the following tutorials on non-linear response).&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|style=&amp;quot;width:15%; text-align:left&amp;quot;|Prev: [[Real time approach to linear response|Independent Particles ]]&lt;br /&gt;
|style=&amp;quot;width:70%; text-align:center&amp;quot;|Now: [[Tutorials|Tutorials]] --&amp;gt; [[Linear response from real time simulations|Linear Response]] --&amp;gt;  [[Real time Bethe-Salpeter Equation (TDSE)]]&lt;br /&gt;
|style=&amp;quot;width:35%; text-align:right&amp;quot;|Next: If you did all steps you can go back to the previous level&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Identify_what%27s_causing_segmentation_fault_in_Yambo&amp;diff=4121</id>
		<title>Identify what&#039;s causing segmentation fault in Yambo</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Identify_what%27s_causing_segmentation_fault_in_Yambo&amp;diff=4121"/>
		<updated>2021-01-11T08:11:12Z</updated>

		<summary type="html">&lt;p&gt;Claudio: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There may be different reasons why the Yambo code generates segmentation faults in a run.&amp;lt;br&amp;gt;&lt;br /&gt;
To help Yambo developers understand where the problem lies and help you, please follow the steps below.&lt;br /&gt;
If one of the step solves your problem and please report the result in the [http://www.yambo-code.org/forum/ forum].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rule out possible causes of the segmentation fault:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;GPU&#039;&#039;&#039;:  recompile without GPU support, remove the &amp;lt;code&amp;gt;--enable-cuda&amp;lt;/code&amp;gt; flag. If this solve the problem report the bug in forum GPU section [http://www.yambo-code.org/forum/viewforum.php?f=38 Yambo on GPU machines].&lt;br /&gt;
# &#039;&#039;&#039;OPEN-MP&#039;&#039;&#039;: compile and run Yambo without open-mp support, no &amp;lt;code&amp;gt;--enable-open-mp&amp;lt;/code&amp;gt; flag in the configure and &amp;lt;code&amp;gt;OMP_NUM_THREADS=&amp;quot;1&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Lapack/Blas&#039;&#039;&#039;: use internal Lapack/Blas. Reconfigure  Yambo with the flag &amp;lt;code&amp;gt;--enable-int-linalg&amp;lt;/code&amp;gt;, recompile and run our job again.&lt;br /&gt;
# &#039;&#039;&#039;FFT&#039;&#039;&#039;: compile Yambo with internal FFT libraries &amp;lt;code&amp;gt;--enable-internal-fftsg&amp;lt;/code&amp;gt; .&lt;br /&gt;
# &#039;&#039;&#039;Scalapack&#039;&#039;&#039;: compile without Scalpack, unset the flag &amp;lt;code&amp;gt;--with-scalapack-libs&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Parallelism&#039;&#039;&#039;&lt;br /&gt;
## Change the number of processors&lt;br /&gt;
## Use automatic parallelization, unset all parallel variable in input&lt;br /&gt;
## Try to disable MPI parallelism by doing &amp;lt;code&amp;gt;yambo -nompi&amp;lt;/code&amp;gt; and/or OPEN-MP parallelism by doing &amp;lt;code&amp;gt;yambo -noopenmp&amp;lt;/code&amp;gt;&lt;br /&gt;
## Compile yambo without MPI and run in serial&lt;br /&gt;
# &#039;&#039;&#039;Optimization&#039;&#039;&#039;: use a lower optimization level for example -O1 or -O0, by doing &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O0&amp;quot; FFLAGS=&amp;quot;-O1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Compilers&#039;&#039;&#039;: change  C/Fortran compiler if it is possible, move form  intel fortran to gfortran or vice-versa. &amp;lt;br&amp;gt;In order to set compilers in the configure use &amp;lt;code&amp;gt;./configure FC=ifort F77=ifort CC=icc&amp;lt;/code&amp;gt; for Intel        and &amp;lt;code&amp;gt;./configure FC=gfortran F77=gfortran CC=gcc&amp;lt;/code&amp;gt; for gfortran.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If no one of the previous steps solved your problem, contact us again in the [http://www.yambo-code.org/forum/ forum]. &amp;lt;br&amp;gt;&lt;br /&gt;
If you want  you can try to debug Yambo and identity the origin of segmentation fault following the steps below. This will help developers to find a solution to the problem more quickly: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debugging the segmentation fault:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Checking options&#039;&#039;&#039;: compile Yambo with the compiler checking options and run again your simulation, then report the result in the forum:&lt;br /&gt;
## for g-fortran compiler &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -fcheck=all&amp;quot; UFLAGS=&amp;quot;-O0 -g -fcheck=all&amp;quot; FFLAGS=&amp;quot;-O1 -g  -fcheck=all&amp;quot;  --enable-keep-src&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
## for intel fortran  &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -CB -CA -debug&amp;quot; UFLAGS=&amp;quot;-O0 -g -CB -CA -debug&amp;quot; FFLAGS=&amp;quot;-O1 -g  -CB -CA -debug&amp;quot;  --enable-keep-src&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Use a debugger&#039;&#039;&#039;: Compile with debugging options&amp;lt;br&amp;gt; for g-fortran compiler &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-Og -g&amp;quot; UFLAGS=&amp;quot;-Og -g&amp;quot; FFLAGS=&amp;quot;-Og -g&amp;quot;  --enable-keep-src&amp;quot; CFLAGS=&amp;quot;-g&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; for intel fortran  &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -debug&amp;quot; UFLAGS=&amp;quot;-O0 -g -debug&amp;quot; FFLAGS=&amp;quot;-O1 -g -debug&amp;quot;  --enable-keep-src&amp;quot; CFLAGS=&amp;quot;-g -debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; then execute the job in a debugger for example &amp;lt;code&amp;gt;[https://www.gnu.org/software/gdb/ gdb] --args yambo -F yambo_input.in&amp;lt;/code&amp;gt;. It can work also in parallel see [https://www.open-mpi.org/faq/?category=debugging here] and [https://stackoverflow.com/questions/329259/how-do-i-debug-an-mpi-program here]&lt;br /&gt;
# &#039;&#039;&#039;Memory leaks&#039;&#039;&#039;: [only for experts] compile Yambo with debugging options then run your job with [https://valgrind.org/ valgrind]: &amp;lt;code&amp;gt;valgrind --tool=memcheck --leak-check=summary ./yambo&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Identify_what%27s_causing_segmentation_fault_in_Yambo&amp;diff=4120</id>
		<title>Identify what&#039;s causing segmentation fault in Yambo</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Identify_what%27s_causing_segmentation_fault_in_Yambo&amp;diff=4120"/>
		<updated>2021-01-11T08:10:57Z</updated>

		<summary type="html">&lt;p&gt;Claudio: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There may be different reasons why the Yambo code generates segmentation faults in a run.&amp;lt;br&amp;gt;&lt;br /&gt;
To help Yambo developers understand where the problem lies and help you, please follow the steps below.&lt;br /&gt;
If one of the step solves your problem and please report the result in the [http://www.yambo-code.org/forum/ forum].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rule out possible causes of the segmentation fault:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;GPU&#039;&#039;&#039;:  recompile without GPU support, remove the &amp;lt;code&amp;gt;--enable-cuda&amp;lt;/code&amp;gt; flag. If this solve the problem report the bug in forum GPU section [http://www.yambo-code.org/forum/viewforum.php?f=38 Yambo on GPU machines].&lt;br /&gt;
# &#039;&#039;&#039;OPEN-MP&#039;&#039;&#039;: compile and run Yambo without open-mp support, no &amp;lt;code&amp;gt;--enable-open-mp&amp;lt;/code&amp;gt; flag in the configure and &amp;lt;code&amp;gt;OMP_NUM_THREADS=&amp;quot;1&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Lapack/Blas&#039;&#039;&#039;: use internal Lapack/Blas. Reconfigure  Yambo with the flag &amp;lt;code&amp;gt;--enable-int-linalg&amp;lt;/code&amp;gt;, recompile and run our job again.&lt;br /&gt;
# &#039;&#039;&#039;FFT&#039;&#039;&#039;: compile Yambo with internal FFT libraries &amp;lt;code&amp;gt;--enable-internal-fftsg&amp;lt;/code&amp;gt; .&lt;br /&gt;
# &#039;&#039;&#039;Scalapack&#039;&#039;&#039;: compile without Scalpack, unset the flag &amp;lt;code&amp;gt;--with-scalapack-libs&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Parallelism&#039;&#039;&#039;&lt;br /&gt;
## Change the number of processors&lt;br /&gt;
## Use automatic parallelization, unset all parallel variable in input&lt;br /&gt;
## Try to disable MPI parallelism by doing &amp;lt;code&amp;gt;yambo -nompi&amp;lt;/cope&amp;gt; and/or OPEN-MP parallelism by doing &amp;lt;code&amp;gt;yambo -noopenmp&amp;lt;/code&amp;gt;&lt;br /&gt;
## Compile yambo without MPI and run in serial&lt;br /&gt;
# &#039;&#039;&#039;Optimization&#039;&#039;&#039;: use a lower optimization level for example -O1 or -O0, by doing &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O0&amp;quot; FFLAGS=&amp;quot;-O1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Compilers&#039;&#039;&#039;: change  C/Fortran compiler if it is possible, move form  intel fortran to gfortran or vice-versa. &amp;lt;br&amp;gt;In order to set compilers in the configure use &amp;lt;code&amp;gt;./configure FC=ifort F77=ifort CC=icc&amp;lt;/code&amp;gt; for Intel        and &amp;lt;code&amp;gt;./configure FC=gfortran F77=gfortran CC=gcc&amp;lt;/code&amp;gt; for gfortran.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If no one of the previous steps solved your problem, contact us again in the [http://www.yambo-code.org/forum/ forum]. &amp;lt;br&amp;gt;&lt;br /&gt;
If you want  you can try to debug Yambo and identity the origin of segmentation fault following the steps below. This will help developers to find a solution to the problem more quickly: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debugging the segmentation fault:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Checking options&#039;&#039;&#039;: compile Yambo with the compiler checking options and run again your simulation, then report the result in the forum:&lt;br /&gt;
## for g-fortran compiler &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -fcheck=all&amp;quot; UFLAGS=&amp;quot;-O0 -g -fcheck=all&amp;quot; FFLAGS=&amp;quot;-O1 -g  -fcheck=all&amp;quot;  --enable-keep-src&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
## for intel fortran  &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -CB -CA -debug&amp;quot; UFLAGS=&amp;quot;-O0 -g -CB -CA -debug&amp;quot; FFLAGS=&amp;quot;-O1 -g  -CB -CA -debug&amp;quot;  --enable-keep-src&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Use a debugger&#039;&#039;&#039;: Compile with debugging options&amp;lt;br&amp;gt; for g-fortran compiler &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-Og -g&amp;quot; UFLAGS=&amp;quot;-Og -g&amp;quot; FFLAGS=&amp;quot;-Og -g&amp;quot;  --enable-keep-src&amp;quot; CFLAGS=&amp;quot;-g&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; for intel fortran  &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -debug&amp;quot; UFLAGS=&amp;quot;-O0 -g -debug&amp;quot; FFLAGS=&amp;quot;-O1 -g -debug&amp;quot;  --enable-keep-src&amp;quot; CFLAGS=&amp;quot;-g -debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; then execute the job in a debugger for example &amp;lt;code&amp;gt;[https://www.gnu.org/software/gdb/ gdb] --args yambo -F yambo_input.in&amp;lt;/code&amp;gt;. It can work also in parallel see [https://www.open-mpi.org/faq/?category=debugging here] and [https://stackoverflow.com/questions/329259/how-do-i-debug-an-mpi-program here]&lt;br /&gt;
# &#039;&#039;&#039;Memory leaks&#039;&#039;&#039;: [only for experts] compile Yambo with debugging options then run your job with [https://valgrind.org/ valgrind]: &amp;lt;code&amp;gt;valgrind --tool=memcheck --leak-check=summary ./yambo&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Identify_what%27s_causing_segmentation_fault_in_Yambo&amp;diff=4119</id>
		<title>Identify what&#039;s causing segmentation fault in Yambo</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Identify_what%27s_causing_segmentation_fault_in_Yambo&amp;diff=4119"/>
		<updated>2021-01-11T08:06:23Z</updated>

		<summary type="html">&lt;p&gt;Claudio: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There may be different reasons why the Yambo code generates segmentation faults in a run.&amp;lt;br&amp;gt;&lt;br /&gt;
To help Yambo developers understand where the problem lies and help you, please follow the steps below.&lt;br /&gt;
If one of the step solves your problem and please report the result in the [http://www.yambo-code.org/forum/ forum].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rule out possible causes of the segmentation fault:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;GPU&#039;&#039;&#039;:  recompile without GPU support, remove the &amp;lt;code&amp;gt;--enable-cuda&amp;lt;/code&amp;gt; flag. If this solve the problem report the bug in forum GPU section [http://www.yambo-code.org/forum/viewforum.php?f=38 Yambo on GPU machines].&lt;br /&gt;
# &#039;&#039;&#039;OPEN-MP&#039;&#039;&#039;: compile and run Yambo without open-mp support, no &amp;lt;code&amp;gt;--enable-open-mp&amp;lt;/code&amp;gt; flag in the configure and &amp;lt;code&amp;gt;OMP_NUM_THREADS=&amp;quot;1&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Lapack/Blas&#039;&#039;&#039;: use internal Lapack/Blas. Reconfigure  Yambo with the flag &amp;lt;code&amp;gt;--enable-int-linalg&amp;lt;/code&amp;gt;, recompile and run our job again.&lt;br /&gt;
# &#039;&#039;&#039;FFT&#039;&#039;&#039;: compile Yambo with internal FFT libraries &amp;lt;code&amp;gt;--enable-internal-fftsg&amp;lt;/code&amp;gt; .&lt;br /&gt;
# &#039;&#039;&#039;Scalapack&#039;&#039;&#039;: compile without Scalpack, unset the flag &amp;lt;code&amp;gt;--with-scalapack-libs&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Parallelism&#039;&#039;&#039;&lt;br /&gt;
## Change the number of processors&lt;br /&gt;
## Use automatic parallelization, unset all parallel variable in input&lt;br /&gt;
## Run in serial&lt;br /&gt;
# &#039;&#039;&#039;Optimization&#039;&#039;&#039;: use a lower optimization level for example -O1 or -O0, by doing &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O0&amp;quot; FFLAGS=&amp;quot;-O1&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Compilers&#039;&#039;&#039;: change  C/Fortran compiler if it is possible, move form  intel fortran to gfortran or vice-versa. &amp;lt;br&amp;gt;In order to set compilers in the configure use &amp;lt;code&amp;gt;./configure FC=ifort F77=ifort CC=icc&amp;lt;/code&amp;gt; for Intel        and &amp;lt;code&amp;gt;./configure FC=gfortran F77=gfortran CC=gcc&amp;lt;/code&amp;gt; for gfortran.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
If no one of the previous steps solved your problem, contact us again in the [http://www.yambo-code.org/forum/ forum]. &amp;lt;br&amp;gt;&lt;br /&gt;
If you want  you can try to debug Yambo and identity the origin of segmentation fault following the steps below. This will help developers to find a solution to the problem more quickly: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Debugging the segmentation fault:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Checking options&#039;&#039;&#039;: compile Yambo with the compiler checking options and run again your simulation, then report the result in the forum:&lt;br /&gt;
## for g-fortran compiler &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -fcheck=all&amp;quot; UFLAGS=&amp;quot;-O0 -g -fcheck=all&amp;quot; FFLAGS=&amp;quot;-O1 -g  -fcheck=all&amp;quot;  --enable-keep-src&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
## for intel fortran  &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -CB -CA -debug&amp;quot; UFLAGS=&amp;quot;-O0 -g -CB -CA -debug&amp;quot; FFLAGS=&amp;quot;-O1 -g  -CB -CA -debug&amp;quot;  --enable-keep-src&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Use a debugger&#039;&#039;&#039;: Compile with debugging options&amp;lt;br&amp;gt; for g-fortran compiler &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-Og -g&amp;quot; UFLAGS=&amp;quot;-Og -g&amp;quot; FFLAGS=&amp;quot;-Og -g&amp;quot;  --enable-keep-src&amp;quot; CFLAGS=&amp;quot;-g&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; for intel fortran  &amp;lt;code&amp;gt;./configure FCFLAGS=&amp;quot;-O1 -g -debug&amp;quot; UFLAGS=&amp;quot;-O0 -g -debug&amp;quot; FFLAGS=&amp;quot;-O1 -g -debug&amp;quot;  --enable-keep-src&amp;quot; CFLAGS=&amp;quot;-g -debug&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; then execute the job in a debugger for example &amp;lt;code&amp;gt;[https://www.gnu.org/software/gdb/ gdb] --args yambo -F yambo_input.in&amp;lt;/code&amp;gt;. It can work also in parallel see [https://www.open-mpi.org/faq/?category=debugging here] and [https://stackoverflow.com/questions/329259/how-do-i-debug-an-mpi-program here]&lt;br /&gt;
# &#039;&#039;&#039;Memory leaks&#039;&#039;&#039;: [only for experts] compile Yambo with debugging options then run your job with [https://valgrind.org/ valgrind]: &amp;lt;code&amp;gt;valgrind --tool=memcheck --leak-check=summary ./yambo&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4067</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4067"/>
		<updated>2021-01-04T08:39:15Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Optical properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial&amp;lt;ref&amp;gt; This tutorial is based on [http://www.attaccalite.com/elena/news/ Elena Cannuccia blog]&amp;lt;/ref&amp;gt; is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calculation with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. You can use this simple python script [http://www.yambo-code.org/educational/tutorials/files/minus_kpoints.py minuq_kpoints.py] to read k-points from the QE output and multiply them by minus one.&lt;br /&gt;
The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: use the same parallelization in the &#039;&#039;&#039;phonon&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculation to avoid problem reading wave-functions.&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/si.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                      # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                     # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                    # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If you repeat the calculation for different temperature you can obtain the trend of the gap vs temperature, see figure below:&lt;br /&gt;
[[File:Si_gap_finite_t.png|600px|center]]&lt;br /&gt;
If you uncomment the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt; the code saves information about the Eliashberg functions that can be plotted using the &#039;&#039;ypp_ph&#039;&#039;, see below.&amp;lt;br&amp;gt;&lt;br /&gt;
Finally if you add &#039;&#039;-V qp&#039;&#039; in the input generation a new flag appears &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;OnMassShell&amp;lt;/span&amp;gt;, if you un-comment this flag calculation will be performed in the &amp;quot;on mass shell&amp;quot; approximation, namely the static limit the Quasi-Particle approximation, for a discussion see reference &amp;lt;ref&amp;gt;H. Kawai et al. [https://arxiv.org/abs/1310.2038 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 085202 (2014)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&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  &#039;&#039;yambo_ph -o c -V qp&#039;&#039;&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;
  1 | 1 |                             # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
   2 |  7 |                           # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
  0.000000 | 5.000000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.0100000 | 0.0100000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd=  500                   # [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. 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 same procedure can be applied to the Bethe-Salpeter calculations. However in this case results can be slightly wrong. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &amp;lt;ref&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&amp;gt;F. Paleari, [https://orbilu.uni.lu/handle/10993/41058 Phd Thesis (2019)]&amp;lt;/ref&amp;gt;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref name=marini&amp;gt;A. Marini, [https://arxiv.org/abs/0712.3365 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039; 106405 (2008)]&amp;lt;/ref&amp;gt; . This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged. This is due to the poor parameters used in this tutorial to make the calculations fast. In order to have converged results, first of all you have to be sure to have converged phonons, in order to do that increase  plane-wave cutoff,  number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the parameters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate  &#039;&#039;&#039;phonons&#039;&#039;&#039;. In the following section we will describe a smart way to accelerate convergence.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene: &amp;lt;/span&amp;gt; At present Yambo neither implements the Fröhlich term at q=0&amp;lt;ref&amp;gt;Carla Verdi and Feliciano Giustino&lt;br /&gt;
[https://arxiv.org/abs/1510.06373 Phys. Rev. Lett. &#039;&#039;&#039;115&#039;&#039;&#039;, 176401 (2015)] &amp;lt;/ref&amp;gt; nor the quadrupolar correction,&amp;lt;ref&amp;gt;G. Brunin et al.  [https://arxiv.org/abs/2002.00628  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 136601 (2020)]&amp;lt;/ref&amp;gt; therefore convergence in polar material can be very slow with the number of q-points.&lt;br /&gt;
&lt;br /&gt;
== Double-grid method for the electron-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
To be done&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phonon density of states&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot phonon density of states with the command: &#039;&#039;ypp_ph -p d&#039;&#039;. In order to get a nice plot set in the input&lt;br /&gt;
&lt;br /&gt;
 phonons                          # [R] Phononic properties&lt;br /&gt;
 dos                              # [R] DOS&lt;br /&gt;
 PhBroad= 0.0005000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps=1000                      # Energy steps&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
notice that this is an easy quantity to check for the convergence in q-points.&lt;br /&gt;
&lt;br /&gt;
[[File:Ph_dos.png|600px|center| Phonon Density of States]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Eliashberg Functions&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot Eliashberg functions&amp;lt;ref&amp;gt;F. Marsiglio, J.P. Carbotte [https://arxiv.org/abs/cond-mat/0106143 Electron - Phonon Superconductivity]&amp;lt;/ref&amp;gt; for both electrons and excitons. In order to plot Eliashberg functions you must have calculated Quasi-Particle correction with the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt;, see above.&lt;br /&gt;
The command  &#039;&#039;ypp_ph -s e&#039;&#039; generate the input for the electronic Eliashberg functions:&lt;br /&gt;
&lt;br /&gt;
 electrons                        # [R] Electronic properties&lt;br /&gt;
 eliashberg                       # [R] Eliashberg&lt;br /&gt;
 PhBroad= 0.0010000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps= 200                      # Energy steps&lt;br /&gt;
 %QPkrange                        #  generalized Kpoint/Band indices&lt;br /&gt;
  1|1|4|5|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
in this example we plot Eliashberg functions for the top valence and bottom conduction band at Gamma point:&lt;br /&gt;
&lt;br /&gt;
[[File:Eliashberg functions.png|600px|center| Eliashberg functions]]&lt;br /&gt;
&lt;br /&gt;
For the excitonic Eliashberg functions use the command &#039;&#039;ypp_ph -e e&#039;&#039;, an example of these functions can be found in ref.&amp;lt;ref name=marini&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atomic displacement amplitudes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Running &#039;&#039;ypp_ph -p a&#039;&#039; will plot the atomic displacement for each atom in the cell each direction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Other variables in the input files &#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In the input files of the present tutorial there are other variable not used in this tutorial.&lt;br /&gt;
In particular &#039;&#039;GkkpExpand&#039;&#039; is used for other calculations not present in the GPL, while  &#039;&#039;GkkpConvert&#039;&#039; is used to checking purpose the IO for different versions&lt;br /&gt;
of the databases.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4066</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4066"/>
		<updated>2021-01-04T08:38:12Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Optical properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial&amp;lt;ref&amp;gt; This tutorial is based on [http://www.attaccalite.com/elena/news/ Elena Cannuccia blog]&amp;lt;/ref&amp;gt; is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calculation with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. You can use this simple python script [http://www.yambo-code.org/educational/tutorials/files/minus_kpoints.py minuq_kpoints.py] to read k-points from the QE output and multiply them by minus one.&lt;br /&gt;
The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: use the same parallelization in the &#039;&#039;&#039;phonon&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculation to avoid problem reading wave-functions.&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/si.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                      # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                     # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                    # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If you repeat the calculation for different temperature you can obtain the trend of the gap vs temperature, see figure below:&lt;br /&gt;
[[File:Si_gap_finite_t.png|600px|center]]&lt;br /&gt;
If you uncomment the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt; the code saves information about the Eliashberg functions that can be plotted using the &#039;&#039;ypp_ph&#039;&#039;, see below.&amp;lt;br&amp;gt;&lt;br /&gt;
Finally if you add &#039;&#039;-V qp&#039;&#039; in the input generation a new flag appears &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;OnMassShell&amp;lt;/span&amp;gt;, if you un-comment this flag calculation will be performed in the &amp;quot;on mass shell&amp;quot; approximation, namely the static limit the Quasi-Particle approximation, for a discussion see reference &amp;lt;ref&amp;gt;H. Kawai et al. [https://arxiv.org/abs/1310.2038 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 085202 (2014)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&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  &#039;&#039;yambo_ph -o c -V qp&#039;&#039;&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;
  1 | 1 |                             # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
   2 |  7 |                           # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
  0.000000 | 5.000000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.0100000 | 0.0100000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd=  500                   # [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. 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 same procedure can be applied to the Bethe-Salpeter calculations. However in this case results can be slightly wrong. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &amp;lt;ref&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&amp;gt;F. Paleari, [https://orbilu.uni.lu/handle/10993/41058 Phd Thesis]&amp;lt;/ref&amp;gt;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref name=marini&amp;gt;A. Marini, [https://arxiv.org/abs/0712.3365 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039; 106405 (2008)]&amp;lt;/ref&amp;gt; . This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged. This is due to the poor parameters used in this tutorial to make the calculations fast. In order to have converged results, first of all you have to be sure to have converged phonons, in order to do that increase  plane-wave cutoff,  number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the parameters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate  &#039;&#039;&#039;phonons&#039;&#039;&#039;. In the following section we will describe a smart way to accelerate convergence.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene: &amp;lt;/span&amp;gt; At present Yambo neither implements the Fröhlich term at q=0&amp;lt;ref&amp;gt;Carla Verdi and Feliciano Giustino&lt;br /&gt;
[https://arxiv.org/abs/1510.06373 Phys. Rev. Lett. &#039;&#039;&#039;115&#039;&#039;&#039;, 176401 (2015)] &amp;lt;/ref&amp;gt; nor the quadrupolar correction,&amp;lt;ref&amp;gt;G. Brunin et al.  [https://arxiv.org/abs/2002.00628  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 136601 (2020)]&amp;lt;/ref&amp;gt; therefore convergence in polar material can be very slow with the number of q-points.&lt;br /&gt;
&lt;br /&gt;
== Double-grid method for the electron-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
To be done&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phonon density of states&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot phonon density of states with the command: &#039;&#039;ypp_ph -p d&#039;&#039;. In order to get a nice plot set in the input&lt;br /&gt;
&lt;br /&gt;
 phonons                          # [R] Phononic properties&lt;br /&gt;
 dos                              # [R] DOS&lt;br /&gt;
 PhBroad= 0.0005000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps=1000                      # Energy steps&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
notice that this is an easy quantity to check for the convergence in q-points.&lt;br /&gt;
&lt;br /&gt;
[[File:Ph_dos.png|600px|center| Phonon Density of States]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Eliashberg Functions&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot Eliashberg functions&amp;lt;ref&amp;gt;F. Marsiglio, J.P. Carbotte [https://arxiv.org/abs/cond-mat/0106143 Electron - Phonon Superconductivity]&amp;lt;/ref&amp;gt; for both electrons and excitons. In order to plot Eliashberg functions you must have calculated Quasi-Particle correction with the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt;, see above.&lt;br /&gt;
The command  &#039;&#039;ypp_ph -s e&#039;&#039; generate the input for the electronic Eliashberg functions:&lt;br /&gt;
&lt;br /&gt;
 electrons                        # [R] Electronic properties&lt;br /&gt;
 eliashberg                       # [R] Eliashberg&lt;br /&gt;
 PhBroad= 0.0010000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps= 200                      # Energy steps&lt;br /&gt;
 %QPkrange                        #  generalized Kpoint/Band indices&lt;br /&gt;
  1|1|4|5|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
in this example we plot Eliashberg functions for the top valence and bottom conduction band at Gamma point:&lt;br /&gt;
&lt;br /&gt;
[[File:Eliashberg functions.png|600px|center| Eliashberg functions]]&lt;br /&gt;
&lt;br /&gt;
For the excitonic Eliashberg functions use the command &#039;&#039;ypp_ph -e e&#039;&#039;, an example of these functions can be found in ref.&amp;lt;ref name=marini&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atomic displacement amplitudes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Running &#039;&#039;ypp_ph -p a&#039;&#039; will plot the atomic displacement for each atom in the cell each direction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Other variables in the input files &#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In the input files of the present tutorial there are other variable not used in this tutorial.&lt;br /&gt;
In particular &#039;&#039;GkkpExpand&#039;&#039; is used for other calculations not present in the GPL, while  &#039;&#039;GkkpConvert&#039;&#039; is used to checking purpose the IO for different versions&lt;br /&gt;
of the databases.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4065</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4065"/>
		<updated>2021-01-04T08:37:41Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Optical properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial&amp;lt;ref&amp;gt; This tutorial is based on [http://www.attaccalite.com/elena/news/ Elena Cannuccia blog]&amp;lt;/ref&amp;gt; is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calculation with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. You can use this simple python script [http://www.yambo-code.org/educational/tutorials/files/minus_kpoints.py minuq_kpoints.py] to read k-points from the QE output and multiply them by minus one.&lt;br /&gt;
The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: use the same parallelization in the &#039;&#039;&#039;phonon&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculation to avoid problem reading wave-functions.&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/si.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                      # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                     # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                    # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If you repeat the calculation for different temperature you can obtain the trend of the gap vs temperature, see figure below:&lt;br /&gt;
[[File:Si_gap_finite_t.png|600px|center]]&lt;br /&gt;
If you uncomment the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt; the code saves information about the Eliashberg functions that can be plotted using the &#039;&#039;ypp_ph&#039;&#039;, see below.&amp;lt;br&amp;gt;&lt;br /&gt;
Finally if you add &#039;&#039;-V qp&#039;&#039; in the input generation a new flag appears &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;OnMassShell&amp;lt;/span&amp;gt;, if you un-comment this flag calculation will be performed in the &amp;quot;on mass shell&amp;quot; approximation, namely the static limit the Quasi-Particle approximation, for a discussion see reference &amp;lt;ref&amp;gt;H. Kawai et al. [https://arxiv.org/abs/1310.2038 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 085202 (2014)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&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  &#039;&#039;yambo_ph -o c -V qp&#039;&#039;&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;
  1 | 1 |                             # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
   2 |  7 |                           # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
  0.000000 | 5.000000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.0100000 | 0.0100000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd=  500                   # [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. 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 same procedure can be applied to the Bethe-Salpeter calculations. However in this case results can be slightly wrong. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &amp;lt;ref&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&amp;gt;F. Paleari [https://orbilu.uni.lu/handle/10993/41058 Phd Thesis]&amp;lt;/ref&amp;gt;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref name=marini&amp;gt;A. Marini, [https://arxiv.org/abs/0712.3365 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039; 106405 (2008)]&amp;lt;/ref&amp;gt; . This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged. This is due to the poor parameters used in this tutorial to make the calculations fast. In order to have converged results, first of all you have to be sure to have converged phonons, in order to do that increase  plane-wave cutoff,  number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the parameters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate  &#039;&#039;&#039;phonons&#039;&#039;&#039;. In the following section we will describe a smart way to accelerate convergence.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene: &amp;lt;/span&amp;gt; At present Yambo neither implements the Fröhlich term at q=0&amp;lt;ref&amp;gt;Carla Verdi and Feliciano Giustino&lt;br /&gt;
[https://arxiv.org/abs/1510.06373 Phys. Rev. Lett. &#039;&#039;&#039;115&#039;&#039;&#039;, 176401 (2015)] &amp;lt;/ref&amp;gt; nor the quadrupolar correction,&amp;lt;ref&amp;gt;G. Brunin et al.  [https://arxiv.org/abs/2002.00628  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 136601 (2020)]&amp;lt;/ref&amp;gt; therefore convergence in polar material can be very slow with the number of q-points.&lt;br /&gt;
&lt;br /&gt;
== Double-grid method for the electron-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
To be done&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phonon density of states&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot phonon density of states with the command: &#039;&#039;ypp_ph -p d&#039;&#039;. In order to get a nice plot set in the input&lt;br /&gt;
&lt;br /&gt;
 phonons                          # [R] Phononic properties&lt;br /&gt;
 dos                              # [R] DOS&lt;br /&gt;
 PhBroad= 0.0005000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps=1000                      # Energy steps&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
notice that this is an easy quantity to check for the convergence in q-points.&lt;br /&gt;
&lt;br /&gt;
[[File:Ph_dos.png|600px|center| Phonon Density of States]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Eliashberg Functions&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot Eliashberg functions&amp;lt;ref&amp;gt;F. Marsiglio, J.P. Carbotte [https://arxiv.org/abs/cond-mat/0106143 Electron - Phonon Superconductivity]&amp;lt;/ref&amp;gt; for both electrons and excitons. In order to plot Eliashberg functions you must have calculated Quasi-Particle correction with the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt;, see above.&lt;br /&gt;
The command  &#039;&#039;ypp_ph -s e&#039;&#039; generate the input for the electronic Eliashberg functions:&lt;br /&gt;
&lt;br /&gt;
 electrons                        # [R] Electronic properties&lt;br /&gt;
 eliashberg                       # [R] Eliashberg&lt;br /&gt;
 PhBroad= 0.0010000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps= 200                      # Energy steps&lt;br /&gt;
 %QPkrange                        #  generalized Kpoint/Band indices&lt;br /&gt;
  1|1|4|5|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
in this example we plot Eliashberg functions for the top valence and bottom conduction band at Gamma point:&lt;br /&gt;
&lt;br /&gt;
[[File:Eliashberg functions.png|600px|center| Eliashberg functions]]&lt;br /&gt;
&lt;br /&gt;
For the excitonic Eliashberg functions use the command &#039;&#039;ypp_ph -e e&#039;&#039;, an example of these functions can be found in ref.&amp;lt;ref name=marini&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atomic displacement amplitudes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Running &#039;&#039;ypp_ph -p a&#039;&#039; will plot the atomic displacement for each atom in the cell each direction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Other variables in the input files &#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In the input files of the present tutorial there are other variable not used in this tutorial.&lt;br /&gt;
In particular &#039;&#039;GkkpExpand&#039;&#039; is used for other calculations not present in the GPL, while  &#039;&#039;GkkpConvert&#039;&#039; is used to checking purpose the IO for different versions&lt;br /&gt;
of the databases.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4064</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4064"/>
		<updated>2021-01-04T08:35:32Z</updated>

		<summary type="html">&lt;p&gt;Claudio: Undo revision 4063 by Claudio (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial&amp;lt;ref&amp;gt; This tutorial is based on [http://www.attaccalite.com/elena/news/ Elena Cannuccia blog]&amp;lt;/ref&amp;gt; is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calculation with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. You can use this simple python script [http://www.yambo-code.org/educational/tutorials/files/minus_kpoints.py minuq_kpoints.py] to read k-points from the QE output and multiply them by minus one.&lt;br /&gt;
The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: use the same parallelization in the &#039;&#039;&#039;phonon&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculation to avoid problem reading wave-functions.&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/si.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                      # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                     # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                    # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If you repeat the calculation for different temperature you can obtain the trend of the gap vs temperature, see figure below:&lt;br /&gt;
[[File:Si_gap_finite_t.png|600px|center]]&lt;br /&gt;
If you uncomment the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt; the code saves information about the Eliashberg functions that can be plotted using the &#039;&#039;ypp_ph&#039;&#039;, see below.&amp;lt;br&amp;gt;&lt;br /&gt;
Finally if you add &#039;&#039;-V qp&#039;&#039; in the input generation a new flag appears &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;OnMassShell&amp;lt;/span&amp;gt;, if you un-comment this flag calculation will be performed in the &amp;quot;on mass shell&amp;quot; approximation, namely the static limit the Quasi-Particle approximation, for a discussion see reference &amp;lt;ref&amp;gt;H. Kawai et al. [https://arxiv.org/abs/1310.2038 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 085202 (2014)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&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  &#039;&#039;yambo_ph -o c -V qp&#039;&#039;&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;
  1 | 1 |                             # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
   2 |  7 |                           # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
  0.000000 | 5.000000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.0100000 | 0.0100000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd=  500                   # [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. 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 same procedure can be applied to the Bethe-Salpeter calculations. However in this case results can be slightly wrong. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &amp;lt;ref&amp;gt;  H. Chen, D. Sangalli, and M. Bernardi, [https://arxiv.org/abs/2002.08913 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039; 107401 (2020)]&amp;lt;/ref&amp;gt;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref name=marini&amp;gt;A. Marini, [https://arxiv.org/abs/0712.3365 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039; 106405 (2008)]&amp;lt;/ref&amp;gt; . This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged. This is due to the poor parameters used in this tutorial to make the calculations fast. In order to have converged results, first of all you have to be sure to have converged phonons, in order to do that increase  plane-wave cutoff,  number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the parameters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate  &#039;&#039;&#039;phonons&#039;&#039;&#039;. In the following section we will describe a smart way to accelerate convergence.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene: &amp;lt;/span&amp;gt; At present Yambo neither implements the Fröhlich term at q=0&amp;lt;ref&amp;gt;Carla Verdi and Feliciano Giustino&lt;br /&gt;
[https://arxiv.org/abs/1510.06373 Phys. Rev. Lett. &#039;&#039;&#039;115&#039;&#039;&#039;, 176401 (2015)] &amp;lt;/ref&amp;gt; nor the quadrupolar correction,&amp;lt;ref&amp;gt;G. Brunin et al.  [https://arxiv.org/abs/2002.00628  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 136601 (2020)]&amp;lt;/ref&amp;gt; therefore convergence in polar material can be very slow with the number of q-points.&lt;br /&gt;
&lt;br /&gt;
== Double-grid method for the electron-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
To be done&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phonon density of states&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot phonon density of states with the command: &#039;&#039;ypp_ph -p d&#039;&#039;. In order to get a nice plot set in the input&lt;br /&gt;
&lt;br /&gt;
 phonons                          # [R] Phononic properties&lt;br /&gt;
 dos                              # [R] DOS&lt;br /&gt;
 PhBroad= 0.0005000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps=1000                      # Energy steps&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
notice that this is an easy quantity to check for the convergence in q-points.&lt;br /&gt;
&lt;br /&gt;
[[File:Ph_dos.png|600px|center| Phonon Density of States]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Eliashberg Functions&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot Eliashberg functions&amp;lt;ref&amp;gt;F. Marsiglio, J.P. Carbotte [https://arxiv.org/abs/cond-mat/0106143 Electron - Phonon Superconductivity]&amp;lt;/ref&amp;gt; for both electrons and excitons. In order to plot Eliashberg functions you must have calculated Quasi-Particle correction with the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt;, see above.&lt;br /&gt;
The command  &#039;&#039;ypp_ph -s e&#039;&#039; generate the input for the electronic Eliashberg functions:&lt;br /&gt;
&lt;br /&gt;
 electrons                        # [R] Electronic properties&lt;br /&gt;
 eliashberg                       # [R] Eliashberg&lt;br /&gt;
 PhBroad= 0.0010000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps= 200                      # Energy steps&lt;br /&gt;
 %QPkrange                        #  generalized Kpoint/Band indices&lt;br /&gt;
  1|1|4|5|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
in this example we plot Eliashberg functions for the top valence and bottom conduction band at Gamma point:&lt;br /&gt;
&lt;br /&gt;
[[File:Eliashberg functions.png|600px|center| Eliashberg functions]]&lt;br /&gt;
&lt;br /&gt;
For the excitonic Eliashberg functions use the command &#039;&#039;ypp_ph -e e&#039;&#039;, an example of these functions can be found in ref.&amp;lt;ref name=marini&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atomic displacement amplitudes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Running &#039;&#039;ypp_ph -p a&#039;&#039; will plot the atomic displacement for each atom in the cell each direction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Other variables in the input files &#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In the input files of the present tutorial there are other variable not used in this tutorial.&lt;br /&gt;
In particular &#039;&#039;GkkpExpand&#039;&#039; is used for other calculations not present in the GPL, while  &#039;&#039;GkkpConvert&#039;&#039; is used to checking purpose the IO for different versions&lt;br /&gt;
of the databases.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4063</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4063"/>
		<updated>2021-01-04T08:34:44Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Optical properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial&amp;lt;ref&amp;gt; This tutorial is based on [http://www.attaccalite.com/elena/news/ Elena Cannuccia blog]&amp;lt;/ref&amp;gt; is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calculation with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. You can use this simple python script [http://www.yambo-code.org/educational/tutorials/files/minus_kpoints.py minuq_kpoints.py] to read k-points from the QE output and multiply them by minus one.&lt;br /&gt;
The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: use the same parallelization in the &#039;&#039;&#039;phonon&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculation to avoid problem reading wave-functions.&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/si.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                      # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                     # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                    # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If you repeat the calculation for different temperature you can obtain the trend of the gap vs temperature, see figure below:&lt;br /&gt;
[[File:Si_gap_finite_t.png|600px|center]]&lt;br /&gt;
If you uncomment the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt; the code saves information about the Eliashberg functions that can be plotted using the &#039;&#039;ypp_ph&#039;&#039;, see below.&amp;lt;br&amp;gt;&lt;br /&gt;
Finally if you add &#039;&#039;-V qp&#039;&#039; in the input generation a new flag appears &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;OnMassShell&amp;lt;/span&amp;gt;, if you un-comment this flag calculation will be performed in the &amp;quot;on mass shell&amp;quot; approximation, namely the static limit the Quasi-Particle approximation, for a discussion see reference &amp;lt;ref&amp;gt;H. Kawai et al. [https://arxiv.org/abs/1310.2038 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 085202 (2014)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&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  &#039;&#039;yambo_ph -o c -V qp&#039;&#039;&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;
  1 | 1 |                             # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
   2 |  7 |                           # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
  0.000000 | 5.000000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.0100000 | 0.0100000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd=  500                   # [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. 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 same procedure can be applied to the Bethe-Salpeter calculations. However in this case results can be slightly wrong. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &amp;lt;ref&amp;gt;  see Supp. Mat. of E. Cannuccia, B. Monserrat, and C. Attaccalite [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.99.081109&lt;br /&gt;
Phys. Rev. B 99, 081109(R)]&amp;lt;ref&amp;gt;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref name=marini&amp;gt;A. Marini, [https://arxiv.org/abs/0712.3365 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039; 106405 (2008)]&amp;lt;/ref&amp;gt; . This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged. This is due to the poor parameters used in this tutorial to make the calculations fast. In order to have converged results, first of all you have to be sure to have converged phonons, in order to do that increase  plane-wave cutoff,  number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the parameters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate  &#039;&#039;&#039;phonons&#039;&#039;&#039;. In the following section we will describe a smart way to accelerate convergence.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene: &amp;lt;/span&amp;gt; At present Yambo neither implements the Fröhlich term at q=0&amp;lt;ref&amp;gt;Carla Verdi and Feliciano Giustino&lt;br /&gt;
[https://arxiv.org/abs/1510.06373 Phys. Rev. Lett. &#039;&#039;&#039;115&#039;&#039;&#039;, 176401 (2015)] &amp;lt;/ref&amp;gt; nor the quadrupolar correction,&amp;lt;ref&amp;gt;G. Brunin et al.  [https://arxiv.org/abs/2002.00628  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 136601 (2020)]&amp;lt;/ref&amp;gt; therefore convergence in polar material can be very slow with the number of q-points.&lt;br /&gt;
&lt;br /&gt;
== Double-grid method for the electron-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
To be done&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phonon density of states&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot phonon density of states with the command: &#039;&#039;ypp_ph -p d&#039;&#039;. In order to get a nice plot set in the input&lt;br /&gt;
&lt;br /&gt;
 phonons                          # [R] Phononic properties&lt;br /&gt;
 dos                              # [R] DOS&lt;br /&gt;
 PhBroad= 0.0005000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps=1000                      # Energy steps&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
notice that this is an easy quantity to check for the convergence in q-points.&lt;br /&gt;
&lt;br /&gt;
[[File:Ph_dos.png|600px|center| Phonon Density of States]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Eliashberg Functions&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
You can plot Eliashberg functions&amp;lt;ref&amp;gt;F. Marsiglio, J.P. Carbotte [https://arxiv.org/abs/cond-mat/0106143 Electron - Phonon Superconductivity]&amp;lt;/ref&amp;gt; for both electrons and excitons. In order to plot Eliashberg functions you must have calculated Quasi-Particle correction with the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;WRgFsq&amp;lt;/span&amp;gt;, see above.&lt;br /&gt;
The command  &#039;&#039;ypp_ph -s e&#039;&#039; generate the input for the electronic Eliashberg functions:&lt;br /&gt;
&lt;br /&gt;
 electrons                        # [R] Electronic properties&lt;br /&gt;
 eliashberg                       # [R] Eliashberg&lt;br /&gt;
 PhBroad= 0.0010000          eV    # Phonon broadening (Eliashberg &amp;amp; DOS)&lt;br /&gt;
 PhStps= 200                      # Energy steps&lt;br /&gt;
 %QPkrange                        #  generalized Kpoint/Band indices&lt;br /&gt;
  1|1|4|5|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
in this example we plot Eliashberg functions for the top valence and bottom conduction band at Gamma point:&lt;br /&gt;
&lt;br /&gt;
[[File:Eliashberg functions.png|600px|center| Eliashberg functions]]&lt;br /&gt;
&lt;br /&gt;
For the excitonic Eliashberg functions use the command &#039;&#039;ypp_ph -e e&#039;&#039;, an example of these functions can be found in ref.&amp;lt;ref name=marini&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atomic displacement amplitudes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Running &#039;&#039;ypp_ph -p a&#039;&#039; will plot the atomic displacement for each atom in the cell each direction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Other variables in the input files &#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
In the input files of the present tutorial there are other variable not used in this tutorial.&lt;br /&gt;
In particular &#039;&#039;GkkpExpand&#039;&#039; is used for other calculations not present in the GPL, while  &#039;&#039;GkkpConvert&#039;&#039; is used to checking purpose the IO for different versions&lt;br /&gt;
of the databases.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4002</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=4002"/>
		<updated>2020-12-18T17:11:00Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/si.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If repeat calculation for different temperature you can obtain the trend of the gap vs temperature:&lt;br /&gt;
[[File:Si_gap_finite_t.png|500px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Si_gap_finite_t.png&amp;diff=4001</id>
		<title>File:Si gap finite t.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Si_gap_finite_t.png&amp;diff=4001"/>
		<updated>2020-12-18T17:04:59Z</updated>

		<summary type="html">&lt;p&gt;Claudio: Claudio uploaded a new version of File:Si gap finite t.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-12-18&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Claudio|Claudio]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Si_gap_finite_t.png&amp;diff=4000</id>
		<title>File:Si gap finite t.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Si_gap_finite_t.png&amp;diff=4000"/>
		<updated>2020-12-18T17:02:40Z</updated>

		<summary type="html">&lt;p&gt;Claudio: Claudio uploaded a new version of File:Si gap finite t.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-12-18&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Claudio|Claudio]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3999</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3999"/>
		<updated>2020-12-18T17:00:05Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Quasi-particle band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If repeat calculation for different temperature you can obtain the trend of the gap vs temperature:&lt;br /&gt;
[[File:Si_gap_finite_t.png|500px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3998</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3998"/>
		<updated>2020-12-18T16:59:30Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Quasi-particle band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If repeat calculation for different temperature you can obtain the trend of the gap vs temperature:&lt;br /&gt;
[[File:Si_gap_finite_t.png|400px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3997</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3997"/>
		<updated>2020-12-18T16:58:05Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Quasi-particle band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
If repeat calculation for different temperature you can obtain the trend of the gap vs temperature:&lt;br /&gt;
[[File:Si_gap_finite_t.png|200px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Si_gap_finite_t.png&amp;diff=3996</id>
		<title>File:Si gap finite t.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Si_gap_finite_t.png&amp;diff=3996"/>
		<updated>2020-12-18T16:54:24Z</updated>

		<summary type="html">&lt;p&gt;Claudio: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-12-18&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Claudio|Claudio]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3995</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3995"/>
		<updated>2020-12-18T16:46:41Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Quasi-particle band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;). In the input we require the correction only at gamma point:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  12                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|1|4|5|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3994</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3994"/>
		<updated>2020-12-18T16:44:38Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3993</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3993"/>
		<updated>2020-12-18T16:43:53Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GkkpExpand&amp;lt;/span&amp;gt;                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3992</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3992"/>
		<updated>2020-12-18T16:43:18Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3991</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3991"/>
		<updated>2020-12-18T16:42:55Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x4 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....       &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (   0.1250000   0.1250000  -0.1250000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (  -0.2500000  -0.2500000   0.2500000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.2500000   0.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (  -0.1250000  -0.3750000   0.3750000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.2500000   0.2500000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (  -0.5000000   0.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000   0.2500000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
8&lt;br /&gt;
       0.000000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.125000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.250000000  0.250000000 -0.250000000 1&lt;br /&gt;
      -0.250000000  0.000000000  0.000000000 1&lt;br /&gt;
      -0.375000000 -0.125000000  0.125000000 1&lt;br /&gt;
       0.000000000  0.250000000 -0.250000000 1&lt;br /&gt;
       0.500000000  0.000000000  0.000000000 1&lt;br /&gt;
       0.500000000 -0.250000000  0.000000000 1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 8 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   12&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3990</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3990"/>
		<updated>2020-12-18T15:58:29Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk hBN.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x2 grid and 16 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
      number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0625000&lt;br /&gt;
        k(    2) = (   0.0000000   0.0000000  -0.1888048), wk =   0.0625000&lt;br /&gt;
        k(    3) = (   0.0000000   0.2886751   0.0000000), wk =   0.3750000&lt;br /&gt;
        k(    4) = (   0.0000000   0.2886751  -0.1888048), wk =   0.3750000&lt;br /&gt;
        k(    5) = (   0.0000000  -0.5773503   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.5773503  -0.1888048), wk =   0.1875000&lt;br /&gt;
        k(    7) = (   0.2500000   0.4330127   0.0000000), wk =   0.3750000&lt;br /&gt;
        k(    8) = (   0.2500000   0.4330127  -0.1888048), wk =   0.3750000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
   0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
   0.0000000   0.0000000   0.1888048   1&lt;br /&gt;
   0.0000000  -0.2886751   0.0000000   1&lt;br /&gt;
   0.0000000  -0.2886751   0.1888048   1&lt;br /&gt;
   0.0000000   0.5773503   0.0000000   1&lt;br /&gt;
   0.0000000   0.5773503   0.1888048   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.0000000   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.1888048   1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
   0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
   0.0000000   0.0000000   0.1888048   1&lt;br /&gt;
   0.0000000  -0.2886751   0.0000000   1&lt;br /&gt;
   0.0000000  -0.2886751   0.1888048   1&lt;br /&gt;
   0.0000000   0.5773503   0.0000000   1&lt;br /&gt;
   0.0000000   0.5773503   0.1888048   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.0000000   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.1888048   1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3989</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3989"/>
		<updated>2020-12-18T15:55:40Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk hBN.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x2 grid and 16 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x2 grid:&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
      number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0625000&lt;br /&gt;
        k(    2) = (   0.0000000   0.0000000  -0.1888048), wk =   0.0625000&lt;br /&gt;
        k(    3) = (   0.0000000   0.2886751   0.0000000), wk =   0.3750000&lt;br /&gt;
        k(    4) = (   0.0000000   0.2886751  -0.1888048), wk =   0.3750000&lt;br /&gt;
        k(    5) = (   0.0000000  -0.5773503   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    6) = (   0.0000000  -0.5773503  -0.1888048), wk =   0.1875000&lt;br /&gt;
        k(    7) = (   0.2500000   0.4330127   0.0000000), wk =   0.3750000&lt;br /&gt;
        k(    8) = (   0.2500000   0.4330127  -0.1888048), wk =   0.3750000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
   0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
   0.0000000   0.0000000   0.1888048   1&lt;br /&gt;
   0.0000000  -0.2886751   0.0000000   1&lt;br /&gt;
   0.0000000  -0.2886751   0.1888048   1&lt;br /&gt;
   0.0000000   0.5773503   0.0000000   1&lt;br /&gt;
   0.0000000   0.5773503   0.1888048   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.0000000   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.1888048   1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
   0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
   0.0000000   0.0000000   0.1888048   1&lt;br /&gt;
   0.0000000  -0.2886751   0.0000000   1&lt;br /&gt;
   0.0000000  -0.2886751   0.1888048   1&lt;br /&gt;
   0.0000000   0.5773503   0.0000000   1&lt;br /&gt;
   0.0000000   0.5773503   0.1888048   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.0000000   1&lt;br /&gt;
  -0.2500000  -0.4330127   0.1888048   1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3988</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3988"/>
		<updated>2020-12-18T15:32:23Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x1 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x1 grid:&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (  -0.2500000   0.2500000  -0.2500000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (   0.5000000  -0.5000000   0.5000000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.0000000   0.5000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (   0.7500000  -0.2500000   0.7500000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.5000000   0.0000000   0.5000000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (   0.0000000  -1.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000  -1.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 8&lt;br /&gt;
     0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
     0.2500000  -0.2500000   0.2500000   1 &lt;br /&gt;
    -0.5000000   0.5000000  -0.5000000   1&lt;br /&gt;
     0.0000000  -0.5000000   0.0000000   1&lt;br /&gt;
    -0.7500000   0.2500000  -0.7500000   1&lt;br /&gt;
    -0.5000000   0.0000000  -0.5000000   1&lt;br /&gt;
     0.0000000   1.0000000   0.0000000   1&lt;br /&gt;
     0.5000000   1.0000000   0.0000000   1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/si*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
8&lt;br /&gt;
     0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
     0.2500000  -0.2500000   0.2500000   1 &lt;br /&gt;
    -0.5000000   0.5000000  -0.5000000   1&lt;br /&gt;
     0.0000000  -0.5000000   0.0000000   1&lt;br /&gt;
    -0.7500000   0.2500000  -0.7500000   1&lt;br /&gt;
    -0.5000000   0.0000000  -0.5000000   1&lt;br /&gt;
     0.0000000   1.0000000   0.0000000   1&lt;br /&gt;
     0.5000000   1.0000000   0.0000000   1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3987</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3987"/>
		<updated>2020-12-18T15:31:52Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties for bulk silicon.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/si.epc.tgz si.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo. Notice that if you are working with 2D systems, not our case, we have to add the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct 2D phonons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 4x4x1 grid and 12 bands.&lt;br /&gt;
In the nscf output you will find the list of k-points corresponding to the 4x4x1 grid:&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
     number of k points=     8&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0312500&lt;br /&gt;
        k(    2) = (  -0.2500000   0.2500000  -0.2500000), wk =   0.2500000&lt;br /&gt;
        k(    3) = (   0.5000000  -0.5000000   0.5000000), wk =   0.1250000&lt;br /&gt;
        k(    4) = (   0.0000000   0.5000000   0.0000000), wk =   0.1875000&lt;br /&gt;
        k(    5) = (   0.7500000  -0.2500000   0.7500000), wk =   0.7500000&lt;br /&gt;
        k(    6) = (   0.5000000   0.0000000   0.5000000), wk =   0.3750000&lt;br /&gt;
        k(    7) = (   0.0000000  -1.0000000   0.0000000), wk =   0.0937500&lt;br /&gt;
        k(    8) = (  -0.5000000  -1.0000000   0.0000000), wk =   0.1875000&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and use it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;si&#039;&lt;br /&gt;
             fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;si.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
8&lt;br /&gt;
     0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
     0.2500000  -0.2500000   0.2500000   1 &lt;br /&gt;
    -0.5000000   0.5000000  -0.5000000   1&lt;br /&gt;
     0.0000000  -0.5000000   0.0000000   1&lt;br /&gt;
    -0.7500000   0.2500000  -0.7500000   1&lt;br /&gt;
    -0.5000000   0.0000000  -0.5000000   1&lt;br /&gt;
     0.0000000   1.0000000   0.0000000   1&lt;br /&gt;
     0.5000000   1.0000000   0.0000000   1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/si.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/si*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;si&#039;&lt;br /&gt;
            fildvscf = &#039;si-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;si.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
8&lt;br /&gt;
     0.0000000   0.0000000   0.0000000   1&lt;br /&gt;
     0.2500000  -0.2500000   0.2500000   1 &lt;br /&gt;
    -0.5000000   0.5000000  -0.5000000   1&lt;br /&gt;
     0.0000000  -0.5000000   0.0000000   1&lt;br /&gt;
    -0.7500000   0.2500000  -0.7500000   1&lt;br /&gt;
    -0.5000000   0.0000000  -0.5000000   1&lt;br /&gt;
     0.0000000   1.0000000   0.0000000   1&lt;br /&gt;
     0.5000000   1.0000000   0.0000000   1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3986</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3986"/>
		<updated>2020-12-18T15:17:49Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Optical properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3985</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3985"/>
		<updated>2020-12-18T15:17:18Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Optical properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in ref. &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;, while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. &amp;lt;ref&amp;gt;A. Marini, [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;. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3984</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3984"/>
		<updated>2020-12-18T15:15:05Z</updated>

		<summary type="html">&lt;p&gt;Claudio: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3983</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3983"/>
		<updated>2020-12-18T14:09:35Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Electron-phonon matrix elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3982</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3982"/>
		<updated>2020-12-18T11:54:55Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Special note for FCC cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3981</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3981"/>
		<updated>2020-12-18T09:38:04Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Special note for FCC cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Special note&amp;lt;/span&amp;gt; for FCC cells ==&lt;br /&gt;
&lt;br /&gt;
In QuantumEspresso there is a different convention respect to Yambo and other codes in the definition of FCC units cell (&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;ibrav=2, 3, and -3&amp;lt;/span&amp;gt;), this results in alat parameter two time smaller than the expected one in Yambo.&lt;br /&gt;
If you import WF from these calculation please &#039;&#039;p2y -a 2.0&#039;&#039;. Otherwise a better solution is to define the FCC cell in a standard way, for example the silicon input becomes:&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3980</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3980"/>
		<updated>2020-12-18T09:37:46Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Special note for FCC cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Special note&amp;lt;/span&amp;gt; for FCC cells ==&lt;br /&gt;
&lt;br /&gt;
In QuantumEspresso there is a different convention respect to Yambo and other codes in the definition of FCC units cell (&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ibrav=2, 3, and -3&amp;lt;/span&amp;gt;), this results in alat parameter two time smaller than the expected one in Yambo.&lt;br /&gt;
If you import WF from these calculation please &#039;&#039;p2y -a 2.0&#039;&#039;. Otherwise a better solution is to define the FCC cell in a standard way, for example the silicon input becomes:&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3979</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3979"/>
		<updated>2020-12-18T09:35:46Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Special note for FCC cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
==  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Special note&amp;lt;/span&amp;gt; for FCC cells ==&lt;br /&gt;
&lt;br /&gt;
In QuantumEspresso there is a different convention respect to Yambo and other codes in the definition of FCC units cell (ibrav=2, 3, and -3), this results in alat parameter two time smaller than the expected one in Yambo.&lt;br /&gt;
If you import WF from these calculation please &#039;&#039;p2y -a 2.0&#039;&#039;. Otherwise a better solution is to define the FCC cell in a standard way, for example the silicon input becomes:&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3978</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3978"/>
		<updated>2020-12-18T09:33:36Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Special note for FCC cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
== Special note for FCC cells ==&lt;br /&gt;
&lt;br /&gt;
In QuantumEspresso there is a different convention respect to Yambo and other codes in the definition of FCC units cell (ibrav=2, 3, and -3), this results in alat parameter two time smaller than the expected one in Yambo.&lt;br /&gt;
If you import WF from these calculation please &#039;&#039;p2y -a 2.0&#039;&#039;. Otherwise a better solution is to define the FCC cell in a standard way, for example the silicon input becomes:&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3977</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3977"/>
		<updated>2020-12-18T09:16:23Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Special note for FCC cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
== Special note for FCC cells ==&lt;br /&gt;
&lt;br /&gt;
In QuantumEspresso there is a different convention respect to Yambo and other codes in the definition of FCC units cell (ibrav=2, 3, and -3), this results in alat parameter two time smaller than the expected one in Yambo.&lt;br /&gt;
If you import WF from these calculation please &#039;&#039;p2y-a 2.0&#039;&#039;. Otherwise a better solution is to define the FCC cell in a standard way, for example the silicon input becomes:&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3976</id>
		<title>Electron Phonon Coupling</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Electron_Phonon_Coupling&amp;diff=3976"/>
		<updated>2020-12-18T09:00:17Z</updated>

		<summary type="html">&lt;p&gt;Claudio: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here we show step-by-step how to use [https://www.quantum-espresso.org/ Quantum Espresso] to calculate phonons and electron-phonon matrix-elements on a regular q-grid, &lt;br /&gt;
with the final aim to allow Yambo to read these databases and calculate the temperature-dependent correction to the electronic states.&lt;br /&gt;
This tutorial is quite complicated, take your time to follow all the steps&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
In this first section we will explain how to generate electron-phonon matrix elements in Quantum-Espresso, and then import them in Yambo.&lt;br /&gt;
Calculations will be divided in different folders:&lt;br /&gt;
 &lt;br /&gt;
* &#039;&#039;&#039;pseudo&#039;&#039;&#039; the pseudo potential folder &lt;br /&gt;
* &#039;&#039;&#039;scf&#039;&#039;&#039; for the self-consistent calculation&lt;br /&gt;
* &#039;&#039;&#039;nscf&#039;&#039;&#039; for the non-self-consistent calcaultion with a larger number of bands&lt;br /&gt;
* &#039;&#039;&#039;phonon&#039;&#039;&#039; for the phonons calculations&lt;br /&gt;
* &#039;&#039;&#039;dvscf&#039;&#039;&#039; for the calculation of  electron-phonon matrix elements&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will show how to calculate electron-phonon induced corrections to the bands and optical properties of 2D hexagonal boron nitride.&lt;br /&gt;
All input file are availabe in the following tgz file: [http://www.yambo-code.org/educational/tutorials/files/hBN.epc.tgz hBN.epc.tgz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. In &#039;&#039;&#039;scf&#039;&#039;&#039; we run a standard scf calculation choosing the a large k-grid in such a way to converge density. Do not forget to set  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;force_symmorphic=.true.&#039;&#039;&amp;lt;/span&amp;gt;, because not symmorphic symmetries are not supported yet in Yambo.      Notice that because the present system is two-dimensional we added the flag  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;assume_isolated=&amp;quot;2D&amp;quot;&#039;&#039;&amp;lt;/span&amp;gt; in such a way correct phonons in 2D, remove this flag is you have a system with a different dimensionality (a bulk, a molecule etc...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder, and then copy the ${PREFIX}.save folder from &#039;&#039;&#039;scf&#039;&#039;&#039; to &#039;&#039;&#039;nscf&#039;&#039;&#039;, in the present example just do  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../scf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
In the nscf input you have to choose the number of k-points and bands you will use for the electron-phonon coupling and Yambo calculations, in our case we will a 9x9x1 grid and 8 bands.&lt;br /&gt;
&lt;br /&gt;
 .....   &lt;br /&gt;
  number of k points=    12&lt;br /&gt;
                       cart. coord. in units 2pi/alat&lt;br /&gt;
        k(    1) = (   0.0000000   0.0000000   0.0000000), wk =   0.0246914&lt;br /&gt;
        k(    2) = (   0.0000000   0.1283001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    3) = (   0.0000000   0.2566001   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    4) = (   0.0000000   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    5) = (   0.0000000   0.5132002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    6) = (   0.1111111   0.1924501   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(    7) = (   0.1111111   0.3207501   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    8) = (   0.1111111   0.4490502   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(    9) = (   0.1111111   0.5773503   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   10) = (   0.2222222   0.3849002   0.0000000), wk =   0.1481481&lt;br /&gt;
        k(   11) = (   0.2222222   0.5132002   0.0000000), wk =   0.2962963&lt;br /&gt;
        k(   12) = (   0.3333333   0.5773503   0.0000000), wk =   0.0493827&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Go in the &#039;&#039;&#039;phonon&#039;&#039;&#039; directory. You have to copy the k-points list in the &#039;&#039;2pi/alat&#039;&#039; units from the previous nscf run and provide it as q-grid for the phonon calculations. Notice that due to an internal convection of Yambo the q-points have to be multiplied for -1 before add them to the phonons input. In the last Yambo version you can also generate the k/q list with the minus sign using the &#039;&#039;ypp -k q&#039;&#039; and turning one the &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;MinusQ&amp;lt;/span&amp;gt; flag. The final input will be:&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
            verbosity = &#039;high&#039;&lt;br /&gt;
               tr2_ph = 1e-12h&lt;br /&gt;
               prefix = &#039;bn&#039;&lt;br /&gt;
             fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
               fildyn = &#039;bn.dyn&#039;,&lt;br /&gt;
      electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
                epsil = .true.&lt;br /&gt;
                trans = .true.&lt;br /&gt;
                ldisp = .false.&lt;br /&gt;
                qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Go in the &#039;&#039;&#039;dvscf&#039;&#039;&#039; folder. From the nscf folder copy density and wave-functions  and from the phonon folder copy the dynamical matrices and the dvscf matrix elements:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../nscf/bn.save ./&#039;&#039;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;&#039;&#039;cp -r ../phonon/_ph0 ../phonon/bn*.dyn* ./&#039;&#039;&amp;lt;/span&amp;gt;.  Then  modify the phonon input to generate electron-phonon matrix elements for Yambo, by changing  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;trans = .false.&amp;lt;/span&amp;gt; and  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;electron_phonon = yambo&amp;lt;/span&amp;gt;. You do not need to specify the k-point grid because it is read from the nscf wave-functions. In this way we will not recalculate phonons, but only the electron-phonon matrix elements for the number of bands present in the nscf input file, in our case 8 bands:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
           verbosity = &#039;high&#039;&lt;br /&gt;
              tr2_ph = 1e-12&lt;br /&gt;
              prefix = &#039;bn&#039;&lt;br /&gt;
            fildvscf = &#039;bn-dvscf&#039;&lt;br /&gt;
              fildyn = &#039;bn.dyn&#039;&lt;br /&gt;
     electron_phonon = &#039;yambo&#039;,&lt;br /&gt;
               epsil = .true.&lt;br /&gt;
               trans = .false.&lt;br /&gt;
               ldisp = .false.&lt;br /&gt;
               qplot = .true.&lt;br /&gt;
 /&lt;br /&gt;
 12&lt;br /&gt;
    0.0000000    0.0000000   0.0000000  1&lt;br /&gt;
    0.0000000   -0.1283001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.2566001   0.0000000  1&lt;br /&gt;
    0.0000000   -0.3849002   0.0000000  1&lt;br /&gt;
    0.0000000   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.1924501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.3207501   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.4490502   0.0000000  1&lt;br /&gt;
   -0.1111111   -0.5773503   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.3849002   0.0000000  1&lt;br /&gt;
   -0.2222222   -0.5132002   0.0000000  1&lt;br /&gt;
   -0.3333333   -0.5773503   0.0000000  1&lt;br /&gt;
&lt;br /&gt;
this run will generate a new folder &#039;&#039;elph_dir&#039;&#039; with all electron-phonon matrix elements in a format compatible with Yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Now you have to read the wave-functions. Go in the &#039;&#039;dvscf/bn.save&#039;&#039; folder, do &#039;&#039;p2y&#039;&#039;, then &#039;&#039;yambo_ph -i -V kpt&#039;&#039; and turn on the flag &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;BSEscatt&amp;lt;/span&amp;gt;, then run the setup. Now you use ypp_ph to import electron-phonon coupling, by doing &#039;&#039;ypp_ph -g&#039; and the the PW el-ph folder:&lt;br /&gt;
&lt;br /&gt;
 gkkp                             # [R] gkkp databases&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DBsPATH= &amp;quot;../elph_dir/&amp;quot; &amp;lt;/span&amp;gt;                    # Path to the PW el-ph databases&lt;br /&gt;
 PHfreqF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon frequencies&lt;br /&gt;
 PHmodeF= &amp;quot;none&amp;quot;                  # PWscf format file containing the phonon modes&lt;br /&gt;
 #GkkpExpand                    # Expand the gkkp in the whole BZ&lt;br /&gt;
 #GkkpConvert                   # Convert the gkkp to new I/O format&lt;br /&gt;
&lt;br /&gt;
run ypp_ph, and if everything went well you will get in output&lt;br /&gt;
&lt;br /&gt;
 .....&lt;br /&gt;
 -&amp;gt; [06] == Electron-Phonon Interface: PW-&amp;gt;Yambo Databases ==&lt;br /&gt;
 &amp;lt;---&amp;gt; PW(ELPH) databases ...[PHONON] ...found 12 Q-grid compatible&lt;br /&gt;
 &amp;lt;---&amp;gt; ELPH databases (WRITE) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt;  Modes           :   6&lt;br /&gt;
 &amp;lt;---&amp;gt;  Bands range     :   8&lt;br /&gt;
 .....&lt;br /&gt;
&lt;br /&gt;
== Quasi-particle band structure ==&lt;br /&gt;
The first quantity we will calculate is the correction to the band structure induced by the electron-phonon coupling. In order to generate the corresponding input do &#039;&#039;yambo_ph -g n -p fan -c p -V gen&#039;&#039; (in the newer versions of Yambo this line will be changed in  &#039;&#039;yambo_ph -g n -p ep -c p -V gen&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
If you run yambo_ph -J T0 you will get correction at zero kelvin to the band structure. You can change the temperature to 300 K by doing:&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_ph_corr                       # [R] Electron-Phonon Correlation&lt;br /&gt;
 Nelectro= 8.000000               # Electrons number&lt;br /&gt;
 ElecTemp= 0.000000         eV    # Electronic Temperature&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp= 300.0            K &amp;lt;/span&amp;gt;   # Bosonic Temperature&lt;br /&gt;
 OccTresh= 0.100000E-4            # Occupation treshold (metallic bands)&lt;br /&gt;
 SE_Threads=0                     # [OPENMP/GW] Number of threads for self-energy&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GphBRnge=  8                     # [ELPH] G[W] bands range&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 |  6 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 #WRgFsq                        # [ELPH] Dump on file gFsq coefficients&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 1|12|1|8|&lt;br /&gt;
 %&lt;br /&gt;
run again &#039;&#039;yambo_ph -J T300&#039;&#039; and compare the two output file o-T0.qp and o-T300.qp, to find how much the gap change with the temperature.&lt;br /&gt;
&lt;br /&gt;
== Optical properties ==&lt;br /&gt;
&lt;br /&gt;
You can use the previous calculate quasi-particle band structure to get optical properties, by doing &#039;&#039;yambo_ph -o b -k sex -y d -V qp -X s&#039;&#039; and then reading the corresponding ndb.QP database &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Nota bene&amp;lt;/span&amp;gt;: Calculation of exciton width is not completely correct. If fact electron-phonon matrix elements should be rotate in the excitonic space, as it was done in Ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.125.107401 Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;  107401 (2020)], while at present Yambo calculate the exciton width from the correction to the single particle bands, see ref. [https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.101.106405 Phys. Rev. Lett. &#039;&#039;&#039;101&#039;&#039;&#039;  106405 (2008)]. This approximation is correct in case of not-strong bounded excitons, and unfortunately this is not the case.&lt;br /&gt;
&lt;br /&gt;
== Convergence ==&lt;br /&gt;
&lt;br /&gt;
The results of this tutorial are not converged, and if you check output there are also some phonon mode with negative energies. This is due to the poor parameters used in this tutorial. In order to have converged results, first of all be sure to have converged phonons, increase the plane-wave cutoff, the number of k-points and if necessary reduce &#039;&#039;tr2_ph&#039;&#039;.&lt;br /&gt;
Then change the paramters for the Yambo calculations, increasing the number of &#039;&#039;&#039;k&#039;&#039;&#039; and &#039;&#039;&#039;q&#039;&#039;&#039; points and the number of bands. If you want to increase only the number of bands, just repeat the &#039;&#039;&#039;nscf&#039;&#039;&#039; and &#039;&#039;&#039;dvscf&#039;&#039;&#039; calculations without recalculate the &#039;&#039;&#039;phonons&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous and post-processing ==&lt;br /&gt;
There are a list of utilities to analyze electron-phonon coupling results:&lt;br /&gt;
* &#039;&#039;ypp_ph -p d&#039;&#039;  -&amp;gt; to plot the phonon density of states&lt;br /&gt;
* &#039;&#039;ypp_ph -p e&#039;&#039;  -&amp;gt; to plot Eliashberg Functions&lt;br /&gt;
* &#039;&#039;ypp_ph -p a&#039;&#039;  -&amp;gt; to analyze single atom amplitudes (to be fixed)&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Special note for FCC cells&amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3914</id>
		<title>Using Yambo in parallel</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3914"/>
		<updated>2020-12-15T10:58:08Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* RPA response in parallel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module presents examples of how to run Yambo in a parallel environment.&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* Initialization for [[Bulk_material:_h-BN|bulk hBN]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* The &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; databases for bulk hBN&lt;br /&gt;
* The &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&lt;br /&gt;
==Yambo Parallelism in a nutshell==&lt;br /&gt;
Yambo implements a hybrid [https://en.wikipedia.org/wiki/Message_Passing_Interface MPI]+[https://en.wikipedia.org/wiki/OpenMP OpenMP] parallel scheme, suited to run&lt;br /&gt;
on large partitions of HPC machines. For instance, runs over several tens of thousands of cores on the Marconi KNL partition (CINECA, IT) have been achieved, with a computational power ~ 3 PFl/s, as well as large scale runs on accelerated machines such as Piz-Daint at CSCS (CH),  featuring NVIDIA GPUs.&lt;br /&gt;
* &#039;&#039;&#039;MPI&#039;&#039;&#039; is particularly suited to distribute both memory and computation, and has a very efficient implementation in Yambo, which needs very few communications though may be prone to load unbalance (see [[GW_parallel_strategies| GW parallel strategies]]).&lt;br /&gt;
* &#039;&#039;&#039;OpenMP&#039;&#039;&#039; instead works within a shared memory paradigm, meaning that multiple threads perform computation in parallel on the same data in memory (no memory replica, at least in principle).&lt;br /&gt;
* Concerning &#039;&#039;&#039;Yambo&#039;&#039;&#039;, tend to use MPI parallelism as much as possible (i.e. as much as memory allows), then resort to OpenMP parallelism in order not to increase memory usage any further while exploiting more cores and computing power.&lt;br /&gt;
* &#039;&#039;&#039;GPU&#039;&#039;&#039; support is extremely efficient in Yambo, meaning that when you are running on GPU accelerated machines it is always a good idea to exploit the GPUs. In general, one needs to set 1 MPI task for each available GPU card, also including OpenMP threads to fully exploit the capabilities of the host. While a very relevant speed up can be achieved, device memory (eg 12, 16, 32 GB on currently available devices) may become a problem and needs to be controlled (eg increasing the number of required nodes and further distributing data across them). &lt;br /&gt;
* The number of &#039;&#039;&#039;MPI tasks&#039;&#039;&#039; and &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039; per task can be controlled in a standard way, e.g. as&lt;br /&gt;
  $ export OMP_NUM_THREADS=4&lt;br /&gt;
  $ mpirun -np 12  yambo  -F yambo.in  -J label &lt;br /&gt;
resulting in a run exploiting up to 48 threads (best fit on 48 physical cores, though hyper-threading, i.e. more threads than cores, can be exploited to feed computing units at best)&lt;br /&gt;
* TIP: In order to control the number of OpenMP threads via the OMP_NUM_THREADS environment variable, make sure that the thread-related variables in the yambo input file (e.g. X_Threads, DIP_Threads, SE_Threads) are set to zero or not set. When set, these variables will overwrite the value given to OMP_NUM_THREADS.&lt;br /&gt;
* A fine tuning of the parallel structure of Yambo (both MPI and OpenMP) can be obtained by operating on specific input variables (run level dependent), which can be activated, during input generation, via the flag &amp;lt;code&amp;gt; -V par&amp;lt;/code&amp;gt; (verbosity high on parallel variables).&lt;br /&gt;
* Yambo can take advantage of parallel dense linear algebra (e.g. via [[https://en.wikipedia.org/wiki/ScaLAPACK ScaLAPACK]], SLK in the following). Control is provided by input variables&lt;br /&gt;
(see e.g. [[Using_Yambo_in_parallel#RPA response in parallel|RPA response in parallel]])&lt;br /&gt;
* When running in parallel, one report file is written, while multiple log files are dumped (one per MPI task, by default), and stored in a newly created &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder. When running with thousands of MPI tasks, the number of log files can be reduced by setting, in the input file, something like:&lt;br /&gt;
  NLogCPUs = 4         # [PARALLEL] Live-timing CPU`s (0 for all)&lt;br /&gt;
&lt;br /&gt;
In the following we give direct examples of parallel setup for some among the most standard Yambo kernels.&lt;br /&gt;
&lt;br /&gt;
==HF run in parallel==&lt;br /&gt;
Full theory and instructions about how to run HF (or, better, exchange self-energy) calculations are given in the [[Hartree Fock]] module.&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, the quantities to be computed are:&lt;br /&gt;
&amp;lt;!-- &amp;lt;br&amp;gt;&amp;lt;math&amp;gt;&lt;br /&gt;
\Sigma^x_{n\mathbf{k}}=\langle n\mathbf{k} | \Sigma^x | n\mathbf{k} \rangle =&lt;br /&gt;
-\sum_m \int_{BZ} \frac{d^3\mathbf{q}}{(2\pi)^3} \sum_{\mathbf{G}} \text{v}(\mathbf{q+G}) |\rho_{nm}(\mathbf{k,q,G})|^2 f_{m\mathbf{(k-q)}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
[[File:Sx.png|none|x50px|caption]]&lt;br /&gt;
Basically, for every orbital &#039;&#039;nk&#039;&#039; we want to compute the exchange contribution to the qp correction. In order to to this, we need to perform a sum over q vectors and a sum over occupied bands (to build the density matrix).&lt;br /&gt;
&lt;br /&gt;
* Generate the input file asking for parallel verbosity:&lt;br /&gt;
  $ yambo -x -V par  -F hf.in&lt;br /&gt;
* By default, OpenMP acts on spatial degrees of freedom (both direct and reciprocal space) and takes care of FFTs. Do not forget to set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; variable (to 1 to avoid OpenMP parallelism)&lt;br /&gt;
  $ export OMP_NUM_THREADS=1     or&lt;br /&gt;
  $ export OMP_NUM_THREADS= &amp;lt;integer_larger_than_one&amp;gt;&lt;br /&gt;
* By default, the MPI parallelism will distribute both computation and memory over the bands in the inner sum (b). Without editing the input file, simply run:&lt;br /&gt;
  $ mpirun -np 4 yambo -F hf.in -J &amp;lt;run_label&amp;gt;&lt;br /&gt;
* Alternatively, MPI parallelism can work over three different levels &amp;lt;code&amp;gt;q,qp,b&amp;lt;/code&amp;gt; at the same time:&lt;br /&gt;
  q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
  qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
  b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F hf.in  -J  run_mpi8_omp1&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==RPA response in parallel==&lt;br /&gt;
Full theory and instructions about how to run independent particle (IP) or RPA linear response calculations are given e.g. in [[Optics at the independent particle level]] or [[Dynamic screening (PPA)]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IP linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, let us focus at first on a q-resolved quantity like the IP optical response:&lt;br /&gt;
[[File:CH1.png|none|x60px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
* Here, in order to obtain the dielectric function, either in the optical limit (q-&amp;gt;0) or at finite q, one basically needs to sum over valence-conduction transitions (v,c) for each k point in the BZ. The calculation can be made easily parallel over these indexes. &lt;br /&gt;
* This is done at the &#039;&#039;&#039;MPI level&#039;&#039;&#039; (distributing both memory and computation), and also by &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039;, just distributing the computational load. &lt;br /&gt;
* In this very specific case, OpenMP also requires some extra memory workspace (i.e. by increasing the number of OMP threads, the memory usage will also increase).&lt;br /&gt;
&lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_IP.in&lt;br /&gt;
edit some the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                 # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                   # [Xd] Transferred momenta &lt;br /&gt;
 %&lt;br /&gt;
These changes set as &#039;&#039;independent particle&#039;&#039; (IP) the response function to be calculated, and asks for the dielectric function at q=1 (that is always gamma)&lt;br /&gt;
* Set also the following openmp related variables to zero (or simply delete them):&lt;br /&gt;
 X_Threads = 0&lt;br /&gt;
 DIP_Threads = 0&lt;br /&gt;
This is needed to control the number of OpenMP threads vai the OMP_NUM_THREADS environment variable. To avoid OpenMP parallelism, set&lt;br /&gt;
 export OMP_NUM_THREADS=1&lt;br /&gt;
* Now you are ready to run. By suing the default parallelism (over 8 MPI tasks) we have to issue:&lt;br /&gt;
  $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8&lt;br /&gt;
* by inspecting the log files (one per MPI task in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder), we see that the parallelism over conduction states has been used.&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU structure provided for the Response_G_space_Zero_Momentum ENVIRONMENT is incomplete. Switching to defaults&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [LA] SERIAL linear algebra&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for K(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for CON bands on 8 CPU] Loaded/Total (Percentual):12/92(13%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for VAL bands on 1 CPU] Loaded/Total (Percentual):8/8(100%)&lt;br /&gt;
* Alternatively, edit the input file and set the parallelism fine-tuning variables:&lt;br /&gt;
 X_q_0_CPU=  &amp;quot; 1 4 2&amp;quot;         # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_q_0_ROLEs= &amp;quot;k c v&amp;quot;         # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
Run as before&lt;br /&gt;
 $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8_tuned&lt;br /&gt;
* Fine tuning is useful when running over a large number of MPI tasks. Care must be taken when setting the parameters: In this case, for instance, we need to make sure that conduction and valence states are multiples of 4 and 2 respectively. Such situations can be handled by yambo, but especially for valence states which are usually less than conduction states, can lead to load unbalance and not perfect filling of the cores.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RPA linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here, after the calculation of the independent particle linear response, a matrix inversion is performed to obtain the RPA response. &lt;br /&gt;
* After initialization (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_RPA.in&lt;br /&gt;
edit some of the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;           # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 NGsBlkXd= 6            Ry   # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                    # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
*Run and inspect the log files: After the calculation of &#039;Xo&#039;, the code computes &#039;X&#039;, performing some dense linear algebra operations, which can &lt;br /&gt;
be made parallel, using scaLapack, by setting, eg&lt;br /&gt;
 X_q_0_nCPU_LinAlG_INV = 8   # [PARALLEL] CPUs for Linear Algebra&lt;br /&gt;
Note that the largest square number smaller than 8, in this case, will be used to form the scaLapack grid (2x2, here).&lt;br /&gt;
* Parallelism fine tuning works as for the IP response.&lt;br /&gt;
&lt;br /&gt;
In case multiple or all q points need to be computed (as in GW calculations), the parallelism variables to be used, are:&lt;br /&gt;
 X_all_q_ROLEs= &amp;quot;g q k c v&amp;quot;     # [PARALLEL] CPUs roles (g,q,k,c,v) &lt;br /&gt;
 X_all_q_CPU= &amp;quot;1 2 1 4 1&amp;quot;      # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_all_q_nCPU_LinAlg_INV= 8   # [PARALLEL] CPUs for Linear Algebra &lt;br /&gt;
adding one extra MPI level of parallelism related to the distribution over q points.&lt;br /&gt;
&lt;br /&gt;
Finally the different possible parallelism strategies for the dielectric constant are:&lt;br /&gt;
&lt;br /&gt;
 g      parallelism over G-vectors&lt;br /&gt;
 q      parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 c/v    parallelism over conduction/valence bands&lt;br /&gt;
 k      parallelism over k-points&lt;br /&gt;
&lt;br /&gt;
Notice that parellelization on c,v and k reduces the amount of memory in the calculation.&lt;br /&gt;
&lt;br /&gt;
==GW in parallel==&lt;br /&gt;
In a complete GW run, several runlevels (dipoles, RPA linear response for all q, exchange self-energy, and correlation self-energy) are run in a row to eventually compute the GW quasi-particle (QP) corrections.  &lt;br /&gt;
How to run [[Using_Yambo_in_parallel#RPA response in parallel|linear response]] and the [[Using_Yambo_in_parallel#HF run in parallel|exchange self-energy]] in parallel has already been discussed above.&lt;br /&gt;
Here we focus on the parallelisation of the correlation self-energy.&lt;br /&gt;
&lt;br /&gt;
The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]]&lt;br /&gt;
&lt;br /&gt;
According to this equation, for each nk matrix element to be computed (qp corrections), a sum over q vectors in the Brillouin zone and a sum over (b) bands (m in Eq.) have to be performed, together with sums over G,G&#039; reciprocal space variables. This gives rise to 3 levels of MPI parallelism (qp, q, b), which can be combined with OpenMP to take care of spatial degrees of freedom.&lt;br /&gt;
As for the exchange self-energy, the MPI parallelism levels that can be controlled are given by:&lt;br /&gt;
&lt;br /&gt;
 q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
 b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Additionally, the variable &amp;lt;code&amp;gt;SE_Threads&amp;lt;/code&amp;gt; can be set to fine-tune the OpenMP parallelism (leave it set to zero to control it via the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable)&lt;br /&gt;
&lt;br /&gt;
To generate the input file, type&lt;br /&gt;
  yambo -g n -p p -F  gw.in &lt;br /&gt;
&lt;br /&gt;
To run in parallel with default parallelism do:&lt;br /&gt;
  export OMP_NUM_THREADS=1    #(or an integer larger than 1 to use OpenMP parallelism) &lt;br /&gt;
  mpirun -np 8 yambo -F gw.in -J  run_mpi8_omp1&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F gw.in  -J  run_mpi8_omp1_tuned&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==BSE in parallel==&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[Tutorials|Back to tutorials menu]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3913</id>
		<title>Using Yambo in parallel</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3913"/>
		<updated>2020-12-15T10:56:48Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* RPA response in parallel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module presents examples of how to run Yambo in a parallel environment.&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* Initialization for [[Bulk_material:_h-BN|bulk hBN]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* The &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; databases for bulk hBN&lt;br /&gt;
* The &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&lt;br /&gt;
==Yambo Parallelism in a nutshell==&lt;br /&gt;
Yambo implements a hybrid [https://en.wikipedia.org/wiki/Message_Passing_Interface MPI]+[https://en.wikipedia.org/wiki/OpenMP OpenMP] parallel scheme, suited to run&lt;br /&gt;
on large partitions of HPC machines. For instance, runs over several tens of thousands of cores on the Marconi KNL partition (CINECA, IT) have been achieved, with a computational power ~ 3 PFl/s, as well as large scale runs on accelerated machines such as Piz-Daint at CSCS (CH),  featuring NVIDIA GPUs.&lt;br /&gt;
* &#039;&#039;&#039;MPI&#039;&#039;&#039; is particularly suited to distribute both memory and computation, and has a very efficient implementation in Yambo, which needs very few communications though may be prone to load unbalance (see [[GW_parallel_strategies| GW parallel strategies]]).&lt;br /&gt;
* &#039;&#039;&#039;OpenMP&#039;&#039;&#039; instead works within a shared memory paradigm, meaning that multiple threads perform computation in parallel on the same data in memory (no memory replica, at least in principle).&lt;br /&gt;
* Concerning &#039;&#039;&#039;Yambo&#039;&#039;&#039;, tend to use MPI parallelism as much as possible (i.e. as much as memory allows), then resort to OpenMP parallelism in order not to increase memory usage any further while exploiting more cores and computing power.&lt;br /&gt;
* &#039;&#039;&#039;GPU&#039;&#039;&#039; support is extremely efficient in Yambo, meaning that when you are running on GPU accelerated machines it is always a good idea to exploit the GPUs. In general, one needs to set 1 MPI task for each available GPU card, also including OpenMP threads to fully exploit the capabilities of the host. While a very relevant speed up can be achieved, device memory (eg 12, 16, 32 GB on currently available devices) may become a problem and needs to be controlled (eg increasing the number of required nodes and further distributing data across them). &lt;br /&gt;
* The number of &#039;&#039;&#039;MPI tasks&#039;&#039;&#039; and &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039; per task can be controlled in a standard way, e.g. as&lt;br /&gt;
  $ export OMP_NUM_THREADS=4&lt;br /&gt;
  $ mpirun -np 12  yambo  -F yambo.in  -J label &lt;br /&gt;
resulting in a run exploiting up to 48 threads (best fit on 48 physical cores, though hyper-threading, i.e. more threads than cores, can be exploited to feed computing units at best)&lt;br /&gt;
* TIP: In order to control the number of OpenMP threads via the OMP_NUM_THREADS environment variable, make sure that the thread-related variables in the yambo input file (e.g. X_Threads, DIP_Threads, SE_Threads) are set to zero or not set. When set, these variables will overwrite the value given to OMP_NUM_THREADS.&lt;br /&gt;
* A fine tuning of the parallel structure of Yambo (both MPI and OpenMP) can be obtained by operating on specific input variables (run level dependent), which can be activated, during input generation, via the flag &amp;lt;code&amp;gt; -V par&amp;lt;/code&amp;gt; (verbosity high on parallel variables).&lt;br /&gt;
* Yambo can take advantage of parallel dense linear algebra (e.g. via [[https://en.wikipedia.org/wiki/ScaLAPACK ScaLAPACK]], SLK in the following). Control is provided by input variables&lt;br /&gt;
(see e.g. [[Using_Yambo_in_parallel#RPA response in parallel|RPA response in parallel]])&lt;br /&gt;
* When running in parallel, one report file is written, while multiple log files are dumped (one per MPI task, by default), and stored in a newly created &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder. When running with thousands of MPI tasks, the number of log files can be reduced by setting, in the input file, something like:&lt;br /&gt;
  NLogCPUs = 4         # [PARALLEL] Live-timing CPU`s (0 for all)&lt;br /&gt;
&lt;br /&gt;
In the following we give direct examples of parallel setup for some among the most standard Yambo kernels.&lt;br /&gt;
&lt;br /&gt;
==HF run in parallel==&lt;br /&gt;
Full theory and instructions about how to run HF (or, better, exchange self-energy) calculations are given in the [[Hartree Fock]] module.&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, the quantities to be computed are:&lt;br /&gt;
&amp;lt;!-- &amp;lt;br&amp;gt;&amp;lt;math&amp;gt;&lt;br /&gt;
\Sigma^x_{n\mathbf{k}}=\langle n\mathbf{k} | \Sigma^x | n\mathbf{k} \rangle =&lt;br /&gt;
-\sum_m \int_{BZ} \frac{d^3\mathbf{q}}{(2\pi)^3} \sum_{\mathbf{G}} \text{v}(\mathbf{q+G}) |\rho_{nm}(\mathbf{k,q,G})|^2 f_{m\mathbf{(k-q)}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
[[File:Sx.png|none|x50px|caption]]&lt;br /&gt;
Basically, for every orbital &#039;&#039;nk&#039;&#039; we want to compute the exchange contribution to the qp correction. In order to to this, we need to perform a sum over q vectors and a sum over occupied bands (to build the density matrix).&lt;br /&gt;
&lt;br /&gt;
* Generate the input file asking for parallel verbosity:&lt;br /&gt;
  $ yambo -x -V par  -F hf.in&lt;br /&gt;
* By default, OpenMP acts on spatial degrees of freedom (both direct and reciprocal space) and takes care of FFTs. Do not forget to set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; variable (to 1 to avoid OpenMP parallelism)&lt;br /&gt;
  $ export OMP_NUM_THREADS=1     or&lt;br /&gt;
  $ export OMP_NUM_THREADS= &amp;lt;integer_larger_than_one&amp;gt;&lt;br /&gt;
* By default, the MPI parallelism will distribute both computation and memory over the bands in the inner sum (b). Without editing the input file, simply run:&lt;br /&gt;
  $ mpirun -np 4 yambo -F hf.in -J &amp;lt;run_label&amp;gt;&lt;br /&gt;
* Alternatively, MPI parallelism can work over three different levels &amp;lt;code&amp;gt;q,qp,b&amp;lt;/code&amp;gt; at the same time:&lt;br /&gt;
  q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
  qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
  b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F hf.in  -J  run_mpi8_omp1&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==RPA response in parallel==&lt;br /&gt;
Full theory and instructions about how to run independent particle (IP) or RPA linear response calculations are given e.g. in [[Optics at the independent particle level]] or [[Dynamic screening (PPA)]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IP linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, let us focus at first on a q-resolved quantity like the IP optical response:&lt;br /&gt;
[[File:CH1.png|none|x60px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
* Here, in order to obtain the dielectric function, either in the optical limit (q-&amp;gt;0) or at finite q, one basically needs to sum over valence-conduction transitions (v,c) for each k point in the BZ. The calculation can be made easily parallel over these indexes. &lt;br /&gt;
* This is done at the &#039;&#039;&#039;MPI level&#039;&#039;&#039; (distributing both memory and computation), and also by &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039;, just distributing the computational load. &lt;br /&gt;
* In this very specific case, OpenMP also requires some extra memory workspace (i.e. by increasing the number of OMP threads, the memory usage will also increase).&lt;br /&gt;
&lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_IP.in&lt;br /&gt;
edit some the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                 # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                   # [Xd] Transferred momenta &lt;br /&gt;
 %&lt;br /&gt;
These changes set as &#039;&#039;independent particle&#039;&#039; (IP) the response function to be calculated, and asks for the dielectric function at q=1 (that is always gamma)&lt;br /&gt;
* Set also the following openmp related variables to zero (or simply delete them):&lt;br /&gt;
 X_Threads = 0&lt;br /&gt;
 DIP_Threads = 0&lt;br /&gt;
This is needed to control the number of OpenMP threads vai the OMP_NUM_THREADS environment variable. To avoid OpenMP parallelism, set&lt;br /&gt;
 export OMP_NUM_THREADS=1&lt;br /&gt;
* Now you are ready to run. By suing the default parallelism (over 8 MPI tasks) we have to issue:&lt;br /&gt;
  $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8&lt;br /&gt;
* by inspecting the log files (one per MPI task in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder), we see that the parallelism over conduction states has been used.&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU structure provided for the Response_G_space_Zero_Momentum ENVIRONMENT is incomplete. Switching to defaults&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [LA] SERIAL linear algebra&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for K(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for CON bands on 8 CPU] Loaded/Total (Percentual):12/92(13%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for VAL bands on 1 CPU] Loaded/Total (Percentual):8/8(100%)&lt;br /&gt;
* Alternatively, edit the input file and set the parallelism fine-tuning variables:&lt;br /&gt;
 X_q_0_CPU=  &amp;quot; 1 4 2&amp;quot;         # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_q_0_ROLEs= &amp;quot;k c v&amp;quot;         # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
Run as before&lt;br /&gt;
 $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8_tuned&lt;br /&gt;
* Fine tuning is useful when running over a large number of MPI tasks. Care must be taken when setting the parameters: In this case, for instance, we need to make sure that conduction and valence states are multiples of 4 and 2 respectively. Such situations can be handled by yambo, but especially for valence states which are usually less than conduction states, can lead to load unbalance and not perfect filling of the cores.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RPA linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here, after the calculation of the independent particle linear response, a matrix inversion is performed to obtain the RPA response. &lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_RPA.in&lt;br /&gt;
edit some of the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;           # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 NGsBlkXd= 6            Ry   # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                    # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
*Run and inspect the log files: After the calculation of &#039;Xo&#039;, the code computes &#039;X&#039;, performing some dense linear algebra operations, which can &lt;br /&gt;
be made parallel, using scaLapack, by setting, eg&lt;br /&gt;
 X_q_0_nCPU_LinAlG_INV = 8   # [PARALLEL] CPUs for Linear Algebra&lt;br /&gt;
Note that the largest square number smaller than 8, in this case, will be used to form the scaLapack grid (2x2, here).&lt;br /&gt;
* Parallelism fine tuning works as for the IP response.&lt;br /&gt;
&lt;br /&gt;
In case multiple or all q points need to be computed (as in GW calculations), the parallelism variables to be used, are:&lt;br /&gt;
 X_all_q_ROLEs= &amp;quot;g q k c v&amp;quot;     # [PARALLEL] CPUs roles (g,q,k,c,v) &lt;br /&gt;
 X_all_q_CPU= &amp;quot;1 2 1 4 1&amp;quot;      # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_all_q_nCPU_LinAlg_INV= 8   # [PARALLEL] CPUs for Linear Algebra &lt;br /&gt;
adding one extra MPI level of parallelism related to the distribution over q points.&lt;br /&gt;
&lt;br /&gt;
Finally the different possible parallelism strategies for the dielectric constant are:&lt;br /&gt;
&lt;br /&gt;
 g      parallelism over G-vectors&lt;br /&gt;
 q      parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 c/v    parallelism over conduction/valence bands&lt;br /&gt;
 k      parallelism over k-points&lt;br /&gt;
&lt;br /&gt;
Notice that parellization on c,v and k reduce the amount of memory in the calculation.&lt;br /&gt;
&lt;br /&gt;
==GW in parallel==&lt;br /&gt;
In a complete GW run, several runlevels (dipoles, RPA linear response for all q, exchange self-energy, and correlation self-energy) are run in a row to eventually compute the GW quasi-particle (QP) corrections.  &lt;br /&gt;
How to run [[Using_Yambo_in_parallel#RPA response in parallel|linear response]] and the [[Using_Yambo_in_parallel#HF run in parallel|exchange self-energy]] in parallel has already been discussed above.&lt;br /&gt;
Here we focus on the parallelisation of the correlation self-energy.&lt;br /&gt;
&lt;br /&gt;
The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]]&lt;br /&gt;
&lt;br /&gt;
According to this equation, for each nk matrix element to be computed (qp corrections), a sum over q vectors in the Brillouin zone and a sum over (b) bands (m in Eq.) have to be performed, together with sums over G,G&#039; reciprocal space variables. This gives rise to 3 levels of MPI parallelism (qp, q, b), which can be combined with OpenMP to take care of spatial degrees of freedom.&lt;br /&gt;
As for the exchange self-energy, the MPI parallelism levels that can be controlled are given by:&lt;br /&gt;
&lt;br /&gt;
 q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
 b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Additionally, the variable &amp;lt;code&amp;gt;SE_Threads&amp;lt;/code&amp;gt; can be set to fine-tune the OpenMP parallelism (leave it set to zero to control it via the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable)&lt;br /&gt;
&lt;br /&gt;
To generate the input file, type&lt;br /&gt;
  yambo -g n -p p -F  gw.in &lt;br /&gt;
&lt;br /&gt;
To run in parallel with default parallelism do:&lt;br /&gt;
  export OMP_NUM_THREADS=1    #(or an integer larger than 1 to use OpenMP parallelism) &lt;br /&gt;
  mpirun -np 8 yambo -F gw.in -J  run_mpi8_omp1&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F gw.in  -J  run_mpi8_omp1_tuned&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==BSE in parallel==&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[Tutorials|Back to tutorials menu]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3912</id>
		<title>Using Yambo in parallel</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3912"/>
		<updated>2020-12-15T10:56:03Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* RPA response in parallel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module presents examples of how to run Yambo in a parallel environment.&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* Initialization for [[Bulk_material:_h-BN|bulk hBN]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* The &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; databases for bulk hBN&lt;br /&gt;
* The &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&lt;br /&gt;
==Yambo Parallelism in a nutshell==&lt;br /&gt;
Yambo implements a hybrid [https://en.wikipedia.org/wiki/Message_Passing_Interface MPI]+[https://en.wikipedia.org/wiki/OpenMP OpenMP] parallel scheme, suited to run&lt;br /&gt;
on large partitions of HPC machines. For instance, runs over several tens of thousands of cores on the Marconi KNL partition (CINECA, IT) have been achieved, with a computational power ~ 3 PFl/s, as well as large scale runs on accelerated machines such as Piz-Daint at CSCS (CH),  featuring NVIDIA GPUs.&lt;br /&gt;
* &#039;&#039;&#039;MPI&#039;&#039;&#039; is particularly suited to distribute both memory and computation, and has a very efficient implementation in Yambo, which needs very few communications though may be prone to load unbalance (see [[GW_parallel_strategies| GW parallel strategies]]).&lt;br /&gt;
* &#039;&#039;&#039;OpenMP&#039;&#039;&#039; instead works within a shared memory paradigm, meaning that multiple threads perform computation in parallel on the same data in memory (no memory replica, at least in principle).&lt;br /&gt;
* Concerning &#039;&#039;&#039;Yambo&#039;&#039;&#039;, tend to use MPI parallelism as much as possible (i.e. as much as memory allows), then resort to OpenMP parallelism in order not to increase memory usage any further while exploiting more cores and computing power.&lt;br /&gt;
* &#039;&#039;&#039;GPU&#039;&#039;&#039; support is extremely efficient in Yambo, meaning that when you are running on GPU accelerated machines it is always a good idea to exploit the GPUs. In general, one needs to set 1 MPI task for each available GPU card, also including OpenMP threads to fully exploit the capabilities of the host. While a very relevant speed up can be achieved, device memory (eg 12, 16, 32 GB on currently available devices) may become a problem and needs to be controlled (eg increasing the number of required nodes and further distributing data across them). &lt;br /&gt;
* The number of &#039;&#039;&#039;MPI tasks&#039;&#039;&#039; and &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039; per task can be controlled in a standard way, e.g. as&lt;br /&gt;
  $ export OMP_NUM_THREADS=4&lt;br /&gt;
  $ mpirun -np 12  yambo  -F yambo.in  -J label &lt;br /&gt;
resulting in a run exploiting up to 48 threads (best fit on 48 physical cores, though hyper-threading, i.e. more threads than cores, can be exploited to feed computing units at best)&lt;br /&gt;
* TIP: In order to control the number of OpenMP threads via the OMP_NUM_THREADS environment variable, make sure that the thread-related variables in the yambo input file (e.g. X_Threads, DIP_Threads, SE_Threads) are set to zero or not set. When set, these variables will overwrite the value given to OMP_NUM_THREADS.&lt;br /&gt;
* A fine tuning of the parallel structure of Yambo (both MPI and OpenMP) can be obtained by operating on specific input variables (run level dependent), which can be activated, during input generation, via the flag &amp;lt;code&amp;gt; -V par&amp;lt;/code&amp;gt; (verbosity high on parallel variables).&lt;br /&gt;
* Yambo can take advantage of parallel dense linear algebra (e.g. via [[https://en.wikipedia.org/wiki/ScaLAPACK ScaLAPACK]], SLK in the following). Control is provided by input variables&lt;br /&gt;
(see e.g. [[Using_Yambo_in_parallel#RPA response in parallel|RPA response in parallel]])&lt;br /&gt;
* When running in parallel, one report file is written, while multiple log files are dumped (one per MPI task, by default), and stored in a newly created &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder. When running with thousands of MPI tasks, the number of log files can be reduced by setting, in the input file, something like:&lt;br /&gt;
  NLogCPUs = 4         # [PARALLEL] Live-timing CPU`s (0 for all)&lt;br /&gt;
&lt;br /&gt;
In the following we give direct examples of parallel setup for some among the most standard Yambo kernels.&lt;br /&gt;
&lt;br /&gt;
==HF run in parallel==&lt;br /&gt;
Full theory and instructions about how to run HF (or, better, exchange self-energy) calculations are given in the [[Hartree Fock]] module.&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, the quantities to be computed are:&lt;br /&gt;
&amp;lt;!-- &amp;lt;br&amp;gt;&amp;lt;math&amp;gt;&lt;br /&gt;
\Sigma^x_{n\mathbf{k}}=\langle n\mathbf{k} | \Sigma^x | n\mathbf{k} \rangle =&lt;br /&gt;
-\sum_m \int_{BZ} \frac{d^3\mathbf{q}}{(2\pi)^3} \sum_{\mathbf{G}} \text{v}(\mathbf{q+G}) |\rho_{nm}(\mathbf{k,q,G})|^2 f_{m\mathbf{(k-q)}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
[[File:Sx.png|none|x50px|caption]]&lt;br /&gt;
Basically, for every orbital &#039;&#039;nk&#039;&#039; we want to compute the exchange contribution to the qp correction. In order to to this, we need to perform a sum over q vectors and a sum over occupied bands (to build the density matrix).&lt;br /&gt;
&lt;br /&gt;
* Generate the input file asking for parallel verbosity:&lt;br /&gt;
  $ yambo -x -V par  -F hf.in&lt;br /&gt;
* By default, OpenMP acts on spatial degrees of freedom (both direct and reciprocal space) and takes care of FFTs. Do not forget to set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; variable (to 1 to avoid OpenMP parallelism)&lt;br /&gt;
  $ export OMP_NUM_THREADS=1     or&lt;br /&gt;
  $ export OMP_NUM_THREADS= &amp;lt;integer_larger_than_one&amp;gt;&lt;br /&gt;
* By default, the MPI parallelism will distribute both computation and memory over the bands in the inner sum (b). Without editing the input file, simply run:&lt;br /&gt;
  $ mpirun -np 4 yambo -F hf.in -J &amp;lt;run_label&amp;gt;&lt;br /&gt;
* Alternatively, MPI parallelism can work over three different levels &amp;lt;code&amp;gt;q,qp,b&amp;lt;/code&amp;gt; at the same time:&lt;br /&gt;
  q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
  qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
  b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F hf.in  -J  run_mpi8_omp1&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==RPA response in parallel==&lt;br /&gt;
Full theory and instructions about how to run independent particle (IP) or RPA linear response calculations are given e.g. in [[Optics at the independent particle level]] or [[Dynamic screening (PPA)]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IP linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, let us focus at first on a q-resolved quantity like the IP optical response:&lt;br /&gt;
[[File:CH1.png|none|x60px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
* Here, in order to obtain the dielectric function, either in the optical limit (q-&amp;gt;0) or at finite q, one basically needs to sum over valence-conduction transitions (v,c) for each k point in the BZ. The calculation can be made easily parallel over these indexes. &lt;br /&gt;
* This is done at the &#039;&#039;&#039;MPI level&#039;&#039;&#039; (distributing both memory and computation), and also by &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039;, just distributing the computational load. &lt;br /&gt;
* In this very specific case, OpenMP also requires some extra memory workspace (i.e. by increasing the number of OMP threads, the memory usage will also increase).&lt;br /&gt;
&lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_IP.in&lt;br /&gt;
edit some the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                 # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                   # [Xd] Transferred momenta &lt;br /&gt;
 %&lt;br /&gt;
These changes set as &#039;&#039;independent particle&#039;&#039; (IP) the response function to be calculated, and asks for the dielectric function at q=1 (that is always gamma)&lt;br /&gt;
* Set also the following openmp related variables to zero (or simply delete them):&lt;br /&gt;
 X_Threads = 0&lt;br /&gt;
 DIP_Threads = 0&lt;br /&gt;
This is needed to control the number of OpenMP threads vai the OMP_NUM_THREADS environment variable. To avoid OpenMP parallelism, set&lt;br /&gt;
 export OMP_NUM_THREADS=1&lt;br /&gt;
* Now you are ready to run. By suing the default parallelism (over 8 MPI tasks) we have to issue:&lt;br /&gt;
  $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8&lt;br /&gt;
* by inspecting the log files (one per MPI task in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder), we see that the parallelism over conduction states has been used.&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU structure provided for the Response_G_space_Zero_Momentum ENVIRONMENT is incomplete. Switching to defaults&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [LA] SERIAL linear algebra&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for K(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for CON bands on 8 CPU] Loaded/Total (Percentual):12/92(13%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for VAL bands on 1 CPU] Loaded/Total (Percentual):8/8(100%)&lt;br /&gt;
* Alternatively, edit the input file and set the parallelism fine-tuning variables:&lt;br /&gt;
 X_q_0_CPU=  &amp;quot; 1 4 2&amp;quot;         # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_q_0_ROLEs= &amp;quot;k c v&amp;quot;         # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
Run as before&lt;br /&gt;
 $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8_tuned&lt;br /&gt;
* Fine tuning is useful when running over a large number of MPI tasks. Care must be taken when setting the parameters: In this case, for instance, we need to make sure that conduction and valence states are multiples of 4 and 2 respectively. Such situations can be handled by yambo, but especially for valence states which are usually less than conduction states, can lead to load unbalance and not perfect filling of the cores.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RPA linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here, after the calculation of the independent particle linear response, a matrix inversion is performed to obtain the RPA response. &lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_RPA.in&lt;br /&gt;
edit some of the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;           # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 NGsBlkXd= 6            Ry   # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                    # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
*Run and inspect the log files: After the calculation of &#039;Xo&#039;, the code computes &#039;X&#039;, performing some dense linear algebra operations, which can &lt;br /&gt;
be made parallel, using scaLapack, by setting, eg&lt;br /&gt;
 X_q_0_nCPU_LinAlG_INV = 8   # [PARALLEL] CPUs for Linear Algebra&lt;br /&gt;
Note that the largest square number smaller than 8, in this case, will be used to form the scaLapack grid (2x2, here).&lt;br /&gt;
* Parallelism fine tuning works as for the IP response.&lt;br /&gt;
&lt;br /&gt;
In case multiple or all q points need to be computed (as in GW calculations), the parallelism variables to be used, are:&lt;br /&gt;
 X_all_q_ROLEs= &amp;quot;g q k c v&amp;quot;     # [PARALLEL] CPUs roles (g,q,k,c,v) &lt;br /&gt;
 X_all_q_CPU= &amp;quot;1 2 1 4 1&amp;quot;      # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_all_q_nCPU_LinAlg_INV= 8   # [PARALLEL] CPUs for Linear Algebra &lt;br /&gt;
adding one extra MPI level of parallelism related to the distribution over q points.&lt;br /&gt;
Finally the different possible parallelism strategies for the dielectric constant are:&lt;br /&gt;
&lt;br /&gt;
 g      parallelism over G-vectors&lt;br /&gt;
 q      parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 c/v    parallelism over conduction/valence bands&lt;br /&gt;
 k      parallelism over k-points&lt;br /&gt;
&lt;br /&gt;
Notice that parellization on c,v and k reduce the amount of memory in the calculation.&lt;br /&gt;
&lt;br /&gt;
==GW in parallel==&lt;br /&gt;
In a complete GW run, several runlevels (dipoles, RPA linear response for all q, exchange self-energy, and correlation self-energy) are run in a row to eventually compute the GW quasi-particle (QP) corrections.  &lt;br /&gt;
How to run [[Using_Yambo_in_parallel#RPA response in parallel|linear response]] and the [[Using_Yambo_in_parallel#HF run in parallel|exchange self-energy]] in parallel has already been discussed above.&lt;br /&gt;
Here we focus on the parallelisation of the correlation self-energy.&lt;br /&gt;
&lt;br /&gt;
The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]]&lt;br /&gt;
&lt;br /&gt;
According to this equation, for each nk matrix element to be computed (qp corrections), a sum over q vectors in the Brillouin zone and a sum over (b) bands (m in Eq.) have to be performed, together with sums over G,G&#039; reciprocal space variables. This gives rise to 3 levels of MPI parallelism (qp, q, b), which can be combined with OpenMP to take care of spatial degrees of freedom.&lt;br /&gt;
As for the exchange self-energy, the MPI parallelism levels that can be controlled are given by:&lt;br /&gt;
&lt;br /&gt;
 q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
 b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Additionally, the variable &amp;lt;code&amp;gt;SE_Threads&amp;lt;/code&amp;gt; can be set to fine-tune the OpenMP parallelism (leave it set to zero to control it via the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable)&lt;br /&gt;
&lt;br /&gt;
To generate the input file, type&lt;br /&gt;
  yambo -g n -p p -F  gw.in &lt;br /&gt;
&lt;br /&gt;
To run in parallel with default parallelism do:&lt;br /&gt;
  export OMP_NUM_THREADS=1    #(or an integer larger than 1 to use OpenMP parallelism) &lt;br /&gt;
  mpirun -np 8 yambo -F gw.in -J  run_mpi8_omp1&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F gw.in  -J  run_mpi8_omp1_tuned&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==BSE in parallel==&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[Tutorials|Back to tutorials menu]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3911</id>
		<title>Using Yambo in parallel</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3911"/>
		<updated>2020-12-15T10:53:03Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* RPA response in parallel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module presents examples of how to run Yambo in a parallel environment.&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* Initialization for [[Bulk_material:_h-BN|bulk hBN]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* The &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; databases for bulk hBN&lt;br /&gt;
* The &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&lt;br /&gt;
==Yambo Parallelism in a nutshell==&lt;br /&gt;
Yambo implements a hybrid [https://en.wikipedia.org/wiki/Message_Passing_Interface MPI]+[https://en.wikipedia.org/wiki/OpenMP OpenMP] parallel scheme, suited to run&lt;br /&gt;
on large partitions of HPC machines. For instance, runs over several tens of thousands of cores on the Marconi KNL partition (CINECA, IT) have been achieved, with a computational power ~ 3 PFl/s, as well as large scale runs on accelerated machines such as Piz-Daint at CSCS (CH),  featuring NVIDIA GPUs.&lt;br /&gt;
* &#039;&#039;&#039;MPI&#039;&#039;&#039; is particularly suited to distribute both memory and computation, and has a very efficient implementation in Yambo, which needs very few communications though may be prone to load unbalance (see [[GW_parallel_strategies| GW parallel strategies]]).&lt;br /&gt;
* &#039;&#039;&#039;OpenMP&#039;&#039;&#039; instead works within a shared memory paradigm, meaning that multiple threads perform computation in parallel on the same data in memory (no memory replica, at least in principle).&lt;br /&gt;
* Concerning &#039;&#039;&#039;Yambo&#039;&#039;&#039;, tend to use MPI parallelism as much as possible (i.e. as much as memory allows), then resort to OpenMP parallelism in order not to increase memory usage any further while exploiting more cores and computing power.&lt;br /&gt;
* &#039;&#039;&#039;GPU&#039;&#039;&#039; support is extremely efficient in Yambo, meaning that when you are running on GPU accelerated machines it is always a good idea to exploit the GPUs. In general, one needs to set 1 MPI task for each available GPU card, also including OpenMP threads to fully exploit the capabilities of the host. While a very relevant speed up can be achieved, device memory (eg 12, 16, 32 GB on currently available devices) may become a problem and needs to be controlled (eg increasing the number of required nodes and further distributing data across them). &lt;br /&gt;
* The number of &#039;&#039;&#039;MPI tasks&#039;&#039;&#039; and &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039; per task can be controlled in a standard way, e.g. as&lt;br /&gt;
  $ export OMP_NUM_THREADS=4&lt;br /&gt;
  $ mpirun -np 12  yambo  -F yambo.in  -J label &lt;br /&gt;
resulting in a run exploiting up to 48 threads (best fit on 48 physical cores, though hyper-threading, i.e. more threads than cores, can be exploited to feed computing units at best)&lt;br /&gt;
* TIP: In order to control the number of OpenMP threads via the OMP_NUM_THREADS environment variable, make sure that the thread-related variables in the yambo input file (e.g. X_Threads, DIP_Threads, SE_Threads) are set to zero or not set. When set, these variables will overwrite the value given to OMP_NUM_THREADS.&lt;br /&gt;
* A fine tuning of the parallel structure of Yambo (both MPI and OpenMP) can be obtained by operating on specific input variables (run level dependent), which can be activated, during input generation, via the flag &amp;lt;code&amp;gt; -V par&amp;lt;/code&amp;gt; (verbosity high on parallel variables).&lt;br /&gt;
* Yambo can take advantage of parallel dense linear algebra (e.g. via [[https://en.wikipedia.org/wiki/ScaLAPACK ScaLAPACK]], SLK in the following). Control is provided by input variables&lt;br /&gt;
(see e.g. [[Using_Yambo_in_parallel#RPA response in parallel|RPA response in parallel]])&lt;br /&gt;
* When running in parallel, one report file is written, while multiple log files are dumped (one per MPI task, by default), and stored in a newly created &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder. When running with thousands of MPI tasks, the number of log files can be reduced by setting, in the input file, something like:&lt;br /&gt;
  NLogCPUs = 4         # [PARALLEL] Live-timing CPU`s (0 for all)&lt;br /&gt;
&lt;br /&gt;
In the following we give direct examples of parallel setup for some among the most standard Yambo kernels.&lt;br /&gt;
&lt;br /&gt;
==HF run in parallel==&lt;br /&gt;
Full theory and instructions about how to run HF (or, better, exchange self-energy) calculations are given in the [[Hartree Fock]] module.&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, the quantities to be computed are:&lt;br /&gt;
&amp;lt;!-- &amp;lt;br&amp;gt;&amp;lt;math&amp;gt;&lt;br /&gt;
\Sigma^x_{n\mathbf{k}}=\langle n\mathbf{k} | \Sigma^x | n\mathbf{k} \rangle =&lt;br /&gt;
-\sum_m \int_{BZ} \frac{d^3\mathbf{q}}{(2\pi)^3} \sum_{\mathbf{G}} \text{v}(\mathbf{q+G}) |\rho_{nm}(\mathbf{k,q,G})|^2 f_{m\mathbf{(k-q)}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
[[File:Sx.png|none|x50px|caption]]&lt;br /&gt;
Basically, for every orbital &#039;&#039;nk&#039;&#039; we want to compute the exchange contribution to the qp correction. In order to to this, we need to perform a sum over q vectors and a sum over occupied bands (to build the density matrix).&lt;br /&gt;
&lt;br /&gt;
* Generate the input file asking for parallel verbosity:&lt;br /&gt;
  $ yambo -x -V par  -F hf.in&lt;br /&gt;
* By default, OpenMP acts on spatial degrees of freedom (both direct and reciprocal space) and takes care of FFTs. Do not forget to set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; variable (to 1 to avoid OpenMP parallelism)&lt;br /&gt;
  $ export OMP_NUM_THREADS=1     or&lt;br /&gt;
  $ export OMP_NUM_THREADS= &amp;lt;integer_larger_than_one&amp;gt;&lt;br /&gt;
* By default, the MPI parallelism will distribute both computation and memory over the bands in the inner sum (b). Without editing the input file, simply run:&lt;br /&gt;
  $ mpirun -np 4 yambo -F hf.in -J &amp;lt;run_label&amp;gt;&lt;br /&gt;
* Alternatively, MPI parallelism can work over three different levels &amp;lt;code&amp;gt;q,qp,b&amp;lt;/code&amp;gt; at the same time:&lt;br /&gt;
  q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
  qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
  b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F hf.in  -J  run_mpi8_omp1&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==RPA response in parallel==&lt;br /&gt;
Full theory and instructions about how to run independent particle (IP) or RPA linear response calculations are given e.g. in [[Optics at the independent particle level]] or [[Dynamic screening (PPA)]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IP linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, let us focus at first on a q-resolved quantity like the IP optical response:&lt;br /&gt;
[[File:CH1.png|none|x60px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
* Here, in order to obtain the dielectric function, either in the optical limit (q-&amp;gt;0) or at finite q, one basically needs to sum over valence-conduction transitions (v,c) for each k point in the BZ. The calculation can be made easily parallel over these indexes. &lt;br /&gt;
* This is done at the &#039;&#039;&#039;MPI level&#039;&#039;&#039; (distributing both memory and computation), and also by &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039;, just distributing the computational load. &lt;br /&gt;
* In this very specific case, OpenMP also requires some extra memory workspace (i.e. by increasing the number of OMP threads, the memory usage will also increase).&lt;br /&gt;
&lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_IP.in&lt;br /&gt;
edit some the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                 # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                   # [Xd] Transferred momenta &lt;br /&gt;
 %&lt;br /&gt;
These changes set as &#039;&#039;independent particle&#039;&#039; (IP) the response function to be calculated, and asks for the dielectric function at q=1 (that is always gamma)&lt;br /&gt;
* Set also the following openmp related variables to zero (or simply delete them):&lt;br /&gt;
 X_Threads = 0&lt;br /&gt;
 DIP_Threads = 0&lt;br /&gt;
This is needed to control the number of OpenMP threads vai the OMP_NUM_THREADS environment variable. To avoid OpenMP parallelism, set&lt;br /&gt;
 export OMP_NUM_THREADS=1&lt;br /&gt;
* Now you are ready to run. By suing the default parallelism (over 8 MPI tasks) we have to issue:&lt;br /&gt;
  $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8&lt;br /&gt;
* by inspecting the log files (one per MPI task in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder), we see that the parallelism over conduction states has been used.&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU structure provided for the Response_G_space_Zero_Momentum ENVIRONMENT is incomplete. Switching to defaults&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [LA] SERIAL linear algebra&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for K(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for CON bands on 8 CPU] Loaded/Total (Percentual):12/92(13%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for VAL bands on 1 CPU] Loaded/Total (Percentual):8/8(100%)&lt;br /&gt;
* Alternatively, edit the input file and set the parallelism fine-tuning variables:&lt;br /&gt;
 X_q_0_CPU=  &amp;quot; 1 4 2&amp;quot;         # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_q_0_ROLEs= &amp;quot;k c v&amp;quot;         # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
Run as before&lt;br /&gt;
 $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8_tuned&lt;br /&gt;
* Fine tuning is useful when running over a large number of MPI tasks. Care must be taken when setting the parameters: In this case, for instance, we need to make sure that conduction and valence states are multiples of 4 and 2 respectively. Such situations can be handled by yambo, but especially for valence states which are usually less than conduction states, can lead to load unbalance and not perfect filling of the cores.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RPA linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here, after the calculation of the independent particle linear response, a matrix inversion is performed to obtain the RPA response. &lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_RPA.in&lt;br /&gt;
edit some of the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;           # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 NGsBlkXd= 6            Ry   # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                    # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
*Run and inspect the log files: After the calculation of &#039;Xo&#039;, the code computes &#039;X&#039;, performing some dense linear algebra operations, which can &lt;br /&gt;
be made parallel, using scaLapack, by setting, eg&lt;br /&gt;
 X_q_0_nCPU_LinAlG_INV = 8   # [PARALLEL] CPUs for Linear Algebra&lt;br /&gt;
Note that the largest square number smaller than 8, in this case, will be used to form the scaLapack grid (2x2, here).&lt;br /&gt;
* Parallelism fine tuning works as for the IP response.&lt;br /&gt;
&lt;br /&gt;
In case multiple or all q points need to be computed (as in GW calculations), the parallelism variables to be used, are:&lt;br /&gt;
 X_all_q_ROLEs= &amp;quot;g q k c v&amp;quot;     # [PARALLEL] CPUs roles (g,q,k,c,v) &lt;br /&gt;
 X_all_q_CPU= &amp;quot;1 2 1 4 1&amp;quot;      # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_all_q_nCPU_LinAlg_INV= 8   # [PARALLEL] CPUs for Linear Algebra &lt;br /&gt;
adding one extra MPI level of parallelism related to the distribution over q points.&lt;br /&gt;
&lt;br /&gt;
==GW in parallel==&lt;br /&gt;
In a complete GW run, several runlevels (dipoles, RPA linear response for all q, exchange self-energy, and correlation self-energy) are run in a row to eventually compute the GW quasi-particle (QP) corrections.  &lt;br /&gt;
How to run [[Using_Yambo_in_parallel#RPA response in parallel|linear response]] and the [[Using_Yambo_in_parallel#HF run in parallel|exchange self-energy]] in parallel has already been discussed above.&lt;br /&gt;
Here we focus on the parallelisation of the correlation self-energy.&lt;br /&gt;
&lt;br /&gt;
The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]]&lt;br /&gt;
&lt;br /&gt;
According to this equation, for each nk matrix element to be computed (qp corrections), a sum over q vectors in the Brillouin zone and a sum over (b) bands (m in Eq.) have to be performed, together with sums over G,G&#039; reciprocal space variables. This gives rise to 3 levels of MPI parallelism (qp, q, b), which can be combined with OpenMP to take care of spatial degrees of freedom.&lt;br /&gt;
As for the exchange self-energy, the MPI parallelism levels that can be controlled are given by:&lt;br /&gt;
&lt;br /&gt;
 q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
 b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Additionally, the variable &amp;lt;code&amp;gt;SE_Threads&amp;lt;/code&amp;gt; can be set to fine-tune the OpenMP parallelism (leave it set to zero to control it via the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable)&lt;br /&gt;
&lt;br /&gt;
To generate the input file, type&lt;br /&gt;
  yambo -g n -p p -F  gw.in &lt;br /&gt;
&lt;br /&gt;
To run in parallel with default parallelism do:&lt;br /&gt;
  export OMP_NUM_THREADS=1    #(or an integer larger than 1 to use OpenMP parallelism) &lt;br /&gt;
  mpirun -np 8 yambo -F gw.in -J  run_mpi8_omp1&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F gw.in  -J  run_mpi8_omp1_tuned&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==BSE in parallel==&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[Tutorials|Back to tutorials menu]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3910</id>
		<title>Using Yambo in parallel</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Using_Yambo_in_parallel&amp;diff=3910"/>
		<updated>2020-12-15T10:52:37Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* RPA response in parallel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module presents examples of how to run Yambo in a parallel environment.&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* Initialization for [[Bulk_material:_h-BN|bulk hBN]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* The &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; databases for bulk hBN&lt;br /&gt;
* The &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&lt;br /&gt;
==Yambo Parallelism in a nutshell==&lt;br /&gt;
Yambo implements a hybrid [https://en.wikipedia.org/wiki/Message_Passing_Interface MPI]+[https://en.wikipedia.org/wiki/OpenMP OpenMP] parallel scheme, suited to run&lt;br /&gt;
on large partitions of HPC machines. For instance, runs over several tens of thousands of cores on the Marconi KNL partition (CINECA, IT) have been achieved, with a computational power ~ 3 PFl/s, as well as large scale runs on accelerated machines such as Piz-Daint at CSCS (CH),  featuring NVIDIA GPUs.&lt;br /&gt;
* &#039;&#039;&#039;MPI&#039;&#039;&#039; is particularly suited to distribute both memory and computation, and has a very efficient implementation in Yambo, which needs very few communications though may be prone to load unbalance (see [[GW_parallel_strategies| GW parallel strategies]]).&lt;br /&gt;
* &#039;&#039;&#039;OpenMP&#039;&#039;&#039; instead works within a shared memory paradigm, meaning that multiple threads perform computation in parallel on the same data in memory (no memory replica, at least in principle).&lt;br /&gt;
* Concerning &#039;&#039;&#039;Yambo&#039;&#039;&#039;, tend to use MPI parallelism as much as possible (i.e. as much as memory allows), then resort to OpenMP parallelism in order not to increase memory usage any further while exploiting more cores and computing power.&lt;br /&gt;
* &#039;&#039;&#039;GPU&#039;&#039;&#039; support is extremely efficient in Yambo, meaning that when you are running on GPU accelerated machines it is always a good idea to exploit the GPUs. In general, one needs to set 1 MPI task for each available GPU card, also including OpenMP threads to fully exploit the capabilities of the host. While a very relevant speed up can be achieved, device memory (eg 12, 16, 32 GB on currently available devices) may become a problem and needs to be controlled (eg increasing the number of required nodes and further distributing data across them). &lt;br /&gt;
* The number of &#039;&#039;&#039;MPI tasks&#039;&#039;&#039; and &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039; per task can be controlled in a standard way, e.g. as&lt;br /&gt;
  $ export OMP_NUM_THREADS=4&lt;br /&gt;
  $ mpirun -np 12  yambo  -F yambo.in  -J label &lt;br /&gt;
resulting in a run exploiting up to 48 threads (best fit on 48 physical cores, though hyper-threading, i.e. more threads than cores, can be exploited to feed computing units at best)&lt;br /&gt;
* TIP: In order to control the number of OpenMP threads via the OMP_NUM_THREADS environment variable, make sure that the thread-related variables in the yambo input file (e.g. X_Threads, DIP_Threads, SE_Threads) are set to zero or not set. When set, these variables will overwrite the value given to OMP_NUM_THREADS.&lt;br /&gt;
* A fine tuning of the parallel structure of Yambo (both MPI and OpenMP) can be obtained by operating on specific input variables (run level dependent), which can be activated, during input generation, via the flag &amp;lt;code&amp;gt; -V par&amp;lt;/code&amp;gt; (verbosity high on parallel variables).&lt;br /&gt;
* Yambo can take advantage of parallel dense linear algebra (e.g. via [[https://en.wikipedia.org/wiki/ScaLAPACK ScaLAPACK]], SLK in the following). Control is provided by input variables&lt;br /&gt;
(see e.g. [[Using_Yambo_in_parallel#RPA response in parallel|RPA response in parallel]])&lt;br /&gt;
* When running in parallel, one report file is written, while multiple log files are dumped (one per MPI task, by default), and stored in a newly created &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder. When running with thousands of MPI tasks, the number of log files can be reduced by setting, in the input file, something like:&lt;br /&gt;
  NLogCPUs = 4         # [PARALLEL] Live-timing CPU`s (0 for all)&lt;br /&gt;
&lt;br /&gt;
In the following we give direct examples of parallel setup for some among the most standard Yambo kernels.&lt;br /&gt;
&lt;br /&gt;
==HF run in parallel==&lt;br /&gt;
Full theory and instructions about how to run HF (or, better, exchange self-energy) calculations are given in the [[Hartree Fock]] module.&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, the quantities to be computed are:&lt;br /&gt;
&amp;lt;!-- &amp;lt;br&amp;gt;&amp;lt;math&amp;gt;&lt;br /&gt;
\Sigma^x_{n\mathbf{k}}=\langle n\mathbf{k} | \Sigma^x | n\mathbf{k} \rangle =&lt;br /&gt;
-\sum_m \int_{BZ} \frac{d^3\mathbf{q}}{(2\pi)^3} \sum_{\mathbf{G}} \text{v}(\mathbf{q+G}) |\rho_{nm}(\mathbf{k,q,G})|^2 f_{m\mathbf{(k-q)}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
[[File:Sx.png|none|x50px|caption]]&lt;br /&gt;
Basically, for every orbital &#039;&#039;nk&#039;&#039; we want to compute the exchange contribution to the qp correction. In order to to this, we need to perform a sum over q vectors and a sum over occupied bands (to build the density matrix).&lt;br /&gt;
&lt;br /&gt;
* Generate the input file asking for parallel verbosity:&lt;br /&gt;
  $ yambo -x -V par  -F hf.in&lt;br /&gt;
* By default, OpenMP acts on spatial degrees of freedom (both direct and reciprocal space) and takes care of FFTs. Do not forget to set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; variable (to 1 to avoid OpenMP parallelism)&lt;br /&gt;
  $ export OMP_NUM_THREADS=1     or&lt;br /&gt;
  $ export OMP_NUM_THREADS= &amp;lt;integer_larger_than_one&amp;gt;&lt;br /&gt;
* By default, the MPI parallelism will distribute both computation and memory over the bands in the inner sum (b). Without editing the input file, simply run:&lt;br /&gt;
  $ mpirun -np 4 yambo -F hf.in -J &amp;lt;run_label&amp;gt;&lt;br /&gt;
* Alternatively, MPI parallelism can work over three different levels &amp;lt;code&amp;gt;q,qp,b&amp;lt;/code&amp;gt; at the same time:&lt;br /&gt;
  q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
  qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
  b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F hf.in  -J  run_mpi8_omp1&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==RPA response in parallel==&lt;br /&gt;
Full theory and instructions about how to run independent particle (IP) or RPA linear response calculations are given e.g. in [[Optics at the independent particle level]] or [[Dynamic screening (PPA)]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IP linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Concerning parallelism, let us focus at first on a q-resolved quantity like the IP optical response:&lt;br /&gt;
[[File:CH1.png|none|x60px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
* Here, in order to obtain the dielectric function, either in the optical limit (q-&amp;gt;0) or at finite q, one basically needs to sum over valence-conduction transitions (v,c) for each k point in the BZ. The calculation can be made easily parallel over these indexes. &lt;br /&gt;
* This is done at the &#039;&#039;&#039;MPI level&#039;&#039;&#039; (distributing both memory and computation), and also by &#039;&#039;&#039;OpenMP threads&#039;&#039;&#039;, just distributing the computational load. &lt;br /&gt;
* In this very specific case, OpenMP also requires some extra memory workspace (i.e. by increasing the number of OMP threads, the memory usage will also increase).&lt;br /&gt;
&lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_IP.in&lt;br /&gt;
edit some the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;IP&amp;quot;                 # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                   # [Xd] Transferred momenta &lt;br /&gt;
 %&lt;br /&gt;
These changes set as &#039;&#039;independent particle&#039;&#039; (IP) the response function to be calculated, and asks for the dielectric function at q=1 (that is always gamma)&lt;br /&gt;
* Set also the following openmp related variables to zero (or simply delete them):&lt;br /&gt;
 X_Threads = 0&lt;br /&gt;
 DIP_Threads = 0&lt;br /&gt;
This is needed to control the number of OpenMP threads vai the OMP_NUM_THREADS environment variable. To avoid OpenMP parallelism, set&lt;br /&gt;
 export OMP_NUM_THREADS=1&lt;br /&gt;
* Now you are ready to run. By suing the default parallelism (over 8 MPI tasks) we have to issue:&lt;br /&gt;
  $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8&lt;br /&gt;
* by inspecting the log files (one per MPI task in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; folder), we see that the parallelism over conduction states has been used.&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU structure provided for the Response_G_space_Zero_Momentum ENVIRONMENT is incomplete. Switching to defaults&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [LA] SERIAL linear algebra&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for K(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for CON bands on 8 CPU] Loaded/Total (Percentual):12/92(13%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Response_G_space_Zero_Momentum for VAL bands on 1 CPU] Loaded/Total (Percentual):8/8(100%)&lt;br /&gt;
* Alternatively, edit the input file and set the parallelism fine-tuning variables:&lt;br /&gt;
 X_q_0_CPU=  &amp;quot; 1 4 2&amp;quot;         # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_q_0_ROLEs= &amp;quot;k c v&amp;quot;         # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
Run as before&lt;br /&gt;
 $ mpirun -np 8 yambo -F yambo_IP.in  -J IP_mpi8_tuned&lt;br /&gt;
* Fine tuning is useful when running over a large number of MPI tasks. Care must be taken when setting the parameters: In this case, for instance, we need to make sure that conduction and valence states are multiples of 4 and 2 respectively. Such situations can be handled by yambo, but especially for valence states which are usually less than conduction states, can lead to load unbalance and not perfect filling of the cores.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RPA linear response&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here, after the calculation of the independent particle linear response, a matrix inversion is performed to obtain the RPA response. &lt;br /&gt;
* After initialisation (see [[Initialization]] for info) generate the input file by issuing:&lt;br /&gt;
 $ yambo -o c -V par -F yambo_RPA.in&lt;br /&gt;
edit some of the variables by setting&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;           # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 NGsBlkXd= 6            Ry   # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
  1 | 1 |                    # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
*Run and inspect the log files: After the calculation of &#039;Xo&#039;, the code computes &#039;X&#039;, performing some dense linear algebra operations, which can &lt;br /&gt;
be made parallel, using scaLapack, by setting, eg&lt;br /&gt;
 X_q_0_nCPU_LinAlG_INV = 8   # [PARALLEL] CPUs for Linear Algebra&lt;br /&gt;
Note that the largest square number smaller than 8, in this case, will be used to form the scaLapack grid (2x2, here).&lt;br /&gt;
* Parallelism fine tuning works as for the IP response.&lt;br /&gt;
&lt;br /&gt;
In case multiple or all q points need to be computed (as in GW calculations), the parallelism variables to be used, are:&lt;br /&gt;
 X_all_q_ROLEs= &amp;quot;g q k c v&amp;quot;     # [PARALLEL] CPUs roles (q,k,c,v) &lt;br /&gt;
 X_all_q_CPU= &amp;quot;1 2 1 4 1&amp;quot;      # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_all_q_nCPU_LinAlg_INV= 8   # [PARALLEL] CPUs for Linear Algebra &lt;br /&gt;
adding one extra MPI level of parallelism related to the distribution over q points.&lt;br /&gt;
&lt;br /&gt;
==GW in parallel==&lt;br /&gt;
In a complete GW run, several runlevels (dipoles, RPA linear response for all q, exchange self-energy, and correlation self-energy) are run in a row to eventually compute the GW quasi-particle (QP) corrections.  &lt;br /&gt;
How to run [[Using_Yambo_in_parallel#RPA response in parallel|linear response]] and the [[Using_Yambo_in_parallel#HF run in parallel|exchange self-energy]] in parallel has already been discussed above.&lt;br /&gt;
Here we focus on the parallelisation of the correlation self-energy.&lt;br /&gt;
&lt;br /&gt;
The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]]&lt;br /&gt;
&lt;br /&gt;
According to this equation, for each nk matrix element to be computed (qp corrections), a sum over q vectors in the Brillouin zone and a sum over (b) bands (m in Eq.) have to be performed, together with sums over G,G&#039; reciprocal space variables. This gives rise to 3 levels of MPI parallelism (qp, q, b), which can be combined with OpenMP to take care of spatial degrees of freedom.&lt;br /&gt;
As for the exchange self-energy, the MPI parallelism levels that can be controlled are given by:&lt;br /&gt;
&lt;br /&gt;
 q       parallelism over transferred momenta (q in Eq. above)&lt;br /&gt;
 qp      parallelism over qp corrections to be computed  (nk in Eq.)&lt;br /&gt;
 b       parallelism over (occupied) density matrix (or Green&#039;s function) bands  (m in Eq.)&lt;br /&gt;
&lt;br /&gt;
Additionally, the variable &amp;lt;code&amp;gt;SE_Threads&amp;lt;/code&amp;gt; can be set to fine-tune the OpenMP parallelism (leave it set to zero to control it via the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable)&lt;br /&gt;
&lt;br /&gt;
To generate the input file, type&lt;br /&gt;
  yambo -g n -p p -F  gw.in &lt;br /&gt;
&lt;br /&gt;
To run in parallel with default parallelism do:&lt;br /&gt;
  export OMP_NUM_THREADS=1    #(or an integer larger than 1 to use OpenMP parallelism) &lt;br /&gt;
  mpirun -np 8 yambo -F gw.in -J  run_mpi8_omp1&lt;br /&gt;
&lt;br /&gt;
Taking the case of hBN, in order to exploit this parallelism over 8 MPI tasks, set e.g.:&lt;br /&gt;
  SE_CPU= &amp;quot;  1 2  4&amp;quot;               # [PARALLEL] CPUs for each role&lt;br /&gt;
  SE_ROLEs= &amp;quot;q qp b&amp;quot;               # [PARALLEL] CPUs roles (q,qp,b)&lt;br /&gt;
Then run as&lt;br /&gt;
  $ mpirun -np 8  yambo -F gw.in  -J  run_mpi8_omp1_tuned&lt;br /&gt;
Note that the product of the numbers in SE_CPU needs to be equal to the total number of MPI tasks, otherwise yambo will switch back to default parallelism (a warning is provided in the log).&lt;br /&gt;
&lt;br /&gt;
Having a look at the report file, &amp;lt;code&amp;gt;r-run_mpi8_omp1_HF_and_locXC&amp;lt;/code&amp;gt; here, one finds:&lt;br /&gt;
 [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 ===========================================&lt;br /&gt;
&lt;br /&gt;
 * CPU-Threads     :8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 * CPU-Threads     :SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
 * MPI CPU         :  8&lt;br /&gt;
 * THREADS    (max): 1&lt;br /&gt;
 * THREADS TOT(max):  8&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the files created in the &amp;lt;code&amp;gt;./LOG&amp;lt;/code&amp;gt; directory, e.g. &amp;lt;code&amp;gt;./LOG/l-run_mpi8_omp1_HF_and_locXC_CPU_1&amp;lt;/code&amp;gt;, where we find:&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [01] CPU structure, Files &amp;amp; I/O Directories&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:8(CPU)-1(threads)-1(threads@SE)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: CPU-Threads:SE(environment)-  1 2  4(CPUs)-q qp b(ROLEs)&lt;br /&gt;
  ...&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for QPs on 2 CPU] Loaded/Total (Percentual):70/140(50%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for Q(ibz) on 1 CPU] Loaded/Total (Percentual):14/14(100%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL Self_Energy for G bands on 4 CPU] Loaded/Total (Percentual):3/10(30%)&lt;br /&gt;
 &amp;lt;---&amp;gt; P0001: [PARALLEL distribution for Wave-Function states] Loaded/Total(Percentual):84/140(60%)&lt;br /&gt;
providing the details of memory and computation distributions for the different levels. This report is from processor 1 (as highlighted about &amp;lt;code&amp;gt;_CPU_1&amp;lt;/code&amp;gt; suffix). Similar pieces of information are provided for all CPUs. If different CPUs show very different distribution levels, it is likely that load unbalance occurs (e.g., try with 6 MPI tasks parallel over bands).&lt;br /&gt;
&lt;br /&gt;
For Yambo version &amp;lt;= 4.1.2, Yambo may not be able to find a proper default parallel structure (try e.g. the above example asking for 20 MPI tasks, while you only have 8 bands to parallelise over). In These cases the calculation crashes and an error message is provided in the report file:&lt;br /&gt;
  [ERROR]Impossible to define an appropriate parallel structure&lt;br /&gt;
&lt;br /&gt;
In these cases it is then mandatory to specify a proper parallel structure. This has been mostly overcome by Yambo v. 4.2 on.&lt;br /&gt;
&lt;br /&gt;
==BSE in parallel==&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[Tutorials|Back to tutorials menu]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Selected_Readings&amp;diff=3909</id>
		<title>Selected Readings</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Selected_Readings&amp;diff=3909"/>
		<updated>2020-12-07T10:57:18Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Theoretical Spectroscopy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General Theory ==&lt;br /&gt;
&lt;br /&gt;
* [http://nanodft09.iyte.edu.tr/pdf/MG-Lectures.pdf Theoretical spectroscopy], M. Gatti&lt;br /&gt;
* [http://etsf.polytechnique.fr/sites/default/files/users/francesco/els.pdf Energy Loss Spectroscopy], F. Sottile&lt;br /&gt;
&lt;br /&gt;
= Many-body Theory =&lt;br /&gt;
&lt;br /&gt;
* [http://nano-bio.ehu.es/lecturescagliari.php PhD lectures: MBPT and Yambo], L. Chiodo&lt;br /&gt;
* [http://www.physics.rutgers.edu/~coleman/mbody/pdf/bk.pdf The evolving monogram on Many Body Physics], Piers Coleman&lt;br /&gt;
* [http://www.sissa.it/cm/phd/lecture_notes/Many-Body.pdf Many Body], Michele Fabrizio&lt;br /&gt;
* [http://www.physics.ucla.edu/~nayak/many_body.pdf Quantum Condensed Matter Physics], Chetan Nayak&lt;br /&gt;
* [http://freescience.info/Physics.php?id=26 FreeScience.info--&amp;gt; Many Body]&lt;br /&gt;
&lt;br /&gt;
= The GW method =&lt;br /&gt;
&lt;br /&gt;
* [http://www.tddft.org/bmg/files/seminarios/24830.pdf Introduction to GW and Bethe-Salpeter - beyond density functional theory], S. Botti&lt;br /&gt;
* [http://www.physics.ohio-state.edu/~wilkins/vita/gw_review.ps Quasiparticle calculations in solids], Aulbur WG, Jonsson L, Wilkins JW&lt;br /&gt;
* [http://xxx.lanl.gov/abs/cond-mat/9712013 The GW methods], F. Aryasetiawan and O. Gunnarsson&lt;br /&gt;
* [http://www.fzj.helmholtz.de/nic-series/volume31/friedrich.pdf Many-Body Perturbation Theory: The GW Approximation], Christoph Friedrich and Arno Schindlmayr&lt;br /&gt;
* [http://www.amazon.com/Electron-Correlation-Solid-State-Norman/dp/1860942008 Electron Correlation in the Solid State] (not free), Norman H. March&lt;br /&gt;
* [http://repository.kulib.kyoto-u.ac.jp/dspace/bitstream/2433/96909/1/KJ00004711290.pdf Correlation effects in solids from first principles], Aryasetiawan Ferdi&lt;br /&gt;
* [https://www.frontiersin.org/articles/10.3389/fchem.2019.00377/full The GW Compendium: A Practical Guide to Theoretical Photoemission Spectroscopy],  Dorothea Golze, Marc Dvorak and Patrick Rinke&lt;br /&gt;
* [http://arxiv.org/abs/1109.3972 Hedin Equations, GW, GW+DMFT, and All That], K. Held, C. Taranto, G. Rohringer, A. Toschi&lt;br /&gt;
&lt;br /&gt;
= Density Functional Theory =&lt;br /&gt;
&lt;br /&gt;
* [http://dft.uci.edu/materials/bookABCDFT/gamma/g1.pdf The ABC of DFT], Kieron Burke&lt;br /&gt;
* [http://chem.ps.uci.edu/~kieron/dft/pubs/PK98.ps Density Functionals for non relativistic Coulomb Systems], J. Perdew and S. Kurth&lt;br /&gt;
* [http://arxiv.org/abs/cond-mat/0211443 A bird&#039;s-eye view of density-functional theory], Klaus Capelle&lt;br /&gt;
* [http://www.fisica.uniud.it/~giannozz/Corsi/pisa05.pdf Density Functional Theory for Electronic Structure Calculations], Paolo Giannozzi&lt;br /&gt;
* [http://arxiv.org/abs/cond-mat/0012092 Phonons and related properties of extended systems from density-functional perturbation theory], S. Baroni, S. de Gironcoli, A. Dal Corso, P. Giannozzi&lt;br /&gt;
* [http://theochem.chem.rug.nl/publications/PDF/ft425.pdf Density functional approach to the many-body problem], Robert van Leeuwen&lt;br /&gt;
&lt;br /&gt;
= TDDFT =&lt;br /&gt;
&lt;br /&gt;
* [http://research.physics.illinois.edu/ElectronicStructure/598SCM-F04/Reining-ref-papers-for-lectures/Reining-RMP.pdf Electronic Excitations: Density-Functional VS Many-body Green&#039;s], G. Onida, L. Reining, A. Rubio&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/BG98.pdf A guided tour of time-dependent density functional theory], K. Burke and E.K.U. Gross&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/MG03.pdf Time-dependent Density Functional Theory], Miguel A. L. Marques and E. K. U. Gross&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/GDP96.pdf Density functional theory of time-dependent phenomena], E.K.U. Gross , J.F. Dobson , and M. Petersilka&lt;br /&gt;
* [http://dcm.ujf-grenoble.fr/PERSONNEL/CT/casida/research/chong.ps Time-dependent density-functional response theory for molecules], Mark Casida&lt;br /&gt;
* [http://www.fhi-berlin.mpg.de/th/publications/RPP-70-357-2007.pdf Time-dependent density-functional theory for extended systems], S. Botti et al.&lt;br /&gt;
&lt;br /&gt;
= Non-equilibrium Green&#039;s function =&lt;br /&gt;
&lt;br /&gt;
* [http://theochem.chem.rug.nl/research/vanleeuwen/literature/NGF.pdf An Introduction to Nonequilibrium Green Functions], Robert van Leeuwen&lt;br /&gt;
* [http://www.physics.arizona.edu/~stafford/Courses/560A/nonequilibrium.pdf An Introduction to Nonequilibrium Many-Body Theory], Joseph Maciejko&lt;br /&gt;
* [http://theochem.chem.rug.nl/publications/PDF/ft497.pdf The Keldysh Formalism Applied to Time-Dependent Current-Density-Functional Theory], Robert van Leeuwen&lt;br /&gt;
&lt;br /&gt;
= Theoretical Spectroscopy =&lt;br /&gt;
&lt;br /&gt;
* [http://www.amazon.com/Electrodynamics-Solids-Optical-Properties-Electrons/dp/0521597269 Electrodynamics of Solids: Optical Properties of Electrons in Matter], Martin Dressel , George Gruner&lt;br /&gt;
* [http://nd.edu/~mkuno/Class_downloads/Chem648_quantum_text.pdf Quantum Mechanics and Spectroscopy: another book], M. Kuno&lt;br /&gt;
* [http://nd.edu/~mkuno/Class_downloads/Chem90652_spect_text.pdf Molecular spectroscopy], M. Kuno&lt;br /&gt;
* [http://folk.uio.no/yurig/lund97.ps.gz Non-Stationary Electric and Optical Properties of Bulk Conductin], Yuri Galperin&lt;br /&gt;
* [http://physik.uni-graz.at/~uxh/Publications/nano.pdf Optical properties of semiconductor nanostructures: Decoherence versus Quantum Control], Ulrich Hohenester&lt;br /&gt;
* [http://www.gps.caltech.edu/~gab/ch21b/Lecture_notes.html Spectroscopy], Geoffrey A. Blake&lt;br /&gt;
* [http://bcsbec.df.unicam.it/files/LaRNC11_N12(1988).pdf Application of the Green’s functions method to the study of the optical properties of semiconductors], G. Strinati&lt;br /&gt;
* [https://iopscience.iop.org/article/10.1238/Physica.Topical.109a00141 Effects of the Electron–Hole Interaction on the Optical Properties of Materials: the Bethe–Salpeter Equation], G. Bussi&lt;br /&gt;
* [http://freescience.info/Physics.php?id=441 FreeScience.info--&amp;gt; Spectroscopy]&lt;br /&gt;
&lt;br /&gt;
= Computer Programming =&lt;br /&gt;
&lt;br /&gt;
* [http://www.star.le.ac.uk/~cgp/f90course/f90.html Fortran90 for Fortran77 Programmers], Clive Page&lt;br /&gt;
* [http://www.personal.psu.edu/jhm/f90/lectures/quickref.html Fortran 90 Lectures], John Mahaffy&lt;br /&gt;
* [http://tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf Bash Guide for Beginners], Machtelt Garrels&lt;br /&gt;
* [http://www.cs.cf.ac.uk/Dave/C/CE.html Programming in C UNIX System Calls and Subroutines using C], A. D. Marshall&lt;br /&gt;
* [http://publications.gbdirect.co.uk/c_book/ The C Book], Mike Banahan, Declan Brady and Mark Doran&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Selected_Readings&amp;diff=3908</id>
		<title>Selected Readings</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Selected_Readings&amp;diff=3908"/>
		<updated>2020-12-07T10:56:48Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Theoretical Spectroscopy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General Theory ==&lt;br /&gt;
&lt;br /&gt;
* [http://nanodft09.iyte.edu.tr/pdf/MG-Lectures.pdf Theoretical spectroscopy], M. Gatti&lt;br /&gt;
* [http://etsf.polytechnique.fr/sites/default/files/users/francesco/els.pdf Energy Loss Spectroscopy], F. Sottile&lt;br /&gt;
&lt;br /&gt;
= Many-body Theory =&lt;br /&gt;
&lt;br /&gt;
* [http://nano-bio.ehu.es/lecturescagliari.php PhD lectures: MBPT and Yambo], L. Chiodo&lt;br /&gt;
* [http://www.physics.rutgers.edu/~coleman/mbody/pdf/bk.pdf The evolving monogram on Many Body Physics], Piers Coleman&lt;br /&gt;
* [http://www.sissa.it/cm/phd/lecture_notes/Many-Body.pdf Many Body], Michele Fabrizio&lt;br /&gt;
* [http://www.physics.ucla.edu/~nayak/many_body.pdf Quantum Condensed Matter Physics], Chetan Nayak&lt;br /&gt;
* [http://freescience.info/Physics.php?id=26 FreeScience.info--&amp;gt; Many Body]&lt;br /&gt;
&lt;br /&gt;
= The GW method =&lt;br /&gt;
&lt;br /&gt;
* [http://www.tddft.org/bmg/files/seminarios/24830.pdf Introduction to GW and Bethe-Salpeter - beyond density functional theory], S. Botti&lt;br /&gt;
* [http://www.physics.ohio-state.edu/~wilkins/vita/gw_review.ps Quasiparticle calculations in solids], Aulbur WG, Jonsson L, Wilkins JW&lt;br /&gt;
* [http://xxx.lanl.gov/abs/cond-mat/9712013 The GW methods], F. Aryasetiawan and O. Gunnarsson&lt;br /&gt;
* [http://www.fzj.helmholtz.de/nic-series/volume31/friedrich.pdf Many-Body Perturbation Theory: The GW Approximation], Christoph Friedrich and Arno Schindlmayr&lt;br /&gt;
* [http://www.amazon.com/Electron-Correlation-Solid-State-Norman/dp/1860942008 Electron Correlation in the Solid State] (not free), Norman H. March&lt;br /&gt;
* [http://repository.kulib.kyoto-u.ac.jp/dspace/bitstream/2433/96909/1/KJ00004711290.pdf Correlation effects in solids from first principles], Aryasetiawan Ferdi&lt;br /&gt;
* [https://www.frontiersin.org/articles/10.3389/fchem.2019.00377/full The GW Compendium: A Practical Guide to Theoretical Photoemission Spectroscopy],  Dorothea Golze, Marc Dvorak and Patrick Rinke&lt;br /&gt;
* [http://arxiv.org/abs/1109.3972 Hedin Equations, GW, GW+DMFT, and All That], K. Held, C. Taranto, G. Rohringer, A. Toschi&lt;br /&gt;
&lt;br /&gt;
= Density Functional Theory =&lt;br /&gt;
&lt;br /&gt;
* [http://dft.uci.edu/materials/bookABCDFT/gamma/g1.pdf The ABC of DFT], Kieron Burke&lt;br /&gt;
* [http://chem.ps.uci.edu/~kieron/dft/pubs/PK98.ps Density Functionals for non relativistic Coulomb Systems], J. Perdew and S. Kurth&lt;br /&gt;
* [http://arxiv.org/abs/cond-mat/0211443 A bird&#039;s-eye view of density-functional theory], Klaus Capelle&lt;br /&gt;
* [http://www.fisica.uniud.it/~giannozz/Corsi/pisa05.pdf Density Functional Theory for Electronic Structure Calculations], Paolo Giannozzi&lt;br /&gt;
* [http://arxiv.org/abs/cond-mat/0012092 Phonons and related properties of extended systems from density-functional perturbation theory], S. Baroni, S. de Gironcoli, A. Dal Corso, P. Giannozzi&lt;br /&gt;
* [http://theochem.chem.rug.nl/publications/PDF/ft425.pdf Density functional approach to the many-body problem], Robert van Leeuwen&lt;br /&gt;
&lt;br /&gt;
= TDDFT =&lt;br /&gt;
&lt;br /&gt;
* [http://research.physics.illinois.edu/ElectronicStructure/598SCM-F04/Reining-ref-papers-for-lectures/Reining-RMP.pdf Electronic Excitations: Density-Functional VS Many-body Green&#039;s], G. Onida, L. Reining, A. Rubio&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/BG98.pdf A guided tour of time-dependent density functional theory], K. Burke and E.K.U. Gross&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/MG03.pdf Time-dependent Density Functional Theory], Miguel A. L. Marques and E. K. U. Gross&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/GDP96.pdf Density functional theory of time-dependent phenomena], E.K.U. Gross , J.F. Dobson , and M. Petersilka&lt;br /&gt;
* [http://dcm.ujf-grenoble.fr/PERSONNEL/CT/casida/research/chong.ps Time-dependent density-functional response theory for molecules], Mark Casida&lt;br /&gt;
* [http://www.fhi-berlin.mpg.de/th/publications/RPP-70-357-2007.pdf Time-dependent density-functional theory for extended systems], S. Botti et al.&lt;br /&gt;
&lt;br /&gt;
= Non-equilibrium Green&#039;s function =&lt;br /&gt;
&lt;br /&gt;
* [http://theochem.chem.rug.nl/research/vanleeuwen/literature/NGF.pdf An Introduction to Nonequilibrium Green Functions], Robert van Leeuwen&lt;br /&gt;
* [http://www.physics.arizona.edu/~stafford/Courses/560A/nonequilibrium.pdf An Introduction to Nonequilibrium Many-Body Theory], Joseph Maciejko&lt;br /&gt;
* [http://theochem.chem.rug.nl/publications/PDF/ft497.pdf The Keldysh Formalism Applied to Time-Dependent Current-Density-Functional Theory], Robert van Leeuwen&lt;br /&gt;
&lt;br /&gt;
= Theoretical Spectroscopy =&lt;br /&gt;
&lt;br /&gt;
* [http://www.amazon.com/Electrodynamics-Solids-Optical-Properties-Electrons/dp/0521597269 Electrodynamics of Solids: Optical Properties of Electrons in Matter], Martin Dressel , George Gruner&lt;br /&gt;
* [http://nd.edu/~mkuno/Class_downloads/Chem648_quantum_text.pdf Quantum Mechanics and Spectroscopy: another book], M. Kuno&lt;br /&gt;
* [http://nd.edu/~mkuno/Class_downloads/Chem90652_spect_text.pdf Molecular spectroscopy], M. Kuno&lt;br /&gt;
* [http://folk.uio.no/yurig/lund97.ps.gz Non-Stationary Electric and Optical Properties of Bulk Conductin], Yuri Galperin&lt;br /&gt;
* [http://physik.uni-graz.at/~uxh/Publications/nano.pdf Optical properties of semiconductor nanostructures: Decoherence versus Quantum Control], Ulrich Hohenester&lt;br /&gt;
* [http://www.gps.caltech.edu/~gab/ch21b/Lecture_notes.html Spectroscopy], Geoffrey A. Blake&lt;br /&gt;
* [http://bcsbec.df.unicam.it/files/LaRNC11_N12(1988).pdf Application of the Green’s functions method to the study of the optical properties of semiconductors], G. Strinati&lt;br /&gt;
* [https://iopscience.iop.org/article/10.1238/Physica.Topical.109a00141 https://iopscience.iop.org/article/10.1238/Physica.Topical.109a00141], G. Bussi&lt;br /&gt;
* [http://freescience.info/Physics.php?id=441 FreeScience.info--&amp;gt; Spectroscopy]&lt;br /&gt;
&lt;br /&gt;
= Computer Programming =&lt;br /&gt;
&lt;br /&gt;
* [http://www.star.le.ac.uk/~cgp/f90course/f90.html Fortran90 for Fortran77 Programmers], Clive Page&lt;br /&gt;
* [http://www.personal.psu.edu/jhm/f90/lectures/quickref.html Fortran 90 Lectures], John Mahaffy&lt;br /&gt;
* [http://tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf Bash Guide for Beginners], Machtelt Garrels&lt;br /&gt;
* [http://www.cs.cf.ac.uk/Dave/C/CE.html Programming in C UNIX System Calls and Subroutines using C], A. D. Marshall&lt;br /&gt;
* [http://publications.gbdirect.co.uk/c_book/ The C Book], Mike Banahan, Declan Brady and Mark Doran&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Selected_Readings&amp;diff=3907</id>
		<title>Selected Readings</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Selected_Readings&amp;diff=3907"/>
		<updated>2020-12-07T10:54:26Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* The GW method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General Theory ==&lt;br /&gt;
&lt;br /&gt;
* [http://nanodft09.iyte.edu.tr/pdf/MG-Lectures.pdf Theoretical spectroscopy], M. Gatti&lt;br /&gt;
* [http://etsf.polytechnique.fr/sites/default/files/users/francesco/els.pdf Energy Loss Spectroscopy], F. Sottile&lt;br /&gt;
&lt;br /&gt;
= Many-body Theory =&lt;br /&gt;
&lt;br /&gt;
* [http://nano-bio.ehu.es/lecturescagliari.php PhD lectures: MBPT and Yambo], L. Chiodo&lt;br /&gt;
* [http://www.physics.rutgers.edu/~coleman/mbody/pdf/bk.pdf The evolving monogram on Many Body Physics], Piers Coleman&lt;br /&gt;
* [http://www.sissa.it/cm/phd/lecture_notes/Many-Body.pdf Many Body], Michele Fabrizio&lt;br /&gt;
* [http://www.physics.ucla.edu/~nayak/many_body.pdf Quantum Condensed Matter Physics], Chetan Nayak&lt;br /&gt;
* [http://freescience.info/Physics.php?id=26 FreeScience.info--&amp;gt; Many Body]&lt;br /&gt;
&lt;br /&gt;
= The GW method =&lt;br /&gt;
&lt;br /&gt;
* [http://www.tddft.org/bmg/files/seminarios/24830.pdf Introduction to GW and Bethe-Salpeter - beyond density functional theory], S. Botti&lt;br /&gt;
* [http://www.physics.ohio-state.edu/~wilkins/vita/gw_review.ps Quasiparticle calculations in solids], Aulbur WG, Jonsson L, Wilkins JW&lt;br /&gt;
* [http://xxx.lanl.gov/abs/cond-mat/9712013 The GW methods], F. Aryasetiawan and O. Gunnarsson&lt;br /&gt;
* [http://www.fzj.helmholtz.de/nic-series/volume31/friedrich.pdf Many-Body Perturbation Theory: The GW Approximation], Christoph Friedrich and Arno Schindlmayr&lt;br /&gt;
* [http://www.amazon.com/Electron-Correlation-Solid-State-Norman/dp/1860942008 Electron Correlation in the Solid State] (not free), Norman H. March&lt;br /&gt;
* [http://repository.kulib.kyoto-u.ac.jp/dspace/bitstream/2433/96909/1/KJ00004711290.pdf Correlation effects in solids from first principles], Aryasetiawan Ferdi&lt;br /&gt;
* [https://www.frontiersin.org/articles/10.3389/fchem.2019.00377/full The GW Compendium: A Practical Guide to Theoretical Photoemission Spectroscopy],  Dorothea Golze, Marc Dvorak and Patrick Rinke&lt;br /&gt;
* [http://arxiv.org/abs/1109.3972 Hedin Equations, GW, GW+DMFT, and All That], K. Held, C. Taranto, G. Rohringer, A. Toschi&lt;br /&gt;
&lt;br /&gt;
= Density Functional Theory =&lt;br /&gt;
&lt;br /&gt;
* [http://dft.uci.edu/materials/bookABCDFT/gamma/g1.pdf The ABC of DFT], Kieron Burke&lt;br /&gt;
* [http://chem.ps.uci.edu/~kieron/dft/pubs/PK98.ps Density Functionals for non relativistic Coulomb Systems], J. Perdew and S. Kurth&lt;br /&gt;
* [http://arxiv.org/abs/cond-mat/0211443 A bird&#039;s-eye view of density-functional theory], Klaus Capelle&lt;br /&gt;
* [http://www.fisica.uniud.it/~giannozz/Corsi/pisa05.pdf Density Functional Theory for Electronic Structure Calculations], Paolo Giannozzi&lt;br /&gt;
* [http://arxiv.org/abs/cond-mat/0012092 Phonons and related properties of extended systems from density-functional perturbation theory], S. Baroni, S. de Gironcoli, A. Dal Corso, P. Giannozzi&lt;br /&gt;
* [http://theochem.chem.rug.nl/publications/PDF/ft425.pdf Density functional approach to the many-body problem], Robert van Leeuwen&lt;br /&gt;
&lt;br /&gt;
= TDDFT =&lt;br /&gt;
&lt;br /&gt;
* [http://research.physics.illinois.edu/ElectronicStructure/598SCM-F04/Reining-ref-papers-for-lectures/Reining-RMP.pdf Electronic Excitations: Density-Functional VS Many-body Green&#039;s], G. Onida, L. Reining, A. Rubio&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/BG98.pdf A guided tour of time-dependent density functional theory], K. Burke and E.K.U. Gross&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/MG03.pdf Time-dependent Density Functional Theory], Miguel A. L. Marques and E. K. U. Gross&lt;br /&gt;
* [http://www.physik.fu-berlin.de/~ag-gross/articles/pdf/GDP96.pdf Density functional theory of time-dependent phenomena], E.K.U. Gross , J.F. Dobson , and M. Petersilka&lt;br /&gt;
* [http://dcm.ujf-grenoble.fr/PERSONNEL/CT/casida/research/chong.ps Time-dependent density-functional response theory for molecules], Mark Casida&lt;br /&gt;
* [http://www.fhi-berlin.mpg.de/th/publications/RPP-70-357-2007.pdf Time-dependent density-functional theory for extended systems], S. Botti et al.&lt;br /&gt;
&lt;br /&gt;
= Non-equilibrium Green&#039;s function =&lt;br /&gt;
&lt;br /&gt;
* [http://theochem.chem.rug.nl/research/vanleeuwen/literature/NGF.pdf An Introduction to Nonequilibrium Green Functions], Robert van Leeuwen&lt;br /&gt;
* [http://www.physics.arizona.edu/~stafford/Courses/560A/nonequilibrium.pdf An Introduction to Nonequilibrium Many-Body Theory], Joseph Maciejko&lt;br /&gt;
* [http://theochem.chem.rug.nl/publications/PDF/ft497.pdf The Keldysh Formalism Applied to Time-Dependent Current-Density-Functional Theory], Robert van Leeuwen&lt;br /&gt;
&lt;br /&gt;
= Theoretical Spectroscopy =&lt;br /&gt;
&lt;br /&gt;
* [http://www.amazon.com/Electrodynamics-Solids-Optical-Properties-Electrons/dp/0521597269 Electrodynamics of Solids: Optical Properties of Electrons in Matter], Martin Dressel , George Gruner&lt;br /&gt;
* [http://nd.edu/~mkuno/Class_downloads/Chem648_quantum_text.pdf Quantum Mechanics and Spectroscopy: another book], M. Kuno&lt;br /&gt;
* [http://nd.edu/~mkuno/Class_downloads/Chem90652_spect_text.pdf Molecular spectroscopy], M. Kuno&lt;br /&gt;
* [http://folk.uio.no/yurig/lund97.ps.gz Non-Stationary Electric and Optical Properties of Bulk Conductin], Yuri Galperin&lt;br /&gt;
* [http://physik.uni-graz.at/~uxh/Publications/nano.pdf Optical properties of semiconductor nanostructures: Decoherence versus Quantum Control], Ulrich Hohenester&lt;br /&gt;
* [http://www.gps.caltech.edu/~gab/ch21b/Lecture_notes.html Spectroscopy], Geoffrey A. Blake&lt;br /&gt;
* [http://bcsbec.df.unicam.it/files/LaRNC11_N12(1988).pdf Application of the Green’s functions method to the study of the optical properties of semiconductors], G. Strinati&lt;br /&gt;
* [http://freescience.info/Physics.php?id=441 FreeScience.info--&amp;gt; Spectroscopy]&lt;br /&gt;
&lt;br /&gt;
= Computer Programming =&lt;br /&gt;
&lt;br /&gt;
* [http://www.star.le.ac.uk/~cgp/f90course/f90.html Fortran90 for Fortran77 Programmers], Clive Page&lt;br /&gt;
* [http://www.personal.psu.edu/jhm/f90/lectures/quickref.html Fortran 90 Lectures], John Mahaffy&lt;br /&gt;
* [http://tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf Bash Guide for Beginners], Machtelt Garrels&lt;br /&gt;
* [http://www.cs.cf.ac.uk/Dave/C/CE.html Programming in C UNIX System Calls and Subroutines using C], A. D. Marshall&lt;br /&gt;
* [http://publications.gbdirect.co.uk/c_book/ The C Book], Mike Banahan, Declan Brady and Mark Doran&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Test-suite&amp;diff=3906</id>
		<title>Test-suite</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Test-suite&amp;diff=3906"/>
		<updated>2020-12-04T10:27:30Z</updated>

		<summary type="html">&lt;p&gt;Claudio: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Web-Interface ==&lt;br /&gt;
&lt;br /&gt;
The updated list of test-suite runs can be found on the old Yambo web-page.&lt;br /&gt;
&lt;br /&gt;
Tests&#039; list is splitted in [http://www.yambo-code.org/robots/index.php branches].&lt;br /&gt;
For each branch many robots are shown.&lt;br /&gt;
Check the [http://www.yambo-code.org/robots/bug-fixes/polluce.php bug-fixes] branch as an example.&lt;br /&gt;
&lt;br /&gt;
This list is automatically updated by the test-suite driver.pl when the -report option is used.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
The test suite is available on GitHub via git&lt;br /&gt;
&lt;br /&gt;
 %git clone https://github.com/yambo-code/yambo-tests.git yambo-tests&lt;br /&gt;
&lt;br /&gt;
you may need to provide your GitHub username and password.&lt;br /&gt;
&lt;br /&gt;
After the checkout the first thing to do is the configuration&lt;br /&gt;
&lt;br /&gt;
 %cd test-suite&lt;br /&gt;
 %./configure --with-yambo=/home/marini/Yambo/yambo/master/&lt;br /&gt;
&lt;br /&gt;
If the configuration works you should see something similar to the following message:&lt;br /&gt;
&lt;br /&gt;
 %./configure --with-yambo=/home/marini/Yambo/yambo/master/&lt;br /&gt;
 %checking build system type... x86_64-unknown-linux-gnu&lt;br /&gt;
 %checking host system type... x86_64-unknown-linux-gnu&lt;br /&gt;
 %checking the anomaly.mlib.ism.cnr.it ROBOT... created&lt;br /&gt;
 %checking for nccopy... no&lt;br /&gt;
 %checking for ncftp... ncftp&lt;br /&gt;
 %checking for ncftpls... ncftpls&lt;br /&gt;
 %checking for ncftpput... ncftpput&lt;br /&gt;
 %checking for awk... awk&lt;br /&gt;
 %checking for txt2html... txt2html&lt;br /&gt;
 %checking the Yambo source... /home/marini/Yambo/yambo/master/&lt;br /&gt;
 %configure: creating ./config.status&lt;br /&gt;
 %config.status: creating config/MODULES.pl&lt;br /&gt;
 %config.status: creating config/TOOLS.pl&lt;br /&gt;
&lt;br /&gt;
=== Robot informations ===&lt;br /&gt;
&lt;br /&gt;
By typing&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -i&lt;br /&gt;
&lt;br /&gt;
you will see some basic info about your machine. This command is useful to see the available flows, configurations and so on. An example is&lt;br /&gt;
&lt;br /&gt;
   Running on host: anomaly.mlib.ism.cnr.it&lt;br /&gt;
   By user        : marini&lt;br /&gt;
   Version        : 5.0&lt;br /&gt;
   Available CPU&#039;s: 8&lt;br /&gt;
   Available confs: default.sh&lt;br /&gt;
   Available flows: failed_master.pl validate.pl default.pl failed_SLK.pl failed_devel-qp-dbs.pl minimal.pl&lt;br /&gt;
&lt;br /&gt;
=== Database download ===&lt;br /&gt;
Now it is time to download all databases. This can be easily done using the -d option&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -d all&lt;br /&gt;
&lt;br /&gt;
=== Compilation ===&lt;br /&gt;
By default the configure copies a basic compilation script in ROBOTS/&amp;lt;YOUR ROBOT&amp;gt;/CONFIGURATIONS/default.sh. This uses internally compiled libraries so it should work easily. In order to test it launch&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -compile&lt;br /&gt;
&lt;br /&gt;
=== Internal Test ===&lt;br /&gt;
Use the autotest to verify your compiled source:&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -autotest&lt;br /&gt;
&lt;br /&gt;
If everything works you should see as log the following message&lt;br /&gt;
&lt;br /&gt;
 %==================================================================================&lt;br /&gt;
 %= Starting Yambo test-suite&lt;br /&gt;
 %==================================================================================&lt;br /&gt;
 % - Check requirements : ...ncftp...ncftpls...ncftpput...txt2html&lt;br /&gt;
 % -     Test selection : from input&lt;br /&gt;
 %               ncdump : /opt/gcc4/netcdf-4.0.1/bin/ncdump&lt;br /&gt;
 % -  Executable checks : (yambo  OK ) (ypp  FAIL )(a2y  FAIL )(p2y  FAIL )&lt;br /&gt;
 %        Running tests : hBN/GW-OPTICS 01_init 02_HF&lt;br /&gt;
 %             Projects : nopj&lt;br /&gt;
 %            Verbosity : low &lt;br /&gt;
 %            Precision : 0.01 &lt;br /&gt;
 %             Hostname : anomaly.mlib.ism.cnr.it &lt;br /&gt;
 %             revision : 14505 &lt;br /&gt;
 %                build : MPI+SLK &lt;br /&gt;
 %              bin dir : bin &lt;br /&gt;
 %           shortname  : &lt;br /&gt;
 %               source : master_-precompiled &lt;br /&gt;
 %        Parallel Loop : SERIAL&lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
 % &amp;gt;  [1  /1  ] hBN/GW-OPTICS[serial]   &#039;&#039;&#039;5 passes&#039;&#039;&#039; &lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
&lt;br /&gt;
The  &#039;&#039;&#039;5 passes&#039;&#039;&#039; are important as they represent the number of passed tests.&lt;br /&gt;
&lt;br /&gt;
== For the impatiens: quick cron run and final reporting ==&lt;br /&gt;
If you do not want to bother with all details of the testing script and want just to install the suite read this section and stop.&lt;br /&gt;
&lt;br /&gt;
In order to properly setup your machine for night test-suite runs you have to:&lt;br /&gt;
&lt;br /&gt;
#Choose the branch(s) to test&lt;br /&gt;
For this purpose use &lt;br /&gt;
 %./driver.pl -edit branches&lt;br /&gt;
#create a crontab entry&lt;br /&gt;
See [https://corenominal.org/2016/05/12/howto-setup-a-crontab-file/ here] for detailled informations on cron. My personal crontab file looks like&lt;br /&gt;
&lt;br /&gt;
 %# m  h   dom mon dow   command&lt;br /&gt;
 % 30 18  *   *   Thu   ~/bin/scripts/yambo_validation.tcsh validate &amp;gt;&amp;gt; /home/marini/Yambo/sources/svn/yambo-tests/test-suite/LOG 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
 %&amp;gt;cat bin/scripts/yambo_validation.tcsh &lt;br /&gt;
 %#!/usr/bin/tcsh&lt;br /&gt;
 %cd /home/marini/Yambo/sources/svn/yambo-tests/test-suite&lt;br /&gt;
 %./driver.pl -flow $argv[1] -report&lt;br /&gt;
&lt;br /&gt;
That&#039;s all you need.&lt;br /&gt;
&lt;br /&gt;
== Available tests ==&lt;br /&gt;
The list of tests can be done using the -l option:&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -l&lt;br /&gt;
&lt;br /&gt;
Note that you can add a TEST to -l to list the specific inputs of that test. For example&lt;br /&gt;
&lt;br /&gt;
 %&amp;gt;./driver.pl -l GaAs001-c4x4/YAMBO&lt;br /&gt;
 %&lt;br /&gt;
 %Available input files for GaAs001-c4x4/YAMBO are:  01_init 02_RAS_full 03_RAS_full 04_RAS_front 05_RAS_dimer&lt;br /&gt;
&lt;br /&gt;
== Reports &amp;amp; Logs ==&lt;br /&gt;
The autotest and any other run of the test-suite produces three files. Each file is labelled with the date of the run.&lt;br /&gt;
&lt;br /&gt;
In order to see the meaning and the in formations written in the files let&#039;s do a quick run of a Dummy test created in order to reproduce some of the possible error conditions.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first clean the suite&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -c&lt;br /&gt;
&lt;br /&gt;
and use the -force to run also tests tagged as BROKEN (like the Dummy one). First thing to do is to download the Dummy database adding the -force option.&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -d Dummy -force&lt;br /&gt;
&lt;br /&gt;
Then we can run the Dummy test using&lt;br /&gt;
 &lt;br /&gt;
 %./driver.pl -tests Dummy -force&lt;br /&gt;
&lt;br /&gt;
The result will now be&lt;br /&gt;
&lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
 % &amp;gt;  [1  /1  ] Dummy[serial]          11 passes  5 fails &lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
&lt;br /&gt;
The 5 fails cover most of the potential errors detected by the test-suite. Details can be now found in the report/log files&lt;br /&gt;
&lt;br /&gt;
=== REPORT file ===&lt;br /&gt;
This file contains very condensed information about the run. There is the duration time plus some detail of the reasons behind the 5 fails.&lt;br /&gt;
&lt;br /&gt;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
 %% Yambo test suite global REPORT&lt;br /&gt;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
 %==================================================================================&lt;br /&gt;
 %Running tests           :Dummy&lt;br /&gt;
 %Projects                :nopj&lt;br /&gt;
 %Date - Time             :Fri-19-May - 11-46&lt;br /&gt;
 %Build                   :master - MPI+SLK - rev.14505&lt;br /&gt;
 %Parallel Conf           :[serial] - none&lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
 %FAIL: 5 &amp;amp; NO RUN: 0 &amp;amp; SKIPS: 0 % WHITELIST: 1 % OKs: 10&lt;br /&gt;
 %FAIL details: 1 wrong output % 1 no reference % 1 no output % 2 no DB&lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
 %% Section Duration : 0:0:3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
 %% TOTAL   Duration : 0:0:3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
&lt;br /&gt;
In the dummy case indeed the suite should detect:&lt;br /&gt;
# 1 wrong output&lt;br /&gt;
# 1 output missing the REFERENCE &lt;br /&gt;
# 1 missing output (not generated by the run)&lt;br /&gt;
# 2 missing databases.&lt;br /&gt;
&lt;br /&gt;
More details can be found in the LOG and and in the ERROR.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The REPORT file is the one used to send final logs to the mailing list.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== ERROR file ===&lt;br /&gt;
This is a useful file with detailed information about the errors only. &lt;br /&gt;
&lt;br /&gt;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
 %% Yambo test suite ERRORs log&lt;br /&gt;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
 %==================================================================================&lt;br /&gt;
 %Running tests           :Dummy&lt;br /&gt;
 %Projects                :nopj&lt;br /&gt;
 %Date - Time             :Fri-19-May - 11-46&lt;br /&gt;
 %Build                   :master - MPI+SLK - rev.14505&lt;br /&gt;
 %Parallel Conf           :[serial] - none&lt;br /&gt;
 %=--------------------------------------------------------------------------------=&lt;br /&gt;
 %Dummy/02_hf-serial-master/o-02_hf.hf  : VALUE(#  17)@COL#  6 is  -5.4691     [REF] vs  -4.4691     [OUT] corresponding to  6.1013     [% RELATIVE TO MAX]&lt;br /&gt;
 %Dummy/02_hf-serial-master  :  NO REFERENCE/o-02_hf.ndb.em1s_fragment_1 in OUTPUT&lt;br /&gt;
 %Dummy/04_em1s-serial-master  :  NO o-04_em1s.ndb.em1s_fragment_1 in REFERENCE&lt;br /&gt;
 %% Section Duration : 0:0:3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
 %% TOTAL   Duration : 0:0:3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Before entering in the details of the different running methods let&#039;s first describe the Parallel Options&lt;br /&gt;
&lt;br /&gt;
=== Parallel Options ===&lt;br /&gt;
 %   (parallel options)&lt;br /&gt;
 %             -np     &amp;lt;N&amp;gt;            Fixed number of CPU used&lt;br /&gt;
 %             -np_min &amp;lt;N&amp;gt;            Minimum number of CPU used&lt;br /&gt;
 %             -np_max &amp;lt;N&amp;gt;            Maximum number of CPU used&lt;br /&gt;
 %             -nt     &amp;lt;T&amp;gt;            # of OMP threads&lt;br /&gt;
 %             -nl     &amp;lt;L&amp;gt;            # of CPU used for linear algebra&lt;br /&gt;
 %             -def_par               Use the default parallelization scheme&lt;br /&gt;
 %             -rand_par              Use randomly generated parallel structures&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy -force -np 2&lt;br /&gt;
&lt;br /&gt;
produces all possible combinations of 2 cpu&#039;s for the Dummy tests. Each run is labelled in such a way to be unique. The Dummy folder will look like&lt;br /&gt;
&lt;br /&gt;
 %%l tests/Dummy/&lt;br /&gt;
 %01_init-Nmpi2-1-master/  02_hf-Nmpi2-3-master/      03_optics-Nmpi2-3-master/  04_em1s-Nmpi2-3-master/  INPUTS/     yambo.in&lt;br /&gt;
 %02_hf                    03_optics                  04_em1s                    04_em1s-Nmpi2-4-master/  LOG/&lt;br /&gt;
 %02_hf-Nmpi2-1-master/    03_optics-Nmpi2-1-master/  04_em1s-Nmpi2-1-master/    BROKEN                   REFERENCE/&lt;br /&gt;
 %02_hf-Nmpi2-2-master/    03_optics-Nmpi2-2-master/  04_em1s-Nmpi2-2-master/    Dummy.tar.gz             SAVE/&lt;br /&gt;
&lt;br /&gt;
Note that each run is labelled by the number of MPI cpus (&#039;&#039;&#039;Nmpi2&#039;&#039;&#039;) and by the increasing counter of potential combinations of the two cpu&#039;s (&#039;&#039;&#039;-1-master,-2-master,...&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Other potential combinations are&lt;br /&gt;
&lt;br /&gt;
* MPI, default parallelization (no cycle)&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy -force -np 2 -def_par&lt;br /&gt;
  &lt;br /&gt;
* MPI, random parallelization (no cycle, good for testing)&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy -force -np 2 -rand_par&lt;br /&gt;
&lt;br /&gt;
* MPI, using 2 and 4 cpu&#039;s, no cycle on combinations, using random parallelization&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy -force -np_min 2 -np_max 4 -rand_par&lt;br /&gt;
&lt;br /&gt;
* OpenMP (if compiled with OpenMP)&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy -force -nt 2&lt;br /&gt;
&lt;br /&gt;
* MPI+SLK&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy -force -np 4 -nl 4 -def_par&lt;br /&gt;
&lt;br /&gt;
== Tests selection ==&lt;br /&gt;
The test-suite can be run in three different ways&lt;br /&gt;
&lt;br /&gt;
# Using a theme&lt;br /&gt;
# Passing individual sets of tests&lt;br /&gt;
# Using flows&lt;br /&gt;
&lt;br /&gt;
Moreover tests can be selected using projects.&lt;br /&gt;
&lt;br /&gt;
Flows are discussed in the [[Test-suite|Flows]].&lt;br /&gt;
&lt;br /&gt;
=== Theme ===&lt;br /&gt;
A theme is a just a series of tests. Themes are stored in the THEMES/ folder and are used simply using&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -theme test&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;test&#039;&#039; is a text file in the THEMES folder.&lt;br /&gt;
&lt;br /&gt;
=== Individual Tests ===&lt;br /&gt;
This is the way we used to run the Dummy test. Just use &lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests Dummy&lt;br /&gt;
&lt;br /&gt;
to select a combination of specific inputs and tests you can use more complex tests options:&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests &amp;quot;Dummy 01_init 02_hf; Si_bulk/GW-OPTICS 00_init 02Cohsex&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Projects &amp;amp; Keys ===&lt;br /&gt;
Project are listed with the test lists and are accessed with the lowercase options: elph,sc,rt,nl...&lt;br /&gt;
&lt;br /&gt;
So in order to run &#039;&#039;&#039;all&#039;&#039;&#039; tests belonging to the &#039;&#039;&#039;sc&#039;&#039;&#039; project just type&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests all -keys sc&lt;br /&gt;
&lt;br /&gt;
Actually the -keys option is more powerful as, in the future, should also select all inputs with specific observables (like gw, optics and so on).&lt;br /&gt;
&lt;br /&gt;
The list of project are accessed by simply the first column in the list obtained by using the -l option. In the following are in bold.&lt;br /&gt;
&lt;br /&gt;
 %%./driver.pl -l&lt;br /&gt;
 %Available test materials/systems: &lt;br /&gt;
 %[YAMBO]    Al111&lt;br /&gt;
 %           C6H3Cl3&lt;br /&gt;
 %           PA_chain[H]&lt;br /&gt;
 %           SiH4&lt;br /&gt;
 %           Al_bulk/GW-OPTICS&lt;br /&gt;
 %           H2/OPTICS&lt;br /&gt;
 %           H_chain/2.05&lt;br /&gt;
 %           H_chain/2.5&lt;br /&gt;
 %           hBN/GW-OPTICS&lt;br /&gt;
 %           LiF/GW-OPTICS&lt;br /&gt;
 %           Si_bulk/GW-OPTICS&lt;br /&gt;
 %           Si_surface/OPTICS&lt;br /&gt;
 %           Si_wire/OPTICS&lt;br /&gt;
 %           MoS2/pwscf/OPTICS&lt;br /&gt;
 %           MoS2/abinit/OPTICS/With-SOC&lt;br /&gt;
 %           MoS2/abinit/OPTICS/Without-SOC-sp1&lt;br /&gt;
 %           MoS2/abinit/OPTICS/Without-SOC-sp2&lt;br /&gt;
 %[&#039;&#039;&#039;QED&#039;&#039;&#039;]      Si_bulk/QED&lt;br /&gt;
 %[&#039;&#039;&#039;NL&#039;&#039;&#039;]       hBN/NL&lt;br /&gt;
 %[&#039;&#039;&#039;RT&#039;&#039;&#039;]       AlAs[H]&lt;br /&gt;
 %           H2/RT&lt;br /&gt;
 %           hBN/RT&lt;br /&gt;
 %           Si_bulk/RT&lt;br /&gt;
 %           WSe2/RT[H]&lt;br /&gt;
 %           MoS2/pwscf/RT&lt;br /&gt;
 %[&#039;&#039;&#039;SC&#039;&#039;&#039;]       H2/SC&lt;br /&gt;
 %           hBN/SC&lt;br /&gt;
 %           Si_bulk/SC&lt;br /&gt;
 %[&#039;&#039;&#039;MAGNETIC&#039;&#039;&#039;] Si_bulk/MAGNETIC&lt;br /&gt;
 %[&#039;&#039;&#039;ELPH&#039;&#039;&#039;]     Diamond/ELPH1[H]&lt;br /&gt;
 %           Si_bulk/ELPH/BSE&lt;br /&gt;
 %           Si_bulk/ELPH/ELPH_base&lt;br /&gt;
 %           Si_bulk/ELPH/ELPH_for_BSE&lt;br /&gt;
 %           Si_bulk/ELPH/QP_CTL&lt;br /&gt;
 %[&#039;&#039;&#039;KERR&#039;&#039;&#039;]     Cobalt&lt;br /&gt;
 %           Nickel&lt;br /&gt;
 %           Iron/pwscf&lt;br /&gt;
 %           Iron/abinit/With-SOC&lt;br /&gt;
 %           Iron/abinit/Without-SOC&lt;br /&gt;
 %[BROKEN]   Dummy&lt;br /&gt;
 %           GaAs001-c4x4/YAMBO&lt;br /&gt;
 %           hBN/PL[PL]&lt;br /&gt;
 %           Si001-c4x2/YAMBO&lt;br /&gt;
 %           WS2/PL[PL]&lt;br /&gt;
&lt;br /&gt;
Note that to access any of these projects you must use the lowercase option. For example&lt;br /&gt;
*SC → -keys sc&lt;br /&gt;
*RT → -keys rt&lt;br /&gt;
*SC+RT → -keys &#039;sc rt&#039;&lt;br /&gt;
&lt;br /&gt;
=== HARD tests ===&lt;br /&gt;
Some of the tests are long. In the tests list they are labelled with a &#039;&#039;&#039;[H]&#039;&#039;&#039;. In order to run them the key &#039;&#039;hard&#039;&#039; must be used. For example&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -tests all -keys &#039;sc rt hard&#039;&lt;br /&gt;
&lt;br /&gt;
runs all SC+RT tests including the heavy ones.&lt;br /&gt;
&lt;br /&gt;
== FLOWS ==&lt;br /&gt;
All properties of a single launch of the test-suite and also a more complex test-suite launch looping on several parallel, tests, branches, combinations can be controlled via the FLOW feature.&lt;br /&gt;
&lt;br /&gt;
A FLOW is a perl file (like validate.pl) containing combinations of descriptors.&lt;br /&gt;
&lt;br /&gt;
All FLOW files are in the &#039;&#039;&#039;ROBOTS/&amp;lt;YOUR ROBOT&amp;gt;/FLOWS&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A FLOW is run using &lt;br /&gt;
&lt;br /&gt;
%./driver.pl -flow validate&lt;br /&gt;
&lt;br /&gt;
A general flow descriptor is&lt;br /&gt;
 % {&lt;br /&gt;
 % ACTIVE      =&amp;gt; &amp;quot;yes&amp;quot;, # can be yes or no&lt;br /&gt;
 % MPI_CPU     =&amp;gt; &amp;quot;NP&amp;quot;,&lt;br /&gt;
 % SLK_CPU     =&amp;gt; &amp;quot;NM&amp;quot;,&lt;br /&gt;
 % PAR_MODE    =&amp;gt; &amp;quot;TEXT&amp;quot;, # (TEXT can be default, random, loop)&lt;br /&gt;
 % THREADS     =&amp;gt; &amp;quot;NT&amp;quot;,&lt;br /&gt;
 % BRANCH      =&amp;gt; &amp;quot;/home/marini/Yambo/sources/git/yambo/branches/SLK&amp;quot;, # (SAVED)&lt;br /&gt;
 % THEME       =&amp;gt; &amp;quot;G_parallelization&amp;quot;, # (SAVED)&lt;br /&gt;
 % CONFIG      =&amp;gt; &amp;quot;gfortran_slk.sh&amp;quot;, # (SAVED)&lt;br /&gt;
 % TESTS       =&amp;gt; &amp;quot;hBN/GW-OPTICS&amp;quot;, #  (SAVED)&lt;br /&gt;
 % KEYS        =&amp;gt; &amp;quot;nopj elph hard bse rpa&amp;quot;, # (SAVED)&lt;br /&gt;
 %}&lt;br /&gt;
&lt;br /&gt;
The fields labelled with a &#039;&#039;&#039;(SAVE)&#039;&#039;&#039; are not changed if this descriptor is included in a more complex FLOW. In order to explain this feature let&#039;s just have a look at the default validate FLOW provided by default:&lt;br /&gt;
&lt;br /&gt;
 %#!/usr/bin/perl&lt;br /&gt;
 %#&lt;br /&gt;
 %@flow = (&lt;br /&gt;
 %{&lt;br /&gt;
 % ACTIVE      =&amp;gt; &amp;quot;yes&amp;quot;,&lt;br /&gt;
 % CONFIG      =&amp;gt; &amp;quot;default.sh&amp;quot;,&lt;br /&gt;
 % KEYS        =&amp;gt; &amp;quot;nopj elph sc hard&amp;quot;,&lt;br /&gt;
 %},&lt;br /&gt;
 %{&lt;br /&gt;
 % MPI_CPU     =&amp;gt; $SYSTEM_NP,&lt;br /&gt;
 % PAR_MODE    =&amp;gt; &amp;quot;default&amp;quot;,&lt;br /&gt;
 %},&lt;br /&gt;
 %{&lt;br /&gt;
 % MPI_CPU     =&amp;gt; $SYSTEM_NP,&lt;br /&gt;
 % PAR_MODE    =&amp;gt; &amp;quot;random&amp;quot;,&lt;br /&gt;
 %},&lt;br /&gt;
 %{&lt;br /&gt;
 % MPI_CPU     =&amp;gt; $SYSTEM_NP_half,&lt;br /&gt;
 % PAR_MODE    =&amp;gt; &amp;quot;loop&amp;quot;,&lt;br /&gt;
 %},&lt;br /&gt;
 %{&lt;br /&gt;
 % THREADS     =&amp;gt; $SYSTEM_NP_half,&lt;br /&gt;
 %},&lt;br /&gt;
 %{&lt;br /&gt;
 % MPI_CPU     =&amp;gt; $SYSTEM_NP,&lt;br /&gt;
 % SLK_CPU     =&amp;gt; $SYSTEM_NP_half,&lt;br /&gt;
 % PAR_MODE    =&amp;gt; &amp;quot;default&amp;quot;,&lt;br /&gt;
 %},&lt;br /&gt;
 %{&lt;br /&gt;
 % MPI_CPU     =&amp;gt; $SYSTEM_NP_half,&lt;br /&gt;
 % THREADS     =&amp;gt; $SYSTEM_NP_half,&lt;br /&gt;
 % SLK_CPU     =&amp;gt; $SYSTEM_SLK,&lt;br /&gt;
 % PAR_MODE    =&amp;gt; &amp;quot;default&amp;quot;,&lt;br /&gt;
 %},&lt;br /&gt;
 %);&lt;br /&gt;
&lt;br /&gt;
When this flow is launched the driver.pl will run all tests of the &#039;&#039;&amp;quot;nopj elph sc hard&amp;quot;&#039;&#039; projects using: a serial run, all system CPU&#039;s with default parallelization, with random parallelization, cycling among all possible combinations and so so...&lt;br /&gt;
&lt;br /&gt;
Note that also the -autotest is just a simple calculation flow.&lt;br /&gt;
&lt;br /&gt;
== Robots ==&lt;br /&gt;
In version 5.0 the concept of Robots was introduced. In practice each time you run the driver.pl test-suite in any form (compilation, flow, manual tests and so on) the perl script will create a ROBOT. &lt;br /&gt;
&lt;br /&gt;
In practice this means that all operations will be labelled with a &amp;lt;ROBOT&amp;gt; string. Single tests, executables will be copied to a dedicated ROBOT folder and also the LOG and REPORT files will be labelled by the specific ROBOT they belong to.&lt;br /&gt;
&lt;br /&gt;
The benefits of this ROBOT structure is that multiple ROBOTS can be run simultaneously on the same test-suite!&lt;br /&gt;
&lt;br /&gt;
Try yourself by simply running two instances of driver.pl.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: when you run more than 1 robot at the same time be sure to give time to the driver.pl to open all log files&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
In addition if you are compiling the same source leave the robot the time to compile it before running a second robot on the same source.&lt;br /&gt;
&lt;br /&gt;
=== Robot specific operations ===&lt;br /&gt;
&lt;br /&gt;
You can clean/kill only the robot ID by using&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -c -robot ID&lt;br /&gt;
 %./driver.pl -kill -robot ID&lt;br /&gt;
&lt;br /&gt;
You can also launch the driver.pl with a specific robot ID&lt;br /&gt;
&lt;br /&gt;
 %./driver.pl -flow validate -robot ID&lt;br /&gt;
&lt;br /&gt;
=== Robot branches ===&lt;br /&gt;
&lt;br /&gt;
When several robots are run at the same time it is often necessary to specify for each robot a branch to do. This can be easily done via the branch file. This is an example of robot dependent branch file (obtained via the ./driver.pl -e branches) command&lt;br /&gt;
&lt;br /&gt;
 /home/marini/yambo/master master R1&lt;br /&gt;
 /home/marini/yambo/master master R2&lt;br /&gt;
 /home/marini/yambo/gpl master R3&lt;br /&gt;
 /home/marini/yambo/gpl master R4&lt;br /&gt;
 /home/marini/yambo/gpl master R5&lt;br /&gt;
 /home/marini/yambo/gpl master R6&lt;br /&gt;
 /home/marini/yambo/branches/devel-rt-stable devel-rt-stable R7&lt;br /&gt;
 /home/marini/yambo/branches/devel-rt-stable devel-rt-stable R8&lt;br /&gt;
                                                                  &lt;br /&gt;
This file commands the driver.pl to run the master when the robot ID (-robot ID) is 1 or 2, the gpl for robots from 3 to 6 and so on.&lt;br /&gt;
&lt;br /&gt;
== Adding New Tests ==&lt;br /&gt;
&lt;br /&gt;
Adding a new test is easy.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s use a simple example.&lt;br /&gt;
&lt;br /&gt;
Imagine I want to add the test hBN/PIPPO for which I have the SAVE and a list of input files. I copy everything in TESTS/MAIN/hBN creating a new directory, PIPPO&lt;br /&gt;
&lt;br /&gt;
 hBN&amp;gt;ls&lt;br /&gt;
 GW-OPTICS  hBN.tar.gz  NL  PIPPO  PL	RT  SC&lt;br /&gt;
&lt;br /&gt;
In PIPPO I have only the INPUTS and SAVE folders&lt;br /&gt;
&lt;br /&gt;
 PIPPO&amp;gt;ls -R&lt;br /&gt;
 .:&lt;br /&gt;
 INPUTS  SAVE  &lt;br /&gt;
&lt;br /&gt;
 ./INPUTS:&lt;br /&gt;
&lt;br /&gt;
 01_init  02_HF&lt;br /&gt;
&lt;br /&gt;
 ./SAVE:&lt;br /&gt;
 ns.db1	ns.kb_pp  ns.kb_pp_fragment_1  ns.kb_pp_fragment_2  ns.kb_pp_fragment_3  ns.kb_pp_fragment_4  ns.wf  ns.wf_fragments_1_1  &lt;br /&gt;
 ns.wf_fragments_2_1  ns.wf_fragments_3_1  ns.wf_fragments_4_1&lt;br /&gt;
&lt;br /&gt;
At this point I simply run&lt;br /&gt;
 &lt;br /&gt;
 ./driver.pl -update hBN/PIPPO&lt;br /&gt;
&lt;br /&gt;
The driver will run the inputs, create the REFERENCE folder, the .tar.gz of the new test which is uploaded on the ftp server. &lt;br /&gt;
&lt;br /&gt;
Remember to add -compile if your source is not compiled.&lt;br /&gt;
&lt;br /&gt;
At the end of the calculation the git status command should give&lt;br /&gt;
&lt;br /&gt;
 yambo-tests&amp;gt;git status&lt;br /&gt;
 On branch master&lt;br /&gt;
 Your branch is up-to-date with &#039;origin/master&#039;.&lt;br /&gt;
 Changes to be committed:&lt;br /&gt;
  (use &amp;quot;git reset HEAD &amp;lt;file&amp;gt;...&amp;quot; to unstage)&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/INPUTS/01_init&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/INPUTS/02_HF&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/REFERENCE/l-02_HF_HF_and_locXC&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/REFERENCE/o-02_HF.hf&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/REFERENCE/o-02_HF.ndb.HF_and_locXC&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/REFERENCE/r-02_HF_HF_and_locXC&lt;br /&gt;
     new file:   TESTS/MAIN/hBN/PIPPO/SAVE/.empty&lt;br /&gt;
&lt;br /&gt;
It&#039;s now enough that you push and the new test will be ready!&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Test-suite-simple&amp;diff=3905</id>
		<title>Test-suite-simple</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Test-suite-simple&amp;diff=3905"/>
		<updated>2020-12-04T10:26:28Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro for dummies ==&lt;br /&gt;
&lt;br /&gt;
Download and configure (warning the last step will download ~1GB)&lt;br /&gt;
 %git clone https://github.com/yambo-code/yambo-tests.git yambo-tests&lt;br /&gt;
 %cd yambo-tests&lt;br /&gt;
 %./configure --with-yambo=/home/marini/Yambo/yambo/master/&lt;br /&gt;
 %./driver.pl -d all&lt;br /&gt;
Run the test suite and wait for it to finish (warning yambo, ypp, p2y, a2y, yambo_rt and ypp_rt need to be already compiled)&lt;br /&gt;
 %./driver.pl -tests Si_bulk -keys rt&lt;br /&gt;
Check for available options&lt;br /&gt;
 %./driver.pl -H&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add a new input inside a test ==&lt;br /&gt;
&lt;br /&gt;
 %cd TESTS/MAIN/Si_bulk/RT&lt;br /&gt;
&lt;br /&gt;
create input file&lt;br /&gt;
 %cp my_test.in INPUTS/XX_testname&lt;br /&gt;
 %git add       INPUTS/XX_testname&lt;br /&gt;
and add output reference files&lt;br /&gt;
 %cp *my_tests* REFERENCE&lt;br /&gt;
 %git add       REFERENCE/*my_test*&lt;br /&gt;
&lt;br /&gt;
After that if you go back to the main folder and run &lt;br /&gt;
 %./driver.pl -tests Si_bulk -keys rt&lt;br /&gt;
the new test will be executed.&lt;br /&gt;
If everything works fine you can commit:&lt;br /&gt;
 %git commit&lt;br /&gt;
&lt;br /&gt;
For a more extended description see [[Test-suite|Test-suite]]&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* If you link external libraries please be sure to copy &#039;&#039;ncdump&#039;&#039;  and &#039;&#039;nccopy&#039;&#039; in the Yambo bin folder&lt;br /&gt;
&lt;br /&gt;
* do not forget to create the BRANCHES file  in ROBOTS/hostname/usernames/BRANCHES with the folder and the name of your branch like&lt;br /&gt;
/home/attacc/SOFTWARE/yambo-bugfixes bugfixes&lt;br /&gt;
&lt;br /&gt;
* In order to make test-suite works properly you need to add ssh-key in GitHub and clone the code using SSH and not HTTPS&lt;br /&gt;
&lt;br /&gt;
* Be sure that the following packages are installed on your pc: ncftp, ncftpls, ncftput, wget, git, awk, txt2html, rsync&lt;br /&gt;
&lt;br /&gt;
* If you want to test a branch and then upload the result on the web, it is important to use -branch branch_name when you perform the test otherwise the script will put the results of all branches in the same report and the upload will not work properly&lt;br /&gt;
&lt;br /&gt;
* If you use a script in the crontab do not forget to add the path of all libraries in the script and to load the MKL variables.&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3899</id>
		<title>How to obtain the quasi-particle band structure of a bulk material: h-BN</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3899"/>
		<updated>2020-11-19T13:53:16Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to:&lt;br /&gt;
* Calculate quasi-particle corrections in the Hartree-Fock approximation &lt;br /&gt;
* Calculate quasi-particle corrections in the GW approximation &lt;br /&gt;
* Choose the input parameters for a meaningful converged calculation&lt;br /&gt;
* Plot a band structure including quasi-particle corrections&lt;br /&gt;
We will use bulk hBN as an example system. Before starting, you need to obtain the appropriate tarball. See instructions on the [[Tutorials|main tutorials page]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We strongly recommend that you first complete the [[First steps: a walk through from DFT to optical properties]] tutorial.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
At this stage, you should have already completed the following modules:&lt;br /&gt;
* [[Generating the Yambo databases|Generating the Yambo databases]]&lt;br /&gt;
* Step 2 Run [[Initialization]] tutorial&lt;br /&gt;
Now we can start to --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The aim of the present tutorial is to obtain quasiparticle correction to energy levels using many-body perturbation theory (MBPT). &amp;lt;br&amp;gt;&lt;br /&gt;
The general non-linear quasiparticle equation reads:&lt;br /&gt;
[[File:Eqp_1.png|none|x26px|caption]] &lt;br /&gt;
As a first step we want to evaluate the self energy Σ entering in the quasiparticle equation. In the GW approach the self-energy can be separated into two components: a static term called the exchange self-energy (Σx), and a dynamical term (energy dependent) called the correlation self-energy (Σc):&lt;br /&gt;
[[File:Sigma.png|none|x25px|caption]]&lt;br /&gt;
We will treat these two terms separately and demonstrate how to set the most important variables for calculating each term.&lt;br /&gt;
In practice we will compute  the quasi-particle corrections to the one particle Kohn-Sham eigenvalues obtained through a DFT calculation. &lt;br /&gt;
&lt;br /&gt;
The steps are the following:&lt;br /&gt;
&lt;br /&gt;
==Step 1: The Exchange Self Energy or HF quasi-particle correction==&lt;br /&gt;
&lt;br /&gt;
We start by evaluating the exchange Self-Energy and the corresponding Quasiparticle energies (Hartree-Fock energies). &lt;br /&gt;
Follow the module on &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; and then return to this tutorial &#039;&#039;How to obtain the quasiparticle band structure of a bulk material: h-BN&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Step 2: The Correlation Self-Energy and Quasiparticle Energies==&lt;br /&gt;
Once we have calculated the exchange part, we next turn our attention to the more demanding dynamical part. The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]] &lt;br /&gt;
In the expression for the correlation self energy, we have (1) a summation over bands, (2) an integral over the Brillouin Zone, and (3) a sum over the G vectors. In contrast with the case of Σx, the summation over bands extends over &#039;&#039;all&#039;&#039; bands (including the unoccupied ones), and so convergence tests are needed. Another important difference is that the Coulomb interaction is now screened so a fundamental ingredient is the evaluation of the dynamical dielectric matrix. The expression for the dielectric matrix, calculated at the RPA level and including local field effects, has been already treated in the [[Local fields|Local fields]] tutorial.&lt;br /&gt;
&lt;br /&gt;
In the following, we will see two ways to take into account the dynamical effects. First, we will see how to set the proper parameters to obtain a model dielectric function based on a widely used approximation, which models the energy dependence of each component of the dielectric matrix with a single pole function. &lt;br /&gt;
Secondly, we will see how to perform calculations by evaluating the dielectric matrix on a regular grid of frequencies. &lt;br /&gt;
&lt;br /&gt;
Once the correlation part of the self-energy is calculated, we will check the convergence of the different parameters with respect to some final quantity, such as the gap. &lt;br /&gt;
&lt;br /&gt;
After computing the frequency dependent self-energy, we will discover that in order to solve the quasiparticle equation we will need to know its value &#039;&#039;at the value of the quasiparticle itself&#039;&#039;. In the following, unless explicitly stated, we will solve the non-linear quasi-particle equation at first order, by expanding the self-energy around the Kohn-Sham eigenvalue. In this way the quasiparticle equation reads:&lt;br /&gt;
&lt;br /&gt;
[[File:Eqp_2.png|none|x26px|caption]] &lt;br /&gt;
&lt;br /&gt;
where the normalization factor Z is defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:z_fac.png|none|x40px|caption]] &lt;br /&gt;
&lt;br /&gt;
===The Plasmon Pole approximation===&lt;br /&gt;
As stated above, the basic idea of the plasmon-pole approximation is to approximate the frequency dependence of the dielectric matrix with a single pole function of the form:&lt;br /&gt;
[[File:ppa.png|none|x26px|caption]]&lt;br /&gt;
The two parameters R&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; and Ω&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; are obtained by a fit (for each component), after having calculated the RPA dielectric matrix at two given frequencies.&lt;br /&gt;
Yambo calculates the dielectric matrix in the static limit ( ω=0) and at a user defined frequency called the plasmon-pole frequency (ω=iωp). &lt;br /&gt;
Such an approximation has the big computational advantage of calculating the dielectric matrix for only two frequencies and leads to an analytical expression for the frequency integral of the correlation self-energy.&lt;br /&gt;
==== Input file generation ====&lt;br /&gt;
Let&#039;s start by building up the input file for a GW/PPA calculation, including the calculation of the exchange self-energy. From &amp;lt;code&amp;gt;yambo -H&amp;lt;/code&amp;gt; you should understand that the correct option is &amp;lt;code&amp;gt;yambo -x -p p -g n&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 $ cd YAMBO_TUTORIALS/hBN/YAMBO&lt;br /&gt;
 $ yambo -x -p p -g n -F gw_ppa.in&lt;br /&gt;
&lt;br /&gt;
Let&#039;s modify the input file in the following way: &lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]] = 40         Ry    # [XX] Exchange RL components&lt;br /&gt;
 [[Variables#VXCRLvcs|VXCRLvcs]] = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]]= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#PPAPntXp|PPAPntXp]] = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %[[Variables#GbndRnge|GbndRnge]]&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %[[Variables#QPkrange|QPkrange]]        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Brief explanation of some settings:&lt;br /&gt;
* Similar to the Hartree Fock study, we will concentrate on the convergence of the &#039;&#039;&#039;direct&#039;&#039;&#039; gap of the system. Hence we select the last occupied (8) and first unoccupied (9) bands for k-point number 7 in the &amp;lt;code&amp;gt;[[Variables#QPkrange|QPkrange]]&amp;lt;/code&amp;gt; variable. &lt;br /&gt;
* We also keep &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; at its converged value of 40 Ry as obtained in the &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; tutorial.&lt;br /&gt;
* For the moment we keep fixed the plasmon pole energy &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; at its default value (=1 Hartree).&lt;br /&gt;
* We keep fixed the direction of the electric field for the evaluation of the dielectric matrix to a non-specific value: &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;=(1,1,1).&lt;br /&gt;
* Later we will study convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;; for now just set them to the values indicated.&lt;br /&gt;
&lt;br /&gt;
==== Understanding the output ====&lt;br /&gt;
Let&#039;s look at the typical Yambo output. Run Yambo with an appropriate &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flag:&lt;br /&gt;
   &lt;br /&gt;
 $ yambo -F gw_ppa.in -J 10b_1Ry&lt;br /&gt;
&lt;br /&gt;
In the standard output you can recognise the different steps of the calculations: calculation of the screening matrix (evaluation of the non interacting and interacting response), calculation of the exchange self-energy, and finally the calculation of the correlation self-energy and quasiparticle energies. Moreover information on memory usage and execution time are reported: &lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;---&amp;gt; [05] Dynamic Dielectric Matrix (PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;08s&amp;gt; Xo@q[3] |########################################| [100%] 03s(E) 03s(X)&lt;br /&gt;
 &amp;lt;08s&amp;gt; X@q[3] |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [06] Bare local and non-local Exchange-Correlation&lt;br /&gt;
 &amp;lt;43s&amp;gt; EXS |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07] Dyson equation: Newton solver&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07.01] G0W0 (W PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; G0W0 (W PPA) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; [07.02] QP properties and I/O&lt;br /&gt;
 &amp;lt;45s&amp;gt; [08] Game Over &amp;amp; Game summary&lt;br /&gt;
&lt;br /&gt;
Let&#039;s have a look at the report and output. The output file &#039;&#039;o-10b_1Ry.qp&#039;&#039; contains (for each band and k-point that we indicated in the input file) the values of the bare KS eigenvalue, its GW correction and the correlation part of the self energy:&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
  7.000000   8.000000  -0.411876  -0.567723   2.322443&lt;br /&gt;
  7.000000   9.000000   3.877976   2.413773  -2.232241&lt;br /&gt;
&lt;br /&gt;
In the header you can see the details of the calculations, for instance it reports that &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=1 Ry corresponds to 5 Gvectors: &lt;br /&gt;
&lt;br /&gt;
 #  X G`s            [used]:  5&lt;br /&gt;
&lt;br /&gt;
Other information can be found in the report file &#039;&#039;r-10b_1Ry_em1d_ppa_HF_and_locXC_gw0&#039;&#039;, such as the renormalization factor defined above, the value of the &#039;&#039;exchange&#039;&#039; self-energy (non-local XC) and of the DFT exchange-correlation potential (local XC): &lt;br /&gt;
&lt;br /&gt;
 [07.02] QP properties and I/O&lt;br /&gt;
  =============================&lt;br /&gt;
  Legend (energies in eV):&lt;br /&gt;
  - B  : Band       - Eo  : bare energy&lt;br /&gt;
  - E  : QP energy  - Z   : Renormalization factor&lt;br /&gt;
  - So : Sc(Eo)     - S   : Sc(E)&lt;br /&gt;
  - dSp: Sc derivative precision&lt;br /&gt;
  - lXC: Starting Local XC (DFT)&lt;br /&gt;
  -nlXC: Starting non-Local XC (HF)&lt;br /&gt;
  QP [eV] @ K [7] (iku): 0.000000 -0.500000  0.000000&lt;br /&gt;
   B=8 Eo= -0.41 E= -0.98 E-Eo= -0.56 Re(Z)=0.81 Im(Z)=-.2368E-2 nlXC=-19.13 lXC=-16.11 So= 2.322&lt;br /&gt;
   B=9 Eo=  3.88 E=  6.29 E-Eo=  2.41 Re(Z)=0.83 Im(Z)=-.2016E-2 nlXC=-5.536 lXC=-10.67 So=-2.232&lt;br /&gt;
&lt;br /&gt;
Extended information can be also found in the output activating in the input the &amp;lt;code&amp;gt;[[Variables#ExtendOut|ExtendOut]]&amp;lt;/code&amp;gt; flag. This is an optional flag that can be activated by adding the &amp;lt;code&amp;gt;-V qp&amp;lt;/code&amp;gt; verbosity option when building the input file. The plasmon pole screening, exchange self-energy and the quasiparticle energies are also saved in databases so that they can be reused in further runs:&lt;br /&gt;
&lt;br /&gt;
 $ ls ./10b_1Ry&lt;br /&gt;
 ndb.pp ndb.pp_fragment_1 ... ndb.HF_and_locXC ndb.QP&lt;br /&gt;
&lt;br /&gt;
===Convergence tests for a quasi particle calculation===&lt;br /&gt;
&lt;br /&gt;
Now we can check the convergence of the different variables entering in the expression of the correlation part of the self energy.&amp;lt;br&amp;gt; &lt;br /&gt;
First, we focus on the parameter governing the &#039;&#039;screening matrix&#039;&#039; you have already seen in the [[RPA/IP]] section. In contrast to the calculation of the [[RPA/IP]] dielectric function, where you considered either the optical limit or a finite q response (EELS), here the dielectric matrix will be calculated for &#039;&#039;all&#039;&#039; q-points determined by the choice of k-point sampling.&lt;br /&gt;
 &lt;br /&gt;
The parameters that need to be converged can be understood by looking at expression of the dielectric matrix:&lt;br /&gt;
[[File:Yambo-CH5.png|none|x30px|Yambo tutorial image]]&lt;br /&gt;
where &#039;&#039;&amp;amp;chi;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&#039;&#039; is given by&lt;br /&gt;
[[File:Dyson_rpa.png|none|x40px|Yambo tutorial image]]&lt;br /&gt;
and  &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; is given by&lt;br /&gt;
[[File:ChiO.png|none|x45px|Yambo tutorial image]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; : The dimension of the microscopic inverse matrix, related to [[Local fields]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; : The sum on bands (c,v) in the independent particle &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Converging Screening Parameters====&lt;br /&gt;
Here we will check the convergence of the gap starting from the variables controlling the screening reported above: the bands employed to build the RPA response function &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and the number of blocks (G,G&#039;) of the dielectric matrix ε&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;G,G&#039;&amp;lt;/sub&amp;gt;  &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;. &lt;br /&gt;
In the next section we will study convergence with respect to the sum over states summation (sum over &#039;&#039;m&#039;&#039; in the Σ&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; expression); here let&#039;s fix &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to a reasonable value (40 Ry). &lt;br /&gt;
&lt;br /&gt;
Let&#039;s build a series of input files differing by the values of bands and block sizes in &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; considering &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in the range 10-50 (upper limit) and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; in the range 1 to 5 Ry. To do this by hand, file by file, open the &#039;&#039;gw_ppa.in&#039;&#039; file in an editor and change to:&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]] = &#039;&#039;&#039;2 Ry&#039;&#039;&#039;&lt;br /&gt;
while leaving the rest untouched. Repeat for 3 Ry, 4 Ry etc. Next, for each &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; change to:&lt;br /&gt;
 % [[Variables#BndsRnXp|BndsRnXp]]&lt;br /&gt;
   1 | 20 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
and repeat for 30, 40 and so on. Give a &#039;&#039;&#039;different name&#039;&#039;&#039; to each file: &#039;&#039;gw_ppa_Xb_YRy.in&#039;&#039; with X=10,20,30,40 and Y=1,2,3,4,5 Ry.&lt;br /&gt;
&lt;br /&gt;
This is obviously quite tedious. However, you can automate both the input construction and code execution using bash or python scripts (indeed later you will learn how to use the the yambo-python [http://www.yambo-code.org/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)]tool for this task). For now, you can use the simple [[bash_scripts|generate_inputs_1.sh]] bash script to generate the required input files (after copying the script you need to type &amp;lt;code&amp;gt;$ chmod +x name_of_the_script.sh &amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Finally launch the calculations:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_10b_1Ry.in -J 10b_1Ry&lt;br /&gt;
 $ yambo -F gw_ppa_10b_2Ry.in -J 10b_2Ry&lt;br /&gt;
 ...&lt;br /&gt;
 $ yambo -F gw_ppa_40b_5Ry.in -J 40b_5Ry&lt;br /&gt;
&lt;br /&gt;
Once the jobs are terminated we can collect the quasiparticle energies for fixed &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in different files named e.g. &#039;&#039;10b.dat, 20b.dat&#039;&#039; etc. for plotting, by putting in separate columns: the energy cutoff; the size of the G blocks; the quasiparticle energy of the valence band; and that of the conduction band.&lt;br /&gt;
To do this e.g. for the &#039;&#039;10b.dat&#039;&#039; file you can type:&lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;8.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
to parse the valence band quasiparticle energies  and &lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;9.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
for the conduction band; and put all the data in the &#039;&#039;10b.dat&#039;&#039; files. As there are many files to process you can use the [[bash_scripts|parse_qps.sh]] script to create the &#039;&#039;10b.dat&#039;&#039; file and edit the script changing the number of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; for the other output files. &lt;br /&gt;
&lt;br /&gt;
Once we have collected all the quasiparticle values we can plot the gap, or the valence and conduction band energies separately, as a function of the block size or energy cutoff:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:3 w lp t &amp;quot; Valence BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:3 w lp t &amp;quot;Valence BndsRnXp=20&amp;quot;,.. &lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:4 w lp t &amp;quot; Conduction BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:4 w lp t &amp;quot;Conduction BndsRnXp=20&amp;quot;,..&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot; Gap BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot;gap BndsRnXp=20&amp;quot;,..  &lt;br /&gt;
or both using e.g. the [[gnuplot_scripts|ppa_gap.gnu]] gnuplot script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=1 caption=&amp;quot;Quasiparticle energies with respect screening parameters&amp;quot;&amp;gt;&lt;br /&gt;
File:ppa2.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:ppa3.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ppa1.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Looking at the plot we can see that:&lt;br /&gt;
* The two parameters are not totally independent (see e.g. the valence quasiparticle convergence) and this is the reason why we converged them simultaneously &lt;br /&gt;
* The gap (energy difference) converge faster than single quasiparticle state&lt;br /&gt;
* The convergence criteria depends on the degree of accuracy we look for, but considering the approximations behind the calculations (plasmon-pole etc.), it is not always a good idea to enforce too strict a criteria.  &lt;br /&gt;
* Even if not totally converged we can consider that the upper limit of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;=30, and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=3Ry are reasonable parameters.&lt;br /&gt;
&lt;br /&gt;
Finally notice that in the last versions of Yambo 4.5 etc. there is a terminator for the dielectric constant that accelerates convergence on the number of bands,&lt;br /&gt;
you can active it with the &amp;lt;code&amp;gt;-V resp&amp;lt;/code&amp;gt; verbosity and setting &amp;lt;code&amp;gt;XTermKind= &amp;quot;BG&amp;quot;&amp;lt;/code&amp;gt;. You can compare the converge of the dielectric constant with and without terminator,&lt;br /&gt;
similar to what happens for the self-energy, see next section.&lt;br /&gt;
&lt;br /&gt;
====Converging the sum over states in the correlation self-energy====&lt;br /&gt;
From now on we will keep fixed these parameters and will perform a convergence study on the sum over state summation in the correlation self-energy (Σc) &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In order to use the screening previously calculated we can copy the plasmon pole parameters saved in the &amp;lt;code&amp;gt;30b_3Ry&amp;lt;/code&amp;gt; directory in the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory. In this way the screening will be read by Yambo and not calculated again:&lt;br /&gt;
&lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./SAVE/.&lt;br /&gt;
&lt;br /&gt;
(Note: you may have to delete these files before running the BSE tutorials)&lt;br /&gt;
&lt;br /&gt;
In order to use the databases we have to be sure to have the same plasmon-pole parameters in our input files.&lt;br /&gt;
Edit &#039;&#039;gw_ppa_30b_3Ry.in&#039;&#039; and modify &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to order to have a number of bands in the range from 10 to 80 inside different files named &#039;&#039;gw_ppa_Gbnd10.in&#039;&#039;, &#039;&#039;gw_ppa_Gbnd20.in&#039;&#039; etc. You can also run the the [[bash_scripts|generate_inputs_2.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next, launch yambo for each input:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and as done before we can inspect the obtained quasiparticle energies: &lt;br /&gt;
&lt;br /&gt;
 $ grep 8.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
for the valence bands, and &lt;br /&gt;
 $ grep 9.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
for the conduction band.&lt;br /&gt;
&lt;br /&gt;
Collect the results in a text file &#039;&#039;Gbnd_conv.dat&#039;&#039; containing: the number of Gbnd, the valence energy, and the conduction energy.&lt;br /&gt;
Now, as done before we can plot the valence and conduction quasiparticle levels separately as well as the gap, as a function of the number of bands used in the summation:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2 w lp lt 7  t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3 w lp lt 7  t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2) w lp lt 7  t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Quasiparticle energies with respect sum over states in correlation self-energy&amp;quot;&amp;gt;&lt;br /&gt;
File:Gbnd_val.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:Gbnd_cond.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Gbnd_gap.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Inspecting the plot we can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is rather slow and many bands are needed to get converged results.&lt;br /&gt;
* As observed above the gap (energy difference) converges faster than the single quasiparticle state energies.&lt;br /&gt;
&lt;br /&gt;
====Accelerating the sum over states convergence in the correlation self-energy====&lt;br /&gt;
In general the convergence with respect the sum over states can be very cumbersome. Here we show how it can be mitigated by using &lt;br /&gt;
a technique developed by F. Bruneval and X. Gonze &amp;lt;ref name=&amp;quot;BG&amp;quot;&amp;gt; F. Bruneval and X. Gonze, Physical Review B 78, 085125  (2008 )&amp;lt;/ref&amp;gt;. The basic idea relies in replacing the eigenenergies of the states that are not treated explicitly by a common energy, and take into account all the states, which are not explicitly included in the calculation through the closure relation.&lt;br /&gt;
To apply this technique in Yambo we need to activate the optional terminator variable [[Variables#GTermKind|GTermKind]]. We can activate it by adding the quasiparticle verbosity to the command line when generating the input file:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -p p -g n -F gw_ppa_Gbnd10.in -V qp&lt;br /&gt;
&lt;br /&gt;
and you can edit the input file by setting:&lt;br /&gt;
 &lt;br /&gt;
 [[Variables#GTermKind|GTermKind]]= &amp;quot;BG&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or simply you can add by hand this line in all the other &#039;&#039;gw_ppa_GbndX.in&#039;&#039; input files.&lt;br /&gt;
Now we can repeat the same calculations &lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10_term&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20_term&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and collect the new results:&lt;br /&gt;
&lt;br /&gt;
 $ grep 8.000 *term.qp  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
 $ grep 9.000 *term.qp  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
&lt;br /&gt;
in a new file called &#039;&#039;Gbnd_conv_terminator.dat&#039;&#039;. Now we can plot the same quantities as before by looking at the effect of having introduced the terminator. &lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:2 w lp t &amp;quot;Valence with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:3 w lp t &amp;quot;Conduction with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:($3-$2) w lp t &amp;quot;Gap with terminator&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Effect of the terminator in convergence of QP energies with respect sum over states&amp;quot;&amp;gt;&lt;br /&gt;
File:val_t.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique &amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
File:cond_t.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:gap_t.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is accelerated in particular for the single quasiparticle states.&lt;br /&gt;
* From the plot above we can see that &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;=40 is sufficient to have a converged gap&lt;br /&gt;
&lt;br /&gt;
===Beyond the plasmon pole approximation: a full frequency approach - real axis integration===&lt;br /&gt;
All the calculations performed up to now were based on the plasmon pole approximation (PPA). Now we remove this approximation by evaluating numerically the frequency integral in the expression of the correlation self-energy (Σc). To this aim we need to evaluate the screening for a number of frequencies in the interval depending on the electron-hole energy difference (energy difference between empty and occupied states) entering in the sum over states. &lt;br /&gt;
Let&#039;s build the input file for a full frequency calculation by simply typing:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff.in -g n &lt;br /&gt;
&lt;br /&gt;
and we can set the variable studied up to now at their converged value:&lt;br /&gt;
&lt;br /&gt;
 %[[Variables#BndsRnXd|BndsRnXd]]&lt;br /&gt;
 1 | 30 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXd|NGsBlkXd]]=3 Ry&lt;br /&gt;
 %[[Variables#GbndRange|GbndRange]]&lt;br /&gt;
 1 | 40 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]=40 Ry&lt;br /&gt;
 % [[Variables#LongDrXd|LongDrXd]] &lt;br /&gt;
 1.000000 | 1.000000 | 1.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 %QPkrange                      # # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and next vary in different files (name them &#039;&#039;gw_ff10.in&#039;&#039; etc.) the number of frequencies we evaluate for the screened coulomb potential. This is done by setting the values of [[Variables#ETStpsXd|ETStpsXd]]=10 , 50 , 100, 150, 200, 250. &lt;br /&gt;
You can also run the the [[bash_scripts|generate_inputs_3.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next launch yambo:&lt;br /&gt;
 $ yambo -F gw_ff10.in -J ff10&lt;br /&gt;
 $ yambo -F gw_ff50.in -J ff50&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Clearly as we are evaluating the screening for a large number of frequencies these calculations will be heavier than the case above where the calculation of the screening was done for only two frequencies  (zero and plasmon-pole). &lt;br /&gt;
As before, collect the valence and conduction bands as a function of the number of frequencies in a file called &#039;&#039;gw_ff.dat&#039;&#039; and plot the behaviour of the conduction and valence bands and the gap.&lt;br /&gt;
 &lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Real axis integration, convergences with respect the used number of frequencies&amp;quot;&amp;gt;&lt;br /&gt;
File:ff_v.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt;&lt;br /&gt;
File:ff_c.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ff_g.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
&lt;br /&gt;
* Oscillations are still present, indicating that even more frequencies have to be considered. In general, a real-axis calculation is very demanding. &lt;br /&gt;
* The final result of the gap obtained up to now does not differ too much from the one obtained at the plasmon-pole level (~50 meV)&lt;br /&gt;
&lt;br /&gt;
===Secant Solver===&lt;br /&gt;
&lt;br /&gt;
The real axis integration permits also to go beyond the linear expansion to solve the quasi particle equation. &lt;br /&gt;
The QP equation is a non-linear equation whose solution must be found using a suitable numerical algorithm. &lt;br /&gt;
[[File:Eqp_sec.png|none|x22px|caption]] &lt;br /&gt;
The mostly used, based on the linearization of the self-energy operator is the Newton method that is the one we have used up to now. &lt;br /&gt;
Yambo can also perform a search of the QP energies using a non-linear iterative method based on the [https://en.wikipedia.org/wiki/Secant_method Secant iterative Method].&lt;br /&gt;
&lt;br /&gt;
In numerical analysis, the secant method is a root-finding algorithm that uses a succession of roots of secant lines to better approximate a root of a function &#039;&#039;f&#039;&#039;. The secant method can be thought of as a finite difference approximation of Newton&#039;s method. &lt;br /&gt;
The equation that defines the secant method is: &lt;br /&gt;
&lt;br /&gt;
[[File:secant_eq.png|none|x35px|caption]] &lt;br /&gt;
&lt;br /&gt;
The first two iterations of the secant method are shown in the following picture. The red curve shows the function f and the blue lines are the secants.&lt;br /&gt;
&lt;br /&gt;
[[File:Secant_method.png|center|250px|caption]] &lt;br /&gt;
&lt;br /&gt;
To see if there is any non-linear effect in the solution of the Dyson equation we compare the result of the calculation using the Newton solver as done before with the present case. &lt;br /&gt;
In order to use the secant method you need to edit one of the the previous &#039;&#039;gw_ffN.in&#039;&#039; files e.g. &#039;&#039;gw_ff100.in&#039;&#039; and substitute:&lt;br /&gt;
&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;&lt;br /&gt;
to &lt;br /&gt;
 DysSolver= &amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Repeat the calculations in the same way as before:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff100.in -J ff100&lt;br /&gt;
&lt;br /&gt;
Note than now the screening will &#039;&#039;not&#039;&#039; be calculated again as it has been stored in the &#039;&#039;ffN&#039;&#039; directories as can be seen in the report file:&lt;br /&gt;
&lt;br /&gt;
 [05] Dynamical Dielectric Matrix&lt;br /&gt;
 ================================&lt;br /&gt;
 [RD./ff10//ndb.em1d]----&lt;br /&gt;
 ...&lt;br /&gt;
 [RD./ff10//ndb.em1d_fragment_1]--------------&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Comparing the output files, e.g. for the case with 100 freqs:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp&#039;&#039;  &#039;&#039;&#039;Newton Solver:&#039;&#039;&#039;&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08708      2.91254 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.421968    -3.417357 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp_01&#039;&#039; &#039;&#039;&#039;Secant Solver:&#039;&#039;&#039;&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08715      2.93518 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.401408    -3.731649 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
From the comparison, we see that the effect is of the order of 20 meV, of the same order of magnitude of the accuracy of the GW calculations.&lt;br /&gt;
&lt;br /&gt;
==Step 3: Interpolating Band Structures==&lt;br /&gt;
Up to now we have checked convergence for the gap. Now we want to calculate the quasiparticle corrections across the Brillouin zone in order to visualize the entire band structure along a path connecting high symmetry points.&lt;br /&gt;
&lt;br /&gt;
To do that we start by calculating the QP correction in the plasmon-pole approximation for all the k points of our sampling and for a number of bands around the gap. You can use a previous input file or generate a new one: &amp;lt;code&amp;gt; yambo -F gw_ppa_all_Bz.in -x -p p -g n &amp;lt;/code&amp;gt; and set the parameters found in the previous tests:&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  40        Ry &lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 30 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3            Ry    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp= 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and we calculate it for all the available kpoints by setting:&lt;br /&gt;
 %QPkrange                    # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1| 14|  6|11|&lt;br /&gt;
 %&lt;br /&gt;
 &lt;br /&gt;
Note that as we have already calculated the screening with these parameters you can save time and use that database either by running in the previous directory by using &amp;lt;code&amp;gt; -J 30b_3Ry &amp;lt;/code&amp;gt; or if you prefer to put the new databases in the new all_Bz directory you can create a new directory and copy there the screening databases:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir all_Bz &lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./all_Bz/&lt;br /&gt;
&lt;br /&gt;
and launch the calculation:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_all_Bz.in -J all_Bz&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the output and see that it contains the correction for all the k points for the bands we asked:&lt;br /&gt;
&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
    1.000000     6.000000    -1.299712    -0.219100     3.788044&lt;br /&gt;
    1.000000     7.000000    -1.296430    -0.241496     3.788092&lt;br /&gt;
    1.000000     8.000000    -1.296420    -0.243115     3.785947&lt;br /&gt;
    1.000000     9.000000     4.832399     0.952386    -3.679259&lt;br /&gt;
    1.00000     10.00000     10.76416      2.09915     -4.38743&lt;br /&gt;
    1.00000     11.00000     11.36167      2.48053     -3.91021&lt;br /&gt;
....&lt;br /&gt;
By plotting some of the &#039;o-all_Bz.qp&amp;quot; columns it is possible to discuss some physical properties of the hBN QPs. Using columns 3 and (3+4), ie plotting the GW energies with respect to the LDA energies we can deduce the band gap renormalization and the stretching of the conduction/valence bands:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-all_Bz.qp&amp;quot; u 3:($3+$4) w p  t &amp;quot;Eqp vs Elda&amp;quot; &lt;br /&gt;
&lt;br /&gt;
[[File:EqpvE0.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
Essentially we can see that the effect of the GW self-energy is the opening of the gap and a linear stretching of the conduction/valence bands that can be estimated by performing a linear fit of the positive and negative energies (the zero is set at top of the valence band). &lt;br /&gt;
&lt;br /&gt;
In order to calculate the band structure, however, we need to interpolate the values we have calculated above on a given path. In Yambo the interpolation is done by the executable &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; (Yambo Post Processing).&lt;br /&gt;
By typing: &lt;br /&gt;
 $ ypp -H  &lt;br /&gt;
you will recognize that in order to interpolate the bands we need to build a ypp input file using&lt;br /&gt;
 $ ypp -s b&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Before editing the &#039;&#039;ypp.in&#039;&#039; input file and running the interpolation, it is important to know that &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; uses an algorithm &amp;lt;ref&amp;gt; Warren E. Pickett, Henry Krakauer, and Philip B. Allen Phys. Rev. B 38, 2721 &amp;lt;/ref&amp;gt;  that cannot be used in presence of time-reversal (TR) symmetry. &lt;br /&gt;
As a first step we therefore remove the TR symmetry by typing:&lt;br /&gt;
&lt;br /&gt;
 $ ypp -y&lt;br /&gt;
&lt;br /&gt;
and we uncomment the corresponding line to remove the TR.&lt;br /&gt;
&lt;br /&gt;
 fixsyms                      # [R] Reduce Symmetries&lt;br /&gt;
 #RmAllSymm                   # Remove all symmetries&lt;br /&gt;
 #RmTimeRev                   # Remove Time Reversal&lt;br /&gt;
&lt;br /&gt;
and launch&lt;br /&gt;
 &lt;br /&gt;
 $ ypp&lt;br /&gt;
&lt;br /&gt;
This will create a new directory called &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; where a &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory containing the electronic structure in the absence of TR is present. &lt;br /&gt;
We will calculate the band structure in the &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
 $ cd FixSymmm&lt;br /&gt;
&lt;br /&gt;
After having performed the usual setup&lt;br /&gt;
&lt;br /&gt;
 $yambo&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
we can generate the input for the band interpolation:&lt;br /&gt;
&lt;br /&gt;
 $ypp -s b -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
and edit the &#039;&#039;ypp_bands.in&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 electrons                    # [R] Electrons (and holes)&lt;br /&gt;
 bnds                         # [R] Bands&lt;br /&gt;
 INTERP_mode= &amp;quot;NN&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach) &lt;br /&gt;
 OutputAlat= 4.716000           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;     &lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   1 | 100 |                   # Number of bands&lt;br /&gt;
 %&lt;br /&gt;
 % INTERP_Grid&lt;br /&gt;
 -1 |-1 |-1 |                             # Interpolation BZ Grid&lt;br /&gt;
 %&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 CIRCUIT_E_DB_path= &amp;quot;none&amp;quot;      # SAVE obtained from the QE `bands` run (alternative to %BANDS_kpts)&lt;br /&gt;
 BANDS_path= &amp;quot;&amp;quot;                 # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 10  &lt;br /&gt;
 #BANDS_built_in                # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts   &lt;br /&gt;
 % &lt;br /&gt;
&lt;br /&gt;
We modify the following lines:&lt;br /&gt;
 BANDS_steps=30&lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   6 | 11 |                   # Number of bands &lt;br /&gt;
 %&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.00000 |0.00000 |0.00000 |&lt;br /&gt;
  0.50000 |-.50000 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.50000 |&lt;br /&gt;
  0.00000 |0.00000 |0.50000 |&lt;br /&gt;
  0.50000 |-.50000 |0.50000 |&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
which means we assign 30 points in each segment, we ask to interpolate 3 occupied and 3 empty bands and we assign the following path passing from the high symmetry points: K Γ M K H A L.&lt;br /&gt;
Launching:&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
will produce the output file &#039;&#039;o.bands_interpolated&#039;&#039; containing:&lt;br /&gt;
&lt;br /&gt;
                 &lt;br /&gt;
 #&lt;br /&gt;
 #   |k|        b6         b7         b8         b9         b10        b11        kx         ky         kz&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
     0.00000   -7.22092   -0.13402   -0.13395    4.67691    4.67694   10.08905    0.33300   -0.66667    0.00000&lt;br /&gt;
     0.03725   -7.18857   -0.17190   -0.12684    4.66126    4.71050   10.12529    0.32190   -0.64445    0.00000&lt;br /&gt;
...&lt;br /&gt;
 &lt;br /&gt;
and we can plot the bands using gnuplot:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o.bands_interpolated&amp;quot; u 0:2 w l, &amp;quot;o.bands_interpolated&amp;quot; u 0:3 w l, ...&lt;br /&gt;
&lt;br /&gt;
[[File:bands_lda.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
and you can recognize the index of the high symmetry point by inspecting the last three columns.&lt;br /&gt;
Note that up to now we have interpolated the LDA band structure. In order to plot the GW band structure, we need to tell &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; in the input file where the &#039;&#039;ndb.QP&#039;&#039; database is found. This is achieved by adding in the &#039;&#039;ypp_bands.in&#039;&#039; file the line:&lt;br /&gt;
&lt;br /&gt;
  GfnQPdb= &amp;quot;E &amp;lt; ./all_Bz/ndb.QP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and relaunch &lt;br /&gt;
&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
Now the file &#039;&#039;o.bands_interpolated_01&#039;&#039; contains the GW interpolated band structure. We can plot the LDA and GW band structure together by using the gnuplot script [[gnuplot_scripts|bands.gnu]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines  widths=500px heights=500px  perrow=2 caption=&amp;quot;Band strcuture of bulk hBN&amp;quot;&amp;gt;&lt;br /&gt;
File:hBN_bands.png| LDA and GW bands structure &lt;br /&gt;
File:hBN_bands_lit.png| LDA and GW bands structure from Ref. &amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*As expected the effect of the GW correction is to open the gap.&lt;br /&gt;
*Comparing the obtained band structure with the one found in the literature by Arnaud and coworkers &amp;lt;ref name=&amp;quot;Arnaud&amp;quot;&amp;gt; B. Arnaud, S. Lebegue,P. Rabiller, and M. Alouani Phys, Rev. Lett. 96, 026402 (2006)&amp;lt;/ref&amp;gt; we found a very nice qualitative agreement. &lt;br /&gt;
*Quantitatively we found a smaller gap: about 5.2 eV (indirect gap), 5.7 eV (direct gap) while in Ref.&amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt;  is found  5.95 eV for the indirect gap and a minimum direct band gap of 6.47 eV. Other values are also reported in the literature depending on the used pseudopotentials, starting functional and type of self-consistency (see below). &lt;br /&gt;
*The present tutorial has been done with a small k point grid which is an important parameter to be checked, so convergence with respect the k point sampling has to be validated.&lt;br /&gt;
&lt;br /&gt;
==Step 4: Summary of the convergence parameters==&lt;br /&gt;
We have calculated the band structure of hBN starting from a DFT calculation, here we summarize the main variable we have checked to achieve convergence:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; # [XX] Exchange RL components&lt;br /&gt;
Number of G-vectors in the exchange. This number should be checked carefully. Generally a large number is needed as the QP energies show a slow convergence. The calcualtion of the exchange part is rather fast. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; #[Xp] Polarization function bands&lt;br /&gt;
Number of bands in the independent response function form which the dielectric matrix is calculated. Also this paramater has to be checked carefully,together with NGsBlkXp as the two variables are interconnected&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;  # [Xp] Response block size&lt;br /&gt;
Number of G-vectors block in the dielectric constant. Also this paramater has to be checked carefully, to be checked together with BndsRnXp. A large number of bands and block can make the calculation very demanding.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]] &amp;lt;/code&amp;gt; # [Xp] [cc] Electric Field&lt;br /&gt;
Direction of the electric field for the calculation of the q=0 component of the dielectric constant e(q,w). In a bulk can be set to (1,1,1), attention must be paid for non 3D systems.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]] &amp;lt;/code&amp;gt; # [Xp] Plasmon pole imaginary energy: this is the second frequency used to fit the Godby-Needs plasmon-pole model (PPM). If results depend consistently by changing this frequency, the PPM is not adequate for your calculation and it is need to gp beyond that, e.g. Real-axis. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]] &amp;lt;/code&amp;gt; # [GW] G[W] bands range&lt;br /&gt;
Number of bands used to expand the Green&#039;s function. This number is usually larger than the number of bands used to calculated the dielectricconstant. Single quasiparticle energies converge slowly with respect GbndRnge, energy difference behave better. You can use terminator technique to mitigate the slow dependence. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GDamping|GDamping]] &amp;lt;/code&amp;gt; # [GW] G[W] damping&lt;br /&gt;
Small damping in the Green&#039;s function definition, the delta &lt;br /&gt;
parameter. The final result shouuld not depend on that, usually set at 0.1 eV&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#dScStep|dScStep]] &amp;lt;/code&amp;gt; # [GW] &lt;br /&gt;
Energy step to evaluate Z factors&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#DysSolver|DysSolver]] &amp;lt;/code&amp;gt; # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
Parameters related to the  solution of the Dyson equation, &amp;quot;n&amp;quot; Newton linearization, &#039;s&#039; non linear secant method&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GTermKind|GTermKind]] &amp;lt;/code&amp;gt; [GW] GW terminator &lt;br /&gt;
Terminator for the self-energy&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt; . We have seen how this spped up the convergence with respect empty bands.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#%QPkrange |QPkrange ]] &amp;lt;/code&amp;gt; # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
K-points and band range where you want to calculate the GW correction. The syntax is&lt;br /&gt;
first kpoint | last kpoint | first band | last band&lt;br /&gt;
&lt;br /&gt;
==Step 5: Eigenvalue only self-consistent evGW0 and evGW (only available in Yambo 4.6) ==&lt;br /&gt;
Here we want to see how we can compute an eigenvalue only evGW0 or evGW correction in Yambo. In the new version of Yambo there are two flags for these kind of self-consistency: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWoIter]]&amp;lt;/code&amp;gt;  number of GW0 iterations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWIter]]&amp;lt;/code&amp;gt;  number of GW iterations&lt;br /&gt;
&lt;br /&gt;
you can set one of them to 10 for example, the code will stop when convergence is reached, usually in less than 5 iterations.&lt;br /&gt;
For example if you consider the input file below:&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 % &lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GWoIter=0                    # [GW] GWo self-consistent (evGWo) iterations on eigenvalues&lt;br /&gt;
 GWIter =0                    # [GW] GW  self-consistent (evGW)  iterations on eigenvalues&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1|  14|  7|  10|&lt;br /&gt;
 % &lt;br /&gt;
if you set both GWIter and GWoIter to zero you get a gap correction of 4.15 eV.&lt;br /&gt;
If you perform self-consistency on G (GWoIter/=)  &lt;br /&gt;
the gap will be 4.713 eV and finally if you perform &lt;br /&gt;
self-consistency in both G and W (GWIter /=0) the gap will be  5.506 eV.&lt;br /&gt;
&lt;br /&gt;
Notice that these values are absolutelly not converged because we used very few&lt;br /&gt;
bands and a small block size.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note that the final result of the self-consistent GW may&lt;br /&gt;
depend from the number of bands you decide to correct, because they are used&lt;br /&gt;
to reconstruct G and W. For the non-corrected bands Yambo applied a rigid shift&lt;br /&gt;
of their energy based on the closed corrected band.&lt;br /&gt;
&lt;br /&gt;
==Step 6: A better integration of the q=0 point ==&lt;br /&gt;
&lt;br /&gt;
The integration of the q=0 of the Coulomb potential is problematic because the 1/q diverges.&lt;br /&gt;
Usually in Yambo this integration is performed analytically in a small sphere around q=0.&lt;br /&gt;
&lt;br /&gt;
[[File:Circle box.gif|center|frame]]&lt;br /&gt;
&lt;br /&gt;
however in this way the code lost part of the integral out of the circle. This usually &lt;br /&gt;
is not problematic because for a large number of q and k point the missing term goes to zero.&lt;br /&gt;
However in system that requires few k-points or even only the gamma one, it is possible&lt;br /&gt;
to perform a better integration of this term by adding the flag -r to generate the input&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&lt;br /&gt;
&amp;gt; 3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1&amp;lt;/span&amp;gt;            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;) &lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
in this input  &amp;lt;code&amp;gt;[[Variables#RandGvec|RandGvec]]&amp;lt;/code&amp;gt; is the component of the Coulomb potential we want integrate numerically,&lt;br /&gt;
in this case only the first one G=G&#039;=0, and &amp;lt;code&amp;gt;[[Variables#RandQpts|RandQpts]]&amp;lt;/code&amp;gt; is the number of random points&lt;br /&gt;
used to perform the integral by Monte Carlo.&lt;br /&gt;
&lt;br /&gt;
If you turn one this integration you will get a slightly different band gap,&lt;br /&gt;
but in the limit of large k points the final results will be the same of the standard method.&lt;br /&gt;
&lt;br /&gt;
However this correction is important for systems that converge with few k-points or with gamma only.&lt;br /&gt;
&lt;br /&gt;
==Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) ==&lt;br /&gt;
&lt;br /&gt;
Hexagonal Boron Nitride is an anisotropic material so there is the question in which direction&lt;br /&gt;
one shold calculate the dielectric constant the enters in the GW. &lt;br /&gt;
If you run again this tutorial changing the direction of the q=0 point in GW calculation,&lt;br /&gt;
the variable &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;, you will realize that the there gap correction changes.&lt;br /&gt;
In Yambo there is a way to take into account this anisitropy of the dielectri tensor.&lt;br /&gt;
&lt;br /&gt;
First of all you need to calculate the dielectric constant in the three cartesian directions with the command &amp;lt;code&amp;gt; yambo -o c -k hartree&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 optics                         # [R] Linear Response optical properties&lt;br /&gt;
 kernel                         # [R] Kernel&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;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 NGsBlkXd= 3000        mRy      # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
   1 | 1 |                       # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
    1 | 100 |                   # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   0.00000 | 10.00000 | eV      # [Xd] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 1                    # [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;
&lt;br /&gt;
From the result in the output file &amp;lt;code&amp;gt; o.eps_q1_inv_rpa_dyson&amp;lt;/code&amp;gt; you can calculate the zero component of inverse dielectric matrix, in this case 1.0/5.044076 = 0.198252.&lt;br /&gt;
&lt;br /&gt;
Repeat this calculation with the field in the other two directions y and z. The y-direction is equal to x, while in z direction the zero component of the inverse dielectric matrix is 1.0/2.872451 = 0.348134.&lt;br /&gt;
&lt;br /&gt;
Now generate a new input file for the GW, with the command &amp;lt;code&amp;gt; yambo -g n -p p -r -V RL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&amp;gt;3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 % Em1Anys&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.198252 &amp;lt;/span&amp;gt;    | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.198252 &amp;lt;/span&amp;gt;    |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.348134 &amp;lt;/span&amp;gt;  |        # [RIM] X Y Z Static Inverse dielectric matrix&lt;br /&gt;
 %&lt;br /&gt;
 IDEm1Ref= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;  &lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
run the calculations and you will find a correction of the gap intermediate between the one with the field in x and z directions.&lt;br /&gt;
&lt;br /&gt;
==Step 8: Exercise: Convergence with respect K points==&lt;br /&gt;
As an exercise now you can check the convergence with respect the K point sampling:&lt;br /&gt;
# perform a new non-scf calculation with a bigger k point grid: 9x9x3 and 12x12x4 ...&lt;br /&gt;
# convert wave functions and electronic structure to Yambo databases in a different directory as explained in the [[Bulk material: h-BN|DFT and p2y module]], &lt;br /&gt;
# [[initialization |Initialize]] the Yambo databases,&lt;br /&gt;
# Redo the steps explained in this section (exchange self energy, plasmon pole GW, band structure interpolation)&lt;br /&gt;
# The PPA-GW calculation using 12x12x4 grid depending on your machine can take several minutes in serial mode. You can think to perform the exercise after having learned some basic on the parallelization strategy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|style=&amp;quot;width:15%; text-align:left&amp;quot;|Prev: [[Tutorials|Tutorials Home]] &lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center&amp;quot;|Now: [[Tutorials|Tutorials Home]] --&amp;gt; [[How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN|GW]] &lt;br /&gt;
|style=&amp;quot;width:35%; text-align:right&amp;quot;|Next: If you did everything, choose another tutorial in the menu&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3898</id>
		<title>How to obtain the quasi-particle band structure of a bulk material: h-BN</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3898"/>
		<updated>2020-11-19T13:44:22Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to:&lt;br /&gt;
* Calculate quasi-particle corrections in the Hartree-Fock approximation &lt;br /&gt;
* Calculate quasi-particle corrections in the GW approximation &lt;br /&gt;
* Choose the input parameters for a meaningful converged calculation&lt;br /&gt;
* Plot a band structure including quasi-particle corrections&lt;br /&gt;
We will use bulk hBN as an example system. Before starting, you need to obtain the appropriate tarball. See instructions on the [[Tutorials|main tutorials page]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We strongly recommend that you first complete the [[First steps: a walk through from DFT to optical properties]] tutorial.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
At this stage, you should have already completed the following modules:&lt;br /&gt;
* [[Generating the Yambo databases|Generating the Yambo databases]]&lt;br /&gt;
* Step 2 Run [[Initialization]] tutorial&lt;br /&gt;
Now we can start to --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The aim of the present tutorial is to obtain quasiparticle correction to energy levels using many-body perturbation theory (MBPT). &amp;lt;br&amp;gt;&lt;br /&gt;
The general non-linear quasiparticle equation reads:&lt;br /&gt;
[[File:Eqp_1.png|none|x26px|caption]] &lt;br /&gt;
As a first step we want to evaluate the self energy Σ entering in the quasiparticle equation. In the GW approach the self-energy can be separated into two components: a static term called the exchange self-energy (Σx), and a dynamical term (energy dependent) called the correlation self-energy (Σc):&lt;br /&gt;
[[File:Sigma.png|none|x25px|caption]]&lt;br /&gt;
We will treat these two terms separately and demonstrate how to set the most important variables for calculating each term.&lt;br /&gt;
In practice we will compute  the quasi-particle corrections to the one particle Kohn-Sham eigenvalues obtained through a DFT calculation. &lt;br /&gt;
&lt;br /&gt;
The steps are the following:&lt;br /&gt;
&lt;br /&gt;
==Step 1: The Exchange Self Energy or HF quasi-particle correction==&lt;br /&gt;
&lt;br /&gt;
We start by evaluating the exchange Self-Energy and the corresponding Quasiparticle energies (Hartree-Fock energies). &lt;br /&gt;
Follow the module on &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; and then return to this tutorial &#039;&#039;How to obtain the quasiparticle band structure of a bulk material: h-BN&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Step 2: The Correlation Self-Energy and Quasiparticle Energies==&lt;br /&gt;
Once we have calculated the exchange part, we next turn our attention to the more demanding dynamical part. The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]] &lt;br /&gt;
In the expression for the correlation self energy, we have (1) a summation over bands, (2) an integral over the Brillouin Zone, and (3) a sum over the G vectors. In contrast with the case of Σx, the summation over bands extends over &#039;&#039;all&#039;&#039; bands (including the unoccupied ones), and so convergence tests are needed. Another important difference is that the Coulomb interaction is now screened so a fundamental ingredient is the evaluation of the dynamical dielectric matrix. The expression for the dielectric matrix, calculated at the RPA level and including local field effects, has been already treated in the [[Local fields|Local fields]] tutorial.&lt;br /&gt;
&lt;br /&gt;
In the following, we will see two ways to take into account the dynamical effects. First, we will see how to set the proper parameters to obtain a model dielectric function based on a widely used approximation, which models the energy dependence of each component of the dielectric matrix with a single pole function. &lt;br /&gt;
Secondly, we will see how to perform calculations by evaluating the dielectric matrix on a regular grid of frequencies. &lt;br /&gt;
&lt;br /&gt;
Once the correlation part of the self-energy is calculated, we will check the convergence of the different parameters with respect to some final quantity, such as the gap. &lt;br /&gt;
&lt;br /&gt;
After computing the frequency dependent self-energy, we will discover that in order to solve the quasiparticle equation we will need to know its value &#039;&#039;at the value of the quasiparticle itself&#039;&#039;. In the following, unless explicitly stated, we will solve the non-linear quasi-particle equation at first order, by expanding the self-energy around the Kohn-Sham eigenvalue. In this way the quasiparticle equation reads:&lt;br /&gt;
&lt;br /&gt;
[[File:Eqp_2.png|none|x26px|caption]] &lt;br /&gt;
&lt;br /&gt;
where the normalization factor Z is defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:z_fac.png|none|x40px|caption]] &lt;br /&gt;
&lt;br /&gt;
===The Plasmon Pole approximation===&lt;br /&gt;
As stated above, the basic idea of the plasmon-pole approximation is to approximate the frequency dependence of the dielectric matrix with a single pole function of the form:&lt;br /&gt;
[[File:ppa.png|none|x26px|caption]]&lt;br /&gt;
The two parameters R&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; and Ω&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; are obtained by a fit (for each component), after having calculated the RPA dielectric matrix at two given frequencies.&lt;br /&gt;
Yambo calculates the dielectric matrix in the static limit ( ω=0) and at a user defined frequency called the plasmon-pole frequency (ω=iωp). &lt;br /&gt;
Such an approximation has the big computational advantage of calculating the dielectric matrix for only two frequencies and leads to an analytical expression for the frequency integral of the correlation self-energy.&lt;br /&gt;
==== Input file generation ====&lt;br /&gt;
Let&#039;s start by building up the input file for a GW/PPA calculation, including the calculation of the exchange self-energy. From &amp;lt;code&amp;gt;yambo -H&amp;lt;/code&amp;gt; you should understand that the correct option is &amp;lt;code&amp;gt;yambo -x -p p -g n&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 $ cd YAMBO_TUTORIALS/hBN/YAMBO&lt;br /&gt;
 $ yambo -x -p p -g n -F gw_ppa.in&lt;br /&gt;
&lt;br /&gt;
Let&#039;s modify the input file in the following way: &lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]] = 40         Ry    # [XX] Exchange RL components&lt;br /&gt;
 [[Variables#VXCRLvcs|VXCRLvcs]] = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]]= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#PPAPntXp|PPAPntXp]] = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %[[Variables#GbndRnge|GbndRnge]]&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %[[Variables#QPkrange|QPkrange]]        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Brief explanation of some settings:&lt;br /&gt;
* Similar to the Hartree Fock study, we will concentrate on the convergence of the &#039;&#039;&#039;direct&#039;&#039;&#039; gap of the system. Hence we select the last occupied (8) and first unoccupied (9) bands for k-point number 7 in the &amp;lt;code&amp;gt;[[Variables#QPkrange|QPkrange]]&amp;lt;/code&amp;gt; variable. &lt;br /&gt;
* We also keep &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; at its converged value of 40 Ry as obtained in the &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; tutorial.&lt;br /&gt;
* For the moment we keep fixed the plasmon pole energy &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; at its default value (=1 Hartree).&lt;br /&gt;
* We keep fixed the direction of the electric field for the evaluation of the dielectric matrix to a non-specific value: &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;=(1,1,1).&lt;br /&gt;
* Later we will study convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;; for now just set them to the values indicated.&lt;br /&gt;
&lt;br /&gt;
==== Understanding the output ====&lt;br /&gt;
Let&#039;s look at the typical Yambo output. Run Yambo with an appropriate &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flag:&lt;br /&gt;
   &lt;br /&gt;
 $ yambo -F gw_ppa.in -J 10b_1Ry&lt;br /&gt;
&lt;br /&gt;
In the standard output you can recognise the different steps of the calculations: calculation of the screening matrix (evaluation of the non interacting and interacting response), calculation of the exchange self-energy, and finally the calculation of the correlation self-energy and quasiparticle energies. Moreover information on memory usage and execution time are reported: &lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;---&amp;gt; [05] Dynamic Dielectric Matrix (PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;08s&amp;gt; Xo@q[3] |########################################| [100%] 03s(E) 03s(X)&lt;br /&gt;
 &amp;lt;08s&amp;gt; X@q[3] |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [06] Bare local and non-local Exchange-Correlation&lt;br /&gt;
 &amp;lt;43s&amp;gt; EXS |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07] Dyson equation: Newton solver&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07.01] G0W0 (W PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; G0W0 (W PPA) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; [07.02] QP properties and I/O&lt;br /&gt;
 &amp;lt;45s&amp;gt; [08] Game Over &amp;amp; Game summary&lt;br /&gt;
&lt;br /&gt;
Let&#039;s have a look at the report and output. The output file &#039;&#039;o-10b_1Ry.qp&#039;&#039; contains (for each band and k-point that we indicated in the input file) the values of the bare KS eigenvalue, its GW correction and the correlation part of the self energy:&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
  7.000000   8.000000  -0.411876  -0.567723   2.322443&lt;br /&gt;
  7.000000   9.000000   3.877976   2.413773  -2.232241&lt;br /&gt;
&lt;br /&gt;
In the header you can see the details of the calculations, for instance it reports that &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=1 Ry corresponds to 5 Gvectors: &lt;br /&gt;
&lt;br /&gt;
 #  X G`s            [used]:  5&lt;br /&gt;
&lt;br /&gt;
Other information can be found in the report file &#039;&#039;r-10b_1Ry_em1d_ppa_HF_and_locXC_gw0&#039;&#039;, such as the renormalization factor defined above, the value of the &#039;&#039;exchange&#039;&#039; self-energy (non-local XC) and of the DFT exchange-correlation potential (local XC): &lt;br /&gt;
&lt;br /&gt;
 [07.02] QP properties and I/O&lt;br /&gt;
  =============================&lt;br /&gt;
  Legend (energies in eV):&lt;br /&gt;
  - B  : Band       - Eo  : bare energy&lt;br /&gt;
  - E  : QP energy  - Z   : Renormalization factor&lt;br /&gt;
  - So : Sc(Eo)     - S   : Sc(E)&lt;br /&gt;
  - dSp: Sc derivative precision&lt;br /&gt;
  - lXC: Starting Local XC (DFT)&lt;br /&gt;
  -nlXC: Starting non-Local XC (HF)&lt;br /&gt;
  QP [eV] @ K [7] (iku): 0.000000 -0.500000  0.000000&lt;br /&gt;
   B=8 Eo= -0.41 E= -0.98 E-Eo= -0.56 Re(Z)=0.81 Im(Z)=-.2368E-2 nlXC=-19.13 lXC=-16.11 So= 2.322&lt;br /&gt;
   B=9 Eo=  3.88 E=  6.29 E-Eo=  2.41 Re(Z)=0.83 Im(Z)=-.2016E-2 nlXC=-5.536 lXC=-10.67 So=-2.232&lt;br /&gt;
&lt;br /&gt;
Extended information can be also found in the output activating in the input the &amp;lt;code&amp;gt;[[Variables#ExtendOut|ExtendOut]]&amp;lt;/code&amp;gt; flag. This is an optional flag that can be activated by adding the &amp;lt;code&amp;gt;-V qp&amp;lt;/code&amp;gt; verbosity option when building the input file. The plasmon pole screening, exchange self-energy and the quasiparticle energies are also saved in databases so that they can be reused in further runs:&lt;br /&gt;
&lt;br /&gt;
 $ ls ./10b_1Ry&lt;br /&gt;
 ndb.pp ndb.pp_fragment_1 ... ndb.HF_and_locXC ndb.QP&lt;br /&gt;
&lt;br /&gt;
===Convergence tests for a quasi particle calculation===&lt;br /&gt;
&lt;br /&gt;
Now we can check the convergence of the different variables entering in the expression of the correlation part of the self energy.&amp;lt;br&amp;gt; &lt;br /&gt;
First, we focus on the parameter governing the &#039;&#039;screening matrix&#039;&#039; you have already seen in the [[RPA/IP]] section. In contrast to the calculation of the [[RPA/IP]] dielectric function, where you considered either the optical limit or a finite q response (EELS), here the dielectric matrix will be calculated for &#039;&#039;all&#039;&#039; q-points determined by the choice of k-point sampling.&lt;br /&gt;
 &lt;br /&gt;
The parameters that need to be converged can be understood by looking at expression of the dielectric matrix:&lt;br /&gt;
[[File:Yambo-CH5.png|none|x30px|Yambo tutorial image]]&lt;br /&gt;
where &#039;&#039;&amp;amp;chi;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&#039;&#039; is given by&lt;br /&gt;
[[File:Dyson_rpa.png|none|x40px|Yambo tutorial image]]&lt;br /&gt;
and  &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; is given by&lt;br /&gt;
[[File:ChiO.png|none|x45px|Yambo tutorial image]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; : The dimension of the microscopic inverse matrix, related to [[Local fields]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; : The sum on bands (c,v) in the independent particle &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Converging Screening Parameters====&lt;br /&gt;
Here we will check the convergence of the gap starting from the variables controlling the screening reported above: the bands employed to build the RPA response function &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and the number of blocks (G,G&#039;) of the dielectric matrix ε&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;G,G&#039;&amp;lt;/sub&amp;gt;  &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;. &lt;br /&gt;
In the next section we will study convergence with respect to the sum over states summation (sum over &#039;&#039;m&#039;&#039; in the Σ&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; expression); here let&#039;s fix &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to a reasonable value (40 Ry). &lt;br /&gt;
&lt;br /&gt;
Let&#039;s build a series of input files differing by the values of bands and block sizes in &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; considering &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in the range 10-50 (upper limit) and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; in the range 1 to 5 Ry. To do this by hand, file by file, open the &#039;&#039;gw_ppa.in&#039;&#039; file in an editor and change to:&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]] = &#039;&#039;&#039;2 Ry&#039;&#039;&#039;&lt;br /&gt;
while leaving the rest untouched. Repeat for 3 Ry, 4 Ry etc. Next, for each &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; change to:&lt;br /&gt;
 % [[Variables#BndsRnXp|BndsRnXp]]&lt;br /&gt;
   1 | 20 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
and repeat for 30, 40 and so on. Give a &#039;&#039;&#039;different name&#039;&#039;&#039; to each file: &#039;&#039;gw_ppa_Xb_YRy.in&#039;&#039; with X=10,20,30,40 and Y=1,2,3,4,5 Ry.&lt;br /&gt;
&lt;br /&gt;
This is obviously quite tedious. However, you can automate both the input construction and code execution using bash or python scripts (indeed later you will learn how to use the the yambo-python [http://www.yambo-code.org/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)]tool for this task). For now, you can use the simple [[bash_scripts|generate_inputs_1.sh]] bash script to generate the required input files (after copying the script you need to type &amp;lt;code&amp;gt;$ chmod +x name_of_the_script.sh &amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Finally launch the calculations:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_10b_1Ry.in -J 10b_1Ry&lt;br /&gt;
 $ yambo -F gw_ppa_10b_2Ry.in -J 10b_2Ry&lt;br /&gt;
 ...&lt;br /&gt;
 $ yambo -F gw_ppa_40b_5Ry.in -J 40b_5Ry&lt;br /&gt;
&lt;br /&gt;
Once the jobs are terminated we can collect the quasiparticle energies for fixed &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in different files named e.g. &#039;&#039;10b.dat, 20b.dat&#039;&#039; etc. for plotting, by putting in separate columns: the energy cutoff; the size of the G blocks; the quasiparticle energy of the valence band; and that of the conduction band.&lt;br /&gt;
To do this e.g. for the &#039;&#039;10b.dat&#039;&#039; file you can type:&lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;8.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
to parse the valence band quasiparticle energies  and &lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;9.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
for the conduction band; and put all the data in the &#039;&#039;10b.dat&#039;&#039; files. As there are many files to process you can use the [[bash_scripts|parse_qps.sh]] script to create the &#039;&#039;10b.dat&#039;&#039; file and edit the script changing the number of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; for the other output files. &lt;br /&gt;
&lt;br /&gt;
Once we have collected all the quasiparticle values we can plot the gap, or the valence and conduction band energies separately, as a function of the block size or energy cutoff:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:3 w lp t &amp;quot; Valence BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:3 w lp t &amp;quot;Valence BndsRnXp=20&amp;quot;,.. &lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:4 w lp t &amp;quot; Conduction BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:4 w lp t &amp;quot;Conduction BndsRnXp=20&amp;quot;,..&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot; Gap BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot;gap BndsRnXp=20&amp;quot;,..  &lt;br /&gt;
or both using e.g. the [[gnuplot_scripts|ppa_gap.gnu]] gnuplot script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=1 caption=&amp;quot;Quasiparticle energies with respect screening parameters&amp;quot;&amp;gt;&lt;br /&gt;
File:ppa2.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:ppa3.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ppa1.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Looking at the plot we can see that:&lt;br /&gt;
* The two parameters are not totally independent (see e.g. the valence quasiparticle convergence) and this is the reason why we converged them simultaneously &lt;br /&gt;
* The gap (energy difference) converge faster than single quasiparticle state&lt;br /&gt;
* The convergence criteria depends on the degree of accuracy we look for, but considering the approximations behind the calculations (plasmon-pole etc.), it is not always a good idea to enforce too strict a criteria.  &lt;br /&gt;
* Even if not totally converged we can consider that the upper limit of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;=30, and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=3Ry are reasonable parameters.&lt;br /&gt;
&lt;br /&gt;
Finally notice that in the last versions of Yambo 4.5 etc. there is a terminator for the dielectric constant that accelerates convergence on the number of bands,&lt;br /&gt;
you can active it with the &amp;lt;code&amp;gt;-V resp&amp;lt;/code&amp;gt; verbosity and setting &amp;lt;code&amp;gt;XTermKind= &amp;quot;BG&amp;quot;&amp;lt;/code&amp;gt;. You can compare the converge of the dielectric constant with and without terminator,&lt;br /&gt;
similar to what happens for the self-energy, see next section.&lt;br /&gt;
&lt;br /&gt;
====Converging the sum over states in the correlation self-energy====&lt;br /&gt;
From now on we will keep fixed these parameters and will perform a convergence study on the sum over state summation in the correlation self-energy (Σc) &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In order to use the screening previously calculated we can copy the plasmon pole parameters saved in the &amp;lt;code&amp;gt;30b_3Ry&amp;lt;/code&amp;gt; directory in the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory. In this way the screening will be read by Yambo and not calculated again:&lt;br /&gt;
&lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./SAVE/.&lt;br /&gt;
&lt;br /&gt;
(Note: you may have to delete these files before running the BSE tutorials)&lt;br /&gt;
&lt;br /&gt;
In order to use the databases we have to be sure to have the same plasmon-pole parameters in our input files.&lt;br /&gt;
Edit &#039;&#039;gw_ppa_30b_3Ry.in&#039;&#039; and modify &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to order to have a number of bands in the range from 10 to 80 inside different files named &#039;&#039;gw_ppa_Gbnd10.in&#039;&#039;, &#039;&#039;gw_ppa_Gbnd20.in&#039;&#039; etc. You can also run the the [[bash_scripts|generate_inputs_2.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next, launch yambo for each input:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and as done before we can inspect the obtained quasiparticle energies: &lt;br /&gt;
&lt;br /&gt;
 $ grep 8.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
for the valence bands, and &lt;br /&gt;
 $ grep 9.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
for the conduction band.&lt;br /&gt;
&lt;br /&gt;
Collect the results in a text file &#039;&#039;Gbnd_conv.dat&#039;&#039; containing: the number of Gbnd, the valence energy, and the conduction energy.&lt;br /&gt;
Now, as done before we can plot the valence and conduction quasiparticle levels separately as well as the gap, as a function of the number of bands used in the summation:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2 w lp lt 7  t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3 w lp lt 7  t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2) w lp lt 7  t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Quasiparticle energies with respect sum over states in correlation self-energy&amp;quot;&amp;gt;&lt;br /&gt;
File:Gbnd_val.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:Gbnd_cond.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Gbnd_gap.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Inspecting the plot we can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is rather slow and many bands are needed to get converged results.&lt;br /&gt;
* As observed above the gap (energy difference) converges faster than the single quasiparticle state energies.&lt;br /&gt;
&lt;br /&gt;
====Accelerating the sum over states convergence in the correlation self-energy====&lt;br /&gt;
In general the convergence with respect the sum over states can be very cumbersome. Here we show how it can be mitigated by using &lt;br /&gt;
a technique developed by F. Bruneval and X. Gonze &amp;lt;ref name=&amp;quot;BG&amp;quot;&amp;gt; F. Bruneval and X. Gonze, Physical Review B 78, 085125  (2008 )&amp;lt;/ref&amp;gt;. The basic idea relies in replacing the eigenenergies of the states that are not treated explicitly by a common energy, and take into account all the states, which are not explicitly included in the calculation through the closure relation.&lt;br /&gt;
To apply this technique in Yambo we need to activate the optional terminator variable [[Variables#GTermKind|GTermKind]]. We can activate it by adding the quasiparticle verbosity to the command line when generating the input file:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -p p -g n -F gw_ppa_Gbnd10.in -V qp&lt;br /&gt;
&lt;br /&gt;
and you can edit the input file by setting:&lt;br /&gt;
 &lt;br /&gt;
 [[Variables#GTermKind|GTermKind]]= &amp;quot;BG&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or simply you can add by hand this line in all the other &#039;&#039;gw_ppa_GbndX.in&#039;&#039; input files.&lt;br /&gt;
Now we can repeat the same calculations &lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10_term&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20_term&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and collect the new results:&lt;br /&gt;
&lt;br /&gt;
 $ grep 8.000 *term.qp  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
 $ grep 9.000 *term.qp  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
&lt;br /&gt;
in a new file called &#039;&#039;Gbnd_conv_terminator.dat&#039;&#039;. Now we can plot the same quantities as before by looking at the effect of having introduced the terminator. &lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:2 w lp t &amp;quot;Valence with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:3 w lp t &amp;quot;Conduction with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:($3-$2) w lp t &amp;quot;Gap with terminator&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Effect of the terminator in convergence of QP energies with respect sum over states&amp;quot;&amp;gt;&lt;br /&gt;
File:val_t.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique &amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
File:cond_t.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:gap_t.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is accelerated in particular for the single quasiparticle states.&lt;br /&gt;
* From the plot above we can see that &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;=40 is sufficient to have a converged gap&lt;br /&gt;
&lt;br /&gt;
===Beyond the plasmon pole approximation: a full frequency approach - real axis integration===&lt;br /&gt;
All the calculations performed up to now were based on the plasmon pole approximation (PPA). Now we remove this approximation by evaluating numerically the frequency integral in the expression of the correlation self-energy (Σc). To this aim we need to evaluate the screening for a number of frequencies in the interval depending on the electron-hole energy difference (energy difference between empty and occupied states) entering in the sum over states. &lt;br /&gt;
Let&#039;s build the input file for a full frequency calculation by simply typing:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff.in -g n &lt;br /&gt;
&lt;br /&gt;
and we can set the variable studied up to now at their converged value:&lt;br /&gt;
&lt;br /&gt;
 %[[Variables#BndsRnXd|BndsRnXd]]&lt;br /&gt;
 1 | 30 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXd|NGsBlkXd]]=3 Ry&lt;br /&gt;
 %[[Variables#GbndRange|GbndRange]]&lt;br /&gt;
 1 | 40 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]=40 Ry&lt;br /&gt;
 % [[Variables#LongDrXd|LongDrXd]] &lt;br /&gt;
 1.000000 | 1.000000 | 1.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 %QPkrange                      # # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and next vary in different files (name them &#039;&#039;gw_ff10.in&#039;&#039; etc.) the number of frequencies we evaluate for the screened coulomb potential. This is done by setting the values of [[Variables#ETStpsXd|ETStpsXd]]=10 , 50 , 100, 150, 200, 250. &lt;br /&gt;
You can also run the the [[bash_scripts|generate_inputs_3.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next launch yambo:&lt;br /&gt;
 $ yambo -F gw_ff10.in -J ff10&lt;br /&gt;
 $ yambo -F gw_ff50.in -J ff50&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Clearly as we are evaluating the screening for a large number of frequencies these calculations will be heavier than the case above where the calculation of the screening was done for only two frequencies  (zero and plasmon-pole). &lt;br /&gt;
As before, collect the valence and conduction bands as a function of the number of frequencies in a file called &#039;&#039;gw_ff.dat&#039;&#039; and plot the behaviour of the conduction and valence bands and the gap.&lt;br /&gt;
 &lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Real axis integration, convergences with respect the used number of frequencies&amp;quot;&amp;gt;&lt;br /&gt;
File:ff_v.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt;&lt;br /&gt;
File:ff_c.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ff_g.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
&lt;br /&gt;
* Oscillations are still present, indicating that even more frequencies have to be considered. In general, a real-axis calculation is very demanding. &lt;br /&gt;
* The final result of the gap obtained up to now does not differ too much from the one obtained at the plasmon-pole level (~50 meV)&lt;br /&gt;
&lt;br /&gt;
===Secant Solver===&lt;br /&gt;
&lt;br /&gt;
The real axis integration permits also to go beyond the linear expansion to solve the quasi particle equation. &lt;br /&gt;
The QP equation is a non-linear equation whose solution must be found using a suitable numerical algorithm. &lt;br /&gt;
[[File:Eqp_sec.png|none|x22px|caption]] &lt;br /&gt;
The mostly used, based on the linearization of the self-energy operator is the Newton method that is the one we have used up to now. &lt;br /&gt;
Yambo can also perform a search of the QP energies using a non-linear iterative method based on the [https://en.wikipedia.org/wiki/Secant_method Secant iterative Method].&lt;br /&gt;
&lt;br /&gt;
In numerical analysis, the secant method is a root-finding algorithm that uses a succession of roots of secant lines to better approximate a root of a function &#039;&#039;f&#039;&#039;. The secant method can be thought of as a finite difference approximation of Newton&#039;s method. &lt;br /&gt;
The equation that defines the secant method is: &lt;br /&gt;
&lt;br /&gt;
[[File:secant_eq.png|none|x35px|caption]] &lt;br /&gt;
&lt;br /&gt;
The first two iterations of the secant method are shown in the following picture. The red curve shows the function f and the blue lines are the secants.&lt;br /&gt;
&lt;br /&gt;
[[File:Secant_method.png|center|250px|caption]] &lt;br /&gt;
&lt;br /&gt;
To see if there is any non-linear effect in the solution of the Dyson equation we compare the result of the calculation using the Newton solver as done before with the present case. &lt;br /&gt;
In order to use the secant method you need to edit one of the the previous &#039;&#039;gw_ffN.in&#039;&#039; files e.g. &#039;&#039;gw_ff100.in&#039;&#039; and substitute:&lt;br /&gt;
&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;&lt;br /&gt;
to &lt;br /&gt;
 DysSolver= &amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Repeat the calculations in the same way as before:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff100.in -J ff100&lt;br /&gt;
&lt;br /&gt;
Note than now the screening will &#039;&#039;not&#039;&#039; be calculated again as it has been stored in the &#039;&#039;ffN&#039;&#039; directories as can be seen in the report file:&lt;br /&gt;
&lt;br /&gt;
 [05] Dynamical Dielectric Matrix&lt;br /&gt;
 ================================&lt;br /&gt;
 [RD./ff10//ndb.em1d]----&lt;br /&gt;
 ...&lt;br /&gt;
 [RD./ff10//ndb.em1d_fragment_1]--------------&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Comparing the output files, e.g. for the case with 100 freqs:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp&#039;&#039;  &#039;&#039;&#039;Newton Solver:&#039;&#039;&#039;&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08708      2.91254 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.421968    -3.417357 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp_01&#039;&#039; &#039;&#039;&#039;Secant Solver:&#039;&#039;&#039;&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08715      2.93518 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.401408    -3.731649 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
From the comparison, we see that the effect is of the order of 20 meV, of the same order of magnitude of the accuracy of the GW calculations.&lt;br /&gt;
&lt;br /&gt;
==Step 3: Interpolating Band Structures==&lt;br /&gt;
Up to now we have checked convergence for the gap. Now we want to calculate the quasiparticle corrections across the Brillouin zone in order to visualize the entire band structure along a path connecting high symmetry points.&lt;br /&gt;
&lt;br /&gt;
To do that we start by calculating the QP correction in the plasmon-pole approximation for all the k points of our sampling and for a number of bands around the gap. You can use a previous input file or generate a new one: &amp;lt;code&amp;gt; yambo -F gw_ppa_all_Bz.in -x -p p -g n &amp;lt;/code&amp;gt; and set the parameters found in the previous tests:&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  40        Ry &lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 30 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3            Ry    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp= 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and we calculate it for all the available kpoints by setting:&lt;br /&gt;
 %QPkrange                    # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1| 14|  6|11|&lt;br /&gt;
 %&lt;br /&gt;
 &lt;br /&gt;
Note that as we have already calculated the screening with these parameters you can save time and use that database either by running in the previous directory by using &amp;lt;code&amp;gt; -J 30b_3Ry &amp;lt;/code&amp;gt; or if you prefer to put the new databases in the new all_Bz directory you can create a new directory and copy there the screening databases:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir all_Bz &lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./all_Bz/&lt;br /&gt;
&lt;br /&gt;
and launch the calculation:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_all_Bz.in -J all_Bz&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the output and see that it contains the correction for all the k points for the bands we asked:&lt;br /&gt;
&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
    1.000000     6.000000    -1.299712    -0.219100     3.788044&lt;br /&gt;
    1.000000     7.000000    -1.296430    -0.241496     3.788092&lt;br /&gt;
    1.000000     8.000000    -1.296420    -0.243115     3.785947&lt;br /&gt;
    1.000000     9.000000     4.832399     0.952386    -3.679259&lt;br /&gt;
    1.00000     10.00000     10.76416      2.09915     -4.38743&lt;br /&gt;
    1.00000     11.00000     11.36167      2.48053     -3.91021&lt;br /&gt;
....&lt;br /&gt;
By plotting some of the &#039;o-all_Bz.qp&amp;quot; columns it is possible to discuss some physical properties of the hBN QPs. Using columns 3 and (3+4), ie plotting the GW energies with respect to the LDA energies we can deduce the band gap renormalization and the stretching of the conduction/valence bands:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-all_Bz.qp&amp;quot; u 3:($3+$4) w p  t &amp;quot;Eqp vs Elda&amp;quot; &lt;br /&gt;
&lt;br /&gt;
[[File:EqpvE0.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
Essentially we can see that the effect of the GW self-energy is the opening of the gap and a linear stretching of the conduction/valence bands that can be estimated by performing a linear fit of the positive and negative energies (the zero is set at top of the valence band). &lt;br /&gt;
&lt;br /&gt;
In order to calculate the band structure, however, we need to interpolate the values we have calculated above on a given path. In Yambo the interpolation is done by the executable &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; (Yambo Post Processing).&lt;br /&gt;
By typing: &lt;br /&gt;
 $ ypp -H  &lt;br /&gt;
you will recognize that in order to interpolate the bands we need to build a ypp input file using&lt;br /&gt;
 $ ypp -s b&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Before editing the &#039;&#039;ypp.in&#039;&#039; input file and running the interpolation, it is important to know that &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; uses an algorithm &amp;lt;ref&amp;gt; Warren E. Pickett, Henry Krakauer, and Philip B. Allen Phys. Rev. B 38, 2721 &amp;lt;/ref&amp;gt;  that cannot be used in presence of time-reversal (TR) symmetry. &lt;br /&gt;
As a first step we therefore remove the TR symmetry by typing:&lt;br /&gt;
&lt;br /&gt;
 $ ypp -y&lt;br /&gt;
&lt;br /&gt;
and we uncomment the corresponding line to remove the TR.&lt;br /&gt;
&lt;br /&gt;
 fixsyms                      # [R] Reduce Symmetries&lt;br /&gt;
 #RmAllSymm                   # Remove all symmetries&lt;br /&gt;
 #RmTimeRev                   # Remove Time Reversal&lt;br /&gt;
&lt;br /&gt;
and launch&lt;br /&gt;
 &lt;br /&gt;
 $ ypp&lt;br /&gt;
&lt;br /&gt;
This will create a new directory called &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; where a &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory containing the electronic structure in the absence of TR is present. &lt;br /&gt;
We will calculate the band structure in the &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
 $ cd FixSymmm&lt;br /&gt;
&lt;br /&gt;
After having performed the usual setup&lt;br /&gt;
&lt;br /&gt;
 $yambo&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
we can generate the input for the band interpolation:&lt;br /&gt;
&lt;br /&gt;
 $ypp -s b -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
and edit the &#039;&#039;ypp_bands.in&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 electrons                    # [R] Electrons (and holes)&lt;br /&gt;
 bnds                         # [R] Bands&lt;br /&gt;
 INTERP_mode= &amp;quot;NN&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach) &lt;br /&gt;
 OutputAlat= 4.716000           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;     &lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   1 | 100 |                   # Number of bands&lt;br /&gt;
 %&lt;br /&gt;
 % INTERP_Grid&lt;br /&gt;
 -1 |-1 |-1 |                             # Interpolation BZ Grid&lt;br /&gt;
 %&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 CIRCUIT_E_DB_path= &amp;quot;none&amp;quot;      # SAVE obtained from the QE `bands` run (alternative to %BANDS_kpts)&lt;br /&gt;
 BANDS_path= &amp;quot;&amp;quot;                 # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 10  &lt;br /&gt;
 #BANDS_built_in                # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts   &lt;br /&gt;
 % &lt;br /&gt;
&lt;br /&gt;
We modify the following lines:&lt;br /&gt;
 BANDS_steps=30&lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   6 | 11 |                   # Number of bands &lt;br /&gt;
 %&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.00000 |0.00000 |0.00000 |&lt;br /&gt;
  0.50000 |-.50000 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.50000 |&lt;br /&gt;
  0.00000 |0.00000 |0.50000 |&lt;br /&gt;
  0.50000 |-.50000 |0.50000 |&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
which means we assign 30 points in each segment, we ask to interpolate 3 occupied and 3 empty bands and we assign the following path passing from the high symmetry points: K Γ M K H A L.&lt;br /&gt;
Launching:&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
will produce the output file &#039;&#039;o.bands_interpolated&#039;&#039; containing:&lt;br /&gt;
&lt;br /&gt;
                 &lt;br /&gt;
 #&lt;br /&gt;
 #   |k|        b6         b7         b8         b9         b10        b11        kx         ky         kz&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
     0.00000   -7.22092   -0.13402   -0.13395    4.67691    4.67694   10.08905    0.33300   -0.66667    0.00000&lt;br /&gt;
     0.03725   -7.18857   -0.17190   -0.12684    4.66126    4.71050   10.12529    0.32190   -0.64445    0.00000&lt;br /&gt;
...&lt;br /&gt;
 &lt;br /&gt;
and we can plot the bands using gnuplot:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o.bands_interpolated&amp;quot; u 0:2 w l, &amp;quot;o.bands_interpolated&amp;quot; u 0:3 w l, ...&lt;br /&gt;
&lt;br /&gt;
[[File:bands_lda.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
and you can recognize the index of the high symmetry point by inspecting the last three columns.&lt;br /&gt;
Note that up to now we have interpolated the LDA band structure. In order to plot the GW band structure, we need to tell &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; in the input file where the &#039;&#039;ndb.QP&#039;&#039; database is found. This is achieved by adding in the &#039;&#039;ypp_bands.in&#039;&#039; file the line:&lt;br /&gt;
&lt;br /&gt;
  GfnQPdb= &amp;quot;E &amp;lt; ./all_Bz/ndb.QP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and relaunch &lt;br /&gt;
&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
Now the file &#039;&#039;o.bands_interpolated_01&#039;&#039; contains the GW interpolated band structure. We can plot the LDA and GW band structure together by using the gnuplot script [[gnuplot_scripts|bands.gnu]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines  widths=500px heights=500px  perrow=2 caption=&amp;quot;Band strcuture of bulk hBN&amp;quot;&amp;gt;&lt;br /&gt;
File:hBN_bands.png| LDA and GW bands structure &lt;br /&gt;
File:hBN_bands_lit.png| LDA and GW bands structure from Ref. &amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*As expected the effect of the GW correction is to open the gap.&lt;br /&gt;
*Comparing the obtained band structure with the one found in the literature by Arnaud and coworkers &amp;lt;ref name=&amp;quot;Arnaud&amp;quot;&amp;gt; B. Arnaud, S. Lebegue,P. Rabiller, and M. Alouani Phys, Rev. Lett. 96, 026402 (2006)&amp;lt;/ref&amp;gt; we found a very nice qualitative agreement. &lt;br /&gt;
*Quantitatively we found a smaller gap: about 5.2 eV (indirect gap), 5.7 eV (direct gap) while in Ref.&amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt;  is found  5.95 eV for the indirect gap and a minimum direct band gap of 6.47 eV. Other values are also reported in the literature depending on the used pseudopotentials, starting functional and type of self-consistency (see below). &lt;br /&gt;
*The present tutorial has been done with a small k point grid which is an important parameter to be checked, so convergence with respect the k point sampling has to be validated.&lt;br /&gt;
&lt;br /&gt;
==Step 4: Summary of the convergence parameters==&lt;br /&gt;
We have calculated the band structure of hBN starting from a DFT calculation, here we summarize the main variable we have checked to achieve convergence:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; # [XX] Exchange RL components&lt;br /&gt;
Number of G-vectors in the exchange. This number should be checked carefully. Generally a large number is needed as the QP energies show a slow convergence. The calcualtion of the exchange part is rather fast. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; #[Xp] Polarization function bands&lt;br /&gt;
Number of bands in the independent response function form which the dielectric matrix is calculated. Also this paramater has to be checked carefully,together with NGsBlkXp as the two variables are interconnected&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;  # [Xp] Response block size&lt;br /&gt;
Number of G-vectors block in the dielectric constant. Also this paramater has to be checked carefully, to be checked together with BndsRnXp. A large number of bands and block can make the calculation very demanding.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]] &amp;lt;/code&amp;gt; # [Xp] [cc] Electric Field&lt;br /&gt;
Direction of the electric field for the calculation of the q=0 component of the dielectric constant e(q,w). In a bulk can be set to (1,1,1), attention must be paid for non 3D systems.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]] &amp;lt;/code&amp;gt; # [Xp] Plasmon pole imaginary energy: this is the second frequency used to fit the Godby-Needs plasmon-pole model (PPM). If results depend consistently by changing this frequency, the PPM is not adequate for your calculation and it is need to gp beyond that, e.g. Real-axis. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]] &amp;lt;/code&amp;gt; # [GW] G[W] bands range&lt;br /&gt;
Number of bands used to expand the Green&#039;s function. This number is usually larger than the number of bands used to calculated the dielectricconstant. Single quasiparticle energies converge slowly with respect GbndRnge, energy difference behave better. You can use terminator technique to mitigate the slow dependence. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GDamping|GDamping]] &amp;lt;/code&amp;gt; # [GW] G[W] damping&lt;br /&gt;
Small damping in the Green&#039;s function definition, the delta &lt;br /&gt;
parameter. The final result shouuld not depend on that, usually set at 0.1 eV&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#dScStep|dScStep]] &amp;lt;/code&amp;gt; # [GW] &lt;br /&gt;
Energy step to evaluate Z factors&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#DysSolver|DysSolver]] &amp;lt;/code&amp;gt; # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
Parameters related to the  solution of the Dyson equation, &amp;quot;n&amp;quot; Newton linearization, &#039;s&#039; non linear secant method&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GTermKind|GTermKind]] &amp;lt;/code&amp;gt; [GW] GW terminator &lt;br /&gt;
Terminator for the self-energy&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt; . We have seen how this spped up the convergence with respect empty bands.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#%QPkrange |QPkrange ]] &amp;lt;/code&amp;gt; # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
K-points and band range where you want to calculate the GW correction. The syntax is&lt;br /&gt;
first kpoint | last kpoint | first band | last band&lt;br /&gt;
&lt;br /&gt;
==Step 5: Eigenvalue only self-consistent evGW0 and evGW (only available in Yambo 4.6) ==&lt;br /&gt;
Here we want to see how we can compute an eigenvalue only evGW0 or evGW correction in Yambo. In the new version of Yambo there are two flags for these kind of self-consistency: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWoIter]]&amp;lt;/code&amp;gt;  number of GW0 iterations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWIter]]&amp;lt;/code&amp;gt;  number of GW iterations&lt;br /&gt;
&lt;br /&gt;
you can set one of them to 10 for example, the code will stop when convergence is reached, usually in less than 5 iterations.&lt;br /&gt;
For example if you consider the input file below:&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 % &lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GWoIter=0                    # [GW] GWo self-consistent (evGWo) iterations on eigenvalues&lt;br /&gt;
 GWIter =0                    # [GW] GW  self-consistent (evGW)  iterations on eigenvalues&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1|  14|  7|  10|&lt;br /&gt;
 % &lt;br /&gt;
if you set both GWIter and GWoIter to zero you get a gap correction of 4.15 eV.&lt;br /&gt;
If you perform self-consistency on G (GWoIter/=)  &lt;br /&gt;
the gap will be 4.713 eV and finally if you perform &lt;br /&gt;
self-consistency in both G and W (GWIter /=0) the gap will be  5.506 eV.&lt;br /&gt;
&lt;br /&gt;
Notice that these values are absolutelly not converged because we used very few&lt;br /&gt;
bands and a small block size.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note that the final result of the self-consistent GW may&lt;br /&gt;
depend from the number of bands you decide to correct, because they are used&lt;br /&gt;
to reconstruct G and W. For the non-corrected bands Yambo applied a rigid shift&lt;br /&gt;
of their energy based on the closed corrected band.&lt;br /&gt;
&lt;br /&gt;
==Step 6: A better integration of the q=0 point ==&lt;br /&gt;
&lt;br /&gt;
The integration of the q=0 of the Coulomb potential is problematic because the 1/q diverges.&lt;br /&gt;
Usually in Yambo this integration is performed analytically in a small sphere around q=0.&lt;br /&gt;
&lt;br /&gt;
[[File:Circle box.gif|center|frame]]&lt;br /&gt;
&lt;br /&gt;
however in this way the code lost part of the integral out of the circle. This usually &lt;br /&gt;
is not problematic because for a large number of q and k point the missing term goes to zero.&lt;br /&gt;
However in system that requires few k-points or even only the gamma one, it is possible&lt;br /&gt;
to perform a better integration of this term by adding the flag -r to generate the input&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&lt;br /&gt;
&amp;gt; 3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1&amp;lt;/span&amp;gt;            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;) &lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
in this input  &amp;lt;code&amp;gt;[[Variables#RandGvec|RandGvec]]&amp;lt;/code&amp;gt; is the component of the Coulomb potential we want integrate numerically,&lt;br /&gt;
in this case only the first one G=G&#039;=0, and &amp;lt;code&amp;gt;[[Variables#RandQpts|RandQpts]]&amp;lt;/code&amp;gt; is the number of random points&lt;br /&gt;
used to perform the integral by Monte Carlo.&lt;br /&gt;
&lt;br /&gt;
If you turn one this integration you will get a slightly different band gap,&lt;br /&gt;
but in the limit of large k points the final results will be the same of the standard method.&lt;br /&gt;
&lt;br /&gt;
However this correction is important for systems that converge with few k-points or with gamma only.&lt;br /&gt;
&lt;br /&gt;
==Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) ==&lt;br /&gt;
&lt;br /&gt;
Hexagonal Boron Nitride is an anisotropic material so there is the question in which direction&lt;br /&gt;
one shold calculate the dielectric constant the enters in the GW. &lt;br /&gt;
If you run again this tutorial changing the direction of the q=0 point in GW calculation,&lt;br /&gt;
the variable &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;, you will realize that the there gap correction changes.&lt;br /&gt;
In Yambo there is a way to take into account this anisitropy of the dielectri tensor.&lt;br /&gt;
&lt;br /&gt;
First of all you need to calculate the dielectric constant in the three cartesian directions with the command &amp;lt;code&amp;gt; yambo -o c -k hartree&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 optics                         # [R] Linear Response optical properties&lt;br /&gt;
 kernel                         # [R] Kernel&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;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 NGsBlkXd= 3000        mRy      # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
   1 | 1 |                       # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
    1 | 100 |                   # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   0.00000 | 10.00000 | eV      # [Xd] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 1                    # [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;
&lt;br /&gt;
In the output file &amp;lt;code&amp;gt; o.eps_q1_inv_rpa_dyson&amp;lt;/code&amp;gt; you will find the real-part of the zero component of inverse dielectric matrix, in this case 1.0/5.044076 = 0.198252.&lt;br /&gt;
&lt;br /&gt;
Repeat this calculation with the field in the other two directions y and z. The y-direction is equal to x, while in z direction the zero component of the inverse dielectric matrix is 1.0/2.872451 = 0.348134.&lt;br /&gt;
&lt;br /&gt;
Now generate a new input file for the GW, with the command &amp;lt;code&amp;gt; yambo -g n -p p -r -V RL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&amp;gt;3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 % Em1Anys&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.198252 &amp;lt;/span&amp;gt;    | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.198252 &amp;lt;/span&amp;gt;    |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.348134 &amp;lt;/span&amp;gt;  |        # [RIM] X Y Z Static Inverse dielectric matrix&lt;br /&gt;
 %&lt;br /&gt;
 IDEm1Ref= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;  &lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
run the calculations and you will find a correction of the gap intermediate between the one with the field in x and z directions.&lt;br /&gt;
&lt;br /&gt;
==Step 8: Exercise: Convergence with respect K points==&lt;br /&gt;
As an exercise now you can check the convergence with respect the K point sampling:&lt;br /&gt;
# perform a new non-scf calculation with a bigger k point grid: 9x9x3 and 12x12x4 ...&lt;br /&gt;
# convert wave functions and electronic structure to Yambo databases in a different directory as explained in the [[Bulk material: h-BN|DFT and p2y module]], &lt;br /&gt;
# [[initialization |Initialize]] the Yambo databases,&lt;br /&gt;
# Redo the steps explained in this section (exchange self energy, plasmon pole GW, band structure interpolation)&lt;br /&gt;
# The PPA-GW calculation using 12x12x4 grid depending on your machine can take several minutes in serial mode. You can think to perform the exercise after having learned some basic on the parallelization strategy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|style=&amp;quot;width:15%; text-align:left&amp;quot;|Prev: [[Tutorials|Tutorials Home]] &lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center&amp;quot;|Now: [[Tutorials|Tutorials Home]] --&amp;gt; [[How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN|GW]] &lt;br /&gt;
|style=&amp;quot;width:35%; text-align:right&amp;quot;|Next: If you did everything, choose another tutorial in the menu&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3897</id>
		<title>How to obtain the quasi-particle band structure of a bulk material: h-BN</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3897"/>
		<updated>2020-11-19T12:44:58Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to:&lt;br /&gt;
* Calculate quasi-particle corrections in the Hartree-Fock approximation &lt;br /&gt;
* Calculate quasi-particle corrections in the GW approximation &lt;br /&gt;
* Choose the input parameters for a meaningful converged calculation&lt;br /&gt;
* Plot a band structure including quasi-particle corrections&lt;br /&gt;
We will use bulk hBN as an example system. Before starting, you need to obtain the appropriate tarball. See instructions on the [[Tutorials|main tutorials page]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We strongly recommend that you first complete the [[First steps: a walk through from DFT to optical properties]] tutorial.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
At this stage, you should have already completed the following modules:&lt;br /&gt;
* [[Generating the Yambo databases|Generating the Yambo databases]]&lt;br /&gt;
* Step 2 Run [[Initialization]] tutorial&lt;br /&gt;
Now we can start to --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The aim of the present tutorial is to obtain quasiparticle correction to energy levels using many-body perturbation theory (MBPT). &amp;lt;br&amp;gt;&lt;br /&gt;
The general non-linear quasiparticle equation reads:&lt;br /&gt;
[[File:Eqp_1.png|none|x26px|caption]] &lt;br /&gt;
As a first step we want to evaluate the self energy Σ entering in the quasiparticle equation. In the GW approach the self-energy can be separated into two components: a static term called the exchange self-energy (Σx), and a dynamical term (energy dependent) called the correlation self-energy (Σc):&lt;br /&gt;
[[File:Sigma.png|none|x25px|caption]]&lt;br /&gt;
We will treat these two terms separately and demonstrate how to set the most important variables for calculating each term.&lt;br /&gt;
In practice we will compute  the quasi-particle corrections to the one particle Kohn-Sham eigenvalues obtained through a DFT calculation. &lt;br /&gt;
&lt;br /&gt;
The steps are the following:&lt;br /&gt;
&lt;br /&gt;
==Step 1: The Exchange Self Energy or HF quasi-particle correction==&lt;br /&gt;
&lt;br /&gt;
We start by evaluating the exchange Self-Energy and the corresponding Quasiparticle energies (Hartree-Fock energies). &lt;br /&gt;
Follow the module on &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; and then return to this tutorial &#039;&#039;How to obtain the quasiparticle band structure of a bulk material: h-BN&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Step 2: The Correlation Self-Energy and Quasiparticle Energies==&lt;br /&gt;
Once we have calculated the exchange part, we next turn our attention to the more demanding dynamical part. The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]] &lt;br /&gt;
In the expression for the correlation self energy, we have (1) a summation over bands, (2) an integral over the Brillouin Zone, and (3) a sum over the G vectors. In contrast with the case of Σx, the summation over bands extends over &#039;&#039;all&#039;&#039; bands (including the unoccupied ones), and so convergence tests are needed. Another important difference is that the Coulomb interaction is now screened so a fundamental ingredient is the evaluation of the dynamical dielectric matrix. The expression for the dielectric matrix, calculated at the RPA level and including local field effects, has been already treated in the [[Local fields|Local fields]] tutorial.&lt;br /&gt;
&lt;br /&gt;
In the following, we will see two ways to take into account the dynamical effects. First, we will see how to set the proper parameters to obtain a model dielectric function based on a widely used approximation, which models the energy dependence of each component of the dielectric matrix with a single pole function. &lt;br /&gt;
Secondly, we will see how to perform calculations by evaluating the dielectric matrix on a regular grid of frequencies. &lt;br /&gt;
&lt;br /&gt;
Once the correlation part of the self-energy is calculated, we will check the convergence of the different parameters with respect to some final quantity, such as the gap. &lt;br /&gt;
&lt;br /&gt;
After computing the frequency dependent self-energy, we will discover that in order to solve the quasiparticle equation we will need to know its value &#039;&#039;at the value of the quasiparticle itself&#039;&#039;. In the following, unless explicitly stated, we will solve the non-linear quasi-particle equation at first order, by expanding the self-energy around the Kohn-Sham eigenvalue. In this way the quasiparticle equation reads:&lt;br /&gt;
&lt;br /&gt;
[[File:Eqp_2.png|none|x26px|caption]] &lt;br /&gt;
&lt;br /&gt;
where the normalization factor Z is defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:z_fac.png|none|x40px|caption]] &lt;br /&gt;
&lt;br /&gt;
===The Plasmon Pole approximation===&lt;br /&gt;
As stated above, the basic idea of the plasmon-pole approximation is to approximate the frequency dependence of the dielectric matrix with a single pole function of the form:&lt;br /&gt;
[[File:ppa.png|none|x26px|caption]]&lt;br /&gt;
The two parameters R&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; and Ω&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; are obtained by a fit (for each component), after having calculated the RPA dielectric matrix at two given frequencies.&lt;br /&gt;
Yambo calculates the dielectric matrix in the static limit ( ω=0) and at a user defined frequency called the plasmon-pole frequency (ω=iωp). &lt;br /&gt;
Such an approximation has the big computational advantage of calculating the dielectric matrix for only two frequencies and leads to an analytical expression for the frequency integral of the correlation self-energy.&lt;br /&gt;
==== Input file generation ====&lt;br /&gt;
Let&#039;s start by building up the input file for a GW/PPA calculation, including the calculation of the exchange self-energy. From &amp;lt;code&amp;gt;yambo -H&amp;lt;/code&amp;gt; you should understand that the correct option is &amp;lt;code&amp;gt;yambo -x -p p -g n&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 $ cd YAMBO_TUTORIALS/hBN/YAMBO&lt;br /&gt;
 $ yambo -x -p p -g n -F gw_ppa.in&lt;br /&gt;
&lt;br /&gt;
Let&#039;s modify the input file in the following way: &lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]] = 40         Ry    # [XX] Exchange RL components&lt;br /&gt;
 [[Variables#VXCRLvcs|VXCRLvcs]] = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]]= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#PPAPntXp|PPAPntXp]] = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %[[Variables#GbndRnge|GbndRnge]]&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %[[Variables#QPkrange|QPkrange]]        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Brief explanation of some settings:&lt;br /&gt;
* Similar to the Hartree Fock study, we will concentrate on the convergence of the &#039;&#039;&#039;direct&#039;&#039;&#039; gap of the system. Hence we select the last occupied (8) and first unoccupied (9) bands for k-point number 7 in the &amp;lt;code&amp;gt;[[Variables#QPkrange|QPkrange]]&amp;lt;/code&amp;gt; variable. &lt;br /&gt;
* We also keep &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; at its converged value of 40 Ry as obtained in the &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; tutorial.&lt;br /&gt;
* For the moment we keep fixed the plasmon pole energy &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; at its default value (=1 Hartree).&lt;br /&gt;
* We keep fixed the direction of the electric field for the evaluation of the dielectric matrix to a non-specific value: &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;=(1,1,1).&lt;br /&gt;
* Later we will study convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;; for now just set them to the values indicated.&lt;br /&gt;
&lt;br /&gt;
==== Understanding the output ====&lt;br /&gt;
Let&#039;s look at the typical Yambo output. Run Yambo with an appropriate &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flag:&lt;br /&gt;
   &lt;br /&gt;
 $ yambo -F gw_ppa.in -J 10b_1Ry&lt;br /&gt;
&lt;br /&gt;
In the standard output you can recognise the different steps of the calculations: calculation of the screening matrix (evaluation of the non interacting and interacting response), calculation of the exchange self-energy, and finally the calculation of the correlation self-energy and quasiparticle energies. Moreover information on memory usage and execution time are reported: &lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;---&amp;gt; [05] Dynamic Dielectric Matrix (PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;08s&amp;gt; Xo@q[3] |########################################| [100%] 03s(E) 03s(X)&lt;br /&gt;
 &amp;lt;08s&amp;gt; X@q[3] |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [06] Bare local and non-local Exchange-Correlation&lt;br /&gt;
 &amp;lt;43s&amp;gt; EXS |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07] Dyson equation: Newton solver&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07.01] G0W0 (W PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; G0W0 (W PPA) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; [07.02] QP properties and I/O&lt;br /&gt;
 &amp;lt;45s&amp;gt; [08] Game Over &amp;amp; Game summary&lt;br /&gt;
&lt;br /&gt;
Let&#039;s have a look at the report and output. The output file &#039;&#039;o-10b_1Ry.qp&#039;&#039; contains (for each band and k-point that we indicated in the input file) the values of the bare KS eigenvalue, its GW correction and the correlation part of the self energy:&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
  7.000000   8.000000  -0.411876  -0.567723   2.322443&lt;br /&gt;
  7.000000   9.000000   3.877976   2.413773  -2.232241&lt;br /&gt;
&lt;br /&gt;
In the header you can see the details of the calculations, for instance it reports that &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=1 Ry corresponds to 5 Gvectors: &lt;br /&gt;
&lt;br /&gt;
 #  X G`s            [used]:  5&lt;br /&gt;
&lt;br /&gt;
Other information can be found in the report file &#039;&#039;r-10b_1Ry_em1d_ppa_HF_and_locXC_gw0&#039;&#039;, such as the renormalization factor defined above, the value of the &#039;&#039;exchange&#039;&#039; self-energy (non-local XC) and of the DFT exchange-correlation potential (local XC): &lt;br /&gt;
&lt;br /&gt;
 [07.02] QP properties and I/O&lt;br /&gt;
  =============================&lt;br /&gt;
  Legend (energies in eV):&lt;br /&gt;
  - B  : Band       - Eo  : bare energy&lt;br /&gt;
  - E  : QP energy  - Z   : Renormalization factor&lt;br /&gt;
  - So : Sc(Eo)     - S   : Sc(E)&lt;br /&gt;
  - dSp: Sc derivative precision&lt;br /&gt;
  - lXC: Starting Local XC (DFT)&lt;br /&gt;
  -nlXC: Starting non-Local XC (HF)&lt;br /&gt;
  QP [eV] @ K [7] (iku): 0.000000 -0.500000  0.000000&lt;br /&gt;
   B=8 Eo= -0.41 E= -0.98 E-Eo= -0.56 Re(Z)=0.81 Im(Z)=-.2368E-2 nlXC=-19.13 lXC=-16.11 So= 2.322&lt;br /&gt;
   B=9 Eo=  3.88 E=  6.29 E-Eo=  2.41 Re(Z)=0.83 Im(Z)=-.2016E-2 nlXC=-5.536 lXC=-10.67 So=-2.232&lt;br /&gt;
&lt;br /&gt;
Extended information can be also found in the output activating in the input the &amp;lt;code&amp;gt;[[Variables#ExtendOut|ExtendOut]]&amp;lt;/code&amp;gt; flag. This is an optional flag that can be activated by adding the &amp;lt;code&amp;gt;-V qp&amp;lt;/code&amp;gt; verbosity option when building the input file. The plasmon pole screening, exchange self-energy and the quasiparticle energies are also saved in databases so that they can be reused in further runs:&lt;br /&gt;
&lt;br /&gt;
 $ ls ./10b_1Ry&lt;br /&gt;
 ndb.pp ndb.pp_fragment_1 ... ndb.HF_and_locXC ndb.QP&lt;br /&gt;
&lt;br /&gt;
===Convergence tests for a quasi particle calculation===&lt;br /&gt;
&lt;br /&gt;
Now we can check the convergence of the different variables entering in the expression of the correlation part of the self energy.&amp;lt;br&amp;gt; &lt;br /&gt;
First, we focus on the parameter governing the &#039;&#039;screening matrix&#039;&#039; you have already seen in the [[RPA/IP]] section. In contrast to the calculation of the [[RPA/IP]] dielectric function, where you considered either the optical limit or a finite q response (EELS), here the dielectric matrix will be calculated for &#039;&#039;all&#039;&#039; q-points determined by the choice of k-point sampling.&lt;br /&gt;
 &lt;br /&gt;
The parameters that need to be converged can be understood by looking at expression of the dielectric matrix:&lt;br /&gt;
[[File:Yambo-CH5.png|none|x30px|Yambo tutorial image]]&lt;br /&gt;
where &#039;&#039;&amp;amp;chi;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&#039;&#039; is given by&lt;br /&gt;
[[File:Dyson_rpa.png|none|x40px|Yambo tutorial image]]&lt;br /&gt;
and  &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; is given by&lt;br /&gt;
[[File:ChiO.png|none|x45px|Yambo tutorial image]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; : The dimension of the microscopic inverse matrix, related to [[Local fields]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; : The sum on bands (c,v) in the independent particle &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Converging Screening Parameters====&lt;br /&gt;
Here we will check the convergence of the gap starting from the variables controlling the screening reported above: the bands employed to build the RPA response function &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and the number of blocks (G,G&#039;) of the dielectric matrix ε&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;G,G&#039;&amp;lt;/sub&amp;gt;  &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;. &lt;br /&gt;
In the next section we will study convergence with respect to the sum over states summation (sum over &#039;&#039;m&#039;&#039; in the Σ&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; expression); here let&#039;s fix &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to a reasonable value (40 Ry). &lt;br /&gt;
&lt;br /&gt;
Let&#039;s build a series of input files differing by the values of bands and block sizes in &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; considering &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in the range 10-50 (upper limit) and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; in the range 1 to 5 Ry. To do this by hand, file by file, open the &#039;&#039;gw_ppa.in&#039;&#039; file in an editor and change to:&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]] = &#039;&#039;&#039;2 Ry&#039;&#039;&#039;&lt;br /&gt;
while leaving the rest untouched. Repeat for 3 Ry, 4 Ry etc. Next, for each &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; change to:&lt;br /&gt;
 % [[Variables#BndsRnXp|BndsRnXp]]&lt;br /&gt;
   1 | 20 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
and repeat for 30, 40 and so on. Give a &#039;&#039;&#039;different name&#039;&#039;&#039; to each file: &#039;&#039;gw_ppa_Xb_YRy.in&#039;&#039; with X=10,20,30,40 and Y=1,2,3,4,5 Ry.&lt;br /&gt;
&lt;br /&gt;
This is obviously quite tedious. However, you can automate both the input construction and code execution using bash or python scripts (indeed later you will learn how to use the the yambo-python [http://www.yambo-code.org/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)]tool for this task). For now, you can use the simple [[bash_scripts|generate_inputs_1.sh]] bash script to generate the required input files (after copying the script you need to type &amp;lt;code&amp;gt;$ chmod +x name_of_the_script.sh &amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Finally launch the calculations:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_10b_1Ry.in -J 10b_1Ry&lt;br /&gt;
 $ yambo -F gw_ppa_10b_2Ry.in -J 10b_2Ry&lt;br /&gt;
 ...&lt;br /&gt;
 $ yambo -F gw_ppa_40b_5Ry.in -J 40b_5Ry&lt;br /&gt;
&lt;br /&gt;
Once the jobs are terminated we can collect the quasiparticle energies for fixed &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in different files named e.g. &#039;&#039;10b.dat, 20b.dat&#039;&#039; etc. for plotting, by putting in separate columns: the energy cutoff; the size of the G blocks; the quasiparticle energy of the valence band; and that of the conduction band.&lt;br /&gt;
To do this e.g. for the &#039;&#039;10b.dat&#039;&#039; file you can type:&lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;8.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
to parse the valence band quasiparticle energies  and &lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;9.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
for the conduction band; and put all the data in the &#039;&#039;10b.dat&#039;&#039; files. As there are many files to process you can use the [[bash_scripts|parse_qps.sh]] script to create the &#039;&#039;10b.dat&#039;&#039; file and edit the script changing the number of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; for the other output files. &lt;br /&gt;
&lt;br /&gt;
Once we have collected all the quasiparticle values we can plot the gap, or the valence and conduction band energies separately, as a function of the block size or energy cutoff:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:3 w lp t &amp;quot; Valence BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:3 w lp t &amp;quot;Valence BndsRnXp=20&amp;quot;,.. &lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:4 w lp t &amp;quot; Conduction BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:4 w lp t &amp;quot;Conduction BndsRnXp=20&amp;quot;,..&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot; Gap BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot;gap BndsRnXp=20&amp;quot;,..  &lt;br /&gt;
or both using e.g. the [[gnuplot_scripts|ppa_gap.gnu]] gnuplot script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=1 caption=&amp;quot;Quasiparticle energies with respect screening parameters&amp;quot;&amp;gt;&lt;br /&gt;
File:ppa2.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:ppa3.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ppa1.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Looking at the plot we can see that:&lt;br /&gt;
* The two parameters are not totally independent (see e.g. the valence quasiparticle convergence) and this is the reason why we converged them simultaneously &lt;br /&gt;
* The gap (energy difference) converge faster than single quasiparticle state&lt;br /&gt;
* The convergence criteria depends on the degree of accuracy we look for, but considering the approximations behind the calculations (plasmon-pole etc.), it is not always a good idea to enforce too strict a criteria.  &lt;br /&gt;
* Even if not totally converged we can consider that the upper limit of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;=30, and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=3Ry are reasonable parameters.&lt;br /&gt;
&lt;br /&gt;
Finally notice that in the last versions of Yambo 4.5 etc. there is a terminator for the dielectric constant that accelerates convergence on the number of bands,&lt;br /&gt;
you can active it with the &amp;lt;code&amp;gt;-V resp&amp;lt;/code&amp;gt; verbosity and setting &amp;lt;code&amp;gt;XTermKind= &amp;quot;BG&amp;quot;&amp;lt;/code&amp;gt;. You can compare the converge of the dielectric constant with and without terminator,&lt;br /&gt;
similar to what happens for the self-energy, see next section.&lt;br /&gt;
&lt;br /&gt;
====Converging the sum over states in the correlation self-energy====&lt;br /&gt;
From now on we will keep fixed these parameters and will perform a convergence study on the sum over state summation in the correlation self-energy (Σc) &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In order to use the screening previously calculated we can copy the plasmon pole parameters saved in the &amp;lt;code&amp;gt;30b_3Ry&amp;lt;/code&amp;gt; directory in the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory. In this way the screening will be read by Yambo and not calculated again:&lt;br /&gt;
&lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./SAVE/.&lt;br /&gt;
&lt;br /&gt;
(Note: you may have to delete these files before running the BSE tutorials)&lt;br /&gt;
&lt;br /&gt;
In order to use the databases we have to be sure to have the same plasmon-pole parameters in our input files.&lt;br /&gt;
Edit &#039;&#039;gw_ppa_30b_3Ry.in&#039;&#039; and modify &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to order to have a number of bands in the range from 10 to 80 inside different files named &#039;&#039;gw_ppa_Gbnd10.in&#039;&#039;, &#039;&#039;gw_ppa_Gbnd20.in&#039;&#039; etc. You can also run the the [[bash_scripts|generate_inputs_2.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next, launch yambo for each input:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and as done before we can inspect the obtained quasiparticle energies: &lt;br /&gt;
&lt;br /&gt;
 $ grep 8.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
for the valence bands, and &lt;br /&gt;
 $ grep 9.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
for the conduction band.&lt;br /&gt;
&lt;br /&gt;
Collect the results in a text file &#039;&#039;Gbnd_conv.dat&#039;&#039; containing: the number of Gbnd, the valence energy, and the conduction energy.&lt;br /&gt;
Now, as done before we can plot the valence and conduction quasiparticle levels separately as well as the gap, as a function of the number of bands used in the summation:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2 w lp lt 7  t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3 w lp lt 7  t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2) w lp lt 7  t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Quasiparticle energies with respect sum over states in correlation self-energy&amp;quot;&amp;gt;&lt;br /&gt;
File:Gbnd_val.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:Gbnd_cond.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Gbnd_gap.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Inspecting the plot we can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is rather slow and many bands are needed to get converged results.&lt;br /&gt;
* As observed above the gap (energy difference) converges faster than the single quasiparticle state energies.&lt;br /&gt;
&lt;br /&gt;
====Accelerating the sum over states convergence in the correlation self-energy====&lt;br /&gt;
In general the convergence with respect the sum over states can be very cumbersome. Here we show how it can be mitigated by using &lt;br /&gt;
a technique developed by F. Bruneval and X. Gonze &amp;lt;ref name=&amp;quot;BG&amp;quot;&amp;gt; F. Bruneval and X. Gonze, Physical Review B 78, 085125  (2008 )&amp;lt;/ref&amp;gt;. The basic idea relies in replacing the eigenenergies of the states that are not treated explicitly by a common energy, and take into account all the states, which are not explicitly included in the calculation through the closure relation.&lt;br /&gt;
To apply this technique in Yambo we need to activate the optional terminator variable [[Variables#GTermKind|GTermKind]]. We can activate it by adding the quasiparticle verbosity to the command line when generating the input file:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -p p -g n -F gw_ppa_Gbnd10.in -V qp&lt;br /&gt;
&lt;br /&gt;
and you can edit the input file by setting:&lt;br /&gt;
 &lt;br /&gt;
 [[Variables#GTermKind|GTermKind]]= &amp;quot;BG&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or simply you can add by hand this line in all the other &#039;&#039;gw_ppa_GbndX.in&#039;&#039; input files.&lt;br /&gt;
Now we can repeat the same calculations &lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10_term&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20_term&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and collect the new results:&lt;br /&gt;
&lt;br /&gt;
 $ grep 8.000 *term.qp  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
 $ grep 9.000 *term.qp  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
&lt;br /&gt;
in a new file called &#039;&#039;Gbnd_conv_terminator.dat&#039;&#039;. Now we can plot the same quantities as before by looking at the effect of having introduced the terminator. &lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:2 w lp t &amp;quot;Valence with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:3 w lp t &amp;quot;Conduction with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:($3-$2) w lp t &amp;quot;Gap with terminator&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Effect of the terminator in convergence of QP energies with respect sum over states&amp;quot;&amp;gt;&lt;br /&gt;
File:val_t.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique &amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
File:cond_t.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:gap_t.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is accelerated in particular for the single quasiparticle states.&lt;br /&gt;
* From the plot above we can see that &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;=40 is sufficient to have a converged gap&lt;br /&gt;
&lt;br /&gt;
===Beyond the plasmon pole approximation: a full frequency approach - real axis integration===&lt;br /&gt;
All the calculations performed up to now were based on the plasmon pole approximation (PPA). Now we remove this approximation by evaluating numerically the frequency integral in the expression of the correlation self-energy (Σc). To this aim we need to evaluate the screening for a number of frequencies in the interval depending on the electron-hole energy difference (energy difference between empty and occupied states) entering in the sum over states. &lt;br /&gt;
Let&#039;s build the input file for a full frequency calculation by simply typing:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff.in -g n &lt;br /&gt;
&lt;br /&gt;
and we can set the variable studied up to now at their converged value:&lt;br /&gt;
&lt;br /&gt;
 %[[Variables#BndsRnXd|BndsRnXd]]&lt;br /&gt;
 1 | 30 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXd|NGsBlkXd]]=3 Ry&lt;br /&gt;
 %[[Variables#GbndRange|GbndRange]]&lt;br /&gt;
 1 | 40 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]=40 Ry&lt;br /&gt;
 % [[Variables#LongDrXd|LongDrXd]] &lt;br /&gt;
 1.000000 | 1.000000 | 1.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 %QPkrange                      # # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and next vary in different files (name them &#039;&#039;gw_ff10.in&#039;&#039; etc.) the number of frequencies we evaluate for the screened coulomb potential. This is done by setting the values of [[Variables#ETStpsXd|ETStpsXd]]=10 , 50 , 100, 150, 200, 250. &lt;br /&gt;
You can also run the the [[bash_scripts|generate_inputs_3.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next launch yambo:&lt;br /&gt;
 $ yambo -F gw_ff10.in -J ff10&lt;br /&gt;
 $ yambo -F gw_ff50.in -J ff50&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Clearly as we are evaluating the screening for a large number of frequencies these calculations will be heavier than the case above where the calculation of the screening was done for only two frequencies  (zero and plasmon-pole). &lt;br /&gt;
As before, collect the valence and conduction bands as a function of the number of frequencies in a file called &#039;&#039;gw_ff.dat&#039;&#039; and plot the behaviour of the conduction and valence bands and the gap.&lt;br /&gt;
 &lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Real axis integration, convergences with respect the used number of frequencies&amp;quot;&amp;gt;&lt;br /&gt;
File:ff_v.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt;&lt;br /&gt;
File:ff_c.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ff_g.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
&lt;br /&gt;
* Oscillations are still present, indicating that even more frequencies have to be considered. In general, a real-axis calculation is very demanding. &lt;br /&gt;
* The final result of the gap obtained up to now does not differ too much from the one obtained at the plasmon-pole level (~50 meV)&lt;br /&gt;
&lt;br /&gt;
===Secant Solver===&lt;br /&gt;
&lt;br /&gt;
The real axis integration permits also to go beyond the linear expansion to solve the quasi particle equation. &lt;br /&gt;
The QP equation is a non-linear equation whose solution must be found using a suitable numerical algorithm. &lt;br /&gt;
[[File:Eqp_sec.png|none|x22px|caption]] &lt;br /&gt;
The mostly used, based on the linearization of the self-energy operator is the Newton method that is the one we have used up to now. &lt;br /&gt;
Yambo can also perform a search of the QP energies using a non-linear iterative method based on the [https://en.wikipedia.org/wiki/Secant_method Secant iterative Method].&lt;br /&gt;
&lt;br /&gt;
In numerical analysis, the secant method is a root-finding algorithm that uses a succession of roots of secant lines to better approximate a root of a function &#039;&#039;f&#039;&#039;. The secant method can be thought of as a finite difference approximation of Newton&#039;s method. &lt;br /&gt;
The equation that defines the secant method is: &lt;br /&gt;
&lt;br /&gt;
[[File:secant_eq.png|none|x35px|caption]] &lt;br /&gt;
&lt;br /&gt;
The first two iterations of the secant method are shown in the following picture. The red curve shows the function f and the blue lines are the secants.&lt;br /&gt;
&lt;br /&gt;
[[File:Secant_method.png|center|250px|caption]] &lt;br /&gt;
&lt;br /&gt;
To see if there is any non-linear effect in the solution of the Dyson equation we compare the result of the calculation using the Newton solver as done before with the present case. &lt;br /&gt;
In order to use the secant method you need to edit one of the the previous &#039;&#039;gw_ffN.in&#039;&#039; files e.g. &#039;&#039;gw_ff100.in&#039;&#039; and substitute:&lt;br /&gt;
&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;&lt;br /&gt;
to &lt;br /&gt;
 DysSolver= &amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Repeat the calculations in the same way as before:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff100.in -J ff100&lt;br /&gt;
&lt;br /&gt;
Note than now the screening will &#039;&#039;not&#039;&#039; be calculated again as it has been stored in the &#039;&#039;ffN&#039;&#039; directories as can be seen in the report file:&lt;br /&gt;
&lt;br /&gt;
 [05] Dynamical Dielectric Matrix&lt;br /&gt;
 ================================&lt;br /&gt;
 [RD./ff10//ndb.em1d]----&lt;br /&gt;
 ...&lt;br /&gt;
 [RD./ff10//ndb.em1d_fragment_1]--------------&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Comparing the output files, e.g. for the case with 100 freqs:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp&#039;&#039;  &#039;&#039;&#039;Newton Solver:&#039;&#039;&#039;&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08708      2.91254 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.421968    -3.417357 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp_01&#039;&#039; &#039;&#039;&#039;Secant Solver:&#039;&#039;&#039;&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08715      2.93518 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.401408    -3.731649 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
From the comparison, we see that the effect is of the order of 20 meV, of the same order of magnitude of the accuracy of the GW calculations.&lt;br /&gt;
&lt;br /&gt;
==Step 3: Interpolating Band Structures==&lt;br /&gt;
Up to now we have checked convergence for the gap. Now we want to calculate the quasiparticle corrections across the Brillouin zone in order to visualize the entire band structure along a path connecting high symmetry points.&lt;br /&gt;
&lt;br /&gt;
To do that we start by calculating the QP correction in the plasmon-pole approximation for all the k points of our sampling and for a number of bands around the gap. You can use a previous input file or generate a new one: &amp;lt;code&amp;gt; yambo -F gw_ppa_all_Bz.in -x -p p -g n &amp;lt;/code&amp;gt; and set the parameters found in the previous tests:&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  40        Ry &lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 30 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3            Ry    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp= 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and we calculate it for all the available kpoints by setting:&lt;br /&gt;
 %QPkrange                    # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1| 14|  6|11|&lt;br /&gt;
 %&lt;br /&gt;
 &lt;br /&gt;
Note that as we have already calculated the screening with these parameters you can save time and use that database either by running in the previous directory by using &amp;lt;code&amp;gt; -J 30b_3Ry &amp;lt;/code&amp;gt; or if you prefer to put the new databases in the new all_Bz directory you can create a new directory and copy there the screening databases:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir all_Bz &lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./all_Bz/&lt;br /&gt;
&lt;br /&gt;
and launch the calculation:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_all_Bz.in -J all_Bz&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the output and see that it contains the correction for all the k points for the bands we asked:&lt;br /&gt;
&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
    1.000000     6.000000    -1.299712    -0.219100     3.788044&lt;br /&gt;
    1.000000     7.000000    -1.296430    -0.241496     3.788092&lt;br /&gt;
    1.000000     8.000000    -1.296420    -0.243115     3.785947&lt;br /&gt;
    1.000000     9.000000     4.832399     0.952386    -3.679259&lt;br /&gt;
    1.00000     10.00000     10.76416      2.09915     -4.38743&lt;br /&gt;
    1.00000     11.00000     11.36167      2.48053     -3.91021&lt;br /&gt;
....&lt;br /&gt;
By plotting some of the &#039;o-all_Bz.qp&amp;quot; columns it is possible to discuss some physical properties of the hBN QPs. Using columns 3 and (3+4), ie plotting the GW energies with respect to the LDA energies we can deduce the band gap renormalization and the stretching of the conduction/valence bands:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-all_Bz.qp&amp;quot; u 3:($3+$4) w p  t &amp;quot;Eqp vs Elda&amp;quot; &lt;br /&gt;
&lt;br /&gt;
[[File:EqpvE0.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
Essentially we can see that the effect of the GW self-energy is the opening of the gap and a linear stretching of the conduction/valence bands that can be estimated by performing a linear fit of the positive and negative energies (the zero is set at top of the valence band). &lt;br /&gt;
&lt;br /&gt;
In order to calculate the band structure, however, we need to interpolate the values we have calculated above on a given path. In Yambo the interpolation is done by the executable &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; (Yambo Post Processing).&lt;br /&gt;
By typing: &lt;br /&gt;
 $ ypp -H  &lt;br /&gt;
you will recognize that in order to interpolate the bands we need to build a ypp input file using&lt;br /&gt;
 $ ypp -s b&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Before editing the &#039;&#039;ypp.in&#039;&#039; input file and running the interpolation, it is important to know that &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; uses an algorithm &amp;lt;ref&amp;gt; Warren E. Pickett, Henry Krakauer, and Philip B. Allen Phys. Rev. B 38, 2721 &amp;lt;/ref&amp;gt;  that cannot be used in presence of time-reversal (TR) symmetry. &lt;br /&gt;
As a first step we therefore remove the TR symmetry by typing:&lt;br /&gt;
&lt;br /&gt;
 $ ypp -y&lt;br /&gt;
&lt;br /&gt;
and we uncomment the corresponding line to remove the TR.&lt;br /&gt;
&lt;br /&gt;
 fixsyms                      # [R] Reduce Symmetries&lt;br /&gt;
 #RmAllSymm                   # Remove all symmetries&lt;br /&gt;
 #RmTimeRev                   # Remove Time Reversal&lt;br /&gt;
&lt;br /&gt;
and launch&lt;br /&gt;
 &lt;br /&gt;
 $ ypp&lt;br /&gt;
&lt;br /&gt;
This will create a new directory called &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; where a &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory containing the electronic structure in the absence of TR is present. &lt;br /&gt;
We will calculate the band structure in the &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
 $ cd FixSymmm&lt;br /&gt;
&lt;br /&gt;
After having performed the usual setup&lt;br /&gt;
&lt;br /&gt;
 $yambo&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
we can generate the input for the band interpolation:&lt;br /&gt;
&lt;br /&gt;
 $ypp -s b -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
and edit the &#039;&#039;ypp_bands.in&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 electrons                    # [R] Electrons (and holes)&lt;br /&gt;
 bnds                         # [R] Bands&lt;br /&gt;
 INTERP_mode= &amp;quot;NN&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach) &lt;br /&gt;
 OutputAlat= 4.716000           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;     &lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   1 | 100 |                   # Number of bands&lt;br /&gt;
 %&lt;br /&gt;
 % INTERP_Grid&lt;br /&gt;
 -1 |-1 |-1 |                             # Interpolation BZ Grid&lt;br /&gt;
 %&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 CIRCUIT_E_DB_path= &amp;quot;none&amp;quot;      # SAVE obtained from the QE `bands` run (alternative to %BANDS_kpts)&lt;br /&gt;
 BANDS_path= &amp;quot;&amp;quot;                 # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 10  &lt;br /&gt;
 #BANDS_built_in                # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts   &lt;br /&gt;
 % &lt;br /&gt;
&lt;br /&gt;
We modify the following lines:&lt;br /&gt;
 BANDS_steps=30&lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   6 | 11 |                   # Number of bands &lt;br /&gt;
 %&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.00000 |0.00000 |0.00000 |&lt;br /&gt;
  0.50000 |-.50000 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.50000 |&lt;br /&gt;
  0.00000 |0.00000 |0.50000 |&lt;br /&gt;
  0.50000 |-.50000 |0.50000 |&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
which means we assign 30 points in each segment, we ask to interpolate 3 occupied and 3 empty bands and we assign the following path passing from the high symmetry points: K Γ M K H A L.&lt;br /&gt;
Launching:&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
will produce the output file &#039;&#039;o.bands_interpolated&#039;&#039; containing:&lt;br /&gt;
&lt;br /&gt;
                 &lt;br /&gt;
 #&lt;br /&gt;
 #   |k|        b6         b7         b8         b9         b10        b11        kx         ky         kz&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
     0.00000   -7.22092   -0.13402   -0.13395    4.67691    4.67694   10.08905    0.33300   -0.66667    0.00000&lt;br /&gt;
     0.03725   -7.18857   -0.17190   -0.12684    4.66126    4.71050   10.12529    0.32190   -0.64445    0.00000&lt;br /&gt;
...&lt;br /&gt;
 &lt;br /&gt;
and we can plot the bands using gnuplot:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o.bands_interpolated&amp;quot; u 0:2 w l, &amp;quot;o.bands_interpolated&amp;quot; u 0:3 w l, ...&lt;br /&gt;
&lt;br /&gt;
[[File:bands_lda.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
and you can recognize the index of the high symmetry point by inspecting the last three columns.&lt;br /&gt;
Note that up to now we have interpolated the LDA band structure. In order to plot the GW band structure, we need to tell &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; in the input file where the &#039;&#039;ndb.QP&#039;&#039; database is found. This is achieved by adding in the &#039;&#039;ypp_bands.in&#039;&#039; file the line:&lt;br /&gt;
&lt;br /&gt;
  GfnQPdb= &amp;quot;E &amp;lt; ./all_Bz/ndb.QP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and relaunch &lt;br /&gt;
&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
Now the file &#039;&#039;o.bands_interpolated_01&#039;&#039; contains the GW interpolated band structure. We can plot the LDA and GW band structure together by using the gnuplot script [[gnuplot_scripts|bands.gnu]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines  widths=500px heights=500px  perrow=2 caption=&amp;quot;Band strcuture of bulk hBN&amp;quot;&amp;gt;&lt;br /&gt;
File:hBN_bands.png| LDA and GW bands structure &lt;br /&gt;
File:hBN_bands_lit.png| LDA and GW bands structure from Ref. &amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*As expected the effect of the GW correction is to open the gap.&lt;br /&gt;
*Comparing the obtained band structure with the one found in the literature by Arnaud and coworkers &amp;lt;ref name=&amp;quot;Arnaud&amp;quot;&amp;gt; B. Arnaud, S. Lebegue,P. Rabiller, and M. Alouani Phys, Rev. Lett. 96, 026402 (2006)&amp;lt;/ref&amp;gt; we found a very nice qualitative agreement. &lt;br /&gt;
*Quantitatively we found a smaller gap: about 5.2 eV (indirect gap), 5.7 eV (direct gap) while in Ref.&amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt;  is found  5.95 eV for the indirect gap and a minimum direct band gap of 6.47 eV. Other values are also reported in the literature depending on the used pseudopotentials, starting functional and type of self-consistency (see below). &lt;br /&gt;
*The present tutorial has been done with a small k point grid which is an important parameter to be checked, so convergence with respect the k point sampling has to be validated.&lt;br /&gt;
&lt;br /&gt;
==Step 4: Summary of the convergence parameters==&lt;br /&gt;
We have calculated the band structure of hBN starting from a DFT calculation, here we summarize the main variable we have checked to achieve convergence:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; # [XX] Exchange RL components&lt;br /&gt;
Number of G-vectors in the exchange. This number should be checked carefully. Generally a large number is needed as the QP energies show a slow convergence. The calcualtion of the exchange part is rather fast. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; #[Xp] Polarization function bands&lt;br /&gt;
Number of bands in the independent response function form which the dielectric matrix is calculated. Also this paramater has to be checked carefully,together with NGsBlkXp as the two variables are interconnected&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;  # [Xp] Response block size&lt;br /&gt;
Number of G-vectors block in the dielectric constant. Also this paramater has to be checked carefully, to be checked together with BndsRnXp. A large number of bands and block can make the calculation very demanding.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]] &amp;lt;/code&amp;gt; # [Xp] [cc] Electric Field&lt;br /&gt;
Direction of the electric field for the calculation of the q=0 component of the dielectric constant e(q,w). In a bulk can be set to (1,1,1), attention must be paid for non 3D systems.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]] &amp;lt;/code&amp;gt; # [Xp] Plasmon pole imaginary energy: this is the second frequency used to fit the Godby-Needs plasmon-pole model (PPM). If results depend consistently by changing this frequency, the PPM is not adequate for your calculation and it is need to gp beyond that, e.g. Real-axis. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]] &amp;lt;/code&amp;gt; # [GW] G[W] bands range&lt;br /&gt;
Number of bands used to expand the Green&#039;s function. This number is usually larger than the number of bands used to calculated the dielectricconstant. Single quasiparticle energies converge slowly with respect GbndRnge, energy difference behave better. You can use terminator technique to mitigate the slow dependence. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GDamping|GDamping]] &amp;lt;/code&amp;gt; # [GW] G[W] damping&lt;br /&gt;
Small damping in the Green&#039;s function definition, the delta &lt;br /&gt;
parameter. The final result shouuld not depend on that, usually set at 0.1 eV&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#dScStep|dScStep]] &amp;lt;/code&amp;gt; # [GW] &lt;br /&gt;
Energy step to evaluate Z factors&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#DysSolver|DysSolver]] &amp;lt;/code&amp;gt; # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
Parameters related to the  solution of the Dyson equation, &amp;quot;n&amp;quot; Newton linearization, &#039;s&#039; non linear secant method&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GTermKind|GTermKind]] &amp;lt;/code&amp;gt; [GW] GW terminator &lt;br /&gt;
Terminator for the self-energy&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt; . We have seen how this spped up the convergence with respect empty bands.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#%QPkrange |QPkrange ]] &amp;lt;/code&amp;gt; # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
K-points and band range where you want to calculate the GW correction. The syntax is&lt;br /&gt;
first kpoint | last kpoint | first band | last band&lt;br /&gt;
&lt;br /&gt;
==Step 5: Eigenvalue only self-consistent evGW0 and evGW (only available in Yambo 4.6) ==&lt;br /&gt;
Here we want to see how we can compute an eigenvalue only evGW0 or evGW correction in Yambo. In the new version of Yambo there are two flags for these kind of self-consistency: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWoIter]]&amp;lt;/code&amp;gt;  number of GW0 iterations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWIter]]&amp;lt;/code&amp;gt;  number of GW iterations&lt;br /&gt;
&lt;br /&gt;
you can set one of them to 10 for example, the code will stop when convergence is reached, usually in less than 5 iterations.&lt;br /&gt;
For example if you consider the input file below:&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 % &lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GWoIter=0                    # [GW] GWo self-consistent (evGWo) iterations on eigenvalues&lt;br /&gt;
 GWIter =0                    # [GW] GW  self-consistent (evGW)  iterations on eigenvalues&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1|  14|  7|  10|&lt;br /&gt;
 % &lt;br /&gt;
if you set both GWIter and GWoIter to zero you get a gap correction of 4.15 eV.&lt;br /&gt;
If you perform self-consistency on G (GWoIter/=)  &lt;br /&gt;
the gap will be 4.713 eV and finally if you perform &lt;br /&gt;
self-consistency in both G and W (GWIter /=0) the gap will be  5.506 eV.&lt;br /&gt;
&lt;br /&gt;
Notice that these values are absolutelly not converged because we used very few&lt;br /&gt;
bands and a small block size.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note that the final result of the self-consistent GW may&lt;br /&gt;
depend from the number of bands you decide to correct, because they are used&lt;br /&gt;
to reconstruct G and W. For the non-corrected bands Yambo applied a rigid shift&lt;br /&gt;
of their energy based on the closed corrected band.&lt;br /&gt;
&lt;br /&gt;
==Step 6: A better integration of the q=0 point ==&lt;br /&gt;
&lt;br /&gt;
The integration of the q=0 of the Coulomb potential is problematic because the 1/q diverges.&lt;br /&gt;
Usually in Yambo this integration is performed analytically in a small sphere around q=0.&lt;br /&gt;
&lt;br /&gt;
[[File:Circle box.gif|center|frame]]&lt;br /&gt;
&lt;br /&gt;
however in this way the code lost part of the integral out of the circle. This usually &lt;br /&gt;
is not problematic because for a large number of q and k point the missing term goes to zero.&lt;br /&gt;
However in system that requires few k-points or even only the gamma one, it is possible&lt;br /&gt;
to perform a better integration of this term by adding the flag -r to generate the input&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&lt;br /&gt;
&amp;gt; 3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1&amp;lt;/span&amp;gt;            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;) &lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
in this input  &amp;lt;code&amp;gt;[[Variables#RandGvec|RandGvec]]&amp;lt;/code&amp;gt; is the component of the Coulomb potential we want integrate numerically,&lt;br /&gt;
in this case only the first one G=G&#039;=0, and &amp;lt;code&amp;gt;[[Variables#RandQpts|RandQpts]]&amp;lt;/code&amp;gt; is the number of random points&lt;br /&gt;
used to perform the integral by Monte Carlo.&lt;br /&gt;
&lt;br /&gt;
If you turn one this integration you will get a slightly different band gap,&lt;br /&gt;
but in the limit of large k points the final results will be the same of the standard method.&lt;br /&gt;
&lt;br /&gt;
However this correction is important for systems that converge with few k-points or with gamma only.&lt;br /&gt;
&lt;br /&gt;
==Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) ==&lt;br /&gt;
&lt;br /&gt;
Hexagonal Boron Nitride is an anisotropic material so there is the question in which direction&lt;br /&gt;
one shold calculate the dielectric constant the enters in the GW. &lt;br /&gt;
If you run again this tutorial changing the direction of the q=0 point in GW calculation,&lt;br /&gt;
the variable &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;, you will realize that the there gap correction changes.&lt;br /&gt;
In Yambo there is a way to take into account this anisitropy of the dielectri tensor.&lt;br /&gt;
&lt;br /&gt;
First of all you need to calculate the dielectric constant in the three cartesian directions with the command &amp;lt;code&amp;gt; yambo -o c -k hartree&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 optics                         # [R] Linear Response optical properties&lt;br /&gt;
 kernel                         # [R] Kernel&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;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 NGsBlkXd= 3000        mRy      # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
   1 | 1 |                       # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
    1 | 100 |                   # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   0.00000 | 10.00000 | eV      # [Xd] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 1                    # [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;
&lt;br /&gt;
In the output file &amp;lt;code&amp;gt; o.eps_q1_inv_rpa_dyson&amp;lt;/code&amp;gt; you will find the real-part of the zero component of inverse dielectric matrix, in this case 5.044076.&lt;br /&gt;
&lt;br /&gt;
Repeat this calculation with the field in the other two directions y and z. The y-direction is equal to x, while in z direction the zero component of the inverse dielectric matrix is 2.872451.&lt;br /&gt;
&lt;br /&gt;
Now generate a new input file for the GW, with the command &amp;lt;code&amp;gt; yambo -g n -p p -r -V RL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&amp;gt;3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 % Em1Anys&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.044076 &amp;lt;/span&amp;gt;    | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.044076 &amp;lt;/span&amp;gt;    |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2.872451 &amp;lt;/span&amp;gt;  |        # [RIM] X Y Z Static Inverse dielectric matrix&lt;br /&gt;
 %&lt;br /&gt;
 IDEm1Ref= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;  &lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
run the calculations and you will find a correction of the gap intermediate between the one with the field in x and z directions.&lt;br /&gt;
&lt;br /&gt;
==Step 8: Exercise: Convergence with respect K points==&lt;br /&gt;
As an exercise now you can check the convergence with respect the K point sampling:&lt;br /&gt;
# perform a new non-scf calculation with a bigger k point grid: 9x9x3 and 12x12x4 ...&lt;br /&gt;
# convert wave functions and electronic structure to Yambo databases in a different directory as explained in the [[Bulk material: h-BN|DFT and p2y module]], &lt;br /&gt;
# [[initialization |Initialize]] the Yambo databases,&lt;br /&gt;
# Redo the steps explained in this section (exchange self energy, plasmon pole GW, band structure interpolation)&lt;br /&gt;
# The PPA-GW calculation using 12x12x4 grid depending on your machine can take several minutes in serial mode. You can think to perform the exercise after having learned some basic on the parallelization strategy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|style=&amp;quot;width:15%; text-align:left&amp;quot;|Prev: [[Tutorials|Tutorials Home]] &lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center&amp;quot;|Now: [[Tutorials|Tutorials Home]] --&amp;gt; [[How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN|GW]] &lt;br /&gt;
|style=&amp;quot;width:35%; text-align:right&amp;quot;|Next: If you did everything, choose another tutorial in the menu&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3896</id>
		<title>How to obtain the quasi-particle band structure of a bulk material: h-BN</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN&amp;diff=3896"/>
		<updated>2020-11-19T12:43:15Z</updated>

		<summary type="html">&lt;p&gt;Claudio: /* Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to:&lt;br /&gt;
* Calculate quasi-particle corrections in the Hartree-Fock approximation &lt;br /&gt;
* Calculate quasi-particle corrections in the GW approximation &lt;br /&gt;
* Choose the input parameters for a meaningful converged calculation&lt;br /&gt;
* Plot a band structure including quasi-particle corrections&lt;br /&gt;
We will use bulk hBN as an example system. Before starting, you need to obtain the appropriate tarball. See instructions on the [[Tutorials|main tutorials page]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We strongly recommend that you first complete the [[First steps: a walk through from DFT to optical properties]] tutorial.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &#039;&#039;&#039;Prerequisites&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
At this stage, you should have already completed the following modules:&lt;br /&gt;
* [[Generating the Yambo databases|Generating the Yambo databases]]&lt;br /&gt;
* Step 2 Run [[Initialization]] tutorial&lt;br /&gt;
Now we can start to --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The aim of the present tutorial is to obtain quasiparticle correction to energy levels using many-body perturbation theory (MBPT). &amp;lt;br&amp;gt;&lt;br /&gt;
The general non-linear quasiparticle equation reads:&lt;br /&gt;
[[File:Eqp_1.png|none|x26px|caption]] &lt;br /&gt;
As a first step we want to evaluate the self energy Σ entering in the quasiparticle equation. In the GW approach the self-energy can be separated into two components: a static term called the exchange self-energy (Σx), and a dynamical term (energy dependent) called the correlation self-energy (Σc):&lt;br /&gt;
[[File:Sigma.png|none|x25px|caption]]&lt;br /&gt;
We will treat these two terms separately and demonstrate how to set the most important variables for calculating each term.&lt;br /&gt;
In practice we will compute  the quasi-particle corrections to the one particle Kohn-Sham eigenvalues obtained through a DFT calculation. &lt;br /&gt;
&lt;br /&gt;
The steps are the following:&lt;br /&gt;
&lt;br /&gt;
==Step 1: The Exchange Self Energy or HF quasi-particle correction==&lt;br /&gt;
&lt;br /&gt;
We start by evaluating the exchange Self-Energy and the corresponding Quasiparticle energies (Hartree-Fock energies). &lt;br /&gt;
Follow the module on &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; and then return to this tutorial &#039;&#039;How to obtain the quasiparticle band structure of a bulk material: h-BN&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Step 2: The Correlation Self-Energy and Quasiparticle Energies==&lt;br /&gt;
Once we have calculated the exchange part, we next turn our attention to the more demanding dynamical part. The correlation part of the self-energy in a plane wave representation reads:&lt;br /&gt;
[[File:Sigma_c.png|none|x50px|caption]] &lt;br /&gt;
In the expression for the correlation self energy, we have (1) a summation over bands, (2) an integral over the Brillouin Zone, and (3) a sum over the G vectors. In contrast with the case of Σx, the summation over bands extends over &#039;&#039;all&#039;&#039; bands (including the unoccupied ones), and so convergence tests are needed. Another important difference is that the Coulomb interaction is now screened so a fundamental ingredient is the evaluation of the dynamical dielectric matrix. The expression for the dielectric matrix, calculated at the RPA level and including local field effects, has been already treated in the [[Local fields|Local fields]] tutorial.&lt;br /&gt;
&lt;br /&gt;
In the following, we will see two ways to take into account the dynamical effects. First, we will see how to set the proper parameters to obtain a model dielectric function based on a widely used approximation, which models the energy dependence of each component of the dielectric matrix with a single pole function. &lt;br /&gt;
Secondly, we will see how to perform calculations by evaluating the dielectric matrix on a regular grid of frequencies. &lt;br /&gt;
&lt;br /&gt;
Once the correlation part of the self-energy is calculated, we will check the convergence of the different parameters with respect to some final quantity, such as the gap. &lt;br /&gt;
&lt;br /&gt;
After computing the frequency dependent self-energy, we will discover that in order to solve the quasiparticle equation we will need to know its value &#039;&#039;at the value of the quasiparticle itself&#039;&#039;. In the following, unless explicitly stated, we will solve the non-linear quasi-particle equation at first order, by expanding the self-energy around the Kohn-Sham eigenvalue. In this way the quasiparticle equation reads:&lt;br /&gt;
&lt;br /&gt;
[[File:Eqp_2.png|none|x26px|caption]] &lt;br /&gt;
&lt;br /&gt;
where the normalization factor Z is defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:z_fac.png|none|x40px|caption]] &lt;br /&gt;
&lt;br /&gt;
===The Plasmon Pole approximation===&lt;br /&gt;
As stated above, the basic idea of the plasmon-pole approximation is to approximate the frequency dependence of the dielectric matrix with a single pole function of the form:&lt;br /&gt;
[[File:ppa.png|none|x26px|caption]]&lt;br /&gt;
The two parameters R&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; and Ω&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; are obtained by a fit (for each component), after having calculated the RPA dielectric matrix at two given frequencies.&lt;br /&gt;
Yambo calculates the dielectric matrix in the static limit ( ω=0) and at a user defined frequency called the plasmon-pole frequency (ω=iωp). &lt;br /&gt;
Such an approximation has the big computational advantage of calculating the dielectric matrix for only two frequencies and leads to an analytical expression for the frequency integral of the correlation self-energy.&lt;br /&gt;
==== Input file generation ====&lt;br /&gt;
Let&#039;s start by building up the input file for a GW/PPA calculation, including the calculation of the exchange self-energy. From &amp;lt;code&amp;gt;yambo -H&amp;lt;/code&amp;gt; you should understand that the correct option is &amp;lt;code&amp;gt;yambo -x -p p -g n&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 $ cd YAMBO_TUTORIALS/hBN/YAMBO&lt;br /&gt;
 $ yambo -x -p p -g n -F gw_ppa.in&lt;br /&gt;
&lt;br /&gt;
Let&#039;s modify the input file in the following way: &lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]] = 40         Ry    # [XX] Exchange RL components&lt;br /&gt;
 [[Variables#VXCRLvcs|VXCRLvcs]] = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]]= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#PPAPntXp|PPAPntXp]] = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %[[Variables#GbndRnge|GbndRnge]]&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %[[Variables#QPkrange|QPkrange]]        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Brief explanation of some settings:&lt;br /&gt;
* Similar to the Hartree Fock study, we will concentrate on the convergence of the &#039;&#039;&#039;direct&#039;&#039;&#039; gap of the system. Hence we select the last occupied (8) and first unoccupied (9) bands for k-point number 7 in the &amp;lt;code&amp;gt;[[Variables#QPkrange|QPkrange]]&amp;lt;/code&amp;gt; variable. &lt;br /&gt;
* We also keep &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; at its converged value of 40 Ry as obtained in the &#039;&#039;&#039;[[Hartree Fock]]&#039;&#039;&#039; tutorial.&lt;br /&gt;
* For the moment we keep fixed the plasmon pole energy &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; at its default value (=1 Hartree).&lt;br /&gt;
* We keep fixed the direction of the electric field for the evaluation of the dielectric matrix to a non-specific value: &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;=(1,1,1).&lt;br /&gt;
* Later we will study convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;; for now just set them to the values indicated.&lt;br /&gt;
&lt;br /&gt;
==== Understanding the output ====&lt;br /&gt;
Let&#039;s look at the typical Yambo output. Run Yambo with an appropriate &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flag:&lt;br /&gt;
   &lt;br /&gt;
 $ yambo -F gw_ppa.in -J 10b_1Ry&lt;br /&gt;
&lt;br /&gt;
In the standard output you can recognise the different steps of the calculations: calculation of the screening matrix (evaluation of the non interacting and interacting response), calculation of the exchange self-energy, and finally the calculation of the correlation self-energy and quasiparticle energies. Moreover information on memory usage and execution time are reported: &lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;---&amp;gt; [05] Dynamic Dielectric Matrix (PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;08s&amp;gt; Xo@q[3] |########################################| [100%] 03s(E) 03s(X)&lt;br /&gt;
 &amp;lt;08s&amp;gt; X@q[3] |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [06] Bare local and non-local Exchange-Correlation&lt;br /&gt;
 &amp;lt;43s&amp;gt; EXS |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07] Dyson equation: Newton solver&lt;br /&gt;
 &amp;lt;43s&amp;gt; [07.01] G0W0 (W PPA)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; G0W0 (W PPA) |########################################| [100%] --(E) --(X)&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;45s&amp;gt; [07.02] QP properties and I/O&lt;br /&gt;
 &amp;lt;45s&amp;gt; [08] Game Over &amp;amp; Game summary&lt;br /&gt;
&lt;br /&gt;
Let&#039;s have a look at the report and output. The output file &#039;&#039;o-10b_1Ry.qp&#039;&#039; contains (for each band and k-point that we indicated in the input file) the values of the bare KS eigenvalue, its GW correction and the correlation part of the self energy:&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
  7.000000   8.000000  -0.411876  -0.567723   2.322443&lt;br /&gt;
  7.000000   9.000000   3.877976   2.413773  -2.232241&lt;br /&gt;
&lt;br /&gt;
In the header you can see the details of the calculations, for instance it reports that &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=1 Ry corresponds to 5 Gvectors: &lt;br /&gt;
&lt;br /&gt;
 #  X G`s            [used]:  5&lt;br /&gt;
&lt;br /&gt;
Other information can be found in the report file &#039;&#039;r-10b_1Ry_em1d_ppa_HF_and_locXC_gw0&#039;&#039;, such as the renormalization factor defined above, the value of the &#039;&#039;exchange&#039;&#039; self-energy (non-local XC) and of the DFT exchange-correlation potential (local XC): &lt;br /&gt;
&lt;br /&gt;
 [07.02] QP properties and I/O&lt;br /&gt;
  =============================&lt;br /&gt;
  Legend (energies in eV):&lt;br /&gt;
  - B  : Band       - Eo  : bare energy&lt;br /&gt;
  - E  : QP energy  - Z   : Renormalization factor&lt;br /&gt;
  - So : Sc(Eo)     - S   : Sc(E)&lt;br /&gt;
  - dSp: Sc derivative precision&lt;br /&gt;
  - lXC: Starting Local XC (DFT)&lt;br /&gt;
  -nlXC: Starting non-Local XC (HF)&lt;br /&gt;
  QP [eV] @ K [7] (iku): 0.000000 -0.500000  0.000000&lt;br /&gt;
   B=8 Eo= -0.41 E= -0.98 E-Eo= -0.56 Re(Z)=0.81 Im(Z)=-.2368E-2 nlXC=-19.13 lXC=-16.11 So= 2.322&lt;br /&gt;
   B=9 Eo=  3.88 E=  6.29 E-Eo=  2.41 Re(Z)=0.83 Im(Z)=-.2016E-2 nlXC=-5.536 lXC=-10.67 So=-2.232&lt;br /&gt;
&lt;br /&gt;
Extended information can be also found in the output activating in the input the &amp;lt;code&amp;gt;[[Variables#ExtendOut|ExtendOut]]&amp;lt;/code&amp;gt; flag. This is an optional flag that can be activated by adding the &amp;lt;code&amp;gt;-V qp&amp;lt;/code&amp;gt; verbosity option when building the input file. The plasmon pole screening, exchange self-energy and the quasiparticle energies are also saved in databases so that they can be reused in further runs:&lt;br /&gt;
&lt;br /&gt;
 $ ls ./10b_1Ry&lt;br /&gt;
 ndb.pp ndb.pp_fragment_1 ... ndb.HF_and_locXC ndb.QP&lt;br /&gt;
&lt;br /&gt;
===Convergence tests for a quasi particle calculation===&lt;br /&gt;
&lt;br /&gt;
Now we can check the convergence of the different variables entering in the expression of the correlation part of the self energy.&amp;lt;br&amp;gt; &lt;br /&gt;
First, we focus on the parameter governing the &#039;&#039;screening matrix&#039;&#039; you have already seen in the [[RPA/IP]] section. In contrast to the calculation of the [[RPA/IP]] dielectric function, where you considered either the optical limit or a finite q response (EELS), here the dielectric matrix will be calculated for &#039;&#039;all&#039;&#039; q-points determined by the choice of k-point sampling.&lt;br /&gt;
 &lt;br /&gt;
The parameters that need to be converged can be understood by looking at expression of the dielectric matrix:&lt;br /&gt;
[[File:Yambo-CH5.png|none|x30px|Yambo tutorial image]]&lt;br /&gt;
where &#039;&#039;&amp;amp;chi;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&#039;&#039; is given by&lt;br /&gt;
[[File:Dyson_rpa.png|none|x40px|Yambo tutorial image]]&lt;br /&gt;
and  &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; is given by&lt;br /&gt;
[[File:ChiO.png|none|x45px|Yambo tutorial image]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; : The dimension of the microscopic inverse matrix, related to [[Local fields]]&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; : The sum on bands (c,v) in the independent particle &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Converging Screening Parameters====&lt;br /&gt;
Here we will check the convergence of the gap starting from the variables controlling the screening reported above: the bands employed to build the RPA response function &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and the number of blocks (G,G&#039;) of the dielectric matrix ε&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;G,G&#039;&amp;lt;/sub&amp;gt;  &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;. &lt;br /&gt;
In the next section we will study convergence with respect to the sum over states summation (sum over &#039;&#039;m&#039;&#039; in the Σ&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; expression); here let&#039;s fix &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to a reasonable value (40 Ry). &lt;br /&gt;
&lt;br /&gt;
Let&#039;s build a series of input files differing by the values of bands and block sizes in &amp;amp;chi;&amp;lt;sup&amp;gt;0&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;GG&#039;&amp;lt;/sub&amp;gt; considering &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in the range 10-50 (upper limit) and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; in the range 1 to 5 Ry. To do this by hand, file by file, open the &#039;&#039;gw_ppa.in&#039;&#039; file in an editor and change to:&lt;br /&gt;
 [[Variables#NGsBlkXp|NGsBlkXp]] = &#039;&#039;&#039;2 Ry&#039;&#039;&#039;&lt;br /&gt;
while leaving the rest untouched. Repeat for 3 Ry, 4 Ry etc. Next, for each &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt; change to:&lt;br /&gt;
 % [[Variables#BndsRnXp|BndsRnXp]]&lt;br /&gt;
   1 | 20 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
and repeat for 30, 40 and so on. Give a &#039;&#039;&#039;different name&#039;&#039;&#039; to each file: &#039;&#039;gw_ppa_Xb_YRy.in&#039;&#039; with X=10,20,30,40 and Y=1,2,3,4,5 Ry.&lt;br /&gt;
&lt;br /&gt;
This is obviously quite tedious. However, you can automate both the input construction and code execution using bash or python scripts (indeed later you will learn how to use the the yambo-python [http://www.yambo-code.org/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)]tool for this task). For now, you can use the simple [[bash_scripts|generate_inputs_1.sh]] bash script to generate the required input files (after copying the script you need to type &amp;lt;code&amp;gt;$ chmod +x name_of_the_script.sh &amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Finally launch the calculations:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_10b_1Ry.in -J 10b_1Ry&lt;br /&gt;
 $ yambo -F gw_ppa_10b_2Ry.in -J 10b_2Ry&lt;br /&gt;
 ...&lt;br /&gt;
 $ yambo -F gw_ppa_40b_5Ry.in -J 40b_5Ry&lt;br /&gt;
&lt;br /&gt;
Once the jobs are terminated we can collect the quasiparticle energies for fixed &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; in different files named e.g. &#039;&#039;10b.dat, 20b.dat&#039;&#039; etc. for plotting, by putting in separate columns: the energy cutoff; the size of the G blocks; the quasiparticle energy of the valence band; and that of the conduction band.&lt;br /&gt;
To do this e.g. for the &#039;&#039;10b.dat&#039;&#039; file you can type:&lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;8.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
to parse the valence band quasiparticle energies  and &lt;br /&gt;
 $ cat o-10b* | grep &amp;quot;9.000&amp;quot; |  awk &#039;{print $3+$4}&#039; &lt;br /&gt;
for the conduction band; and put all the data in the &#039;&#039;10b.dat&#039;&#039; files. As there are many files to process you can use the [[bash_scripts|parse_qps.sh]] script to create the &#039;&#039;10b.dat&#039;&#039; file and edit the script changing the number of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; for the other output files. &lt;br /&gt;
&lt;br /&gt;
Once we have collected all the quasiparticle values we can plot the gap, or the valence and conduction band energies separately, as a function of the block size or energy cutoff:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:3 w lp t &amp;quot; Valence BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:3 w lp t &amp;quot;Valence BndsRnXp=20&amp;quot;,.. &lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:4 w lp t &amp;quot; Conduction BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:4 w lp t &amp;quot;Conduction BndsRnXp=20&amp;quot;,..&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;10b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot; Gap BndsRnXp=10&amp;quot;, &amp;quot;20b.dat&amp;quot; u 1:($4-$3) w lp t &amp;quot;gap BndsRnXp=20&amp;quot;,..  &lt;br /&gt;
or both using e.g. the [[gnuplot_scripts|ppa_gap.gnu]] gnuplot script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=1 caption=&amp;quot;Quasiparticle energies with respect screening parameters&amp;quot;&amp;gt;&lt;br /&gt;
File:ppa2.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:ppa3.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ppa1.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Looking at the plot we can see that:&lt;br /&gt;
* The two parameters are not totally independent (see e.g. the valence quasiparticle convergence) and this is the reason why we converged them simultaneously &lt;br /&gt;
* The gap (energy difference) converge faster than single quasiparticle state&lt;br /&gt;
* The convergence criteria depends on the degree of accuracy we look for, but considering the approximations behind the calculations (plasmon-pole etc.), it is not always a good idea to enforce too strict a criteria.  &lt;br /&gt;
* Even if not totally converged we can consider that the upper limit of &amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt;=30, and &amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;=3Ry are reasonable parameters.&lt;br /&gt;
&lt;br /&gt;
Finally notice that in the last versions of Yambo 4.5 etc. there is a terminator for the dielectric constant that accelerates convergence on the number of bands,&lt;br /&gt;
you can active it with the &amp;lt;code&amp;gt;-V resp&amp;lt;/code&amp;gt; verbosity and setting &amp;lt;code&amp;gt;XTermKind= &amp;quot;BG&amp;quot;&amp;lt;/code&amp;gt;. You can compare the converge of the dielectric constant with and without terminator,&lt;br /&gt;
similar to what happens for the self-energy, see next section.&lt;br /&gt;
&lt;br /&gt;
====Converging the sum over states in the correlation self-energy====&lt;br /&gt;
From now on we will keep fixed these parameters and will perform a convergence study on the sum over state summation in the correlation self-energy (Σc) &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In order to use the screening previously calculated we can copy the plasmon pole parameters saved in the &amp;lt;code&amp;gt;30b_3Ry&amp;lt;/code&amp;gt; directory in the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory. In this way the screening will be read by Yambo and not calculated again:&lt;br /&gt;
&lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./SAVE/.&lt;br /&gt;
&lt;br /&gt;
(Note: you may have to delete these files before running the BSE tutorials)&lt;br /&gt;
&lt;br /&gt;
In order to use the databases we have to be sure to have the same plasmon-pole parameters in our input files.&lt;br /&gt;
Edit &#039;&#039;gw_ppa_30b_3Ry.in&#039;&#039; and modify &amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]]&amp;lt;/code&amp;gt; to order to have a number of bands in the range from 10 to 80 inside different files named &#039;&#039;gw_ppa_Gbnd10.in&#039;&#039;, &#039;&#039;gw_ppa_Gbnd20.in&#039;&#039; etc. You can also run the the [[bash_scripts|generate_inputs_2.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next, launch yambo for each input:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and as done before we can inspect the obtained quasiparticle energies: &lt;br /&gt;
&lt;br /&gt;
 $ grep 8.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
for the valence bands, and &lt;br /&gt;
 $ grep 9.00 o-Gbnd*  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
for the conduction band.&lt;br /&gt;
&lt;br /&gt;
Collect the results in a text file &#039;&#039;Gbnd_conv.dat&#039;&#039; containing: the number of Gbnd, the valence energy, and the conduction energy.&lt;br /&gt;
Now, as done before we can plot the valence and conduction quasiparticle levels separately as well as the gap, as a function of the number of bands used in the summation:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2 w lp lt 7  t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3 w lp lt 7  t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2) w lp lt 7  t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Quasiparticle energies with respect sum over states in correlation self-energy&amp;quot;&amp;gt;&lt;br /&gt;
File:Gbnd_val.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
File:Gbnd_cond.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Gbnd_gap.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
Inspecting the plot we can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is rather slow and many bands are needed to get converged results.&lt;br /&gt;
* As observed above the gap (energy difference) converges faster than the single quasiparticle state energies.&lt;br /&gt;
&lt;br /&gt;
====Accelerating the sum over states convergence in the correlation self-energy====&lt;br /&gt;
In general the convergence with respect the sum over states can be very cumbersome. Here we show how it can be mitigated by using &lt;br /&gt;
a technique developed by F. Bruneval and X. Gonze &amp;lt;ref name=&amp;quot;BG&amp;quot;&amp;gt; F. Bruneval and X. Gonze, Physical Review B 78, 085125  (2008 )&amp;lt;/ref&amp;gt;. The basic idea relies in replacing the eigenenergies of the states that are not treated explicitly by a common energy, and take into account all the states, which are not explicitly included in the calculation through the closure relation.&lt;br /&gt;
To apply this technique in Yambo we need to activate the optional terminator variable [[Variables#GTermKind|GTermKind]]. We can activate it by adding the quasiparticle verbosity to the command line when generating the input file:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -p p -g n -F gw_ppa_Gbnd10.in -V qp&lt;br /&gt;
&lt;br /&gt;
and you can edit the input file by setting:&lt;br /&gt;
 &lt;br /&gt;
 [[Variables#GTermKind|GTermKind]]= &amp;quot;BG&amp;quot;&lt;br /&gt;
&lt;br /&gt;
or simply you can add by hand this line in all the other &#039;&#039;gw_ppa_GbndX.in&#039;&#039; input files.&lt;br /&gt;
Now we can repeat the same calculations &lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd10.in -J Gbnd10_term&lt;br /&gt;
 $ yambo -F gw_ppa_Gbnd20.in -J Gbnd20_term&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
and collect the new results:&lt;br /&gt;
&lt;br /&gt;
 $ grep 8.000 *term.qp  | awk &#039;{print $4+$5}&#039;&lt;br /&gt;
 $ grep 9.000 *term.qp  | awk &#039;{print $4+$5}&#039; &lt;br /&gt;
&lt;br /&gt;
in a new file called &#039;&#039;Gbnd_conv_terminator.dat&#039;&#039;. Now we can plot the same quantities as before by looking at the effect of having introduced the terminator. &lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:2 w lp t &amp;quot;Valence with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:3 w lp t &amp;quot;Conduction with terminator&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;Gbnd_conv.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;, &amp;quot;Gbnd_conv_terminator.dat&amp;quot; u 1:($3-$2) w lp t &amp;quot;Gap with terminator&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Effect of the terminator in convergence of QP energies with respect sum over states&amp;quot;&amp;gt;&lt;br /&gt;
File:val_t.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique &amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
File:cond_t.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; with and without the terminator technique&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:gap_t.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
* The convergence with respect to &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt; is accelerated in particular for the single quasiparticle states.&lt;br /&gt;
* From the plot above we can see that &amp;lt;code&amp;gt;[[Variables#GbndRange|GbndRange]]&amp;lt;/code&amp;gt;=40 is sufficient to have a converged gap&lt;br /&gt;
&lt;br /&gt;
===Beyond the plasmon pole approximation: a full frequency approach - real axis integration===&lt;br /&gt;
All the calculations performed up to now were based on the plasmon pole approximation (PPA). Now we remove this approximation by evaluating numerically the frequency integral in the expression of the correlation self-energy (Σc). To this aim we need to evaluate the screening for a number of frequencies in the interval depending on the electron-hole energy difference (energy difference between empty and occupied states) entering in the sum over states. &lt;br /&gt;
Let&#039;s build the input file for a full frequency calculation by simply typing:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff.in -g n &lt;br /&gt;
&lt;br /&gt;
and we can set the variable studied up to now at their converged value:&lt;br /&gt;
&lt;br /&gt;
 %[[Variables#BndsRnXd|BndsRnXd]]&lt;br /&gt;
 1 | 30 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#NGsBlkXd|NGsBlkXd]]=3 Ry&lt;br /&gt;
 %[[Variables#GbndRange|GbndRange]]&lt;br /&gt;
 1 | 40 |&lt;br /&gt;
 %&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]=40 Ry&lt;br /&gt;
 % [[Variables#LongDrXd|LongDrXd]] &lt;br /&gt;
 1.000000 | 1.000000 | 1.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 %QPkrange                      # # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and next vary in different files (name them &#039;&#039;gw_ff10.in&#039;&#039; etc.) the number of frequencies we evaluate for the screened coulomb potential. This is done by setting the values of [[Variables#ETStpsXd|ETStpsXd]]=10 , 50 , 100, 150, 200, 250. &lt;br /&gt;
You can also run the the [[bash_scripts|generate_inputs_3.sh]] bash script to generate the required input files.&lt;br /&gt;
&lt;br /&gt;
Next launch yambo:&lt;br /&gt;
 $ yambo -F gw_ff10.in -J ff10&lt;br /&gt;
 $ yambo -F gw_ff50.in -J ff50&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Clearly as we are evaluating the screening for a large number of frequencies these calculations will be heavier than the case above where the calculation of the screening was done for only two frequencies  (zero and plasmon-pole). &lt;br /&gt;
As before, collect the valence and conduction bands as a function of the number of frequencies in a file called &#039;&#039;gw_ff.dat&#039;&#039; and plot the behaviour of the conduction and valence bands and the gap.&lt;br /&gt;
 &lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:2  w lp t &amp;quot;Valence&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:3  w lp t &amp;quot;Conduction&amp;quot;&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;gw_ff.dat&amp;quot; u 1:($3-$2)  w lp t &amp;quot;Gap&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines widths=500px heights=500px perrow=2 caption=&amp;quot;Real axis integration, convergences with respect the used number of frequencies&amp;quot;&amp;gt;&lt;br /&gt;
File:ff_v.png|Valence band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt;&lt;br /&gt;
File:ff_c.png|Conduction band energy wrt &amp;lt;code&amp;gt;[[Variables#ETStpsXd|ETStpsXd]]&amp;lt;/code&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ff_g.png|center|600px|caption]]&lt;br /&gt;
&lt;br /&gt;
We can see that:&lt;br /&gt;
&lt;br /&gt;
* Oscillations are still present, indicating that even more frequencies have to be considered. In general, a real-axis calculation is very demanding. &lt;br /&gt;
* The final result of the gap obtained up to now does not differ too much from the one obtained at the plasmon-pole level (~50 meV)&lt;br /&gt;
&lt;br /&gt;
===Secant Solver===&lt;br /&gt;
&lt;br /&gt;
The real axis integration permits also to go beyond the linear expansion to solve the quasi particle equation. &lt;br /&gt;
The QP equation is a non-linear equation whose solution must be found using a suitable numerical algorithm. &lt;br /&gt;
[[File:Eqp_sec.png|none|x22px|caption]] &lt;br /&gt;
The mostly used, based on the linearization of the self-energy operator is the Newton method that is the one we have used up to now. &lt;br /&gt;
Yambo can also perform a search of the QP energies using a non-linear iterative method based on the [https://en.wikipedia.org/wiki/Secant_method Secant iterative Method].&lt;br /&gt;
&lt;br /&gt;
In numerical analysis, the secant method is a root-finding algorithm that uses a succession of roots of secant lines to better approximate a root of a function &#039;&#039;f&#039;&#039;. The secant method can be thought of as a finite difference approximation of Newton&#039;s method. &lt;br /&gt;
The equation that defines the secant method is: &lt;br /&gt;
&lt;br /&gt;
[[File:secant_eq.png|none|x35px|caption]] &lt;br /&gt;
&lt;br /&gt;
The first two iterations of the secant method are shown in the following picture. The red curve shows the function f and the blue lines are the secants.&lt;br /&gt;
&lt;br /&gt;
[[File:Secant_method.png|center|250px|caption]] &lt;br /&gt;
&lt;br /&gt;
To see if there is any non-linear effect in the solution of the Dyson equation we compare the result of the calculation using the Newton solver as done before with the present case. &lt;br /&gt;
In order to use the secant method you need to edit one of the the previous &#039;&#039;gw_ffN.in&#039;&#039; files e.g. &#039;&#039;gw_ff100.in&#039;&#039; and substitute:&lt;br /&gt;
&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;&lt;br /&gt;
to &lt;br /&gt;
 DysSolver= &amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Repeat the calculations in the same way as before:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ff100.in -J ff100&lt;br /&gt;
&lt;br /&gt;
Note than now the screening will &#039;&#039;not&#039;&#039; be calculated again as it has been stored in the &#039;&#039;ffN&#039;&#039; directories as can be seen in the report file:&lt;br /&gt;
&lt;br /&gt;
 [05] Dynamical Dielectric Matrix&lt;br /&gt;
 ================================&lt;br /&gt;
 [RD./ff10//ndb.em1d]----&lt;br /&gt;
 ...&lt;br /&gt;
 [RD./ff10//ndb.em1d_fragment_1]--------------&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Comparing the output files, e.g. for the case with 100 freqs:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp&#039;&#039;  &#039;&#039;&#039;Newton Solver:&#039;&#039;&#039;&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08708      2.91254 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.421968    -3.417357 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;o-ff100.qp_01&#039;&#039; &#039;&#039;&#039;Secant Solver:&#039;&#039;&#039;&lt;br /&gt;
 #&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
   7.00000   8.00000   -0.41188   -0.08715      2.93518 &lt;br /&gt;
   7.00000   9.00000   3.877976   1.401408    -3.731649 &lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
From the comparison, we see that the effect is of the order of 20 meV, of the same order of magnitude of the accuracy of the GW calculations.&lt;br /&gt;
&lt;br /&gt;
==Step 3: Interpolating Band Structures==&lt;br /&gt;
Up to now we have checked convergence for the gap. Now we want to calculate the quasiparticle corrections across the Brillouin zone in order to visualize the entire band structure along a path connecting high symmetry points.&lt;br /&gt;
&lt;br /&gt;
To do that we start by calculating the QP correction in the plasmon-pole approximation for all the k points of our sampling and for a number of bands around the gap. You can use a previous input file or generate a new one: &amp;lt;code&amp;gt; yambo -F gw_ppa_all_Bz.in -x -p p -g n &amp;lt;/code&amp;gt; and set the parameters found in the previous tests:&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  40        Ry &lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 30 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3            Ry    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp= 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and we calculate it for all the available kpoints by setting:&lt;br /&gt;
 %QPkrange                    # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1| 14|  6|11|&lt;br /&gt;
 %&lt;br /&gt;
 &lt;br /&gt;
Note that as we have already calculated the screening with these parameters you can save time and use that database either by running in the previous directory by using &amp;lt;code&amp;gt; -J 30b_3Ry &amp;lt;/code&amp;gt; or if you prefer to put the new databases in the new all_Bz directory you can create a new directory and copy there the screening databases:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir all_Bz &lt;br /&gt;
 $ cp ./30b_3Ry/ndb.pp* ./all_Bz/&lt;br /&gt;
&lt;br /&gt;
and launch the calculation:&lt;br /&gt;
&lt;br /&gt;
 $ yambo -F gw_ppa_all_Bz.in -J all_Bz&lt;br /&gt;
&lt;br /&gt;
Now we can inspect the output and see that it contains the correction for all the k points for the bands we asked:&lt;br /&gt;
&lt;br /&gt;
 #  K-point    Band       Eo         E-Eo       Sc|Eo&lt;br /&gt;
 #&lt;br /&gt;
    1.000000     6.000000    -1.299712    -0.219100     3.788044&lt;br /&gt;
    1.000000     7.000000    -1.296430    -0.241496     3.788092&lt;br /&gt;
    1.000000     8.000000    -1.296420    -0.243115     3.785947&lt;br /&gt;
    1.000000     9.000000     4.832399     0.952386    -3.679259&lt;br /&gt;
    1.00000     10.00000     10.76416      2.09915     -4.38743&lt;br /&gt;
    1.00000     11.00000     11.36167      2.48053     -3.91021&lt;br /&gt;
....&lt;br /&gt;
By plotting some of the &#039;o-all_Bz.qp&amp;quot; columns it is possible to discuss some physical properties of the hBN QPs. Using columns 3 and (3+4), ie plotting the GW energies with respect to the LDA energies we can deduce the band gap renormalization and the stretching of the conduction/valence bands:&lt;br /&gt;
&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-all_Bz.qp&amp;quot; u 3:($3+$4) w p  t &amp;quot;Eqp vs Elda&amp;quot; &lt;br /&gt;
&lt;br /&gt;
[[File:EqpvE0.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
Essentially we can see that the effect of the GW self-energy is the opening of the gap and a linear stretching of the conduction/valence bands that can be estimated by performing a linear fit of the positive and negative energies (the zero is set at top of the valence band). &lt;br /&gt;
&lt;br /&gt;
In order to calculate the band structure, however, we need to interpolate the values we have calculated above on a given path. In Yambo the interpolation is done by the executable &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; (Yambo Post Processing).&lt;br /&gt;
By typing: &lt;br /&gt;
 $ ypp -H  &lt;br /&gt;
you will recognize that in order to interpolate the bands we need to build a ypp input file using&lt;br /&gt;
 $ ypp -s b&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Before editing the &#039;&#039;ypp.in&#039;&#039; input file and running the interpolation, it is important to know that &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; uses an algorithm &amp;lt;ref&amp;gt; Warren E. Pickett, Henry Krakauer, and Philip B. Allen Phys. Rev. B 38, 2721 &amp;lt;/ref&amp;gt;  that cannot be used in presence of time-reversal (TR) symmetry. &lt;br /&gt;
As a first step we therefore remove the TR symmetry by typing:&lt;br /&gt;
&lt;br /&gt;
 $ ypp -y&lt;br /&gt;
&lt;br /&gt;
and we uncomment the corresponding line to remove the TR.&lt;br /&gt;
&lt;br /&gt;
 fixsyms                      # [R] Reduce Symmetries&lt;br /&gt;
 #RmAllSymm                   # Remove all symmetries&lt;br /&gt;
 #RmTimeRev                   # Remove Time Reversal&lt;br /&gt;
&lt;br /&gt;
and launch&lt;br /&gt;
 &lt;br /&gt;
 $ ypp&lt;br /&gt;
&lt;br /&gt;
This will create a new directory called &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; where a &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory containing the electronic structure in the absence of TR is present. &lt;br /&gt;
We will calculate the band structure in the &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
 $ cd FixSymmm&lt;br /&gt;
&lt;br /&gt;
After having performed the usual setup&lt;br /&gt;
&lt;br /&gt;
 $yambo&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
we can generate the input for the band interpolation:&lt;br /&gt;
&lt;br /&gt;
 $ypp -s b -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
and edit the &#039;&#039;ypp_bands.in&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 electrons                    # [R] Electrons (and holes)&lt;br /&gt;
 bnds                         # [R] Bands&lt;br /&gt;
 INTERP_mode= &amp;quot;NN&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach) &lt;br /&gt;
 OutputAlat= 4.716000           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;     &lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   1 | 100 |                   # Number of bands&lt;br /&gt;
 %&lt;br /&gt;
 % INTERP_Grid&lt;br /&gt;
 -1 |-1 |-1 |                             # Interpolation BZ Grid&lt;br /&gt;
 %&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 CIRCUIT_E_DB_path= &amp;quot;none&amp;quot;      # SAVE obtained from the QE `bands` run (alternative to %BANDS_kpts)&lt;br /&gt;
 BANDS_path= &amp;quot;&amp;quot;                 # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 10  &lt;br /&gt;
 #BANDS_built_in                # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts   &lt;br /&gt;
 % &lt;br /&gt;
&lt;br /&gt;
We modify the following lines:&lt;br /&gt;
 BANDS_steps=30&lt;br /&gt;
 % BANDS_bands&lt;br /&gt;
   6 | 11 |                   # Number of bands &lt;br /&gt;
 %&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.00000 |0.00000 |0.00000 |&lt;br /&gt;
  0.50000 |-.50000 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.00000 |&lt;br /&gt;
  0.33300 |-.66667 |0.50000 |&lt;br /&gt;
  0.00000 |0.00000 |0.50000 |&lt;br /&gt;
  0.50000 |-.50000 |0.50000 |&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
which means we assign 30 points in each segment, we ask to interpolate 3 occupied and 3 empty bands and we assign the following path passing from the high symmetry points: K Γ M K H A L.&lt;br /&gt;
Launching:&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
will produce the output file &#039;&#039;o.bands_interpolated&#039;&#039; containing:&lt;br /&gt;
&lt;br /&gt;
                 &lt;br /&gt;
 #&lt;br /&gt;
 #   |k|        b6         b7         b8         b9         b10        b11        kx         ky         kz&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
     0.00000   -7.22092   -0.13402   -0.13395    4.67691    4.67694   10.08905    0.33300   -0.66667    0.00000&lt;br /&gt;
     0.03725   -7.18857   -0.17190   -0.12684    4.66126    4.71050   10.12529    0.32190   -0.64445    0.00000&lt;br /&gt;
...&lt;br /&gt;
 &lt;br /&gt;
and we can plot the bands using gnuplot:&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o.bands_interpolated&amp;quot; u 0:2 w l, &amp;quot;o.bands_interpolated&amp;quot; u 0:3 w l, ...&lt;br /&gt;
&lt;br /&gt;
[[File:bands_lda.png|center|350px|caption]] &lt;br /&gt;
&lt;br /&gt;
and you can recognize the index of the high symmetry point by inspecting the last three columns.&lt;br /&gt;
Note that up to now we have interpolated the LDA band structure. In order to plot the GW band structure, we need to tell &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; in the input file where the &#039;&#039;ndb.QP&#039;&#039; database is found. This is achieved by adding in the &#039;&#039;ypp_bands.in&#039;&#039; file the line:&lt;br /&gt;
&lt;br /&gt;
  GfnQPdb= &amp;quot;E &amp;lt; ./all_Bz/ndb.QP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and relaunch &lt;br /&gt;
&lt;br /&gt;
 $ ypp -F ypp_bands.in&lt;br /&gt;
&lt;br /&gt;
Now the file &#039;&#039;o.bands_interpolated_01&#039;&#039; contains the GW interpolated band structure. We can plot the LDA and GW band structure together by using the gnuplot script [[gnuplot_scripts|bands.gnu]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=nolines  widths=500px heights=500px  perrow=2 caption=&amp;quot;Band strcuture of bulk hBN&amp;quot;&amp;gt;&lt;br /&gt;
File:hBN_bands.png| LDA and GW bands structure &lt;br /&gt;
File:hBN_bands_lit.png| LDA and GW bands structure from Ref. &amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*As expected the effect of the GW correction is to open the gap.&lt;br /&gt;
*Comparing the obtained band structure with the one found in the literature by Arnaud and coworkers &amp;lt;ref name=&amp;quot;Arnaud&amp;quot;&amp;gt; B. Arnaud, S. Lebegue,P. Rabiller, and M. Alouani Phys, Rev. Lett. 96, 026402 (2006)&amp;lt;/ref&amp;gt; we found a very nice qualitative agreement. &lt;br /&gt;
*Quantitatively we found a smaller gap: about 5.2 eV (indirect gap), 5.7 eV (direct gap) while in Ref.&amp;lt;ref name=&amp;quot;Arnaud&amp;quot; /&amp;gt;  is found  5.95 eV for the indirect gap and a minimum direct band gap of 6.47 eV. Other values are also reported in the literature depending on the used pseudopotentials, starting functional and type of self-consistency (see below). &lt;br /&gt;
*The present tutorial has been done with a small k point grid which is an important parameter to be checked, so convergence with respect the k point sampling has to be validated.&lt;br /&gt;
&lt;br /&gt;
==Step 4: Summary of the convergence parameters==&lt;br /&gt;
We have calculated the band structure of hBN starting from a DFT calculation, here we summarize the main variable we have checked to achieve convergence:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;[[Variables#EXXRLvcs|EXXRLvcs]]&amp;lt;/code&amp;gt; # [XX] Exchange RL components&lt;br /&gt;
Number of G-vectors in the exchange. This number should be checked carefully. Generally a large number is needed as the QP energies show a slow convergence. The calcualtion of the exchange part is rather fast. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#BndsRnXp|BndsRnXp]]&amp;lt;/code&amp;gt; #[Xp] Polarization function bands&lt;br /&gt;
Number of bands in the independent response function form which the dielectric matrix is calculated. Also this paramater has to be checked carefully,together with NGsBlkXp as the two variables are interconnected&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#NGsBlkXp|NGsBlkXp]]&amp;lt;/code&amp;gt;  # [Xp] Response block size&lt;br /&gt;
Number of G-vectors block in the dielectric constant. Also this paramater has to be checked carefully, to be checked together with BndsRnXp. A large number of bands and block can make the calculation very demanding.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]] &amp;lt;/code&amp;gt; # [Xp] [cc] Electric Field&lt;br /&gt;
Direction of the electric field for the calculation of the q=0 component of the dielectric constant e(q,w). In a bulk can be set to (1,1,1), attention must be paid for non 3D systems.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]] &amp;lt;/code&amp;gt; # [Xp] Plasmon pole imaginary energy: this is the second frequency used to fit the Godby-Needs plasmon-pole model (PPM). If results depend consistently by changing this frequency, the PPM is not adequate for your calculation and it is need to gp beyond that, e.g. Real-axis. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GbndRnge|GbndRnge]] &amp;lt;/code&amp;gt; # [GW] G[W] bands range&lt;br /&gt;
Number of bands used to expand the Green&#039;s function. This number is usually larger than the number of bands used to calculated the dielectricconstant. Single quasiparticle energies converge slowly with respect GbndRnge, energy difference behave better. You can use terminator technique to mitigate the slow dependence. &lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GDamping|GDamping]] &amp;lt;/code&amp;gt; # [GW] G[W] damping&lt;br /&gt;
Small damping in the Green&#039;s function definition, the delta &lt;br /&gt;
parameter. The final result shouuld not depend on that, usually set at 0.1 eV&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#dScStep|dScStep]] &amp;lt;/code&amp;gt; # [GW] &lt;br /&gt;
Energy step to evaluate Z factors&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#DysSolver|DysSolver]] &amp;lt;/code&amp;gt; # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
Parameters related to the  solution of the Dyson equation, &amp;quot;n&amp;quot; Newton linearization, &#039;s&#039; non linear secant method&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#GTermKind|GTermKind]] &amp;lt;/code&amp;gt; [GW] GW terminator &lt;br /&gt;
Terminator for the self-energy&amp;lt;ref name=&amp;quot;BG&amp;quot; /&amp;gt; . We have seen how this spped up the convergence with respect empty bands.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;[[Variables#%QPkrange |QPkrange ]] &amp;lt;/code&amp;gt; # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
K-points and band range where you want to calculate the GW correction. The syntax is&lt;br /&gt;
first kpoint | last kpoint | first band | last band&lt;br /&gt;
&lt;br /&gt;
==Step 5: Eigenvalue only self-consistent evGW0 and evGW (only available in Yambo 4.6) ==&lt;br /&gt;
Here we want to see how we can compute an eigenvalue only evGW0 or evGW correction in Yambo. In the new version of Yambo there are two flags for these kind of self-consistency: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWoIter]]&amp;lt;/code&amp;gt;  number of GW0 iterations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Variables#GWoIter|GWIter]]&amp;lt;/code&amp;gt;  number of GW iterations&lt;br /&gt;
&lt;br /&gt;
you can set one of them to 10 for example, the code will stop when convergence is reached, usually in less than 5 iterations.&lt;br /&gt;
For example if you consider the input file below:&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 % &lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GWoIter=0                    # [GW] GWo self-consistent (evGWo) iterations on eigenvalues&lt;br /&gt;
 GWIter =0                    # [GW] GW  self-consistent (evGW)  iterations on eigenvalues&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  1|  14|  7|  10|&lt;br /&gt;
 % &lt;br /&gt;
if you set both GWIter and GWoIter to zero you get a gap correction of 4.15 eV.&lt;br /&gt;
If you perform self-consistency on G (GWoIter/=)  &lt;br /&gt;
the gap will be 4.713 eV and finally if you perform &lt;br /&gt;
self-consistency in both G and W (GWIter /=0) the gap will be  5.506 eV.&lt;br /&gt;
&lt;br /&gt;
Notice that these values are absolutelly not converged because we used very few&lt;br /&gt;
bands and a small block size.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note that the final result of the self-consistent GW may&lt;br /&gt;
depend from the number of bands you decide to correct, because they are used&lt;br /&gt;
to reconstruct G and W. For the non-corrected bands Yambo applied a rigid shift&lt;br /&gt;
of their energy based on the closed corrected band.&lt;br /&gt;
&lt;br /&gt;
==Step 6: A better integration of the q=0 point ==&lt;br /&gt;
&lt;br /&gt;
The integration of the q=0 of the Coulomb potential is problematic because the 1/q diverges.&lt;br /&gt;
Usually in Yambo this integration is performed analytically in a small sphere around q=0.&lt;br /&gt;
&lt;br /&gt;
[[File:Circle box.gif|center|frame]]&lt;br /&gt;
&lt;br /&gt;
however in this way the code lost part of the integral out of the circle. This usually &lt;br /&gt;
is not problematic because for a large number of q and k point the missing term goes to zero.&lt;br /&gt;
However in system that requires few k-points or even only the gamma one, it is possible&lt;br /&gt;
to perform a better integration of this term by adding the flag -r to generate the input&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&lt;br /&gt;
&amp;gt; 3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1&amp;lt;/span&amp;gt;            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;) &lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
in this input  &amp;lt;code&amp;gt;[[Variables#RandGvec|RandGvec]]&amp;lt;/code&amp;gt; is the component of the Coulomb potential we want integrate numerically,&lt;br /&gt;
in this case only the first one G=G&#039;=0, and &amp;lt;code&amp;gt;[[Variables#RandQpts|RandQpts]]&amp;lt;/code&amp;gt; is the number of random points&lt;br /&gt;
used to perform the integral by Monte Carlo.&lt;br /&gt;
&lt;br /&gt;
If you turn one this integration you will get a slightly different band gap,&lt;br /&gt;
but in the limit of large k points the final results will be the same of the standard method.&lt;br /&gt;
&lt;br /&gt;
However this correction is important for systems that converge with few k-points or with gamma only.&lt;br /&gt;
&lt;br /&gt;
==Step 7: Taking into account the material anisotropy (only available in Yambo 4.6) ==&lt;br /&gt;
&lt;br /&gt;
Hexagonal Boron Nitride is an anisotropic material so there is the question in which direction&lt;br /&gt;
one shold calculate the dielectric constant the enters in the GW. &lt;br /&gt;
If you run again this tutorial changing the direction of the q=0 point in GW calculation,&lt;br /&gt;
the variable &amp;lt;code&amp;gt;[[Variables#LongDrXp|LongDrXp]]&amp;lt;/code&amp;gt;, you will realize that the there gap correction changes.&lt;br /&gt;
In Yambo there is a way to take into account this anisitropy of the dielectri tensor.&lt;br /&gt;
&lt;br /&gt;
First of all you need to calculate the dielectric constant in the three cartesian directions with the command &amp;lt;code&amp;gt; yambo -o c -k hartree&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 optics                         # [R] Linear Response optical properties&lt;br /&gt;
 kernel                         # [R] Kernel&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;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 NGsBlkXd= 3000        mRy      # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
   1 | 1 |                       # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
    1 | 100 |                   # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   0.00000 | 10.00000 | eV      # [Xd] Energy range &lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 1                    # [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;
&lt;br /&gt;
In the output file &amp;lt;code&amp;gt; o.eps_q1_inv_rpa_dyson&amp;lt;/code&amp;gt; you will find the real-part of the inverse dielectric matrix, in this case 5.044076.&lt;br /&gt;
&lt;br /&gt;
Repeat this calculation with the field in the other two directions y and z. The y-direction will be equal to x, while in z the dielectric constant will be 2.872451.&lt;br /&gt;
&lt;br /&gt;
Now generate a new input file for the GW, with the command &amp;lt;code&amp;gt; yambo -g n -p p -r -V RL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 HF_and_locXC                 # [R XX] Hartree-Fock Self-energy and Vxc&lt;br /&gt;
 ppa                          # [R Xp] Plasmon Pole Approximation&lt;br /&gt;
 gw0                          # [R GW] GoWo Quasiparticle energy levels&lt;br /&gt;
 rim_cut                      # [R] Coulomb potential&lt;br /&gt;
 em1d                         # [R Xd] Dynamical Inverse Dielectric Matrix&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&amp;gt;3000000&amp;lt;/span&amp;gt;                     # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1            RL      # [RIM] Coulomb interaction RS components&lt;br /&gt;
 #QpgFull                       # [F RIM] Coulomb interaction: Full matrix&lt;br /&gt;
 % Em1Anys&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.044076 &amp;lt;/span&amp;gt;    | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.044076 &amp;lt;/span&amp;gt;    |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 2.872451 &amp;lt;/span&amp;gt;  |        # [RIM] X Y Z Static Inverse dielectric matrix&lt;br /&gt;
 %&lt;br /&gt;
 IDEm1Ref= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1&amp;lt;/span&amp;gt;  &lt;br /&gt;
 EXXRLvcs = 40.000     mRy    # [XX] Exchange RL components&lt;br /&gt;
 VXCRLvcs = 3187        RL      # [XC] XCpotential RL components&lt;br /&gt;
 Chimod= &amp;quot;Hartree&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
   1 | 10 |                 # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 1000          mRy    # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp = 27.21138     eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 %GbndRnge&lt;br /&gt;
   1 | 40 |                 # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GDamping=  0.10000     eV    # [GW] G[W] damping&lt;br /&gt;
 dScStep=  0.10000      eV    # [GW] Energy step to evaluate Z factors&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;               # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
  7|  7|  8|  9|&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
run the calculations and you will find a correction of the gap intermediate between the one with the field in x and z directions.&lt;br /&gt;
&lt;br /&gt;
==Step 8: Exercise: Convergence with respect K points==&lt;br /&gt;
As an exercise now you can check the convergence with respect the K point sampling:&lt;br /&gt;
# perform a new non-scf calculation with a bigger k point grid: 9x9x3 and 12x12x4 ...&lt;br /&gt;
# convert wave functions and electronic structure to Yambo databases in a different directory as explained in the [[Bulk material: h-BN|DFT and p2y module]], &lt;br /&gt;
# [[initialization |Initialize]] the Yambo databases,&lt;br /&gt;
# Redo the steps explained in this section (exchange self energy, plasmon pole GW, band structure interpolation)&lt;br /&gt;
# The PPA-GW calculation using 12x12x4 grid depending on your machine can take several minutes in serial mode. You can think to perform the exercise after having learned some basic on the parallelization strategy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width:100%&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|style=&amp;quot;width:15%; text-align:left&amp;quot;|Prev: [[Tutorials|Tutorials Home]] &lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center&amp;quot;|Now: [[Tutorials|Tutorials Home]] --&amp;gt; [[How_to_obtain_the_quasi-particle_band_structure_of_a_bulk_material:_h-BN|GW]] &lt;br /&gt;
|style=&amp;quot;width:35%; text-align:right&amp;quot;|Next: If you did everything, choose another tutorial in the menu&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Claudio</name></author>
	</entry>
</feed>