<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.lumen-code.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Davide</id>
	<title>Lumen wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.lumen-code.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Davide"/>
	<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Special:Contributions/Davide"/>
	<updated>2026-10-15T11:04:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1055</id>
		<title>Exciton-phonon coupling and luminescence - Yambo postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1055"/>
		<updated>2026-10-10T21:34:34Z</updated>

		<summary type="html">&lt;p&gt;Davide: section title changed (added step 9 before)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is part 2 of the tutorial on exciton-phonon coupling&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot;/&amp;gt; (yambo version). You should have arrived here from part 1:&lt;br /&gt;
[[Exciton-phonon_coupling_and_luminescence| Exciton-phonon coupling and luminescence in hBN (part 1)]]&lt;br /&gt;
&lt;br /&gt;
== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
TODO:&amp;lt;br&amp;gt;&lt;br /&gt;
- manually run letzelphc&amp;lt;br&amp;gt;&lt;br /&gt;
- use the fortran converter&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. In this version of the tutorial we present the latter case.&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k,0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have to write a new yambo input, that we can call &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt;, for this. You can copy (and adapt) the one below, or you can generate one by running from the command line:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -excph o&lt;br /&gt;
&lt;br /&gt;
This generates an input to compute luminescence (&amp;quot;o&amp;quot; is for &amp;quot;optics&amp;quot;). The variables that we are interested in are:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse_Lfull&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 9 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
In this input, we have to select the initial exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcStates&amp;lt;/code&amp;gt;, the final exciton states &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcSum&amp;lt;/code&amp;gt; and the phonon modes &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ElPhModes&amp;lt;/code&amp;gt;. Here we consider the first four states at &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; (corresponding to just two excitons because they are both doubly degenerate -- do not break degeneracies when selecting states!) and the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point. We also include all the nine phonon modes of monolayer MoS2.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;LoutPath&amp;lt;/code&amp;gt;? This variable controls the directory where the databases for the final-state excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is located, which can be different from the directory with the initial-state excitons &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; read as usual with the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; option when running the code. This makes it possible to compute the coupling between different exciton kinds. However, for our tutorial, we stick with the previously computed &amp;lt;code&amp;gt;Lfull&amp;lt;/code&amp;gt; in both cases.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lfull -C excph&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;ndb.excph*&amp;lt;/code&amp;gt; databases in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph_yambo_ph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases using the &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt; from yambopy. &lt;br /&gt;
You can find this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# A: 2,3 -- B: 6,7&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ndb_exc=f&#039;{path}/excph&#039;&lt;br /&gt;
  &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1),Expand=True)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read exc-ph databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 X = YamboExcitonPhononDB(ylat,save_excph=ndb_exc)&lt;br /&gt;
 print(X)&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is defined inside the plotting function as&lt;br /&gt;
&lt;br /&gt;
 G_squared = excph.excph_sq&lt;br /&gt;
 G2plt = np.zeros(len(G_squared))&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use the default scatterplot provided by &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 excph.plot_excph(F_q,plt_cbar=plt_cbar,**kwargs)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon. In addition, we can calculate the renormalization of the &amp;quot;direct&amp;quot; exciton recombination, due to the appearance of the satellites. However, in order to model both phonon replicas (satellites) and main peak renormalization, we pay the price of approximating the replicas oscillator strength. In the yambopy postprocessing, currently we do not compute peak renormalization but rather we calculate the full expression for the satellites. &lt;br /&gt;
&lt;br /&gt;
The luminescence expression implemented in Yambo comes from the first-order exciton-phonon response function adapted using the Van Roosbroeck-Shockley relation. It employs the diagonal exciton-phonon self-energy only, so that we can call this &amp;quot;exciton-quasiparticle approximation&amp;quot;.&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{PL}(\omega)=I^{(0)}(\omega)+I^{Sat}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first-order renormalised direct part is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{(0)}(\omega)=-\omega \sum_\alpha \omega^2 \frac{|D_\alpha|^2 [1-R_\alpha^{em}(T)-R^{abs}_\alpha (T)]N_\alpha^{exc}(T_{exc})}{\omega - E_\alpha +\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The satellite parts are (phonon absorption | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,abs}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{ \frac{1}{N_q}\frac{(\omega-2\Omega_{\mu q})^2 |D_\alpha |^2 T^{em}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})n_{\mu q}(T)}{\omega - [E_{\beta q}+\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and (phonon emission | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,em}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{\frac{1}{N_q} \frac{(\omega+2\Omega_{\mu q})^2 |D_\alpha |^2 T^{abs}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})[1+n_{\mu q}(T)]}{\omega - [E_{\beta q}-\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;-factors contain the satellite weights&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T^{em}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}+\Omega_{\mu q}|^2}, \quad T^{abs}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}-\Omega_{\mu q}|^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which, once summed, form the renormalization factors (equal to minus the energy-derivative of the exc-ph self-energy evaluated at the &amp;quot;bare&amp;quot; exciton energy, analogous to GW)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R^{abs}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{em}_{\mu\beta\alpha q}[1+n_{\mu q}(T)], \quad R^{em}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{abs}_{\mu\beta\alpha q}n_{\mu q}(T)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In these expressions, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
The phonon temperature-dependent Bose-Einstein occupation function is &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt;. We include the processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), as well as of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{(1)}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; with yambopy to get the el-ph matrix elements:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 &lt;br /&gt;
&lt;br /&gt;
6. And finally we generate the exciton-phonon input &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;yambo_ph -excph o&amp;lt;/code&amp;gt;. Now, we take a look at all the additional variables that we didn&#039;t check before, specifying also the details for luminescence the spectrum calculation.&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ExcPhOptics                      # [R][EXCPH] Exciton-Phonon Optics&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp=10.000000         Kn    # Bosonic Temperature&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EXCTemp= 10.000000          Kn    # [EXCPH] Excitonic Temperature (for luminescence spectra)&amp;lt;/span&amp;gt;&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
  1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse-L_full&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 EXCPHdEtresh= 0.100000E-5  eV    # [ELPH] Energy treshold for exc-ph denominator&lt;br /&gt;
 LDamping= 0.500000E-3      eV    # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# These are the plot parameters, same as in other parts of yambo&amp;lt;/span&amp;gt; &lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   4.00000 | 5.00000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.00500000 | 0.00500000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 4000                    # [Xd] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;BoseTemp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EXCTemp&amp;lt;/code&amp;gt; are the lattice and excitonic temperature, respectively.&lt;br /&gt;
&lt;br /&gt;
Now we run the calculation with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;. Here, we read as &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; excitons with &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; the ones without the long-range Coulomb exchange:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lbar -C excph&lt;br /&gt;
&lt;br /&gt;
and we find our outputs in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory. &lt;br /&gt;
&lt;br /&gt;
NB: Step 6 could have been equivalently run in yambopy, limiting the use of the yambo code to just step 4. This latter option is more flexible, as it allows for a greater degree of control by the user. We are in the last stages of the development and it will be available soon.&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
&lt;br /&gt;
If we check the output directory from the step 6 calculation, we find the &amp;lt;code&amp;gt;o-excph.pl_bse_ph_ass&amp;lt;/code&amp;gt; output files containing the luminescence spectra. We can plot them with gnuplot or any other tool:&lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 &amp;gt; set xrange[4.2:5]&lt;br /&gt;
 &amp;gt; p &#039;o-excph.pl_bse_ph_ass&#039; u 1:2 w l lc rgb &#039;red&#039; lw 3&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence plot.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. The direct recombination peak is completely suppressed. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Step 9: Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo_ph -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: 20.22155 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: 32.95292 meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039;/&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence&amp;diff=1054</id>
		<title>Exciton-phonon coupling and luminescence</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence&amp;diff=1054"/>
		<updated>2026-10-10T21:26:10Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Tdgw-phonon-usc-01-1024x829.jpg|thumb|right|400px|(c) Zhenglu Li, University of Southern California]]&lt;br /&gt;
&lt;br /&gt;
In this advanced tutorial, we will calculate exciton-phonon interactions from first principles by interfacing DFPT (for phonon calculations) and BSE (for exciton calculations).&lt;br /&gt;
&lt;br /&gt;
The DFTP calculations are run with Quantum ESPRESSO, while the many-body GW-BSE calculations are run with Yambo. Finally, the exciton-phonon interaction will be obtained by combining and postprocessing the databases computed in the two previous runs. The great advantage of this workflow is that the calculations can be run in the irreducible Brillouin zones both for the electronic momenta (&#039;&#039;&#039;k&#039;&#039;&#039;) and the transfer momenta (&#039;&#039;&#039;Q&#039;&#039;&#039;, &#039;&#039;&#039;q&#039;&#039;&#039;) of excitons and phonons, thus speeding up considerably the jobs while reducing the IO and memory load.&lt;br /&gt;
&lt;br /&gt;
We will first compute the exciton-phonon coupling matrix elements: these are the building blocks needed to construct experimental observables such as phonon-assisted optical spectra (such as luminescence), Raman spectra and exciton lifetimes. We will do this in the case of monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, a 2D system with large spin-orbit interaction.&lt;br /&gt;
&lt;br /&gt;
As an example of application, we will consider the case of phonon-assisted luminescence. We will do this in the case of bulk hBN, a layered indirect insulator with strong electron-phonon coupling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; this tutorial will be updated when new exc-ph tools become available in Yambopy (including full-python postprocessing, Raman spectra, interpolated lifetimes, etc).&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
This is an advanced topic: we assume that you already know something about the theory&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot; /&amp;gt; and applications&amp;lt;ref name=&amp;quot;paleari2019&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot; /&amp;gt; of exciton-phonon physics. &lt;br /&gt;
&lt;br /&gt;
Also, we assume that you already know how to run both a basic &#039;&#039;&#039;Yambo&#039;&#039;&#039; GW-BSE calculation and a DFPT phonon calculation with &#039;&#039;&#039;Quantum ESPRESSO&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Besides the QE executables &amp;lt;code&amp;gt;pw.x&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ph.x&amp;lt;/code&amp;gt;, we also use the yambo phonon-specific executable &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; and the python utility &#039;&#039;&#039;Yambopy&#039;&#039;&#039;. The auxiliary code &#039;&#039;&#039;LetzElPhC&#039;&#039;&#039; (executable &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt;) will be used to obtain the electron-phonon matrix elements by reading the same electronic wavefunctions used by Yambo (and stored in the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory), while also making full use of crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At this point there will be two options for completing part 2 of the tutorial: &amp;lt;br&amp;gt;&lt;br /&gt;
a) &amp;lt;code&amp;gt;Yambopy&amp;lt;/code&amp;gt; path. [https://github.com/yambo-code/LetzElPhC LetzElPhC] will be run by Yambopy, which will be later also used to handle the electron-phonon databases and compute exciton-pronon couplings and derived quantites.  &amp;lt;br&amp;gt;&lt;br /&gt;
b) &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; path. [https://github.com/yambo-code/LetzElPhC LetzElPhC] will be run as a standalone software, and the elph databases from &amp;lt;code&amp;gt;Letzelphc&amp;lt;/code&amp;gt; converted into &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; format. Finally, the exciton-phonon properties will be computed with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Workflow scheme.png|800px|center]]&lt;br /&gt;
&lt;br /&gt;
== Step 0: Pseudopotentials, equilibrium structure and convergence ==&lt;br /&gt;
&lt;br /&gt;
In a real calculation, it is important to ensure that both the pseudopotential and the lattice parameters that we are using are compatible and perform well for the electronic excited states and for the lattice vibrations simultaneously. Furthermore, you have to make sure that the wave function cutoff &amp;lt;code&amp;gt;ecutwfc&amp;lt;/code&amp;gt; is converged with respect to the DFPT step and not just to the DFT one. This is in addition to the other customary convergence tests for DFT, DFPT, GW and BSE calculations.&lt;br /&gt;
&lt;br /&gt;
This is often the most time-demanding step when starting on a new system.&lt;br /&gt;
&lt;br /&gt;
For the sake of this tutorial, we assume that we have already done all these tests and we are starting the final workflow to get the exciton-phonon properties.&lt;br /&gt;
&lt;br /&gt;
== Step 1: scf calculation ==&lt;br /&gt;
&lt;br /&gt;
First of all, we run a standard scf calculation with &amp;lt;code&amp;gt;pw.x&amp;lt;/code&amp;gt; for Yambo. We stick with non-symmorphic symmetries. At the end, we will have the QE &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
This is the input &amp;lt;code&amp;gt;mos2.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
           wf_collect = .true.,&lt;br /&gt;
          calculation = &amp;quot;scf&amp;quot;,&lt;br /&gt;
            verbosity = &#039;high&#039;,&lt;br /&gt;
           pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
               prefix = &amp;quot;mos2&amp;quot;,&lt;br /&gt;
               outdir = &#039;.&#039;,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;system&lt;br /&gt;
              ecutwfc = 100.0,&lt;br /&gt;
          occupations = &#039;fixed&#039;,&lt;br /&gt;
                ibrav = 4,&lt;br /&gt;
            celldm(1) = 5.9000811881,&lt;br /&gt;
            celldm(3) = 6.7795677253,&lt;br /&gt;
                  nat = 3,&lt;br /&gt;
                 ntyp = 2,&lt;br /&gt;
             lspinorb = .true.&lt;br /&gt;
             noncolin = .true.&lt;br /&gt;
             assume_isolated = &#039;2D&#039;&lt;br /&gt;
         force_symmorphic = .true.&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;electrons&lt;br /&gt;
     electron_maxstep = 200,&lt;br /&gt;
          mixing_beta = 0.7,&lt;br /&gt;
             conv_thr = 1.d-08,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
   ATOMIC_SPECIES&lt;br /&gt;
    Mo  95.940      Mo_ONCV_PBE_FR-1.0.upf&lt;br /&gt;
    S    32.065     S_ONCV_PBE_FR-1.1.upf&lt;br /&gt;
   ATOMIC_POSITIONS { crystal }&lt;br /&gt;
 Mo       0.333333333   0.666666667   0.000000000&lt;br /&gt;
 S        0.666666667   0.333333333   0.073413577&lt;br /&gt;
 S        0.666666667   0.333333333  -0.073413577&lt;br /&gt;
  K_POINTS { automatic }&lt;br /&gt;
 6 6 1 0 0 0&lt;br /&gt;
&lt;br /&gt;
Here we are using full relativistic pseudopotentials from the SG-15 database.&lt;br /&gt;
&lt;br /&gt;
We can run it on our machine (for example using 4 MPI tasks) as:&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp mos2.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
== Step 2: nscf calculation for Yambo ==&lt;br /&gt;
&lt;br /&gt;
Copy the QE &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory from the scf calculation and run the nscf calculation for any number of empty states, with the correct &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;-grid we want to use in Yambo. Here we are using a badly underconverged grid of 6x6x1.&lt;br /&gt;
&lt;br /&gt;
This reciprocal-space grid will also match the momentum transfer &amp;lt;code&amp;gt;q&amp;lt;/code&amp;gt; grid on which excitons and phonons will be defined!&lt;br /&gt;
&lt;br /&gt;
The electronic wavefunctions computed at this step and stored in the new nscf &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory will be used both by Yambo and by the electron-phonon code: this is important because using different sets of wavefunctions would lead to a phase mismatch issue in the exciton-phonon matrix elements.&lt;br /&gt;
&lt;br /&gt;
The nscf input &amp;lt;code&amp;gt;mos2.nscf&amp;lt;/code&amp;gt; is&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
           wf_collect = .true.,&lt;br /&gt;
          calculation = &amp;quot;nscf&amp;quot;,&lt;br /&gt;
            verbosity = &#039;high&#039;,&lt;br /&gt;
           pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
               prefix = &amp;quot;mos2&amp;quot;,&lt;br /&gt;
               outdir = &#039;.&#039;,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;system&lt;br /&gt;
              ecutwfc = 100.0,&lt;br /&gt;
          occupations = &#039;fixed&#039;,&lt;br /&gt;
                ibrav = 4,&lt;br /&gt;
            celldm(1) = 5.9000811881,&lt;br /&gt;
            celldm(3) = 6.7795677253,&lt;br /&gt;
                  nat = 3,&lt;br /&gt;
                 ntyp = 2,&lt;br /&gt;
             lspinorb = .true.&lt;br /&gt;
             noncolin = .true.&lt;br /&gt;
                nbnd  = 250&lt;br /&gt;
             assume_isolated = &#039;2D&#039;&lt;br /&gt;
         force_symmorphic = .true.&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;electrons&lt;br /&gt;
     electron_maxstep = 200,&lt;br /&gt;
          mixing_beta = 0.7,&lt;br /&gt;
             conv_thr = 1.d-08,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
   ATOMIC_SPECIES&lt;br /&gt;
    Mo  95.940      Mo_ONCV_PBE_FR-1.0.upf&lt;br /&gt;
    S    32.065     S_ONCV_PBE_FR-1.1.upf&lt;br /&gt;
   ATOMIC_POSITIONS { crystal }&lt;br /&gt;
 Mo       0.333333333   0.666666667   0.000000000&lt;br /&gt;
 S        0.666666667   0.333333333   0.073413577&lt;br /&gt;
 S        0.666666667   0.333333333  -0.073413577&lt;br /&gt;
  K_POINTS { automatic }&lt;br /&gt;
 6 6 1 0 0 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Again, we run the calculation&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp mos2.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
== Step 3: dvscf phonon calculation ==&lt;br /&gt;
&lt;br /&gt;
Now we run the phonon calculation.&lt;br /&gt;
&lt;br /&gt;
Copy the &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory from the &#039;&#039;&#039;scf&#039;&#039;&#039; calculation and run &amp;lt;code&amp;gt;ph.x&amp;lt;/code&amp;gt; for a dvscf calculation with a standard &amp;lt;code&amp;gt;q&amp;lt;/code&amp;gt;-grid matching the &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;-grid we wanna use in Yambo.&lt;br /&gt;
&lt;br /&gt;
At the end, we will have the &amp;lt;code&amp;gt;_ph0&amp;lt;/code&amp;gt; directory containing the variation of the self-consistent potential, &amp;lt;math&amp;gt;\Delta V_{SCF}(q)&amp;lt;/math&amp;gt;, and the &amp;lt;code&amp;gt;*.dyn&amp;lt;/code&amp;gt; files with the phonon energies and eigenvectors.&lt;br /&gt;
&lt;br /&gt;
NB: one could further refine the phonon energies by enforcing the acoustic sum rule, including non-analytic long-range contributions, interpolating to finer grids... all of this can be done within Quantum ESPRESSO and will not be covered in this version of the tutorial.&lt;br /&gt;
&lt;br /&gt;
The input is &amp;lt;code&amp;gt;mos2.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
 mos2_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;mos2&#039;,&lt;br /&gt;
   fildvscf = &#039;mos2-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;mos2.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=1&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
And now we run as&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 ph.x -inp mos2.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
This time we use nohup and more processes because this calculation may take some time. It is a good idea to set &amp;lt;code&amp;gt;recover=.true.&amp;lt;/code&amp;gt; as in a real calculation you will easily breach walltime, and in this way you can safely restart.&lt;br /&gt;
&lt;br /&gt;
== Step 4: create Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory ==&lt;br /&gt;
&lt;br /&gt;
This is just the standard Yambo initialization: run &lt;br /&gt;
 &lt;br /&gt;
 p2y &lt;br /&gt;
&lt;br /&gt;
and then &lt;br /&gt;
&lt;br /&gt;
 yambo &lt;br /&gt;
&lt;br /&gt;
in the &#039;&#039;&#039;nscf&#039;&#039;&#039; &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; folder and then move the newly generated &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory to a convenient place.&lt;br /&gt;
&lt;br /&gt;
== Step 5: run a BSE calculation ==&lt;br /&gt;
&lt;br /&gt;
Now we switch from QE to Yambo. Here, we forgo the GW step for simplicity (we can use a scissor operator to open the band gap).&lt;br /&gt;
&lt;br /&gt;
This calculation has a couple of differences with respect to a standard BSE calculation for optical absorption. We can look at the input file &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Runlevels&amp;lt;/span&amp;gt;&lt;br /&gt;
 optics                       # [R OPT] Optics&lt;br /&gt;
 rim_cut                      # [R RIM CUT] Coulomb potential&lt;br /&gt;
 bss                          # [R BSS] Bethe Salpeter Equation solver&lt;br /&gt;
 em1s                         # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 bse                          # [R BSE] Bethe Salpeter Equation.&lt;br /&gt;
 bsk                          # [R BSK] Bethe Salpeter Equation kernel&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# RIM and cutoff settings&amp;lt;/span&amp;gt;&lt;br /&gt;
 RandQpts=1000000             # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 100            RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;quot;slab z&amp;quot;               # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere X/Y/Z/XY..&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Static screening&amp;lt;/span&amp;gt;&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 4 2 1&amp;quot;       # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;      # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 Chimod= &amp;quot;hartree&amp;quot;            # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  200 |                 # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 8000            mRy    # [Xs] Response block size&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# BSE&amp;lt;/span&amp;gt;&lt;br /&gt;
 BS_CPU= &amp;quot;4.1.2&amp;quot;                   # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k.eh.t&amp;quot;                 # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_diago=4              # [PARALLEL] CPUs for matrix diagonalization&lt;br /&gt;
 BSEmod= &amp;quot;causal&amp;quot;             # [BSE] resonant/causal/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                  # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  40000      mRy    # [BSK] Exchange components&lt;br /&gt;
 ALLGexx                      # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  8000       mRy    # [BSK] Screened interaction block size&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind=&amp;quot;full&amp;quot;                  #[BSE,X] bar(default)/full/tilde&amp;lt;/span&amp;gt;&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.00000 |  4.00000 | eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
   0.05000 |  0.05000 | eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 2000               # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 7 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BSEBands&lt;br /&gt;
    25 |  28 |                 # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                      # [BSS] Write to disk excitonic the FWs&lt;br /&gt;
 &lt;br /&gt;
This file was generated using the command: &amp;lt;code&amp;gt; yambo -X s -o b -k sex -y d -r&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all, we compute the excitons for all the momenta in the irreducible Brillouin zone for our discrete grid via the &amp;lt;code&amp;gt;BSEQptR&amp;lt;/code&amp;gt; variable. This will be a &#039;&#039;&#039;finite-momentum&#039;&#039;&#039; BSE calculation, analogous to the phonon one.&lt;br /&gt;
&lt;br /&gt;
Second, we change the variable &amp;lt;code&amp;gt;Lkind&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;bar&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;full&amp;lt;/code&amp;gt;. In Yambo, &amp;lt;code&amp;gt;Lkind=&amp;quot;bar&amp;quot;&amp;lt;/code&amp;gt;, which is the default for optical absorption, means that we are computing the excitonic response function without the long-range component of the exchange interaction. This cannot be used when computing the exciton momentum dependence, where the long-range exchange interaction can play a role, therefore we have to include it with &amp;lt;code&amp;gt;Lkind=&amp;quot;full&amp;quot;&amp;lt;/code&amp;gt;. This allows for the calculation of the excitonic longitudinal-transverse splitting (in 3D systems) as well.&lt;br /&gt;
&lt;br /&gt;
We can now run the code:&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
At the end of the calculation, we have obtained the &amp;lt;code&amp;gt;ndb.BS_diago_Q*&amp;lt;/code&amp;gt; databases inside the directory &amp;lt;code&amp;gt;bse_Lfull&amp;lt;/code&amp;gt;. They contain information on the exciton energies and wavefunctions at each momentum. Do not forget to check the report and logs of your calculation in the same directory to make sure that the code is doing what you want.&lt;br /&gt;
&lt;br /&gt;
==Go to Part 2==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
* For the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Yambo postprocessing&#039;&#039;&#039;&amp;lt;/span&amp;gt; case (running yambo inputs with the &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; executable), &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;follow [[Exciton-phonon coupling and luminescence - Yambo postprocessing|at this link]]&#039;&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
* For the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Yambopy postprocessing&#039;&#039;&#039;&amp;lt;/span&amp;gt; case (using flexible python scripting), &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;follow [[Exciton-phonon coupling and luminescence - Yambopy postprocessing|at this link]]&#039;&#039;&#039;&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1053</id>
		<title>Exciton-phonon coupling and luminescence - Yambo postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1053"/>
		<updated>2026-10-10T21:25:06Z</updated>

		<summary type="html">&lt;p&gt;Davide: removed space&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is part 2 of the tutorial on exciton-phonon coupling&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot;/&amp;gt; (yambo version). You should have arrived here from part 1:&lt;br /&gt;
[[Exciton-phonon_coupling_and_luminescence| Exciton-phonon coupling and luminescence in hBN (part 1)]]&lt;br /&gt;
&lt;br /&gt;
== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
TODO:&amp;lt;br&amp;gt;&lt;br /&gt;
- manually run letzelphc&amp;lt;br&amp;gt;&lt;br /&gt;
- use the fortran converter&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. In this version of the tutorial we present the latter case.&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k,0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have to write a new yambo input, that we can call &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt;, for this. You can copy (and adapt) the one below, or you can generate one by running from the command line:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -excph o&lt;br /&gt;
&lt;br /&gt;
This generates an input to compute luminescence (&amp;quot;o&amp;quot; is for &amp;quot;optics&amp;quot;). The variables that we are interested in are:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse_Lfull&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 9 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
In this input, we have to select the initial exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcStates&amp;lt;/code&amp;gt;, the final exciton states &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcSum&amp;lt;/code&amp;gt; and the phonon modes &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ElPhModes&amp;lt;/code&amp;gt;. Here we consider the first four states at &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; (corresponding to just two excitons because they are both doubly degenerate -- do not break degeneracies when selecting states!) and the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point. We also include all the nine phonon modes of monolayer MoS2.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;LoutPath&amp;lt;/code&amp;gt;? This variable controls the directory where the databases for the final-state excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is located, which can be different from the directory with the initial-state excitons &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; read as usual with the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; option when running the code. This makes it possible to compute the coupling between different exciton kinds. However, for our tutorial, we stick with the previously computed &amp;lt;code&amp;gt;Lfull&amp;lt;/code&amp;gt; in both cases.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lfull -C excph&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;ndb.excph*&amp;lt;/code&amp;gt; databases in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph_yambo_ph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases using the &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt; from yambopy. &lt;br /&gt;
You can find this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# A: 2,3 -- B: 6,7&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ndb_exc=f&#039;{path}/excph&#039;&lt;br /&gt;
  &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1),Expand=True)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read exc-ph databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 X = YamboExcitonPhononDB(ylat,save_excph=ndb_exc)&lt;br /&gt;
 print(X)&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is defined inside the plotting function as&lt;br /&gt;
&lt;br /&gt;
 G_squared = excph.excph_sq&lt;br /&gt;
 G2plt = np.zeros(len(G_squared))&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use the default scatterplot provided by &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 excph.plot_excph(F_q,plt_cbar=plt_cbar,**kwargs)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon. In addition, we can calculate the renormalization of the &amp;quot;direct&amp;quot; exciton recombination, due to the appearance of the satellites. However, in order to model both phonon replicas (satellites) and main peak renormalization, we pay the price of approximating the replicas oscillator strength. In the yambopy postprocessing, currently we do not compute peak renormalization but rather we calculate the full expression for the satellites. &lt;br /&gt;
&lt;br /&gt;
The luminescence expression implemented in Yambo comes from the first-order exciton-phonon response function adapted using the Van Roosbroeck-Shockley relation. It employs the diagonal exciton-phonon self-energy only, so that we can call this &amp;quot;exciton-quasiparticle approximation&amp;quot;.&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{PL}(\omega)=I^{(0)}(\omega)+I^{Sat}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first-order renormalised direct part is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{(0)}(\omega)=-\omega \sum_\alpha \omega^2 \frac{|D_\alpha|^2 [1-R_\alpha^{em}(T)-R^{abs}_\alpha (T)]N_\alpha^{exc}(T_{exc})}{\omega - E_\alpha +\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The satellite parts are (phonon absorption | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,abs}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{ \frac{1}{N_q}\frac{(\omega-2\Omega_{\mu q})^2 |D_\alpha |^2 T^{em}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})n_{\mu q}(T)}{\omega - [E_{\beta q}+\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and (phonon emission | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,em}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{\frac{1}{N_q} \frac{(\omega+2\Omega_{\mu q})^2 |D_\alpha |^2 T^{abs}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})[1+n_{\mu q}(T)]}{\omega - [E_{\beta q}-\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;-factors contain the satellite weights&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T^{em}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}+\Omega_{\mu q}|^2}, \quad T^{abs}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}-\Omega_{\mu q}|^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which, once summed, form the renormalization factors (equal to minus the energy-derivative of the exc-ph self-energy evaluated at the &amp;quot;bare&amp;quot; exciton energy, analogous to GW)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R^{abs}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{em}_{\mu\beta\alpha q}[1+n_{\mu q}(T)], \quad R^{em}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{abs}_{\mu\beta\alpha q}n_{\mu q}(T)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In these expressions, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
The phonon temperature-dependent Bose-Einstein occupation function is &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt;. We include the processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), as well as of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{(1)}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; with yambopy to get the el-ph matrix elements:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 &lt;br /&gt;
&lt;br /&gt;
6. And finally we generate the exciton-phonon input &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;yambo_ph -excph o&amp;lt;/code&amp;gt;. Now, we take a look at all the additional variables that we didn&#039;t check before, specifying also the details for luminescence the spectrum calculation.&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ExcPhOptics                      # [R][EXCPH] Exciton-Phonon Optics&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp=10.000000         Kn    # Bosonic Temperature&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EXCTemp= 10.000000          Kn    # [EXCPH] Excitonic Temperature (for luminescence spectra)&amp;lt;/span&amp;gt;&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
  1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse-L_full&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 EXCPHdEtresh= 0.100000E-5  eV    # [ELPH] Energy treshold for exc-ph denominator&lt;br /&gt;
 LDamping= 0.500000E-3      eV    # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# These are the plot parameters, same as in other parts of yambo&amp;lt;/span&amp;gt; &lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   4.00000 | 5.00000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.00500000 | 0.00500000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 4000                    # [Xd] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;BoseTemp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EXCTemp&amp;lt;/code&amp;gt; are the lattice and excitonic temperature, respectively.&lt;br /&gt;
&lt;br /&gt;
Now we run the calculation with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;. Here, we read as &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; excitons with &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; the ones without the long-range Coulomb exchange:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lbar -C excph&lt;br /&gt;
&lt;br /&gt;
and we find our outputs in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory. &lt;br /&gt;
&lt;br /&gt;
NB: Step 6 could have been equivalently run in yambopy, limiting the use of the yambo code to just step 4. This latter option is more flexible, as it allows for a greater degree of control by the user. We are in the last stages of the development and it will be available soon.&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
&lt;br /&gt;
If we check the output directory from the step 6 calculation, we find the &amp;lt;code&amp;gt;o-excph.pl_bse_ph_ass&amp;lt;/code&amp;gt; output files containing the luminescence spectra. We can plot them with gnuplot or any other tool:&lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 &amp;gt; set xrange[4.2:5]&lt;br /&gt;
 &amp;gt; p &#039;o-excph.pl_bse_ph_ass&#039; u 1:2 w l lc rgb &#039;red&#039; lw 3&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence plot.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. The direct recombination peak is completely suppressed. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo_ph -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: 20.22155 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: 32.95292 meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039;/&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1052</id>
		<title>Exciton-phonon coupling and luminescence - Yambo postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1052"/>
		<updated>2026-10-10T21:24:55Z</updated>

		<summary type="html">&lt;p&gt;Davide: intro and references added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is part 2 of the tutorial on exciton-phonon coupling&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot;/&amp;gt; (yambo version). You should have arrived here from part 1:&lt;br /&gt;
[[Exciton-phonon_coupling_and_luminescence| Exciton-phonon coupling and luminescence in hBN (part 1)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
TODO:&amp;lt;br&amp;gt;&lt;br /&gt;
- manually run letzelphc&amp;lt;br&amp;gt;&lt;br /&gt;
- use the fortran converter&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. In this version of the tutorial we present the latter case.&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k,0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have to write a new yambo input, that we can call &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt;, for this. You can copy (and adapt) the one below, or you can generate one by running from the command line:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -excph o&lt;br /&gt;
&lt;br /&gt;
This generates an input to compute luminescence (&amp;quot;o&amp;quot; is for &amp;quot;optics&amp;quot;). The variables that we are interested in are:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse_Lfull&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 9 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
In this input, we have to select the initial exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcStates&amp;lt;/code&amp;gt;, the final exciton states &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcSum&amp;lt;/code&amp;gt; and the phonon modes &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ElPhModes&amp;lt;/code&amp;gt;. Here we consider the first four states at &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; (corresponding to just two excitons because they are both doubly degenerate -- do not break degeneracies when selecting states!) and the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point. We also include all the nine phonon modes of monolayer MoS2.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;LoutPath&amp;lt;/code&amp;gt;? This variable controls the directory where the databases for the final-state excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is located, which can be different from the directory with the initial-state excitons &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; read as usual with the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; option when running the code. This makes it possible to compute the coupling between different exciton kinds. However, for our tutorial, we stick with the previously computed &amp;lt;code&amp;gt;Lfull&amp;lt;/code&amp;gt; in both cases.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lfull -C excph&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;ndb.excph*&amp;lt;/code&amp;gt; databases in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph_yambo_ph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases using the &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt; from yambopy. &lt;br /&gt;
You can find this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# A: 2,3 -- B: 6,7&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ndb_exc=f&#039;{path}/excph&#039;&lt;br /&gt;
  &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1),Expand=True)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read exc-ph databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 X = YamboExcitonPhononDB(ylat,save_excph=ndb_exc)&lt;br /&gt;
 print(X)&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is defined inside the plotting function as&lt;br /&gt;
&lt;br /&gt;
 G_squared = excph.excph_sq&lt;br /&gt;
 G2plt = np.zeros(len(G_squared))&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use the default scatterplot provided by &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 excph.plot_excph(F_q,plt_cbar=plt_cbar,**kwargs)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon. In addition, we can calculate the renormalization of the &amp;quot;direct&amp;quot; exciton recombination, due to the appearance of the satellites. However, in order to model both phonon replicas (satellites) and main peak renormalization, we pay the price of approximating the replicas oscillator strength. In the yambopy postprocessing, currently we do not compute peak renormalization but rather we calculate the full expression for the satellites. &lt;br /&gt;
&lt;br /&gt;
The luminescence expression implemented in Yambo comes from the first-order exciton-phonon response function adapted using the Van Roosbroeck-Shockley relation. It employs the diagonal exciton-phonon self-energy only, so that we can call this &amp;quot;exciton-quasiparticle approximation&amp;quot;.&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{PL}(\omega)=I^{(0)}(\omega)+I^{Sat}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first-order renormalised direct part is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{(0)}(\omega)=-\omega \sum_\alpha \omega^2 \frac{|D_\alpha|^2 [1-R_\alpha^{em}(T)-R^{abs}_\alpha (T)]N_\alpha^{exc}(T_{exc})}{\omega - E_\alpha +\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The satellite parts are (phonon absorption | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,abs}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{ \frac{1}{N_q}\frac{(\omega-2\Omega_{\mu q})^2 |D_\alpha |^2 T^{em}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})n_{\mu q}(T)}{\omega - [E_{\beta q}+\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and (phonon emission | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,em}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{\frac{1}{N_q} \frac{(\omega+2\Omega_{\mu q})^2 |D_\alpha |^2 T^{abs}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})[1+n_{\mu q}(T)]}{\omega - [E_{\beta q}-\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;-factors contain the satellite weights&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T^{em}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}+\Omega_{\mu q}|^2}, \quad T^{abs}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}-\Omega_{\mu q}|^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which, once summed, form the renormalization factors (equal to minus the energy-derivative of the exc-ph self-energy evaluated at the &amp;quot;bare&amp;quot; exciton energy, analogous to GW)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R^{abs}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{em}_{\mu\beta\alpha q}[1+n_{\mu q}(T)], \quad R^{em}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{abs}_{\mu\beta\alpha q}n_{\mu q}(T)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In these expressions, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
The phonon temperature-dependent Bose-Einstein occupation function is &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt;. We include the processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), as well as of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{(1)}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; with yambopy to get the el-ph matrix elements:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 &lt;br /&gt;
&lt;br /&gt;
6. And finally we generate the exciton-phonon input &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;yambo_ph -excph o&amp;lt;/code&amp;gt;. Now, we take a look at all the additional variables that we didn&#039;t check before, specifying also the details for luminescence the spectrum calculation.&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ExcPhOptics                      # [R][EXCPH] Exciton-Phonon Optics&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp=10.000000         Kn    # Bosonic Temperature&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EXCTemp= 10.000000          Kn    # [EXCPH] Excitonic Temperature (for luminescence spectra)&amp;lt;/span&amp;gt;&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
  1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse-L_full&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 EXCPHdEtresh= 0.100000E-5  eV    # [ELPH] Energy treshold for exc-ph denominator&lt;br /&gt;
 LDamping= 0.500000E-3      eV    # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# These are the plot parameters, same as in other parts of yambo&amp;lt;/span&amp;gt; &lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   4.00000 | 5.00000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.00500000 | 0.00500000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 4000                    # [Xd] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;BoseTemp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EXCTemp&amp;lt;/code&amp;gt; are the lattice and excitonic temperature, respectively.&lt;br /&gt;
&lt;br /&gt;
Now we run the calculation with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;. Here, we read as &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; excitons with &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; the ones without the long-range Coulomb exchange:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lbar -C excph&lt;br /&gt;
&lt;br /&gt;
and we find our outputs in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory. &lt;br /&gt;
&lt;br /&gt;
NB: Step 6 could have been equivalently run in yambopy, limiting the use of the yambo code to just step 4. This latter option is more flexible, as it allows for a greater degree of control by the user. We are in the last stages of the development and it will be available soon.&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
&lt;br /&gt;
If we check the output directory from the step 6 calculation, we find the &amp;lt;code&amp;gt;o-excph.pl_bse_ph_ass&amp;lt;/code&amp;gt; output files containing the luminescence spectra. We can plot them with gnuplot or any other tool:&lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 &amp;gt; set xrange[4.2:5]&lt;br /&gt;
 &amp;gt; p &#039;o-excph.pl_bse_ph_ass&#039; u 1:2 w l lc rgb &#039;red&#039; lw 3&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence plot.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. The direct recombination peak is completely suppressed. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo_ph -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: 20.22155 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: 32.95292 meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039;/&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambopy_postprocessing&amp;diff=1051</id>
		<title>Exciton-phonon coupling and luminescence - Yambopy postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambopy_postprocessing&amp;diff=1051"/>
		<updated>2026-10-10T21:24:10Z</updated>

		<summary type="html">&lt;p&gt;Davide: fixed references, added intro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is part 2 of the tutorial on exciton-phonon coupling&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot;/&amp;gt; (yambopy version). You should have arrived here from part 1:&lt;br /&gt;
[[Exciton-phonon_coupling_and_luminescence| Exciton-phonon coupling and luminescence in hBN (part 1)]]&lt;br /&gt;
&lt;br /&gt;
== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
We have finished the heavy simulations. Now it&#039;s time for the postprocessing. The first order of business is the reconstruction of the electron-phonon coupling matrix elements from the dvscf results and the electronic wavefunctions.&lt;br /&gt;
&lt;br /&gt;
In order to do this, we will run the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable of the &#039;&#039;&#039;LetzElPhC&#039;&#039;&#039; code. We will run via command line using yambopy, although it will be instructive to have look at the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; input files later.&lt;br /&gt;
&lt;br /&gt;
We run in the same directory where the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; is (remember than you can also virtually move it with a symbolic link).&lt;br /&gt;
&lt;br /&gt;
Type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y&lt;br /&gt;
&lt;br /&gt;
to see the help for the calculation. Have a look at the various flags and their description.&lt;br /&gt;
For example, if we want to do a serial run of LetzElPhC for bands from &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt;, we should type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/ph_input.in -b n_i n_f&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt; are integers representing the initial and final band indices. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 1 and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f]&amp;lt;/math&amp;gt; including the extrema of the interval.&lt;br /&gt;
&lt;br /&gt;
These should coincide with those used for the Bethe-Salpeter kernel, i.e. those specified in the &amp;lt;code&amp;gt;BSEBands&amp;lt;/code&amp;gt; variable of the BSE input file (this is not strictly necessary, but certainly efficient since these calculations use a lot of disk space). &lt;br /&gt;
&lt;br /&gt;
For our system, we want to do a parallel calculation with 4 qpools and 2 kpools. In addition, we want to explicitly specify the path of the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable and avoid automatically deleting the LetzElPhC data. So we type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/mos2.dvscf -b 25 28 -par 4 2 -lelphc path/to/lelphc_exe&lt;br /&gt;
&lt;br /&gt;
At the end, check your directory: you should find the &amp;lt;code&amp;gt;lelphc.in&amp;lt;/code&amp;gt; input file that was run, let&#039;s inspect it: &lt;br /&gt;
&lt;br /&gt;
 # LetzElPhC input for yambo generated by yambopy&lt;br /&gt;
 nqpool      = 2&lt;br /&gt;
 nkpool      = 4&lt;br /&gt;
 start_bnd   = 25&lt;br /&gt;
 end_bnd     = 28&lt;br /&gt;
 save_dir    = ./SAVE&lt;br /&gt;
 kernel      = dfpt&lt;br /&gt;
 ph_save_dir = dvscf/ph_save&lt;br /&gt;
 convention = yambo&lt;br /&gt;
&lt;br /&gt;
Notice the variable &amp;lt;code&amp;gt;convention=yambo&amp;lt;/code&amp;gt;: what does it mean? At variance with QE and many other codes, Yambo uses the &amp;quot;backward&amp;quot; momentum transfer convention for electronic scatterings. That is, an electronic transition goes from band &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k-q&amp;lt;/math&amp;gt; to band &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;. In the &amp;quot;forward&amp;quot; momentum transfer convention (the more standard one), the transitions go from &amp;lt;math&amp;gt;nk&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;mk+q&amp;lt;/math&amp;gt;. Therefore, this variable ensures that the electron-phonon coupling matrix elements are computed as &amp;lt;math&amp;gt;\langle mk|dV|nk-q\rangle&amp;lt;/math&amp;gt;. This will have consequences also in the formulation of the &#039;&#039;exciton&#039;&#039;-phonon coupling matrix element.&lt;br /&gt;
&lt;br /&gt;
You will also find a &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; database that contains the computed electron-phonon matrix elements, in the output format of &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition, if you check the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; folder:&lt;br /&gt;
&lt;br /&gt;
 ls SAVE/ndb.elph_gkkp*&lt;br /&gt;
&lt;br /&gt;
you will see that yambopy has created the Yambo-compatible electron-phonon databases.&lt;br /&gt;
&lt;br /&gt;
If you want to run LetzElPhC directly, without using yambopy, you can refer to its [https://github.com/yambo-code/LetzElPhC/blob/main/docs/tex_doc/main.pdf|user guide].&lt;br /&gt;
Keep in mind that in this case, in order to convert the database to the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases of Yambo, you will then need a couple of lines of python using the Yambopy class &amp;lt;code&amp;gt;ConvertElectronPhononDB&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;yambopy/letzelph_interface/lelph2y.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases -- e.g., because you are doing the exc-ph postprocessing with yambopy -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_gkkp&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases -- e.g., because you are using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; for the exc-ph part -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_lelphc_dbs&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k, 0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
In order to calculate this quantity using python, we need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases natively generated by the &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt; code, as well as the BSE databases &amp;lt;code&amp;gt;ndb.BS_diago_Q*&amp;lt;/code&amp;gt; containing the information on exciton wavefunctions and energies.&lt;br /&gt;
&lt;br /&gt;
Next, we write a python user script importing the yambopy exciton-phonon tools. You can find a version of this script in &amp;lt;code&amp;gt;yambopy/tutorials/exciton-phonon/calculate_excph.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np &lt;br /&gt;
 from yambopy import YamboLatticeDB,YamboWFDB,LetzElphElectronPhononDB &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific Yambopy dbs loading classes&amp;lt;/span&amp;gt;&lt;br /&gt;
 from yambopy.exciton_phonon.excph_matrix_elements import exciton_phonon_matelem &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific exc-ph functions&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 path = &#039;1L_MoS2&#039;&lt;br /&gt;
 bands_range=[24,28] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence bands, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# number of excitonic states&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 bsepath    = f&#039;{path}/bse-allq_full&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lin=Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath   = f&#039;{path}/SAVE&#039;     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Yambo SAVE&amp;lt;/span&amp;gt;&lt;br /&gt;
 ndb_elph   = f&#039;{path}/ndb.elph&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# LetzElPhC electron-phonon database (any convention)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice&amp;lt;/span&amp;gt;&lt;br /&gt;
 lattice = YamboLatticeDB.from_db_file(filename=f&#039;{savepath}/ns.db1&#039;)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read electron-phonon&amp;lt;/span&amp;gt;&lt;br /&gt;
 elph    = LetzElphElectronPhononDB(ndb_elph,read_all=False)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read wave functions&amp;lt;/span&amp;gt;&lt;br /&gt;
 wfcs    = YamboWFDB(filename=&#039;ns.wf&#039;,save=savepath,latdb=lattice,bands_range=bands_range)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Calculate exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 exph = exciton_phonon_matelem(lattice,elph,wfcs,BSE_dir=bsepath,nexc_in=nexc,nexc_out=nexc,dmat_mode=&#039;save&#039;,exph_file=&#039;MoS2_Ex-ph.npy&#039;)&lt;br /&gt;
&lt;br /&gt;
In this script, we can select the number exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;nexc&amp;lt;/code&amp;gt;, the single-particle bands range with &amp;lt;code&amp;gt;bands_range&amp;lt;/code&amp;gt;. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 0 (python indexing) and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f)&amp;lt;/math&amp;gt;, therefore the last value (28 in the example) is excluded. That is, in the example we are selecting the 25th, 26th, 27th and 28th bands. Those bands have to be present in both the electron-phonon and BSE calculations. &lt;br /&gt;
&lt;br /&gt;
Here we calculate the couplings of the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point including &amp;lt;math&amp;gt;q=0&amp;lt;/math&amp;gt;. We also include all the nine phonon modes of monolayer MoS2. We also need access to the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory in order to read the electronic wavefunctions: they are used to compute the electronic representation matrices (&amp;lt;code&amp;gt;dmat&amp;lt;/code&amp;gt; in the code). The argument &amp;lt;code&amp;gt;dmat_mode&amp;lt;/code&amp;gt; can be set to &amp;lt;code&amp;gt;&#039;load&#039;&amp;lt;/code&amp;gt; for subsequent calculations.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code:&lt;br /&gt;
&lt;br /&gt;
 python calculate_excph.py&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;MoS2_Ex-ph.npy&amp;lt;/code&amp;gt; binary file in the directory where you ran.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases. &lt;br /&gt;
You can find a version of this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# First bright peak (A: 2,3 -- B: 6,7)&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of dark triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ns_ypy = &#039;MoS2_Ex-ph.npy&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Load exc-ph database&amp;lt;/span&amp;gt;&lt;br /&gt;
 X_py = np.load(ns_ypy)&lt;br /&gt;
 G_squared = np.abs(X_py)**2.&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is obtained from a dedicated function as:&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use a custom scatterplot employing some of the plotting tools provided by yambopy (but you can do whatever you want).&lt;br /&gt;
&lt;br /&gt;
 plot_2D_excph(qgrid,G2_to_plot,rlat=ylat.rlat,plt_cbar=True,\&lt;br /&gt;
               marker=&#039;H&#039;,s=700,cmap=&#039;magma&#039;)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat}(\omega)=\frac{1}{ N_q} \frac{1}{3} \sum_{\epsilon s\beta \mu q} \frac{1}{E_{\beta q}-s\Omega_{\mu q}}\left|\sum_\alpha\frac{ D^{\epsilon}_\alpha \mathcal{G}_{\beta \alpha}^{\mu,*}(q)}{E_\alpha -E_{\beta q} +s\Omega_{\mu q}+\mathrm{i}\eta}\right|^2 \frac{N^{exc}_{\beta q}(T_{exc})[\frac{1+s}{2}+n_{\mu q}(T)]}{\omega -[E_{\beta q}-s\Omega_{\mu q}]+\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt; is the temperature-dependent phonon Bose-Einstein occupation function. As it can be seen, &amp;lt;math&amp;gt;s=1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), while &amp;lt;math&amp;gt;s=-1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{Sat}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
Finally, the spectrum is averaged over the polarization directions of the emitted photons (&amp;lt;math&amp;gt;\epsilon=x,y,z&amp;lt;/math&amp;gt; representing the respective dipole components).&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; (with or without yambopy: in the latter case remember the option &amp;lt;code&amp;gt;-D&amp;lt;/code&amp;gt;) to get the el-ph matrix elements, particularly the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 -D&lt;br /&gt;
&lt;br /&gt;
=== Luminescence calculation ===&lt;br /&gt;
&lt;br /&gt;
6. And finally we calculate exciton-phonon matrix elements and the luminescence spectrum in one go using a python script importing the Yambopy exciton-phonon tools: in order to do this, we need to take a look at all the necessary input variables for the formula written above.&lt;br /&gt;
&lt;br /&gt;
We can start from the script &amp;lt;code&amp;gt;luminescence.py&amp;lt;/code&amp;gt; available in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 from yambopy.exciton_phonon.excph_luminescence import exc_ph_luminescence&lt;br /&gt;
 from yambopy.exciton_phonon.excph_input_data import exc_ph_get_inputs&lt;br /&gt;
&lt;br /&gt;
We import the necessary tools...&lt;br /&gt;
&lt;br /&gt;
 path = &#039;3D_hBN&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lout--&amp;gt; response is Lfull)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bsepath =  f&#039;{path}/bse_Lfull&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q* databases are needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation for optically active exciton (Lin --&amp;gt; response is Lbar)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bseBARpath =  f&#039;{path}/bse_Lbar&#039;  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to electron-phonon calculation&amp;lt;/span&amp;gt;&lt;br /&gt;
 elphpath = path &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.elph is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to unprojected dipoles matrix elements (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 dipolespath = bsepath &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.dipoles is needed (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath = f&#039;{path}/SAVE&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ns.db1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... and we specify the paths to the necessary databases. Note that, if we want to perform polarization averaging, we have to recompute the excitonic dipoles in python as seen here.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;bseBARpath&amp;lt;/code&amp;gt;? This variable points to the directory where the databases for the optical (zero-momentum) excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; (which may be computed with &amp;lt;code&amp;gt;Lkind=&#039;Lbar&#039;&amp;lt;/code&amp;gt;) is located, which can be different from the directory with the full indirect exciton dispersion &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; (usually computed with &amp;lt;code&amp;gt;Lkind=&#039;Lfull&#039;&amp;lt;/code&amp;gt;, however &amp;lt;code&amp;gt;Lkind=&#039;Ltilde&#039;&amp;lt;/code&amp;gt; can also be used if one is interested in &amp;quot;irreducible&amp;quot; excitons). This makes it possible to compute the coupling between different exciton kinds.&lt;br /&gt;
&lt;br /&gt;
 bands_range=[6,10] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 phonons_range=[0,12] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# All phonons&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_out = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at each momentum (Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_in  = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at Q=0 (Lin)&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_ph  = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Lattice temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_exc = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Effective excitonic temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 emin=4.4      &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Energy range and plot details (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
 emax=4.7&lt;br /&gt;
 estep=0.0002&lt;br /&gt;
 broad = 0.005 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Broadening parameter for peak width (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we specify the parameters for the calculation. We include valence bands from 7 to 10 (6 to 9 in python index) and the contribution of all 12 phonon modes. We consider 12 excitonic states for the coupling matrix elements.&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;T_ph&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;T_exc&amp;lt;/code&amp;gt; are the lattice and excitonic temperatures, respectively.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate and load all the inputs:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Excitonic dipole matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Phonon energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * We specify bse_path2=bseBARpath meaning we use Lbar calculation for Q=0 excitons&amp;lt;/span&amp;gt;&lt;br /&gt;
 input_data = exc_ph_get_inputs(savepath,elphpath,bsepath,\&lt;br /&gt;
                                bse_path2=bseBARpath,dipoles_path=dipolespath,\&lt;br /&gt;
                                nexc_in=12,nexc_out=12,\&lt;br /&gt;
                                bands_range=[6,10],phonons_range=[0,12])&lt;br /&gt;
&lt;br /&gt;
 ph_energies, exc_energies, exc_energies_in, G, exc_dipoles = input_data&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;code&amp;gt;exc_ph_get_inputs&amp;lt;/code&amp;gt; gives us all the input data for luminescence in the correct format: phonon energies, exciton energies, optical exciton energies (if needed), exciton-phonon matrix elements (calculated on the fly and printed to file), unprojected exciton dipoles (optional, calculated on the fly and printed to file).&lt;br /&gt;
The exc-ph matrix element calculation is just a wrapper of the same tools that we have tested in the above section on MoS2.&lt;br /&gt;
&lt;br /&gt;
Finally, there is the calculation of the luminescence spectrum via the function &amp;lt;code&amp;gt;exc_ph_luminescence&amp;lt;/code&amp;gt;:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate the luminescence spectrum including the input data from before&amp;lt;/span&amp;gt;&lt;br /&gt;
 w,PL = exc_ph_luminescence(T_ph,ph_energies,exc_energies,exc_dipoles,G,\&lt;br /&gt;
                            exc_energies_in=exc_energies_in,exc_temp=T_exc,\&lt;br /&gt;
                            nexc_out=nexc_out,nexc_in=nexc_in,emin=emin,emax=emax,\&lt;br /&gt;
                            estep=estep,broad=broad)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to print the luminescence data for later plotting, you can also add the following line to the script:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Save to file&amp;lt;/span&amp;gt;&lt;br /&gt;
 data = np.column_stack((w, PL))&lt;br /&gt;
 np.savetxt(&amp;quot;hBN_luminescence_12x12x1.dat&amp;quot;, data, fmt=&amp;quot;%.8f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
It is now time to run the whole script:&lt;br /&gt;
&lt;br /&gt;
 python luminescence.py&lt;br /&gt;
 &lt;br /&gt;
NB: By using Yambopy for Step 6, we have limited the use of the Yambo code to just step 4 in the entire workflow. This option is more flexible, as it allows for a greater degree of control by the user. On the other hand the Yambo postprocessing route features a Yambo-style input that doesn&#039;t require python knowledge and the calculation is currently faster in fortran. However, the luminescence expression computed in Yambo is a slightly different than this one: it is more approximated in the description of the satellite oscillator strengths, but it explicitly includes the renormalization of the direct exciton peak. You can check the differences [[Exciton-phonon coupling and luminescence - Yambo postprocessing|here]].&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
We can plot the results of the step 6 calculation. If we do it in the same script we can add something like this:&lt;br /&gt;
 fig = plt.figure()&lt;br /&gt;
 ax = fig.add_subplot(1,1,1)&lt;br /&gt;
 ax.set_xlim(emin,emax)&lt;br /&gt;
 ax.set_ylim(0,np.max(PL)*1.1)&lt;br /&gt;
 ax.get_yaxis().set_visible(False)&lt;br /&gt;
 &lt;br /&gt;
 ax.plot(w, PL, &#039;-&#039;,c=&#039;red&#039;, label=&amp;quot;AA&#039; hBN luminescence&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 plt.legend()&lt;br /&gt;
 plt.savefig(&#039;hBN_luminescence.png&#039;)&lt;br /&gt;
 plt.show()&lt;br /&gt;
&lt;br /&gt;
[[File:HBN luminescence satellites.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1050</id>
		<title>Exciton-phonon coupling and luminescence - Yambo postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1050"/>
		<updated>2026-10-10T21:16:33Z</updated>

		<summary type="html">&lt;p&gt;Davide: Prepared empty section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
TODO:&amp;lt;br&amp;gt;&lt;br /&gt;
- manually run letzelphc&amp;lt;br&amp;gt;&lt;br /&gt;
- use the fortran converter&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. In this version of the tutorial we present the latter case.&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k,0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have to write a new yambo input, that we can call &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt;, for this. You can copy (and adapt) the one below, or you can generate one by running from the command line:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -excph o&lt;br /&gt;
&lt;br /&gt;
This generates an input to compute luminescence (&amp;quot;o&amp;quot; is for &amp;quot;optics&amp;quot;). The variables that we are interested in are:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse_Lfull&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 9 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
In this input, we have to select the initial exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcStates&amp;lt;/code&amp;gt;, the final exciton states &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcSum&amp;lt;/code&amp;gt; and the phonon modes &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ElPhModes&amp;lt;/code&amp;gt;. Here we consider the first four states at &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; (corresponding to just two excitons because they are both doubly degenerate -- do not break degeneracies when selecting states!) and the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point. We also include all the nine phonon modes of monolayer MoS2.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;LoutPath&amp;lt;/code&amp;gt;? This variable controls the directory where the databases for the final-state excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is located, which can be different from the directory with the initial-state excitons &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; read as usual with the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; option when running the code. This makes it possible to compute the coupling between different exciton kinds. However, for our tutorial, we stick with the previously computed &amp;lt;code&amp;gt;Lfull&amp;lt;/code&amp;gt; in both cases.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lfull -C excph&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;ndb.excph*&amp;lt;/code&amp;gt; databases in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph_yambo_ph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases using the &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt; from yambopy. &lt;br /&gt;
You can find this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# A: 2,3 -- B: 6,7&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ndb_exc=f&#039;{path}/excph&#039;&lt;br /&gt;
  &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1),Expand=True)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read exc-ph databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 X = YamboExcitonPhononDB(ylat,save_excph=ndb_exc)&lt;br /&gt;
 print(X)&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is defined inside the plotting function as&lt;br /&gt;
&lt;br /&gt;
 G_squared = excph.excph_sq&lt;br /&gt;
 G2plt = np.zeros(len(G_squared))&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use the default scatterplot provided by &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 excph.plot_excph(F_q,plt_cbar=plt_cbar,**kwargs)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon. In addition, we can calculate the renormalization of the &amp;quot;direct&amp;quot; exciton recombination, due to the appearance of the satellites. However, in order to model both phonon replicas (satellites) and main peak renormalization, we pay the price of approximating the replicas oscillator strength. In the yambopy postprocessing, currently we do not compute peak renormalization but rather we calculate the full expression for the satellites. &lt;br /&gt;
&lt;br /&gt;
The luminescence expression implemented in Yambo comes from the first-order exciton-phonon response function adapted using the Van Roosbroeck-Shockley relation. It employs the diagonal exciton-phonon self-energy only, so that we can call this &amp;quot;exciton-quasiparticle approximation&amp;quot;.&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{PL}(\omega)=I^{(0)}(\omega)+I^{Sat}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first-order renormalised direct part is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{(0)}(\omega)=-\omega \sum_\alpha \omega^2 \frac{|D_\alpha|^2 [1-R_\alpha^{em}(T)-R^{abs}_\alpha (T)]N_\alpha^{exc}(T_{exc})}{\omega - E_\alpha +\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The satellite parts are (phonon absorption | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,abs}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{ \frac{1}{N_q}\frac{(\omega-2\Omega_{\mu q})^2 |D_\alpha |^2 T^{em}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})n_{\mu q}(T)}{\omega - [E_{\beta q}+\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and (phonon emission | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,em}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{\frac{1}{N_q} \frac{(\omega+2\Omega_{\mu q})^2 |D_\alpha |^2 T^{abs}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})[1+n_{\mu q}(T)]}{\omega - [E_{\beta q}-\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;-factors contain the satellite weights&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T^{em}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}+\Omega_{\mu q}|^2}, \quad T^{abs}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}-\Omega_{\mu q}|^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which, once summed, form the renormalization factors (equal to minus the energy-derivative of the exc-ph self-energy evaluated at the &amp;quot;bare&amp;quot; exciton energy, analogous to GW)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R^{abs}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{em}_{\mu\beta\alpha q}[1+n_{\mu q}(T)], \quad R^{em}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{abs}_{\mu\beta\alpha q}n_{\mu q}(T)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In these expressions, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
The phonon temperature-dependent Bose-Einstein occupation function is &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt;. We include the processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), as well as of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{(1)}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; with yambopy to get the el-ph matrix elements:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 &lt;br /&gt;
&lt;br /&gt;
6. And finally we generate the exciton-phonon input &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;yambo_ph -excph o&amp;lt;/code&amp;gt;. Now, we take a look at all the additional variables that we didn&#039;t check before, specifying also the details for luminescence the spectrum calculation.&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ExcPhOptics                      # [R][EXCPH] Exciton-Phonon Optics&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp=10.000000         Kn    # Bosonic Temperature&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EXCTemp= 10.000000          Kn    # [EXCPH] Excitonic Temperature (for luminescence spectra)&amp;lt;/span&amp;gt;&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
  1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse-L_full&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 EXCPHdEtresh= 0.100000E-5  eV    # [ELPH] Energy treshold for exc-ph denominator&lt;br /&gt;
 LDamping= 0.500000E-3      eV    # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# These are the plot parameters, same as in other parts of yambo&amp;lt;/span&amp;gt; &lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   4.00000 | 5.00000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.00500000 | 0.00500000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 4000                    # [Xd] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;BoseTemp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EXCTemp&amp;lt;/code&amp;gt; are the lattice and excitonic temperature, respectively.&lt;br /&gt;
&lt;br /&gt;
Now we run the calculation with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;. Here, we read as &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; excitons with &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; the ones without the long-range Coulomb exchange:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lbar -C excph&lt;br /&gt;
&lt;br /&gt;
and we find our outputs in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory. &lt;br /&gt;
&lt;br /&gt;
NB: Step 6 could have been equivalently run in yambopy, limiting the use of the yambo code to just step 4. This latter option is more flexible, as it allows for a greater degree of control by the user. We are in the last stages of the development and it will be available soon.&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
&lt;br /&gt;
If we check the output directory from the step 6 calculation, we find the &amp;lt;code&amp;gt;o-excph.pl_bse_ph_ass&amp;lt;/code&amp;gt; output files containing the luminescence spectra. We can plot them with gnuplot or any other tool:&lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 &amp;gt; set xrange[4.2:5]&lt;br /&gt;
 &amp;gt; p &#039;o-excph.pl_bse_ph_ass&#039; u 1:2 w l lc rgb &#039;red&#039; lw 3&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence plot.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. The direct recombination peak is completely suppressed. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo_ph -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: 20.22155 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: 32.95292 meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039;/&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambopy_postprocessing&amp;diff=1049</id>
		<title>Exciton-phonon coupling and luminescence - Yambopy postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambopy_postprocessing&amp;diff=1049"/>
		<updated>2026-10-10T21:15:23Z</updated>

		<summary type="html">&lt;p&gt;Davide: Added references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
We have finished the heavy simulations. Now it&#039;s time for the postprocessing. The first order of business is the reconstruction of the electron-phonon coupling matrix elements from the dvscf results and the electronic wavefunctions.&lt;br /&gt;
&lt;br /&gt;
In order to do this, we will run the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable of the &#039;&#039;&#039;LetzElPhC&#039;&#039;&#039; code. We will run via command line using yambopy, although it will be instructive to have look at the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; input files later.&lt;br /&gt;
&lt;br /&gt;
We run in the same directory where the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; is (remember than you can also virtually move it with a symbolic link).&lt;br /&gt;
&lt;br /&gt;
Type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y&lt;br /&gt;
&lt;br /&gt;
to see the help for the calculation. Have a look at the various flags and their description.&lt;br /&gt;
For example, if we want to do a serial run of LetzElPhC for bands from &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt;, we should type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/ph_input.in -b n_i n_f&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt; are integers representing the initial and final band indices. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 1 and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f]&amp;lt;/math&amp;gt; including the extrema of the interval.&lt;br /&gt;
&lt;br /&gt;
These should coincide with those used for the Bethe-Salpeter kernel, i.e. those specified in the &amp;lt;code&amp;gt;BSEBands&amp;lt;/code&amp;gt; variable of the BSE input file (this is not strictly necessary, but certainly efficient since these calculations use a lot of disk space). &lt;br /&gt;
&lt;br /&gt;
For our system, we want to do a parallel calculation with 4 qpools and 2 kpools. In addition, we want to explicitly specify the path of the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable and avoid automatically deleting the LetzElPhC data. So we type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/mos2.dvscf -b 25 28 -par 4 2 -lelphc path/to/lelphc_exe&lt;br /&gt;
&lt;br /&gt;
At the end, check your directory: you should find the &amp;lt;code&amp;gt;lelphc.in&amp;lt;/code&amp;gt; input file that was run, let&#039;s inspect it: &lt;br /&gt;
&lt;br /&gt;
 # LetzElPhC input for yambo generated by yambopy&lt;br /&gt;
 nqpool      = 2&lt;br /&gt;
 nkpool      = 4&lt;br /&gt;
 start_bnd   = 25&lt;br /&gt;
 end_bnd     = 28&lt;br /&gt;
 save_dir    = ./SAVE&lt;br /&gt;
 kernel      = dfpt&lt;br /&gt;
 ph_save_dir = dvscf/ph_save&lt;br /&gt;
 convention = yambo&lt;br /&gt;
&lt;br /&gt;
Notice the variable &amp;lt;code&amp;gt;convention=yambo&amp;lt;/code&amp;gt;: what does it mean? At variance with QE and many other codes, Yambo uses the &amp;quot;backward&amp;quot; momentum transfer convention for electronic scatterings. That is, an electronic transition goes from band &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k-q&amp;lt;/math&amp;gt; to band &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;. In the &amp;quot;forward&amp;quot; momentum transfer convention (the more standard one), the transitions go from &amp;lt;math&amp;gt;nk&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;mk+q&amp;lt;/math&amp;gt;. Therefore, this variable ensures that the electron-phonon coupling matrix elements are computed as &amp;lt;math&amp;gt;\langle mk|dV|nk-q\rangle&amp;lt;/math&amp;gt;. This will have consequences also in the formulation of the &#039;&#039;exciton&#039;&#039;-phonon coupling matrix element.&lt;br /&gt;
&lt;br /&gt;
You will also find a &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; database that contains the computed electron-phonon matrix elements, in the output format of &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition, if you check the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; folder:&lt;br /&gt;
&lt;br /&gt;
 ls SAVE/ndb.elph_gkkp*&lt;br /&gt;
&lt;br /&gt;
you will see that yambopy has created the Yambo-compatible electron-phonon databases.&lt;br /&gt;
&lt;br /&gt;
If you want to run LetzElPhC directly, without using yambopy, you can refer to its [https://github.com/yambo-code/LetzElPhC/blob/main/docs/tex_doc/main.pdf|user guide].&lt;br /&gt;
Keep in mind that in this case, in order to convert the database to the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases of Yambo, you will then need a couple of lines of python using the Yambopy class &amp;lt;code&amp;gt;ConvertElectronPhononDB&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;yambopy/letzelph_interface/lelph2y.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases -- e.g., because you are doing the exc-ph postprocessing with yambopy -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_gkkp&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases -- e.g., because you are using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; for the exc-ph part -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_lelphc_dbs&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k, 0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
In order to calculate this quantity using python, we need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases natively generated by the &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt; code, as well as the BSE databases &amp;lt;code&amp;gt;ndb.BS_diago_Q*&amp;lt;/code&amp;gt; containing the information on exciton wavefunctions and energies.&lt;br /&gt;
&lt;br /&gt;
Next, we write a python user script importing the yambopy exciton-phonon tools. You can find a version of this script in &amp;lt;code&amp;gt;yambopy/tutorials/exciton-phonon/calculate_excph.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np &lt;br /&gt;
 from yambopy import YamboLatticeDB,YamboWFDB,LetzElphElectronPhononDB &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific Yambopy dbs loading classes&amp;lt;/span&amp;gt;&lt;br /&gt;
 from yambopy.exciton_phonon.excph_matrix_elements import exciton_phonon_matelem &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific exc-ph functions&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 path = &#039;1L_MoS2&#039;&lt;br /&gt;
 bands_range=[24,28] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence bands, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# number of excitonic states&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 bsepath    = f&#039;{path}/bse-allq_full&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lin=Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath   = f&#039;{path}/SAVE&#039;     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Yambo SAVE&amp;lt;/span&amp;gt;&lt;br /&gt;
 ndb_elph   = f&#039;{path}/ndb.elph&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# LetzElPhC electron-phonon database (any convention)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice&amp;lt;/span&amp;gt;&lt;br /&gt;
 lattice = YamboLatticeDB.from_db_file(filename=f&#039;{savepath}/ns.db1&#039;)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read electron-phonon&amp;lt;/span&amp;gt;&lt;br /&gt;
 elph    = LetzElphElectronPhononDB(ndb_elph,read_all=False)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read wave functions&amp;lt;/span&amp;gt;&lt;br /&gt;
 wfcs    = YamboWFDB(filename=&#039;ns.wf&#039;,save=savepath,latdb=lattice,bands_range=bands_range)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Calculate exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 exph = exciton_phonon_matelem(lattice,elph,wfcs,BSE_dir=bsepath,nexc_in=nexc,nexc_out=nexc,dmat_mode=&#039;save&#039;,exph_file=&#039;MoS2_Ex-ph.npy&#039;)&lt;br /&gt;
&lt;br /&gt;
In this script, we can select the number exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;nexc&amp;lt;/code&amp;gt;, the single-particle bands range with &amp;lt;code&amp;gt;bands_range&amp;lt;/code&amp;gt;. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 0 (python indexing) and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f)&amp;lt;/math&amp;gt;, therefore the last value (28 in the example) is excluded. That is, in the example we are selecting the 25th, 26th, 27th and 28th bands. Those bands have to be present in both the electron-phonon and BSE calculations. &lt;br /&gt;
&lt;br /&gt;
Here we calculate the couplings of the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point including &amp;lt;math&amp;gt;q=0&amp;lt;/math&amp;gt;. We also include all the nine phonon modes of monolayer MoS2. We also need access to the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory in order to read the electronic wavefunctions: they are used to compute the electronic representation matrices (&amp;lt;code&amp;gt;dmat&amp;lt;/code&amp;gt; in the code). The argument &amp;lt;code&amp;gt;dmat_mode&amp;lt;/code&amp;gt; can be set to &amp;lt;code&amp;gt;&#039;load&#039;&amp;lt;/code&amp;gt; for subsequent calculations.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code:&lt;br /&gt;
&lt;br /&gt;
 python calculate_excph.py&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;MoS2_Ex-ph.npy&amp;lt;/code&amp;gt; binary file in the directory where you ran.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases. &lt;br /&gt;
You can find a version of this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# First bright peak (A: 2,3 -- B: 6,7)&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of dark triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ns_ypy = &#039;MoS2_Ex-ph.npy&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Load exc-ph database&amp;lt;/span&amp;gt;&lt;br /&gt;
 X_py = np.load(ns_ypy)&lt;br /&gt;
 G_squared = np.abs(X_py)**2.&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is obtained from a dedicated function as:&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use a custom scatterplot employing some of the plotting tools provided by yambopy (but you can do whatever you want).&lt;br /&gt;
&lt;br /&gt;
 plot_2D_excph(qgrid,G2_to_plot,rlat=ylat.rlat,plt_cbar=True,\&lt;br /&gt;
               marker=&#039;H&#039;,s=700,cmap=&#039;magma&#039;)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat}(\omega)=\frac{1}{ N_q} \frac{1}{3} \sum_{\epsilon s\beta \mu q} \frac{1}{E_{\beta q}-s\Omega_{\mu q}}\left|\sum_\alpha\frac{ D^{\epsilon}_\alpha \mathcal{G}_{\beta \alpha}^{\mu,*}(q)}{E_\alpha -E_{\beta q} +s\Omega_{\mu q}+\mathrm{i}\eta}\right|^2 \frac{N^{exc}_{\beta q}(T_{exc})[\frac{1+s}{2}+n_{\mu q}(T)]}{\omega -[E_{\beta q}-s\Omega_{\mu q}]+\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt; is the temperature-dependent phonon Bose-Einstein occupation function. As it can be seen, &amp;lt;math&amp;gt;s=1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), while &amp;lt;math&amp;gt;s=-1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{Sat}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
Finally, the spectrum is averaged over the polarization directions of the emitted photons (&amp;lt;math&amp;gt;\epsilon=x,y,z&amp;lt;/math&amp;gt; representing the respective dipole components).&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; (with or without yambopy: in the latter case remember the option &amp;lt;code&amp;gt;-D&amp;lt;/code&amp;gt;) to get the el-ph matrix elements, particularly the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 -D&lt;br /&gt;
&lt;br /&gt;
=== Luminescence calculation ===&lt;br /&gt;
&lt;br /&gt;
6. And finally we calculate exciton-phonon matrix elements and the luminescence spectrum in one go using a python script importing the Yambopy exciton-phonon tools: in order to do this, we need to take a look at all the necessary input variables for the formula written above.&lt;br /&gt;
&lt;br /&gt;
We can start from the script &amp;lt;code&amp;gt;luminescence.py&amp;lt;/code&amp;gt; available in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 from yambopy.exciton_phonon.excph_luminescence import exc_ph_luminescence&lt;br /&gt;
 from yambopy.exciton_phonon.excph_input_data import exc_ph_get_inputs&lt;br /&gt;
&lt;br /&gt;
We import the necessary tools...&lt;br /&gt;
&lt;br /&gt;
 path = &#039;3D_hBN&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lout--&amp;gt; response is Lfull)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bsepath =  f&#039;{path}/bse_Lfull&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q* databases are needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation for optically active exciton (Lin --&amp;gt; response is Lbar)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bseBARpath =  f&#039;{path}/bse_Lbar&#039;  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to electron-phonon calculation&amp;lt;/span&amp;gt;&lt;br /&gt;
 elphpath = path &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.elph is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to unprojected dipoles matrix elements (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 dipolespath = bsepath &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.dipoles is needed (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath = f&#039;{path}/SAVE&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ns.db1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... and we specify the paths to the necessary databases. Note that, if we want to perform polarization averaging, we have to recompute the excitonic dipoles in python as seen here.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;bseBARpath&amp;lt;/code&amp;gt;? This variable points to the directory where the databases for the optical (zero-momentum) excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; (which may be computed with &amp;lt;code&amp;gt;Lkind=&#039;Lbar&#039;&amp;lt;/code&amp;gt;) is located, which can be different from the directory with the full indirect exciton dispersion &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; (usually computed with &amp;lt;code&amp;gt;Lkind=&#039;Lfull&#039;&amp;lt;/code&amp;gt;, however &amp;lt;code&amp;gt;Lkind=&#039;Ltilde&#039;&amp;lt;/code&amp;gt; can also be used if one is interested in &amp;quot;irreducible&amp;quot; excitons). This makes it possible to compute the coupling between different exciton kinds.&lt;br /&gt;
&lt;br /&gt;
 bands_range=[6,10] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 phonons_range=[0,12] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# All phonons&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_out = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at each momentum (Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_in  = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at Q=0 (Lin)&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_ph  = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Lattice temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_exc = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Effective excitonic temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 emin=4.4      &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Energy range and plot details (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
 emax=4.7&lt;br /&gt;
 estep=0.0002&lt;br /&gt;
 broad = 0.005 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Broadening parameter for peak width (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we specify the parameters for the calculation. We include valence bands from 7 to 10 (6 to 9 in python index) and the contribution of all 12 phonon modes. We consider 12 excitonic states for the coupling matrix elements.&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;T_ph&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;T_exc&amp;lt;/code&amp;gt; are the lattice and excitonic temperatures, respectively.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate and load all the inputs:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Excitonic dipole matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Phonon energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * We specify bse_path2=bseBARpath meaning we use Lbar calculation for Q=0 excitons&amp;lt;/span&amp;gt;&lt;br /&gt;
 input_data = exc_ph_get_inputs(savepath,elphpath,bsepath,\&lt;br /&gt;
                                bse_path2=bseBARpath,dipoles_path=dipolespath,\&lt;br /&gt;
                                nexc_in=12,nexc_out=12,\&lt;br /&gt;
                                bands_range=[6,10],phonons_range=[0,12])&lt;br /&gt;
&lt;br /&gt;
 ph_energies, exc_energies, exc_energies_in, G, exc_dipoles = input_data&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;code&amp;gt;exc_ph_get_inputs&amp;lt;/code&amp;gt; gives us all the input data for luminescence in the correct format: phonon energies, exciton energies, optical exciton energies (if needed), exciton-phonon matrix elements (calculated on the fly and printed to file), unprojected exciton dipoles (optional, calculated on the fly and printed to file).&lt;br /&gt;
The exc-ph matrix element calculation is just a wrapper of the same tools that we have tested in the above section on MoS2.&lt;br /&gt;
&lt;br /&gt;
Finally, there is the calculation of the luminescence spectrum via the function &amp;lt;code&amp;gt;exc_ph_luminescence&amp;lt;/code&amp;gt;:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate the luminescence spectrum including the input data from before&amp;lt;/span&amp;gt;&lt;br /&gt;
 w,PL = exc_ph_luminescence(T_ph,ph_energies,exc_energies,exc_dipoles,G,\&lt;br /&gt;
                            exc_energies_in=exc_energies_in,exc_temp=T_exc,\&lt;br /&gt;
                            nexc_out=nexc_out,nexc_in=nexc_in,emin=emin,emax=emax,\&lt;br /&gt;
                            estep=estep,broad=broad)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to print the luminescence data for later plotting, you can also add the following line to the script:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Save to file&amp;lt;/span&amp;gt;&lt;br /&gt;
 data = np.column_stack((w, PL))&lt;br /&gt;
 np.savetxt(&amp;quot;hBN_luminescence_12x12x1.dat&amp;quot;, data, fmt=&amp;quot;%.8f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
It is now time to run the whole script:&lt;br /&gt;
&lt;br /&gt;
 python luminescence.py&lt;br /&gt;
 &lt;br /&gt;
NB: By using Yambopy for Step 6, we have limited the use of the Yambo code to just step 4 in the entire workflow. This option is more flexible, as it allows for a greater degree of control by the user. On the other hand the Yambo postprocessing route features a Yambo-style input that doesn&#039;t require python knowledge and the calculation is currently faster in fortran. However, the luminescence expression computed in Yambo is a slightly different than this one: it is more approximated in the description of the satellite oscillator strengths, but it explicitly includes the renormalization of the direct exciton peak. You can check the differences [[Exciton-phonon coupling and luminescence - Yambo postprocessing|here]].&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
We can plot the results of the step 6 calculation. If we do it in the same script we can add something like this:&lt;br /&gt;
 fig = plt.figure()&lt;br /&gt;
 ax = fig.add_subplot(1,1,1)&lt;br /&gt;
 ax.set_xlim(emin,emax)&lt;br /&gt;
 ax.set_ylim(0,np.max(PL)*1.1)&lt;br /&gt;
 ax.get_yaxis().set_visible(False)&lt;br /&gt;
 &lt;br /&gt;
 ax.plot(w, PL, &#039;-&#039;,c=&#039;red&#039;, label=&amp;quot;AA&#039; hBN luminescence&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 plt.legend()&lt;br /&gt;
 plt.savefig(&#039;hBN_luminescence.png&#039;)&lt;br /&gt;
 plt.show()&lt;br /&gt;
&lt;br /&gt;
[[File:HBN luminescence satellites.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambopy_postprocessing&amp;diff=1048</id>
		<title>Exciton-phonon coupling and luminescence - Yambopy postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambopy_postprocessing&amp;diff=1048"/>
		<updated>2026-10-10T21:13:30Z</updated>

		<summary type="html">&lt;p&gt;Davide: Created part 2 for exchph via yambopy, splitting it from part 1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
We have finished the heavy simulations. Now it&#039;s time for the postprocessing. The first order of business is the reconstruction of the electron-phonon coupling matrix elements from the dvscf results and the electronic wavefunctions.&lt;br /&gt;
&lt;br /&gt;
In order to do this, we will run the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable of the &#039;&#039;&#039;LetzElPhC&#039;&#039;&#039; code. We will run via command line using yambopy, although it will be instructive to have look at the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; input files later.&lt;br /&gt;
&lt;br /&gt;
We run in the same directory where the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; is (remember than you can also virtually move it with a symbolic link).&lt;br /&gt;
&lt;br /&gt;
Type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y&lt;br /&gt;
&lt;br /&gt;
to see the help for the calculation. Have a look at the various flags and their description.&lt;br /&gt;
For example, if we want to do a serial run of LetzElPhC for bands from &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt;, we should type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/ph_input.in -b n_i n_f&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt; are integers representing the initial and final band indices. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 1 and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f]&amp;lt;/math&amp;gt; including the extrema of the interval.&lt;br /&gt;
&lt;br /&gt;
These should coincide with those used for the Bethe-Salpeter kernel, i.e. those specified in the &amp;lt;code&amp;gt;BSEBands&amp;lt;/code&amp;gt; variable of the BSE input file (this is not strictly necessary, but certainly efficient since these calculations use a lot of disk space). &lt;br /&gt;
&lt;br /&gt;
For our system, we want to do a parallel calculation with 4 qpools and 2 kpools. In addition, we want to explicitly specify the path of the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable and avoid automatically deleting the LetzElPhC data. So we type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/mos2.dvscf -b 25 28 -par 4 2 -lelphc path/to/lelphc_exe&lt;br /&gt;
&lt;br /&gt;
At the end, check your directory: you should find the &amp;lt;code&amp;gt;lelphc.in&amp;lt;/code&amp;gt; input file that was run, let&#039;s inspect it: &lt;br /&gt;
&lt;br /&gt;
 # LetzElPhC input for yambo generated by yambopy&lt;br /&gt;
 nqpool      = 2&lt;br /&gt;
 nkpool      = 4&lt;br /&gt;
 start_bnd   = 25&lt;br /&gt;
 end_bnd     = 28&lt;br /&gt;
 save_dir    = ./SAVE&lt;br /&gt;
 kernel      = dfpt&lt;br /&gt;
 ph_save_dir = dvscf/ph_save&lt;br /&gt;
 convention = yambo&lt;br /&gt;
&lt;br /&gt;
Notice the variable &amp;lt;code&amp;gt;convention=yambo&amp;lt;/code&amp;gt;: what does it mean? At variance with QE and many other codes, Yambo uses the &amp;quot;backward&amp;quot; momentum transfer convention for electronic scatterings. That is, an electronic transition goes from band &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k-q&amp;lt;/math&amp;gt; to band &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;. In the &amp;quot;forward&amp;quot; momentum transfer convention (the more standard one), the transitions go from &amp;lt;math&amp;gt;nk&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;mk+q&amp;lt;/math&amp;gt;. Therefore, this variable ensures that the electron-phonon coupling matrix elements are computed as &amp;lt;math&amp;gt;\langle mk|dV|nk-q\rangle&amp;lt;/math&amp;gt;. This will have consequences also in the formulation of the &#039;&#039;exciton&#039;&#039;-phonon coupling matrix element.&lt;br /&gt;
&lt;br /&gt;
You will also find a &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; database that contains the computed electron-phonon matrix elements, in the output format of &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition, if you check the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; folder:&lt;br /&gt;
&lt;br /&gt;
 ls SAVE/ndb.elph_gkkp*&lt;br /&gt;
&lt;br /&gt;
you will see that yambopy has created the Yambo-compatible electron-phonon databases.&lt;br /&gt;
&lt;br /&gt;
If you want to run LetzElPhC directly, without using yambopy, you can refer to its [https://github.com/yambo-code/LetzElPhC/blob/main/docs/tex_doc/main.pdf|user guide].&lt;br /&gt;
Keep in mind that in this case, in order to convert the database to the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases of Yambo, you will then need a couple of lines of python using the Yambopy class &amp;lt;code&amp;gt;ConvertElectronPhononDB&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;yambopy/letzelph_interface/lelph2y.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases -- e.g., because you are doing the exc-ph postprocessing with yambopy -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_gkkp&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases -- e.g., because you are using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; for the exc-ph part -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_lelphc_dbs&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k, 0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
In order to calculate this quantity using python, we need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases natively generated by the &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt; code, as well as the BSE databases &amp;lt;code&amp;gt;ndb.BS_diago_Q*&amp;lt;/code&amp;gt; containing the information on exciton wavefunctions and energies.&lt;br /&gt;
&lt;br /&gt;
Next, we write a python user script importing the yambopy exciton-phonon tools. You can find a version of this script in &amp;lt;code&amp;gt;yambopy/tutorials/exciton-phonon/calculate_excph.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np &lt;br /&gt;
 from yambopy import YamboLatticeDB,YamboWFDB,LetzElphElectronPhononDB &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific Yambopy dbs loading classes&amp;lt;/span&amp;gt;&lt;br /&gt;
 from yambopy.exciton_phonon.excph_matrix_elements import exciton_phonon_matelem &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific exc-ph functions&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 path = &#039;1L_MoS2&#039;&lt;br /&gt;
 bands_range=[24,28] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence bands, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# number of excitonic states&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 bsepath    = f&#039;{path}/bse-allq_full&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lin=Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath   = f&#039;{path}/SAVE&#039;     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Yambo SAVE&amp;lt;/span&amp;gt;&lt;br /&gt;
 ndb_elph   = f&#039;{path}/ndb.elph&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# LetzElPhC electron-phonon database (any convention)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice&amp;lt;/span&amp;gt;&lt;br /&gt;
 lattice = YamboLatticeDB.from_db_file(filename=f&#039;{savepath}/ns.db1&#039;)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read electron-phonon&amp;lt;/span&amp;gt;&lt;br /&gt;
 elph    = LetzElphElectronPhononDB(ndb_elph,read_all=False)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read wave functions&amp;lt;/span&amp;gt;&lt;br /&gt;
 wfcs    = YamboWFDB(filename=&#039;ns.wf&#039;,save=savepath,latdb=lattice,bands_range=bands_range)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Calculate exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 exph = exciton_phonon_matelem(lattice,elph,wfcs,BSE_dir=bsepath,nexc_in=nexc,nexc_out=nexc,dmat_mode=&#039;save&#039;,exph_file=&#039;MoS2_Ex-ph.npy&#039;)&lt;br /&gt;
&lt;br /&gt;
In this script, we can select the number exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;nexc&amp;lt;/code&amp;gt;, the single-particle bands range with &amp;lt;code&amp;gt;bands_range&amp;lt;/code&amp;gt;. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 0 (python indexing) and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f)&amp;lt;/math&amp;gt;, therefore the last value (28 in the example) is excluded. That is, in the example we are selecting the 25th, 26th, 27th and 28th bands. Those bands have to be present in both the electron-phonon and BSE calculations. &lt;br /&gt;
&lt;br /&gt;
Here we calculate the couplings of the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point including &amp;lt;math&amp;gt;q=0&amp;lt;/math&amp;gt;. We also include all the nine phonon modes of monolayer MoS2. We also need access to the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory in order to read the electronic wavefunctions: they are used to compute the electronic representation matrices (&amp;lt;code&amp;gt;dmat&amp;lt;/code&amp;gt; in the code). The argument &amp;lt;code&amp;gt;dmat_mode&amp;lt;/code&amp;gt; can be set to &amp;lt;code&amp;gt;&#039;load&#039;&amp;lt;/code&amp;gt; for subsequent calculations.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code:&lt;br /&gt;
&lt;br /&gt;
 python calculate_excph.py&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;MoS2_Ex-ph.npy&amp;lt;/code&amp;gt; binary file in the directory where you ran.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases. &lt;br /&gt;
You can find a version of this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# First bright peak (A: 2,3 -- B: 6,7)&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of dark triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ns_ypy = &#039;MoS2_Ex-ph.npy&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Load exc-ph database&amp;lt;/span&amp;gt;&lt;br /&gt;
 X_py = np.load(ns_ypy)&lt;br /&gt;
 G_squared = np.abs(X_py)**2.&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is obtained from a dedicated function as:&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use a custom scatterplot employing some of the plotting tools provided by yambopy (but you can do whatever you want).&lt;br /&gt;
&lt;br /&gt;
 plot_2D_excph(qgrid,G2_to_plot,rlat=ylat.rlat,plt_cbar=True,\&lt;br /&gt;
               marker=&#039;H&#039;,s=700,cmap=&#039;magma&#039;)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat}(\omega)=\frac{1}{ N_q} \frac{1}{3} \sum_{\epsilon s\beta \mu q} \frac{1}{E_{\beta q}-s\Omega_{\mu q}}\left|\sum_\alpha\frac{ D^{\epsilon}_\alpha \mathcal{G}_{\beta \alpha}^{\mu,*}(q)}{E_\alpha -E_{\beta q} +s\Omega_{\mu q}+\mathrm{i}\eta}\right|^2 \frac{N^{exc}_{\beta q}(T_{exc})[\frac{1+s}{2}+n_{\mu q}(T)]}{\omega -[E_{\beta q}-s\Omega_{\mu q}]+\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt; is the temperature-dependent phonon Bose-Einstein occupation function. As it can be seen, &amp;lt;math&amp;gt;s=1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), while &amp;lt;math&amp;gt;s=-1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{Sat}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
Finally, the spectrum is averaged over the polarization directions of the emitted photons (&amp;lt;math&amp;gt;\epsilon=x,y,z&amp;lt;/math&amp;gt; representing the respective dipole components).&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; (with or without yambopy: in the latter case remember the option &amp;lt;code&amp;gt;-D&amp;lt;/code&amp;gt;) to get the el-ph matrix elements, particularly the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 -D&lt;br /&gt;
&lt;br /&gt;
=== Luminescence calculation ===&lt;br /&gt;
&lt;br /&gt;
6. And finally we calculate exciton-phonon matrix elements and the luminescence spectrum in one go using a python script importing the Yambopy exciton-phonon tools: in order to do this, we need to take a look at all the necessary input variables for the formula written above.&lt;br /&gt;
&lt;br /&gt;
We can start from the script &amp;lt;code&amp;gt;luminescence.py&amp;lt;/code&amp;gt; available in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 from yambopy.exciton_phonon.excph_luminescence import exc_ph_luminescence&lt;br /&gt;
 from yambopy.exciton_phonon.excph_input_data import exc_ph_get_inputs&lt;br /&gt;
&lt;br /&gt;
We import the necessary tools...&lt;br /&gt;
&lt;br /&gt;
 path = &#039;3D_hBN&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lout--&amp;gt; response is Lfull)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bsepath =  f&#039;{path}/bse_Lfull&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q* databases are needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation for optically active exciton (Lin --&amp;gt; response is Lbar)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bseBARpath =  f&#039;{path}/bse_Lbar&#039;  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to electron-phonon calculation&amp;lt;/span&amp;gt;&lt;br /&gt;
 elphpath = path &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.elph is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to unprojected dipoles matrix elements (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 dipolespath = bsepath &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.dipoles is needed (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath = f&#039;{path}/SAVE&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ns.db1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... and we specify the paths to the necessary databases. Note that, if we want to perform polarization averaging, we have to recompute the excitonic dipoles in python as seen here.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;bseBARpath&amp;lt;/code&amp;gt;? This variable points to the directory where the databases for the optical (zero-momentum) excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; (which may be computed with &amp;lt;code&amp;gt;Lkind=&#039;Lbar&#039;&amp;lt;/code&amp;gt;) is located, which can be different from the directory with the full indirect exciton dispersion &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; (usually computed with &amp;lt;code&amp;gt;Lkind=&#039;Lfull&#039;&amp;lt;/code&amp;gt;, however &amp;lt;code&amp;gt;Lkind=&#039;Ltilde&#039;&amp;lt;/code&amp;gt; can also be used if one is interested in &amp;quot;irreducible&amp;quot; excitons). This makes it possible to compute the coupling between different exciton kinds.&lt;br /&gt;
&lt;br /&gt;
 bands_range=[6,10] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 phonons_range=[0,12] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# All phonons&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_out = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at each momentum (Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_in  = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at Q=0 (Lin)&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_ph  = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Lattice temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_exc = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Effective excitonic temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 emin=4.4      &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Energy range and plot details (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
 emax=4.7&lt;br /&gt;
 estep=0.0002&lt;br /&gt;
 broad = 0.005 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Broadening parameter for peak width (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we specify the parameters for the calculation. We include valence bands from 7 to 10 (6 to 9 in python index) and the contribution of all 12 phonon modes. We consider 12 excitonic states for the coupling matrix elements.&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;T_ph&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;T_exc&amp;lt;/code&amp;gt; are the lattice and excitonic temperatures, respectively.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate and load all the inputs:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Excitonic dipole matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Phonon energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * We specify bse_path2=bseBARpath meaning we use Lbar calculation for Q=0 excitons&amp;lt;/span&amp;gt;&lt;br /&gt;
 input_data = exc_ph_get_inputs(savepath,elphpath,bsepath,\&lt;br /&gt;
                                bse_path2=bseBARpath,dipoles_path=dipolespath,\&lt;br /&gt;
                                nexc_in=12,nexc_out=12,\&lt;br /&gt;
                                bands_range=[6,10],phonons_range=[0,12])&lt;br /&gt;
&lt;br /&gt;
 ph_energies, exc_energies, exc_energies_in, G, exc_dipoles = input_data&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;code&amp;gt;exc_ph_get_inputs&amp;lt;/code&amp;gt; gives us all the input data for luminescence in the correct format: phonon energies, exciton energies, optical exciton energies (if needed), exciton-phonon matrix elements (calculated on the fly and printed to file), unprojected exciton dipoles (optional, calculated on the fly and printed to file).&lt;br /&gt;
The exc-ph matrix element calculation is just a wrapper of the same tools that we have tested in the above section on MoS2.&lt;br /&gt;
&lt;br /&gt;
Finally, there is the calculation of the luminescence spectrum via the function &amp;lt;code&amp;gt;exc_ph_luminescence&amp;lt;/code&amp;gt;:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate the luminescence spectrum including the input data from before&amp;lt;/span&amp;gt;&lt;br /&gt;
 w,PL = exc_ph_luminescence(T_ph,ph_energies,exc_energies,exc_dipoles,G,\&lt;br /&gt;
                            exc_energies_in=exc_energies_in,exc_temp=T_exc,\&lt;br /&gt;
                            nexc_out=nexc_out,nexc_in=nexc_in,emin=emin,emax=emax,\&lt;br /&gt;
                            estep=estep,broad=broad)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to print the luminescence data for later plotting, you can also add the following line to the script:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Save to file&amp;lt;/span&amp;gt;&lt;br /&gt;
 data = np.column_stack((w, PL))&lt;br /&gt;
 np.savetxt(&amp;quot;hBN_luminescence_12x12x1.dat&amp;quot;, data, fmt=&amp;quot;%.8f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
It is now time to run the whole script:&lt;br /&gt;
&lt;br /&gt;
 python luminescence.py&lt;br /&gt;
 &lt;br /&gt;
NB: By using Yambopy for Step 6, we have limited the use of the Yambo code to just step 4 in the entire workflow. This option is more flexible, as it allows for a greater degree of control by the user. On the other hand the Yambo postprocessing route features a Yambo-style input that doesn&#039;t require python knowledge and the calculation is currently faster in fortran. However, the luminescence expression computed in Yambo is a slightly different than this one: it is more approximated in the description of the satellite oscillator strengths, but it explicitly includes the renormalization of the direct exciton peak. You can check the differences [[Exciton-phonon coupling and luminescence - Yambo postprocessing|here]].&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
We can plot the results of the step 6 calculation. If we do it in the same script we can add something like this:&lt;br /&gt;
 fig = plt.figure()&lt;br /&gt;
 ax = fig.add_subplot(1,1,1)&lt;br /&gt;
 ax.set_xlim(emin,emax)&lt;br /&gt;
 ax.set_ylim(0,np.max(PL)*1.1)&lt;br /&gt;
 ax.get_yaxis().set_visible(False)&lt;br /&gt;
 &lt;br /&gt;
 ax.plot(w, PL, &#039;-&#039;,c=&#039;red&#039;, label=&amp;quot;AA&#039; hBN luminescence&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 plt.legend()&lt;br /&gt;
 plt.savefig(&#039;hBN_luminescence.png&#039;)&lt;br /&gt;
 plt.show()&lt;br /&gt;
&lt;br /&gt;
[[File:HBN luminescence satellites.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1047</id>
		<title>Exciton-phonon coupling and luminescence - Yambo postprocessing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_-_Yambo_postprocessing&amp;diff=1047"/>
		<updated>2026-10-10T21:12:53Z</updated>

		<summary type="html">&lt;p&gt;Davide: Imported section on exciton-lifetimes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. In this version of the tutorial we present the latter case.&lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k,0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have to write a new yambo input, that we can call &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt;, for this. You can copy (and adapt) the one below, or you can generate one by running from the command line:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -excph o&lt;br /&gt;
&lt;br /&gt;
This generates an input to compute luminescence (&amp;quot;o&amp;quot; is for &amp;quot;optics&amp;quot;). The variables that we are interested in are:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse_Lfull&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 9 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
In this input, we have to select the initial exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcStates&amp;lt;/code&amp;gt;, the final exciton states &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ELPhExcSum&amp;lt;/code&amp;gt; and the phonon modes &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;ElPhModes&amp;lt;/code&amp;gt;. Here we consider the first four states at &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; (corresponding to just two excitons because they are both doubly degenerate -- do not break degeneracies when selecting states!) and the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point. We also include all the nine phonon modes of monolayer MoS2.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;LoutPath&amp;lt;/code&amp;gt;? This variable controls the directory where the databases for the final-state excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is located, which can be different from the directory with the initial-state excitons &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; read as usual with the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; option when running the code. This makes it possible to compute the coupling between different exciton kinds. However, for our tutorial, we stick with the previously computed &amp;lt;code&amp;gt;Lfull&amp;lt;/code&amp;gt; in both cases.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lfull -C excph&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;ndb.excph*&amp;lt;/code&amp;gt; databases in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph_yambo_ph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases using the &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt; from yambopy. &lt;br /&gt;
You can find this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# A: 2,3 -- B: 6,7&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ndb_exc=f&#039;{path}/excph&#039;&lt;br /&gt;
  &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1),Expand=True)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read exc-ph databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 X = YamboExcitonPhononDB(ylat,save_excph=ndb_exc)&lt;br /&gt;
 print(X)&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is defined inside the plotting function as&lt;br /&gt;
&lt;br /&gt;
 G_squared = excph.excph_sq&lt;br /&gt;
 G2plt = np.zeros(len(G_squared))&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use the default scatterplot provided by &amp;lt;code&amp;gt;YamboExcitonPhononDB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 excph.plot_excph(F_q,plt_cbar=plt_cbar,**kwargs)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon. In addition, we can calculate the renormalization of the &amp;quot;direct&amp;quot; exciton recombination, due to the appearance of the satellites. However, in order to model both phonon replicas (satellites) and main peak renormalization, we pay the price of approximating the replicas oscillator strength. In the yambopy postprocessing, currently we do not compute peak renormalization but rather we calculate the full expression for the satellites. &lt;br /&gt;
&lt;br /&gt;
The luminescence expression implemented in Yambo comes from the first-order exciton-phonon response function adapted using the Van Roosbroeck-Shockley relation. It employs the diagonal exciton-phonon self-energy only, so that we can call this &amp;quot;exciton-quasiparticle approximation&amp;quot;.&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{PL}(\omega)=I^{(0)}(\omega)+I^{Sat}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first-order renormalised direct part is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{(0)}(\omega)=-\omega \sum_\alpha \omega^2 \frac{|D_\alpha|^2 [1-R_\alpha^{em}(T)-R^{abs}_\alpha (T)]N_\alpha^{exc}(T_{exc})}{\omega - E_\alpha +\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The satellite parts are (phonon absorption | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,abs}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{ \frac{1}{N_q}\frac{(\omega-2\Omega_{\mu q})^2 |D_\alpha |^2 T^{em}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})n_{\mu q}(T)}{\omega - [E_{\beta q}+\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and (phonon emission | photon emission):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat,em}(\omega)=-\omega\sum_{\beta q \alpha \mu}\left\{\frac{1}{N_q} \frac{(\omega+2\Omega_{\mu q})^2 |D_\alpha |^2 T^{abs}_{\mu \beta \alpha q} N^{exc}_{\beta q}(T_{exc})[1+n_{\mu q}(T)]}{\omega - [E_{\beta q}-\Omega_{\mu q}]+\mathrm{i}\eta}  \right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;-factors contain the satellite weights&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T^{em}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}+\Omega_{\mu q}|^2}, \quad T^{abs}_{\mu\beta\alpha q}=\frac{|\mathcal{G}_{\beta\alpha}^\mu(q)|^2}{|E_{\beta q}-E_{\alpha}-\Omega_{\mu q}|^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which, once summed, form the renormalization factors (equal to minus the energy-derivative of the exc-ph self-energy evaluated at the &amp;quot;bare&amp;quot; exciton energy, analogous to GW)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R^{abs}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{em}_{\mu\beta\alpha q}[1+n_{\mu q}(T)], \quad R^{em}_\alpha = \sum_{\beta \mu q} \frac{1}{N_q} T^{abs}_{\mu\beta\alpha q}n_{\mu q}(T)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In these expressions, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
The phonon temperature-dependent Bose-Einstein occupation function is &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt;. We include the processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), as well as of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{(1)}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; with yambopy to get the el-ph matrix elements:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 &lt;br /&gt;
&lt;br /&gt;
6. And finally we generate the exciton-phonon input &amp;lt;code&amp;gt;excph.in&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;yambo_ph -excph o&amp;lt;/code&amp;gt;. Now, we take a look at all the additional variables that we didn&#039;t check before, specifying also the details for luminescence the spectrum calculation.&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;ExcPhOptics                      # [R][EXCPH] Exciton-Phonon Optics&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;BoseTemp=10.000000         Kn    # Bosonic Temperature&amp;lt;/span&amp;gt; &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EXCTemp= 10.000000          Kn    # [EXCPH] Excitonic Temperature (for luminescence spectra)&amp;lt;/span&amp;gt;&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
  1 | 4 |                             # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
  1 | 12 |                             # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
  1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;./bse-L_full&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 EXCPHdEtresh= 0.100000E-5  eV    # [ELPH] Energy treshold for exc-ph denominator&lt;br /&gt;
 LDamping= 0.500000E-3      eV    # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# These are the plot parameters, same as in other parts of yambo&amp;lt;/span&amp;gt; &lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
   4.00000 | 5.00000 |         eV    # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.00500000 | 0.00500000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 4000                    # [Xd] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;BoseTemp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;EXCTemp&amp;lt;/code&amp;gt; are the lattice and excitonic temperature, respectively.&lt;br /&gt;
&lt;br /&gt;
Now we run the calculation with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;. Here, we read as &amp;lt;math&amp;gt;Q=0&amp;lt;/math&amp;gt; excitons with &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; the ones without the long-range Coulomb exchange:&lt;br /&gt;
&lt;br /&gt;
 yambo_ph -F excph.in -J excph,bse_Lbar -C excph&lt;br /&gt;
&lt;br /&gt;
and we find our outputs in the &amp;lt;code&amp;gt;excph&amp;lt;/code&amp;gt; directory. &lt;br /&gt;
&lt;br /&gt;
NB: Step 6 could have been equivalently run in yambopy, limiting the use of the yambo code to just step 4. This latter option is more flexible, as it allows for a greater degree of control by the user. We are in the last stages of the development and it will be available soon.&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
&lt;br /&gt;
If we check the output directory from the step 6 calculation, we find the &amp;lt;code&amp;gt;o-excph.pl_bse_ph_ass&amp;lt;/code&amp;gt; output files containing the luminescence spectra. We can plot them with gnuplot or any other tool:&lt;br /&gt;
&lt;br /&gt;
 gnuplot&lt;br /&gt;
 &amp;gt; set xrange[4.2:5]&lt;br /&gt;
 &amp;gt; p &#039;o-excph.pl_bse_ph_ass&#039; u 1:2 w l lc rgb &#039;red&#039; lw 3&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence plot.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. The direct recombination peak is completely suppressed. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo_ph -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: 20.22155 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: 32.95292 meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039;/&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1046</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1046"/>
		<updated>2026-10-10T21:05:09Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Electron-phonon and exciton-phonon coupling */  Splitting exc-ph tutorial in 2 parts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic ==&lt;br /&gt;
* [[First steps: a walk through from DFT to optical properties]] (modular tutorial) &lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)|GW on h-BN]] (standalone version);  [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW on h-BN]] (modular version) &lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[BSE tutorial on hBN standalone|BSE on h-BN]] (standalone version); [[BSE tutorial on hBN|BSE on h-BN]] (modular version); &lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials on GW and Quasi-particles ==&lt;br /&gt;
* [[Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW parallel strategies|GW parallel strategies v1]]; [[GW parallel strategies CECAM|GW parallel strategies v2]];  [[Pushing convergence in parallel|GW convergence in parallel]] (modular tutorials)&lt;br /&gt;
* [[GW tutorial on HPC]] (external tutorial on HackMD)&lt;br /&gt;
* [[Quasi-particles and Self-energy within the Multipole Approximation (MPA)]]&lt;br /&gt;
* [http://www.attaccalite.com/gw-correction-on-an-arbitrary-point-of-the-brillouin-zone GW on arbitrary k point] (external tutorial on www.attaccalite.com)&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials Linear response and BSE ==&lt;br /&gt;
=== Optical properties and more in extended systems ===&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
* [[The magneto-optical Kerr effect|The magneto-optical Kerr effect in bulk iron, RPA]]&lt;br /&gt;
* [[The magneto-optical Kerr effect including excitonic effects|The magneto-optical Kerr effect in XXX, excitonic effects]] (todo)&lt;br /&gt;
* [[Magneto-electric reponse]]&lt;br /&gt;
* [[Magnons with BSE formalism]] (todo)&lt;br /&gt;
* [[Bands selection in BSE and application to semi-core states]] (todo)&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Fast convergence of dielectric constant with double grid]]&lt;br /&gt;
=== Optical properties and more in lower dimensional systems (1D/2D) ===&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]] (1D)&lt;br /&gt;
* [[Si wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&lt;br /&gt;
* [[Si Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
&lt;br /&gt;
=== Optical properties and more in molecules ===&lt;br /&gt;
* [[H2|H2 molecule: Linear Response &amp;amp; TDDFT (0D)]] (to restore from old version)&lt;br /&gt;
* [[SiH4|SiH4: isolated molecule TDDFT &amp;amp; BSE (0D)]] (restored from old version, still to be finalized)&lt;br /&gt;
* [[Dichroism in molecules]]&lt;br /&gt;
&lt;br /&gt;
== Post Processing with ypp and YamboPy ==&lt;br /&gt;
&lt;br /&gt;
=== Basic post-processing features ===&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
* [[First steps in YamboPy]]&lt;br /&gt;
&lt;br /&gt;
=== Post BSE tutorials ===&lt;br /&gt;
* [[NEQ AREPS from BSE post processing]]&lt;br /&gt;
* [[Inter/Intra exciton transitions from BSE post processing]]&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon and exciton-phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling (old tutorial)]]&lt;br /&gt;
* [[Electron Phonon Coupling (new)]]&lt;br /&gt;
* [[Electron and exciton life-time]]&lt;br /&gt;
* [[Optical properties at finite temperature]]&lt;br /&gt;
* [[Phonon-assisted luminescence by finite atomic displacements]]&lt;br /&gt;
&amp;lt;!-- * [[Exciton-phonon coupling and luminescence hBN | Exciton-phonon coupling and luminescence in hBN via yambopy (version 1)]] --&amp;gt;&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence | Exciton-phonon coupling and luminescence in hBN (part 1)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence - Yambopy postprocessing | Exciton-phonon coupling and luminescence in hBN, (part 2) via yambopy]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence - Yambo postprocessing | Exciton-phonon coupling and luminescence in hBN, (part 2) via yambo_ph]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Real time propagation ==&lt;br /&gt;
&lt;br /&gt;
=== Linear response from real time propagation ===&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response using the density matrix (IP)]]&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase|Linear response using wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response in velocity gauge|Linear response using wave-functions in velocity gauge (IP)]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Linear response using the density matrix (TD-HSEX)]]&lt;br /&gt;
* [[Linear response from real time simulations|Linear response from real time simulations (IP &amp;amp; TD-HSEX)]] (modular tutorial)&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response from real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real time approach to non-linear response (SHG)]]&lt;br /&gt;
* [[Correlation effects in the non-linear response]]&lt;br /&gt;
* [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [[Spin-orbit coupling and non-linear response]]&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]]&lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response in Floquet formulation ===&lt;br /&gt;
* [[SHG from Floquet formulation]]&lt;br /&gt;
=== Pump and Probe experiments ===&lt;br /&gt;
&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon|Pump and Probe: Transient Absorption from BSE with NEQ occupations]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption from real time propagation with pump and probe]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES|Pump and Probe: Time resolved ARPES from real time propagation with pump]]&lt;br /&gt;
&lt;br /&gt;
=== More on real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real-time dynamics with external field read from file]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Developing Lumen ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence&amp;diff=1045</id>
		<title>Exciton-phonon coupling and luminescence</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence&amp;diff=1045"/>
		<updated>2026-10-10T21:02:56Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Requirements */  Preparing splitting into two parts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Tdgw-phonon-usc-01-1024x829.jpg|thumb|right|400px|(c) Zhenglu Li, University of Southern California]]&lt;br /&gt;
&lt;br /&gt;
In this advanced tutorial, we will calculate exciton-phonon interactions from first principles by interfacing DFPT (for phonon calculations) and BSE (for exciton calculations).&lt;br /&gt;
&lt;br /&gt;
The DFTP calculations are run with Quantum ESPRESSO, while the many-body GW-BSE calculations are run with Yambo. Finally, the exciton-phonon interaction will be obtained by combining and postprocessing the databases computed in the two previous runs. The great advantage of this workflow is that the calculations can be run in the irreducible Brillouin zones both for the electronic momenta (&#039;&#039;&#039;k&#039;&#039;&#039;) and the transfer momenta (&#039;&#039;&#039;Q&#039;&#039;&#039;, &#039;&#039;&#039;q&#039;&#039;&#039;) of excitons and phonons, thus speeding up considerably the jobs while reducing the IO and memory load.&lt;br /&gt;
&lt;br /&gt;
We will first compute the exciton-phonon coupling matrix elements: these are the building blocks needed to construct experimental observables such as phonon-assisted optical spectra (such as luminescence), Raman spectra and exciton lifetimes. We will do this in the case of monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, a 2D system with large spin-orbit interaction.&lt;br /&gt;
&lt;br /&gt;
As an example of application, we will consider the case of phonon-assisted luminescence. We will do this in the case of bulk hBN, a layered indirect insulator with strong electron-phonon coupling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; this tutorial will be updated when new exc-ph tools become available in Yambopy (including full-python postprocessing, Raman spectra, interpolated lifetimes, etc).&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
This is an advanced topic: we assume that you already know something about the theory&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot; /&amp;gt; and applications&amp;lt;ref name=&amp;quot;paleari2019&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot; /&amp;gt; of exciton-phonon physics. &lt;br /&gt;
&lt;br /&gt;
Also, we assume that you already know how to run both a basic &#039;&#039;&#039;Yambo&#039;&#039;&#039; GW-BSE calculation and a DFPT phonon calculation with &#039;&#039;&#039;Quantum ESPRESSO&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Besides the QE executables &amp;lt;code&amp;gt;pw.x&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ph.x&amp;lt;/code&amp;gt;, we also use the yambo phonon-specific executable &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; and the python utility &#039;&#039;&#039;Yambopy&#039;&#039;&#039;. The auxiliary code &#039;&#039;&#039;LetzElPhC&#039;&#039;&#039; (executable &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt;) will be used to obtain the electron-phonon matrix elements by reading the same electronic wavefunctions used by Yambo (and stored in the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory), while also making full use of crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At this point there will be two options for completing part 2 of the tutorial: &amp;lt;br&amp;gt;&lt;br /&gt;
a) &amp;lt;code&amp;gt;Yambopy&amp;lt;/code&amp;gt; path. [https://github.com/yambo-code/LetzElPhC LetzElPhC] will be run by Yambopy, which will be later also used to handle the electron-phonon databases and compute exciton-pronon couplings and derived quantites.  &amp;lt;br&amp;gt;&lt;br /&gt;
b) &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; path. [https://github.com/yambo-code/LetzElPhC LetzElPhC] will be run as a standalone software, and the elph databases from &amp;lt;code&amp;gt;Letzelphc&amp;lt;/code&amp;gt; converted into &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; format. Finally, the exciton-phonon properties will be computed with &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Workflow scheme.png|800px|center]]&lt;br /&gt;
&lt;br /&gt;
== Step 0: Pseudopotentials, equilibrium structure and convergence ==&lt;br /&gt;
&lt;br /&gt;
In a real calculation, it is important to ensure that both the pseudopotential and the lattice parameters that we are using are compatible and perform well for the electronic excited states and for the lattice vibrations simultaneously. Furthermore, you have to make sure that the wave function cutoff &amp;lt;code&amp;gt;ecutwfc&amp;lt;/code&amp;gt; is converged with respect to the DFPT step and not just to the DFT one. This is in addition to the other customary convergence tests for DFT, DFPT, GW and BSE calculations.&lt;br /&gt;
&lt;br /&gt;
This is often the most time-demanding step when starting on a new system.&lt;br /&gt;
&lt;br /&gt;
For the sake of this tutorial, we assume that we have already done all these tests and we are starting the final workflow to get the exciton-phonon properties.&lt;br /&gt;
&lt;br /&gt;
== Step 1: scf calculation ==&lt;br /&gt;
&lt;br /&gt;
First of all, we run a standard scf calculation with &amp;lt;code&amp;gt;pw.x&amp;lt;/code&amp;gt; for Yambo. We stick with non-symmorphic symmetries. At the end, we will have the QE &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
This is the input &amp;lt;code&amp;gt;mos2.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
           wf_collect = .true.,&lt;br /&gt;
          calculation = &amp;quot;scf&amp;quot;,&lt;br /&gt;
            verbosity = &#039;high&#039;,&lt;br /&gt;
           pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
               prefix = &amp;quot;mos2&amp;quot;,&lt;br /&gt;
               outdir = &#039;.&#039;,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;system&lt;br /&gt;
              ecutwfc = 100.0,&lt;br /&gt;
          occupations = &#039;fixed&#039;,&lt;br /&gt;
                ibrav = 4,&lt;br /&gt;
            celldm(1) = 5.9000811881,&lt;br /&gt;
            celldm(3) = 6.7795677253,&lt;br /&gt;
                  nat = 3,&lt;br /&gt;
                 ntyp = 2,&lt;br /&gt;
             lspinorb = .true.&lt;br /&gt;
             noncolin = .true.&lt;br /&gt;
             assume_isolated = &#039;2D&#039;&lt;br /&gt;
         force_symmorphic = .true.&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;electrons&lt;br /&gt;
     electron_maxstep = 200,&lt;br /&gt;
          mixing_beta = 0.7,&lt;br /&gt;
             conv_thr = 1.d-08,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
   ATOMIC_SPECIES&lt;br /&gt;
    Mo  95.940      Mo_ONCV_PBE_FR-1.0.upf&lt;br /&gt;
    S    32.065     S_ONCV_PBE_FR-1.1.upf&lt;br /&gt;
   ATOMIC_POSITIONS { crystal }&lt;br /&gt;
 Mo       0.333333333   0.666666667   0.000000000&lt;br /&gt;
 S        0.666666667   0.333333333   0.073413577&lt;br /&gt;
 S        0.666666667   0.333333333  -0.073413577&lt;br /&gt;
  K_POINTS { automatic }&lt;br /&gt;
 6 6 1 0 0 0&lt;br /&gt;
&lt;br /&gt;
Here we are using full relativistic pseudopotentials from the SG-15 database.&lt;br /&gt;
&lt;br /&gt;
We can run it on our machine (for example using 4 MPI tasks) as:&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp mos2.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
== Step 2: nscf calculation for Yambo ==&lt;br /&gt;
&lt;br /&gt;
Copy the QE &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory from the scf calculation and run the nscf calculation for any number of empty states, with the correct &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;-grid we want to use in Yambo. Here we are using a badly underconverged grid of 6x6x1.&lt;br /&gt;
&lt;br /&gt;
This reciprocal-space grid will also match the momentum transfer &amp;lt;code&amp;gt;q&amp;lt;/code&amp;gt; grid on which excitons and phonons will be defined!&lt;br /&gt;
&lt;br /&gt;
The electronic wavefunctions computed at this step and stored in the new nscf &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory will be used both by Yambo and by the electron-phonon code: this is important because using different sets of wavefunctions would lead to a phase mismatch issue in the exciton-phonon matrix elements.&lt;br /&gt;
&lt;br /&gt;
The nscf input &amp;lt;code&amp;gt;mos2.nscf&amp;lt;/code&amp;gt; is&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
           wf_collect = .true.,&lt;br /&gt;
          calculation = &amp;quot;nscf&amp;quot;,&lt;br /&gt;
            verbosity = &#039;high&#039;,&lt;br /&gt;
           pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
               prefix = &amp;quot;mos2&amp;quot;,&lt;br /&gt;
               outdir = &#039;.&#039;,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;system&lt;br /&gt;
              ecutwfc = 100.0,&lt;br /&gt;
          occupations = &#039;fixed&#039;,&lt;br /&gt;
                ibrav = 4,&lt;br /&gt;
            celldm(1) = 5.9000811881,&lt;br /&gt;
            celldm(3) = 6.7795677253,&lt;br /&gt;
                  nat = 3,&lt;br /&gt;
                 ntyp = 2,&lt;br /&gt;
             lspinorb = .true.&lt;br /&gt;
             noncolin = .true.&lt;br /&gt;
                nbnd  = 250&lt;br /&gt;
             assume_isolated = &#039;2D&#039;&lt;br /&gt;
         force_symmorphic = .true.&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
  &amp;amp;electrons&lt;br /&gt;
     electron_maxstep = 200,&lt;br /&gt;
          mixing_beta = 0.7,&lt;br /&gt;
             conv_thr = 1.d-08,&lt;br /&gt;
  /&amp;amp;end&lt;br /&gt;
   ATOMIC_SPECIES&lt;br /&gt;
    Mo  95.940      Mo_ONCV_PBE_FR-1.0.upf&lt;br /&gt;
    S    32.065     S_ONCV_PBE_FR-1.1.upf&lt;br /&gt;
   ATOMIC_POSITIONS { crystal }&lt;br /&gt;
 Mo       0.333333333   0.666666667   0.000000000&lt;br /&gt;
 S        0.666666667   0.333333333   0.073413577&lt;br /&gt;
 S        0.666666667   0.333333333  -0.073413577&lt;br /&gt;
  K_POINTS { automatic }&lt;br /&gt;
 6 6 1 0 0 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Again, we run the calculation&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp mos2.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
== Step 3: dvscf phonon calculation ==&lt;br /&gt;
&lt;br /&gt;
Now we run the phonon calculation.&lt;br /&gt;
&lt;br /&gt;
Copy the &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; directory from the &#039;&#039;&#039;scf&#039;&#039;&#039; calculation and run &amp;lt;code&amp;gt;ph.x&amp;lt;/code&amp;gt; for a dvscf calculation with a standard &amp;lt;code&amp;gt;q&amp;lt;/code&amp;gt;-grid matching the &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;-grid we wanna use in Yambo.&lt;br /&gt;
&lt;br /&gt;
At the end, we will have the &amp;lt;code&amp;gt;_ph0&amp;lt;/code&amp;gt; directory containing the variation of the self-consistent potential, &amp;lt;math&amp;gt;\Delta V_{SCF}(q)&amp;lt;/math&amp;gt;, and the &amp;lt;code&amp;gt;*.dyn&amp;lt;/code&amp;gt; files with the phonon energies and eigenvectors.&lt;br /&gt;
&lt;br /&gt;
NB: one could further refine the phonon energies by enforcing the acoustic sum rule, including non-analytic long-range contributions, interpolating to finer grids... all of this can be done within Quantum ESPRESSO and will not be covered in this version of the tutorial.&lt;br /&gt;
&lt;br /&gt;
The input is &amp;lt;code&amp;gt;mos2.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
 mos2_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;mos2&#039;,&lt;br /&gt;
   fildvscf = &#039;mos2-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;mos2.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=1&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
And now we run as&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 ph.x -inp mos2.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
This time we use nohup and more processes because this calculation may take some time. It is a good idea to set &amp;lt;code&amp;gt;recover=.true.&amp;lt;/code&amp;gt; as in a real calculation you will easily breach walltime, and in this way you can safely restart.&lt;br /&gt;
&lt;br /&gt;
== Step 4: create Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory ==&lt;br /&gt;
&lt;br /&gt;
This is just the standard Yambo initialization: run &lt;br /&gt;
 &lt;br /&gt;
 p2y &lt;br /&gt;
&lt;br /&gt;
and then &lt;br /&gt;
&lt;br /&gt;
 yambo &lt;br /&gt;
&lt;br /&gt;
in the &#039;&#039;&#039;nscf&#039;&#039;&#039; &amp;lt;code&amp;gt;save&amp;lt;/code&amp;gt; folder and then move the newly generated &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory to a convenient place.&lt;br /&gt;
&lt;br /&gt;
== Step 5: run a BSE calculation ==&lt;br /&gt;
&lt;br /&gt;
Now we switch from QE to Yambo. Here, we forgo the GW step for simplicity (we can use a scissor operator to open the band gap).&lt;br /&gt;
&lt;br /&gt;
This calculation has a couple of differences with respect to a standard BSE calculation for optical absorption. We can look at the input file &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Runlevels&amp;lt;/span&amp;gt;&lt;br /&gt;
 optics                       # [R OPT] Optics&lt;br /&gt;
 rim_cut                      # [R RIM CUT] Coulomb potential&lt;br /&gt;
 bss                          # [R BSS] Bethe Salpeter Equation solver&lt;br /&gt;
 em1s                         # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 bse                          # [R BSE] Bethe Salpeter Equation.&lt;br /&gt;
 bsk                          # [R BSK] Bethe Salpeter Equation kernel&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# RIM and cutoff settings&amp;lt;/span&amp;gt;&lt;br /&gt;
 RandQpts=1000000             # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 100            RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;quot;slab z&amp;quot;               # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere X/Y/Z/XY..&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Static screening&amp;lt;/span&amp;gt;&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 4 2 1&amp;quot;       # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;      # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 Chimod= &amp;quot;hartree&amp;quot;            # [X] IP/Hartree/ALDA/LRC/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  200 |                 # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 8000            mRy    # [Xs] Response block size&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# BSE&amp;lt;/span&amp;gt;&lt;br /&gt;
 BS_CPU= &amp;quot;4.1.2&amp;quot;                   # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k.eh.t&amp;quot;                 # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_diago=4              # [PARALLEL] CPUs for matrix diagonalization&lt;br /&gt;
 BSEmod= &amp;quot;causal&amp;quot;             # [BSE] resonant/causal/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                  # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  40000      mRy    # [BSK] Exchange components&lt;br /&gt;
 ALLGexx                      # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  8000       mRy    # [BSK] Screened interaction block size&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind=&amp;quot;full&amp;quot;                  #[BSE,X] bar(default)/full/tilde&amp;lt;/span&amp;gt;&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.00000 |  4.00000 | eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
   0.05000 |  0.05000 | eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 2000               # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 7 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BSEBands&lt;br /&gt;
    25 |  28 |                 # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                      # [BSS] Write to disk excitonic the FWs&lt;br /&gt;
 &lt;br /&gt;
This file was generated using the command: &amp;lt;code&amp;gt; yambo -X s -o b -k sex -y d -r&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all, we compute the excitons for all the momenta in the irreducible Brillouin zone for our discrete grid via the &amp;lt;code&amp;gt;BSEQptR&amp;lt;/code&amp;gt; variable. This will be a &#039;&#039;&#039;finite-momentum&#039;&#039;&#039; BSE calculation, analogous to the phonon one.&lt;br /&gt;
&lt;br /&gt;
Second, we change the variable &amp;lt;code&amp;gt;Lkind&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;bar&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;full&amp;lt;/code&amp;gt;. In Yambo, &amp;lt;code&amp;gt;Lkind=&amp;quot;bar&amp;quot;&amp;lt;/code&amp;gt;, which is the default for optical absorption, means that we are computing the excitonic response function without the long-range component of the exchange interaction. This cannot be used when computing the exciton momentum dependence, where the long-range exchange interaction can play a role, therefore we have to include it with &amp;lt;code&amp;gt;Lkind=&amp;quot;full&amp;quot;&amp;lt;/code&amp;gt;. This allows for the calculation of the excitonic longitudinal-transverse splitting (in 3D systems) as well.&lt;br /&gt;
&lt;br /&gt;
We can now run the code:&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
At the end of the calculation, we have obtained the &amp;lt;code&amp;gt;ndb.BS_diago_Q*&amp;lt;/code&amp;gt; databases inside the directory &amp;lt;code&amp;gt;bse_Lfull&amp;lt;/code&amp;gt;. They contain information on the exciton energies and wavefunctions at each momentum. Do not forget to check the report and logs of your calculation in the same directory to make sure that the code is doing what you want.&lt;br /&gt;
&lt;br /&gt;
== Step 6: obtain the electron-phonon matrix elements ==&lt;br /&gt;
&lt;br /&gt;
We have finished the heavy simulations. Now it&#039;s time for the postprocessing. The first order of business is the reconstruction of the electron-phonon coupling matrix elements from the dvscf results and the electronic wavefunctions.&lt;br /&gt;
&lt;br /&gt;
In order to do this, we will run the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable of the &#039;&#039;&#039;LetzElPhC&#039;&#039;&#039; code. We will run via command line using yambopy, although it will be instructive to have look at the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; input files later.&lt;br /&gt;
&lt;br /&gt;
We run in the same directory where the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; is (remember than you can also virtually move it with a symbolic link).&lt;br /&gt;
&lt;br /&gt;
Type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y&lt;br /&gt;
&lt;br /&gt;
to see the help for the calculation. Have a look at the various flags and their description.&lt;br /&gt;
For example, if we want to do a serial run of LetzElPhC for bands from &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt;, we should type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/ph_input.in -b n_i n_f&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;math&amp;gt;n_i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;n_f&amp;lt;/math&amp;gt; are integers representing the initial and final band indices. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 1 and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f]&amp;lt;/math&amp;gt; including the extrema of the interval.&lt;br /&gt;
&lt;br /&gt;
These should coincide with those used for the Bethe-Salpeter kernel, i.e. those specified in the &amp;lt;code&amp;gt;BSEBands&amp;lt;/code&amp;gt; variable of the BSE input file (this is not strictly necessary, but certainly efficient since these calculations use a lot of disk space). &lt;br /&gt;
&lt;br /&gt;
For our system, we want to do a parallel calculation with 4 qpools and 2 kpools. In addition, we want to explicitly specify the path of the &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; executable and avoid automatically deleting the LetzElPhC data. So we type:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/mos2.dvscf -b 25 28 -par 4 2 -lelphc path/to/lelphc_exe&lt;br /&gt;
&lt;br /&gt;
At the end, check your directory: you should find the &amp;lt;code&amp;gt;lelphc.in&amp;lt;/code&amp;gt; input file that was run, let&#039;s inspect it: &lt;br /&gt;
&lt;br /&gt;
 # LetzElPhC input for yambo generated by yambopy&lt;br /&gt;
 nqpool      = 2&lt;br /&gt;
 nkpool      = 4&lt;br /&gt;
 start_bnd   = 25&lt;br /&gt;
 end_bnd     = 28&lt;br /&gt;
 save_dir    = ./SAVE&lt;br /&gt;
 kernel      = dfpt&lt;br /&gt;
 ph_save_dir = dvscf/ph_save&lt;br /&gt;
 convention = yambo&lt;br /&gt;
&lt;br /&gt;
Notice the variable &amp;lt;code&amp;gt;convention=yambo&amp;lt;/code&amp;gt;: what does it mean? At variance with QE and many other codes, Yambo uses the &amp;quot;backward&amp;quot; momentum transfer convention for electronic scatterings. That is, an electronic transition goes from band &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k-q&amp;lt;/math&amp;gt; to band &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and momentum &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;. In the &amp;quot;forward&amp;quot; momentum transfer convention (the more standard one), the transitions go from &amp;lt;math&amp;gt;nk&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;mk+q&amp;lt;/math&amp;gt;. Therefore, this variable ensures that the electron-phonon coupling matrix elements are computed as &amp;lt;math&amp;gt;\langle mk|dV|nk-q\rangle&amp;lt;/math&amp;gt;. This will have consequences also in the formulation of the &#039;&#039;exciton&#039;&#039;-phonon coupling matrix element.&lt;br /&gt;
&lt;br /&gt;
You will also find a &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; database that contains the computed electron-phonon matrix elements, in the output format of &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In addition, if you check the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; folder:&lt;br /&gt;
&lt;br /&gt;
 ls SAVE/ndb.elph_gkkp*&lt;br /&gt;
&lt;br /&gt;
you will see that yambopy has created the Yambo-compatible electron-phonon databases.&lt;br /&gt;
&lt;br /&gt;
If you want to run LetzElPhC directly, without using yambopy, you can refer to its [https://github.com/yambo-code/LetzElPhC/blob/main/docs/tex_doc/main.pdf|user guide].&lt;br /&gt;
Keep in mind that in this case, in order to convert the database to the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases of Yambo, you will then need a couple of lines of python using the Yambopy class &amp;lt;code&amp;gt;ConvertElectronPhononDB&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;yambopy/letzelph_interface/lelph2y.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph_gkkp*&amp;lt;/code&amp;gt; databases -- e.g., because you are doing the exc-ph postprocessing with yambopy -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_gkkp&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases -- e.g., because you are using &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; for the exc-ph part -- you can run &amp;lt;code&amp;gt;yambopy l2y ...&amp;lt;/code&amp;gt; with the &amp;lt;code&amp;gt;--no_lelphc_dbs&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the exciton-phonon coupling ==&lt;br /&gt;
&lt;br /&gt;
Now, we can finally access our basic building block for exciton-phonon physics. This could be done entirely in python (using &#039;&#039;&#039;Yambopy&#039;&#039;&#039;), or by running &#039;&#039;&#039;Yambo&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
* For the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Yambo postprocessing&#039;&#039;&#039;&amp;lt;/span&amp;gt; case (running yambo inputs with the &amp;lt;code&amp;gt;yambo_ph&amp;lt;/code&amp;gt; executable), &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;follow the alternative route to Steps 7-8 [[Exciton-phonon coupling and luminescence - Yambo postprocessing|at this link]]&#039;&#039;&#039;&amp;lt;/span&amp;gt;.&lt;br /&gt;
* For the &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;Yambopy postprocessing&#039;&#039;&#039;&amp;lt;/span&amp;gt; case (using flexible python scripting), &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&#039;&#039;&#039;keep following Steps 7-8 on this page&#039;&#039;&#039;&amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Our objective is obtaining the following quantity: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathcal{G}^\mu_{\alpha\lambda}(0,q)=\sum_{vv^\prime c k} A^{\alpha, *}_{cv^\prime} (k, q) g_{vv^\prime}^\mu (k,q) A^{\lambda}_{cv}(k,0) - \sum_{cc^\prime vk} A^{\alpha, *}_{c^\prime v} (k+q, q) g_{c^\prime c}^\mu (k+q,q) A^{\lambda}_{cv}(k, 0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;A^{\alpha}_{cv}(k,q)&amp;lt;/math&amp;gt; are the exciton coefficients extracted from the eigenvector of the two-particles Hamiltonian during the BSE calculation in step 5, while &amp;lt;math&amp;gt;g_{nm}^\mu (k,q)&amp;lt;/math&amp;gt; are the electron-phonon coupling matrix elements obtained in step 6. As you can see, the exciton &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; undergoes phonon-mediated scattering to state &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; via phonon mode &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;. The scattering can happen for the hole (valence, &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or for the electron (conduction, &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
NB: &lt;br /&gt;
&lt;br /&gt;
(1) This is written in the &amp;quot;backward&amp;quot; momentum transfer convention used by Yambo. The momentum dependence is different in the &amp;quot;forward&amp;quot; transfer convention. &lt;br /&gt;
&lt;br /&gt;
(2) For simplicity, this is written for zero initial exciton momentum. This means that one of the two states involved in the phonon-mediated scattering process will be in the optical limit (and possibly an optically generated exciton), while the other state can have any momentum: this momentum will be the same as the phonon one. This matrix element can be used to describe phonon-assisted absorption and emission spectra.&lt;br /&gt;
&lt;br /&gt;
In order to calculate this quantity using python, we need the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases natively generated by the &amp;lt;code&amp;gt;LetzElPhC&amp;lt;/code&amp;gt; code, as well as the BSE databases &amp;lt;code&amp;gt;ndb.BS_diago_Q*&amp;lt;/code&amp;gt; containing the information on exciton wavefunctions and energies.&lt;br /&gt;
&lt;br /&gt;
Next, we write a python user script importing the yambopy exciton-phonon tools. You can find a version of this script in &amp;lt;code&amp;gt;yambopy/tutorials/exciton-phonon/calculate_excph.py&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np &lt;br /&gt;
 from yambopy import YamboLatticeDB,YamboWFDB,LetzElphElectronPhononDB &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific Yambopy dbs loading classes&amp;lt;/span&amp;gt;&lt;br /&gt;
 from yambopy.exciton_phonon.excph_matrix_elements import exciton_phonon_matelem &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;#Specific exc-ph functions&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 path = &#039;1L_MoS2&#039;&lt;br /&gt;
 bands_range=[24,28] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence bands, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# number of excitonic states&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 bsepath    = f&#039;{path}/bse-allq_full&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lin=Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath   = f&#039;{path}/SAVE&#039;     &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Yambo SAVE&amp;lt;/span&amp;gt;&lt;br /&gt;
 ndb_elph   = f&#039;{path}/ndb.elph&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# LetzElPhC electron-phonon database (any convention)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice&amp;lt;/span&amp;gt;&lt;br /&gt;
 lattice = YamboLatticeDB.from_db_file(filename=f&#039;{savepath}/ns.db1&#039;)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read electron-phonon&amp;lt;/span&amp;gt;&lt;br /&gt;
 elph    = LetzElphElectronPhononDB(ndb_elph,read_all=False)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read wave functions&amp;lt;/span&amp;gt;&lt;br /&gt;
 wfcs    = YamboWFDB(filename=&#039;ns.wf&#039;,save=savepath,latdb=lattice,bands_range=bands_range)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Calculate exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 exph = exciton_phonon_matelem(lattice,elph,wfcs,BSE_dir=bsepath,nexc_in=nexc,nexc_out=nexc,dmat_mode=&#039;save&#039;,exph_file=&#039;MoS2_Ex-ph.npy&#039;)&lt;br /&gt;
&lt;br /&gt;
In this script, we can select the number exciton states &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; with &amp;lt;code&amp;gt;nexc&amp;lt;/code&amp;gt;, the single-particle bands range with &amp;lt;code&amp;gt;bands_range&amp;lt;/code&amp;gt;. &#039;&#039;&#039;Please note&#039;&#039;&#039;: in this case, the band index starts from 0 (python indexing) and the the interval of bands read by the code is &amp;lt;math&amp;gt;[n_i,n_f)&amp;lt;/math&amp;gt;, therefore the last value (28 in the example) is excluded. That is, in the example we are selecting the 25th, 26th, 27th and 28th bands. Those bands have to be present in both the electron-phonon and BSE calculations. &lt;br /&gt;
&lt;br /&gt;
Here we calculate the couplings of the first twelve states at each finite-&amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; point including &amp;lt;math&amp;gt;q=0&amp;lt;/math&amp;gt;. We also include all the nine phonon modes of monolayer MoS2. We also need access to the Yambo &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory in order to read the electronic wavefunctions: they are used to compute the electronic representation matrices (&amp;lt;code&amp;gt;dmat&amp;lt;/code&amp;gt; in the code). The argument &amp;lt;code&amp;gt;dmat_mode&amp;lt;/code&amp;gt; can be set to &amp;lt;code&amp;gt;&#039;load&#039;&amp;lt;/code&amp;gt; for subsequent calculations.&lt;br /&gt;
&lt;br /&gt;
When we are satisfied with the input, we run the code:&lt;br /&gt;
&lt;br /&gt;
 python calculate_excph.py&lt;br /&gt;
&lt;br /&gt;
If you check the output, you should find the &amp;lt;code&amp;gt;MoS2_Ex-ph.npy&amp;lt;/code&amp;gt; binary file in the directory where you ran.&lt;br /&gt;
&lt;br /&gt;
=== Analysis of the couplings ===&lt;br /&gt;
&lt;br /&gt;
It is a good idea to have a look at what we computed up to now in order to make sure nothing has gone wrong. &lt;br /&gt;
&lt;br /&gt;
It is not easy to know what to expect (apart from symmetry and gauge compliance of the matrix elements), but one can work out the exciton-phonon selection rules in advance, check that the magnitude is reasonable, etc.&lt;br /&gt;
&lt;br /&gt;
It is also not easy to meaningfully plot this quantity. We have to make sure that we are not breaking degenerate states, otherwise the plots will not be invariant. &lt;br /&gt;
&lt;br /&gt;
First of all, we have to know our system: in monolayer MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;, the first four excitons are all doubly degenerate. The first exciton responsible for a bright peak in the absorption spectrum (the &#039;&#039;&#039;A&#039;&#039;&#039; peak), is the second state, corresponding to state indices &amp;lt;code&amp;gt;(3,4)&amp;lt;/code&amp;gt; in fortran indexing or &amp;lt;code&amp;gt;(2,3)&amp;lt;/code&amp;gt; in python indexing. &lt;br /&gt;
&lt;br /&gt;
All these information can be obtained by analyzing the BSE results (this stuff is explained in the BSE tutorials) and by knowledge of the system or class of systems from the literature.&lt;br /&gt;
&lt;br /&gt;
Thus, a good quantity to plot may be the norm of the matrix elements, summed over the degenerate subspace of exciton A, for a certain number of scattered final states mediated by certain phonon modes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F_A(q)= \sqrt{ \sum_{\alpha \in A,\lambda,\mu} |\mathcal{G}_{\alpha\lambda}^\mu (0,q)|^2 }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do this, we create a python script &amp;lt;code&amp;gt;analyse_excph.py&amp;lt;/code&amp;gt; in which we first load the excph dabatases. &lt;br /&gt;
You can find a version of this script in the yambopy directory, in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;. &lt;br /&gt;
First, we select the exciton and phonon states to be included in &amp;lt;code&amp;gt;F_A&amp;lt;/code&amp;gt;, together with the path of databases and plot details:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Exciton &amp;quot;in&amp;quot; states&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_in  = [2,3]  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# First bright peak (A: 2,3 -- B: 6,7)&amp;lt;/span&amp;gt;&lt;br /&gt;
 exc_out = [0,1,2,3] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# first 4 states (dispersion of dark triplet state and A)&amp;lt;/span&amp;gt;&lt;br /&gt;
 ph_in  = &#039;all&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Paths of databases&amp;lt;/span&amp;gt;&lt;br /&gt;
 ns_db1 =f&#039;{path}/SAVE/ns.db1&#039;&lt;br /&gt;
 ns_ypy = &#039;MoS2_Ex-ph.npy&#039;&lt;br /&gt;
 &lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
Then, we load the data:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Read lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 ylat = YamboLatticeDB.from_db_file(filename=ns_db1)&lt;br /&gt;
 print(ylat)&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Load exc-ph database&amp;lt;/span&amp;gt;&lt;br /&gt;
 X_py = np.load(ns_ypy)&lt;br /&gt;
 G_squared = np.abs(X_py)**2.&lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt;F_A(q)&amp;lt;/math&amp;gt; is obtained from a dedicated function as:&lt;br /&gt;
 &lt;br /&gt;
 if exc_in  == &#039;all&#039;: exc_in  = range(G_squared.shape[2])&lt;br /&gt;
 if exc_out == &#039;all&#039;: exc_out = range(G_squared.shape[3])&lt;br /&gt;
 if ph_in   == &#039;all&#039;: ph_in   = range(G_squared.shape[1])&lt;br /&gt;
 &lt;br /&gt;
 G_squared = G_squared[:, ph_in, :, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_in, :].sum(axis=(1))&lt;br /&gt;
 G_squared = G_squared[:, exc_out].sum(axis=(1))&lt;br /&gt;
 &lt;br /&gt;
 F_q = np.sqrt( G_squared )*ha2ev &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Switch from Ha to eV&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, we have to make a plotting function. For this tutorial we will use a custom scatterplot employing some of the plotting tools provided by yambopy (but you can do whatever you want).&lt;br /&gt;
&lt;br /&gt;
 plot_2D_excph(qgrid,G2_to_plot,rlat=ylat.rlat,plt_cbar=True,\&lt;br /&gt;
               marker=&#039;H&#039;,s=700,cmap=&#039;magma&#039;)&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
You can get more experience on using Yambopy for these kinds of visualization by following the [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy Yambopy tutorials]. In fact, remember that these scripts and all the other Yambopy tutorial scripts are just suggestions, not source code written in stone: if you know &amp;lt;code&amp;gt;numpy&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; you can do your own analysis and your own plots, you just need to import the required Yambopy modules to load the data.&lt;br /&gt;
&lt;br /&gt;
In our case, the resulting plot is the following.&lt;br /&gt;
&lt;br /&gt;
[[File:1L MoS2 MoS2 Ex-ph.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
This can be checked against Fig. 2(d) of reference &amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;, although you have to keep in mind that our results are badly undersampled in terms of the reciprocal-space grid, as can be easily seen, and the quantity plotted is not exactly the same. However, the main features are already there since they are dictated mostly by crystal symmetries.&lt;br /&gt;
&lt;br /&gt;
Now that we have the exciton-phonon matrix elements, we can use them to build several kinds of observables. Below, we give an example related to phonon-assisted luminescence, but we may update this tutorial in the future to include more cases.&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
&lt;br /&gt;
[[File:Luminescence scheme.png|250px|right]]&lt;br /&gt;
&lt;br /&gt;
We want to compute the experimental optical signature due to the phonon-assisted recombination of an exciton (as sketched in the figure).&lt;br /&gt;
&lt;br /&gt;
The signal from the phonon replicas can be modeled as a second-order scattering process involving one phonon and one photon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I^{Sat}(\omega)=\frac{1}{ N_q} \frac{1}{3} \sum_{\epsilon s\beta \mu q} \frac{1}{E_{\beta q}-s\Omega_{\mu q}}\left|\sum_\alpha\frac{ D^{\epsilon}_\alpha \mathcal{G}_{\beta \alpha}^{\mu,*}(q)}{E_\alpha -E_{\beta q} +s\Omega_{\mu q}+\mathrm{i}\eta}\right|^2 \frac{N^{exc}_{\beta q}(T_{exc})[\frac{1+s}{2}+n_{\mu q}(T)]}{\omega -[E_{\beta q}-s\Omega_{\mu q}]+\mathrm{i}\eta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this equation, the oscillator strength of the peak is given by the exciton-phonon coupling matrix elements &amp;lt;math&amp;gt;\mathcal{G}&amp;lt;/math&amp;gt; multiplied by the exciton dipoles &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; (they are called &amp;quot;residuals&amp;quot; in Yambo). Here &amp;lt;math&amp;gt;E_\lambda&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_{\alpha q}&amp;lt;/math&amp;gt; are the energies of the optical and finite-momentum excitons, respectively, while &amp;lt;math&amp;gt;\Omega_{\mu q}&amp;lt;/math&amp;gt; are the phonon energies. &lt;br /&gt;
&lt;br /&gt;
Here, &amp;lt;math&amp;gt;n_{\mu q}(T)&amp;lt;/math&amp;gt; is the temperature-dependent phonon Bose-Einstein occupation function. As it can be seen, &amp;lt;math&amp;gt;s=1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;emission&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)+1&amp;lt;/math&amp;gt;), while &amp;lt;math&amp;gt;s=-1&amp;lt;/math&amp;gt; corresponds to processes of phonon &#039;&#039;absorption&#039;&#039; (&amp;lt;math&amp;gt;\propto n(T)&amp;lt;/math&amp;gt;). Therefore, &amp;lt;math&amp;gt;I^{Sat}_{PL}(\omega;T)&amp;lt;/math&amp;gt; describes &#039;&#039;light&#039;&#039; emission by recombining excitons mediated by either &#039;&#039;phonon&#039;&#039; absorption or emission. &lt;br /&gt;
&lt;br /&gt;
The quantity &amp;lt;math&amp;gt; N_{\alpha q}(T_{exc})&amp;lt;/math&amp;gt; is the exciton occupation function. Luminescence is technically an out-of-equilibrium process, but we can assume that for very low density of excitations and in steady-state conditions, the exciton population can be approximately described by an equilibrium distribution evaluated at an effective temperature. Here, we use the Boltzmann distribution. Experimentally, &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; tends to coincide with the lattice temperature &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; more or less above 100 K, while at very low temperature (&amp;lt; 10 K), &amp;lt;math&amp;gt;T_{exc}&amp;lt;/math&amp;gt; may vary between 10-50 K. It goes without saying that this needs to carefully be checked in your realistic calculations.&lt;br /&gt;
&lt;br /&gt;
Finally, the spectrum is averaged over the polarization directions of the emitted photons (&amp;lt;math&amp;gt;\epsilon=x,y,z&amp;lt;/math&amp;gt; representing the respective dipole components).&lt;br /&gt;
&lt;br /&gt;
=== Running the jobs ===&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the pseudo-dojo library and the following are the calculations steps.&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./tmp&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.scf &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
2. Input &amp;lt;code&amp;gt;hbn.nscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
 mpirun -np 4 pw.x -inp hbn.nscf &amp;gt; nscf.out&lt;br /&gt;
&lt;br /&gt;
3. Input &amp;lt;code&amp;gt;hbn.dvscf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 pw.x -inp hbn.dvscf &amp;gt; dvscf.out &amp;amp;&lt;br /&gt;
&lt;br /&gt;
4. Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands):&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 em1s&lt;br /&gt;
 DIP_CPU= &amp;quot;1 8 1&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;k c v&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;1 1 1 8 1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;q g k c v&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=-1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;8 1 1&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=-1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=-1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 % QpntsRXs&lt;br /&gt;
    1 | 14 |                         # [Xs] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10                Ry    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lfull&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 | 120 |                         # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 DipComputed= &amp;quot;R V P&amp;quot;             # [DIP] [default R P V; extra P2 Spin Orb]&lt;br /&gt;
 BSENGexx= 30000            Ry    # [BSK] Exchange components&lt;br /&gt;
 #ALLGexx                       # [BSS] Force the use use all RL vectors for the exchange part&lt;br /&gt;
 BSENGBlk=  9000            Ry    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of W(q,G,Gp)]&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.25997 | 1.08816 | 1.12683 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 14 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEBands&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   7 | 10 |                         # [BSK] Bands range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   0.50000 | 8.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 WRbsWF                        # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
&lt;br /&gt;
 nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull &amp;amp;&lt;br /&gt;
&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;% BSEQptR&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 |                     # [BSK] Transferred momenta range&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;%&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
&lt;br /&gt;
5. Now we run &amp;lt;code&amp;gt;lelphc&amp;lt;/code&amp;gt; (with or without yambopy: in the latter case remember the option &amp;lt;code&amp;gt;-D&amp;lt;/code&amp;gt;) to get the el-ph matrix elements, particularly the &amp;lt;code&amp;gt;ndb.elph&amp;lt;/code&amp;gt; databases:&lt;br /&gt;
&lt;br /&gt;
 yambopy l2y -ph path/of/dvscf/hbn.dvscf -b 7 10 -par 4 2 -D&lt;br /&gt;
&lt;br /&gt;
=== Luminescence calculation ===&lt;br /&gt;
&lt;br /&gt;
6. And finally we calculate exciton-phonon matrix elements and the luminescence spectrum in one go using a python script importing the Yambopy exciton-phonon tools: in order to do this, we need to take a look at all the necessary input variables for the formula written above.&lt;br /&gt;
&lt;br /&gt;
We can start from the script &amp;lt;code&amp;gt;luminescence.py&amp;lt;/code&amp;gt; available in &amp;lt;code&amp;gt;tutorials/exciton-phonon&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 from yambopy.exciton_phonon.excph_luminescence import exc_ph_luminescence&lt;br /&gt;
 from yambopy.exciton_phonon.excph_input_data import exc_ph_get_inputs&lt;br /&gt;
&lt;br /&gt;
We import the necessary tools...&lt;br /&gt;
&lt;br /&gt;
 path = &#039;3D_hBN&#039;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation (Lout--&amp;gt; response is Lfull)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bsepath =  f&#039;{path}/bse_Lfull&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q* databases are needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to BSE calculation for optically active exciton (Lin --&amp;gt; response is Lbar)&amp;lt;/span&amp;gt;&lt;br /&gt;
 bseBARpath =  f&#039;{path}/bse_Lbar&#039;  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.BS_diago_Q1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to electron-phonon calculation&amp;lt;/span&amp;gt;&lt;br /&gt;
 elphpath = path &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.elph is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to unprojected dipoles matrix elements (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 dipolespath = bsepath &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ndb.dipoles is needed (optional)&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Path to lattice and k-space info&amp;lt;/span&amp;gt;&lt;br /&gt;
 savepath = f&#039;{path}/SAVE&#039; &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# ns.db1 database is needed&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... and we specify the paths to the necessary databases. Note that, if we want to perform polarization averaging, we have to recompute the excitonic dipoles in python as seen here.&lt;br /&gt;
&lt;br /&gt;
What about &amp;lt;code&amp;gt;bseBARpath&amp;lt;/code&amp;gt;? This variable points to the directory where the databases for the optical (zero-momentum) excitons &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; (which may be computed with &amp;lt;code&amp;gt;Lkind=&#039;Lbar&#039;&amp;lt;/code&amp;gt;) is located, which can be different from the directory with the full indirect exciton dispersion &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; (usually computed with &amp;lt;code&amp;gt;Lkind=&#039;Lfull&#039;&amp;lt;/code&amp;gt;, however &amp;lt;code&amp;gt;Lkind=&#039;Ltilde&#039;&amp;lt;/code&amp;gt; can also be used if one is interested in &amp;quot;irreducible&amp;quot; excitons). This makes it possible to compute the coupling between different exciton kinds.&lt;br /&gt;
&lt;br /&gt;
 bands_range=[6,10] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 2 valence, 2 conduction bands&amp;lt;/span&amp;gt;&lt;br /&gt;
 phonons_range=[0,12] &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# All phonons&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_out = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at each momentum (Lout)&amp;lt;/span&amp;gt;&lt;br /&gt;
 nexc_in  = 12 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# 12 excitonic states at Q=0 (Lin)&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_ph  = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Lattice temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
 T_exc = 10 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Effective excitonic temperature&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 emin=4.4      &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Energy range and plot details (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
 emax=4.7&lt;br /&gt;
 estep=0.0002&lt;br /&gt;
 broad = 0.005 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Broadening parameter for peak width (in eV)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we specify the parameters for the calculation. We include valence bands from 7 to 10 (6 to 9 in python index) and the contribution of all 12 phonon modes. We consider 12 excitonic states for the coupling matrix elements.&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;T_ph&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;T_exc&amp;lt;/code&amp;gt; are the lattice and excitonic temperatures, respectively.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate and load all the inputs:&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton-phonon matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Excitonic dipole matrix elements&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Exciton energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * Phonon energies&amp;lt;/span&amp;gt;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# * We specify bse_path2=bseBARpath meaning we use Lbar calculation for Q=0 excitons&amp;lt;/span&amp;gt;&lt;br /&gt;
 input_data = exc_ph_get_inputs(savepath,elphpath,bsepath,\&lt;br /&gt;
                                bse_path2=bseBARpath,dipoles_path=dipolespath,\&lt;br /&gt;
                                nexc_in=12,nexc_out=12,\&lt;br /&gt;
                                bands_range=[6,10],phonons_range=[0,12])&lt;br /&gt;
&lt;br /&gt;
 ph_energies, exc_energies, exc_energies_in, G, exc_dipoles = input_data&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;code&amp;gt;exc_ph_get_inputs&amp;lt;/code&amp;gt; gives us all the input data for luminescence in the correct format: phonon energies, exciton energies, optical exciton energies (if needed), exciton-phonon matrix elements (calculated on the fly and printed to file), unprojected exciton dipoles (optional, calculated on the fly and printed to file).&lt;br /&gt;
The exc-ph matrix element calculation is just a wrapper of the same tools that we have tested in the above section on MoS2.&lt;br /&gt;
&lt;br /&gt;
Finally, there is the calculation of the luminescence spectrum via the function &amp;lt;code&amp;gt;exc_ph_luminescence&amp;lt;/code&amp;gt;:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# We calculate the luminescence spectrum including the input data from before&amp;lt;/span&amp;gt;&lt;br /&gt;
 w,PL = exc_ph_luminescence(T_ph,ph_energies,exc_energies,exc_dipoles,G,\&lt;br /&gt;
                            exc_energies_in=exc_energies_in,exc_temp=T_exc,\&lt;br /&gt;
                            nexc_out=nexc_out,nexc_in=nexc_in,emin=emin,emax=emax,\&lt;br /&gt;
                            estep=estep,broad=broad)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to print the luminescence data for later plotting, you can also add the following line to the script:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;# Save to file&amp;lt;/span&amp;gt;&lt;br /&gt;
 data = np.column_stack((w, PL))&lt;br /&gt;
 np.savetxt(&amp;quot;hBN_luminescence_12x12x1.dat&amp;quot;, data, fmt=&amp;quot;%.8f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
It is now time to run the whole script:&lt;br /&gt;
&lt;br /&gt;
 python luminescence.py&lt;br /&gt;
 &lt;br /&gt;
NB: By using Yambopy for Step 6, we have limited the use of the Yambo code to just step 4 in the entire workflow. This option is more flexible, as it allows for a greater degree of control by the user. On the other hand the Yambo postprocessing route features a Yambo-style input that doesn&#039;t require python knowledge and the calculation is currently faster in fortran. However, the luminescence expression computed in Yambo is a slightly different than this one: it is more approximated in the description of the satellite oscillator strengths, but it explicitly includes the renormalization of the direct exciton peak. You can check the differences [[Exciton-phonon coupling and luminescence - Yambo postprocessing|here]].&lt;br /&gt;
&lt;br /&gt;
=== Results ===&lt;br /&gt;
We can plot the results of the step 6 calculation. If we do it in the same script we can add something like this:&lt;br /&gt;
 fig = plt.figure()&lt;br /&gt;
 ax = fig.add_subplot(1,1,1)&lt;br /&gt;
 ax.set_xlim(emin,emax)&lt;br /&gt;
 ax.set_ylim(0,np.max(PL)*1.1)&lt;br /&gt;
 ax.get_yaxis().set_visible(False)&lt;br /&gt;
 &lt;br /&gt;
 ax.plot(w, PL, &#039;-&#039;,c=&#039;red&#039;, label=&amp;quot;AA&#039; hBN luminescence&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 plt.legend()&lt;br /&gt;
 plt.savefig(&#039;hBN_luminescence.png&#039;)&lt;br /&gt;
 plt.show()&lt;br /&gt;
&lt;br /&gt;
[[File:HBN luminescence satellites.png|500px|center]]&lt;br /&gt;
&lt;br /&gt;
Here, the signal corresponds to a finite-momentum exciton that recombines with the help of several different phonon modes, both optical and acoustic. Each phonon mode whose coupling with the exciton is allowed can generate a peak, and the energy shifts of these peaks with respect to the initial exciton energy correspond to the phonon energies. This result is underconverged, but the main features are all there. In the plot, we show a more converged example using a 12x12x4 grid (all the other parameters being equal). These plots can be compared with Fig. 4(a) of reference &amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo_ph -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: 0.697314 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: 20.22155 meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: 32.95292 meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039;/&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Inter/Intra_exciton_transitions_from_BSE_post_processing&amp;diff=1044</id>
		<title>Inter/Intra exciton transitions from BSE post processing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Inter/Intra_exciton_transitions_from_BSE_post_processing&amp;diff=1044"/>
		<updated>2026-10-09T08:09:52Z</updated>

		<summary type="html">&lt;p&gt;Davide: Few more info added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Inter/Intra exciton transitions from BSE post-processing ==&lt;br /&gt;
&lt;br /&gt;
TO DO ... See Refs. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot; /&amp;gt; &amp;lt;ref name=&amp;quot;Qian2026&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a tutorial based on real time propagation see [[Pump_and_Probe|Transient Absorption from real-time propagation]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-exc-exc-new]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;&amp;gt;D. Sangalli, M. D&#039;Alessandro and C. Attaccalite, &#039;&#039;Exciton - Exciton transitions involving strongly bound excitons: an ab-initio approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.107.205203 Physical Review B &#039;&#039;&#039;107&#039;&#039;&#039; (20), 205203 (2023)], preprint [https://arxiv.org/abs/2211.12241 arXiv: 2211.12241 (2023)] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Qian2026&amp;quot;&amp;gt;To ADD&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe&amp;diff=1043</id>
		<title>Pump and Probe</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe&amp;diff=1043"/>
		<updated>2026-10-09T08:06:38Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
In this tutorial we will show you how to setup two external fields in &#039;&#039;&#039;yambo_nl&#039;&#039;&#039;, to perform pump and probe simulation. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;/&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial is at independent particle level, but the same kind of simulation can be repeated including local field effects, &lt;br /&gt;
quasi-particle correction or electron-hole interaction, see for example the tutorials:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Correlation effects in the non-linear response]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Real time Bethe-Salpeter Equation (TDSE)]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial supposes that you are already familiar with real-time simulation with Yambo&amp;lt;ref name=&amp;quot;dberry&amp;quot;&amp;gt;[https://arxiv.org/abs/1609.09639 Non-linear response in extended systems: a real-time approach], C. Attaccalite &amp;lt;/ref&amp;gt;&lt;br /&gt;
if it is not the case please check these tutorials: [[Tutorials#Non_linear_response]]&lt;br /&gt;
&lt;br /&gt;
We start from the h-BN monolayer with an in place lattice constant a=2.5 Å and a box large 33 a.u. in the z-direction.&lt;br /&gt;
Standard DFT input for hBN monolayer for ABINIT or QuantumEspresso can be found here [[Tutorials]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We used  a 9x9x1 k-points grid and 8 bands in the non-self consistent calculation and 40 Ry cutoff for the wave-function.&lt;br /&gt;
&lt;br /&gt;
In our example we choose direction [0,1,0] for the pump and [1,0,0] for the probe. &lt;br /&gt;
We generate the ypp.in to remove symmetries with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp -y&amp;lt;/span&amp;gt; and we modify it as:&lt;br /&gt;
&lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&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;      # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
&lt;br /&gt;
then we go in the FixSymm directory and run again the setup. &amp;lt;br&amp;gt;&lt;br /&gt;
We will perform three different real-time calculations: &amp;lt;br&amp;gt;&lt;br /&gt;
* the probe field alone; &lt;br /&gt;
* the pump field alone; &lt;br /&gt;
* the pump and probe configuration.&lt;br /&gt;
&lt;br /&gt;
== Probe only ==&lt;br /&gt;
&lt;br /&gt;
We can generate the input file for a generic Pump and Probe calculations with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u p -F yambo.in_probe&amp;lt;/span&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  3 |  6 |    &amp;lt;/span&amp;gt;                       # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 80.000000&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;IPA&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;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot; &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|COS|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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 |  &amp;lt;/span&amp;gt;      # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.00000  &amp;lt;/span&amp;gt;  fs    # [RT Field1] Initial Time&lt;br /&gt;
 [......]&lt;br /&gt;
&lt;br /&gt;
In this input we set only the first field that is the probe, we use a DELTA function as field in such a way to probe all the frequencies, and set the starting point of the delta at t=5 fs. &amp;lt;br&amp;gt;Run this job in a separate folder with the command  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_probe -J PROBE&amp;lt;/span&amp;gt;. Then we can analyze the spectra with &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp -u -J PROBE &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LORENTZIAN&amp;lt;/span&amp;gt;&amp;quot;           # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.100000&amp;lt;/span&amp;gt;       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;           # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
and get the dielectric response. Notice that we introduce a Lorentzian broadening the post-processing. &amp;lt;br&amp;gt;&lt;br /&gt;
Hereafter we plot the damped polarization along the y-direction and the corresponding dielectric constant:&lt;br /&gt;
&lt;br /&gt;
[[File:Eps probe.png|800px|center | Probe only]]&lt;br /&gt;
&lt;br /&gt;
the arrow indicates the position where we will put the Pump in the next simulation.&lt;br /&gt;
&lt;br /&gt;
==Pump only==&lt;br /&gt;
&lt;br /&gt;
Now we run a simulation with the pump field only. We generate the input in the same way &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u p -F yambo.in_pump&amp;lt;/span&amp;gt;. &amp;lt;br&amp;gt;&lt;br /&gt;
These result will be our reference field in the final analysis. Here the input file for the pump:&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;150.0000&amp;lt;/span&amp;gt;           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&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;
 NLDamping=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000&amp;lt;/span&amp;gt;        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.42 | 5.42 &amp;lt;/span&amp;gt;|         eV    # [RT Field2] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field2] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00 &amp;lt;/span&amp;gt;      kWLm2 # [RT Field2] Intensity&lt;br /&gt;
 Field1_Width= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt;     fs    # [RT Field2] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;QSSIN&amp;lt;/span&amp;gt;&amp;quot;             # [RT Field2] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field1_pol= &amp;quot;linear&amp;quot;             # [RT Field2] Pol(linear|circular)&lt;br /&gt;
 % Field1_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;     # [RT Field2] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= 0.010000    fs    # [RT Field2] Initial Time&lt;br /&gt;
 [...]&lt;br /&gt;
In this simulation we used as Pump field QSSIN that is sinus with a Guassian envelope[https://demonstrations.wolfram.com/SineGaussianSignals/ sine-Gaussian wave]. For a list of all possible field in Yambo see the file  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; src/modules/mod_fields.F&amp;lt;/span&amp;gt;. We centred the field frequency at 5.42 eV that is the energy of the highest peak in the previous figure, see arrow there. &lt;br /&gt;
Run the simulation with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_pump -J PUMP &amp;lt;/span&amp;gt;.&lt;br /&gt;
The pump field, column 6th of the file &amp;lt;code&amp;gt;o-PUMP.external_potential_F1&amp;lt;/code&amp;gt;, is shown in the figure below:&lt;br /&gt;
&lt;br /&gt;
[[File:Pump only.png|800px|center|Pump field]]&lt;br /&gt;
&lt;br /&gt;
== Pump and probe==&lt;br /&gt;
&lt;br /&gt;
Now we copy the pump in file in a new file &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; cp yambo.in_pump yambo.in_pump_and_probe&amp;lt;/span&amp;gt; and turn on  the probe field:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
   3 |  6 |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;150.0000 &amp;lt;/span&amp;gt;          fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&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;
 NLDamping=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.00  &amp;lt;/span&amp;gt;     kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|COS|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;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;90.0000  &amp;lt;/span&amp;gt;  fs    # [RT Field1] Initial Time&lt;br /&gt;
 % Field2_Freq&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.42 | 5.42 |  &amp;lt;/span&amp;gt;       eV    # [RT Field2] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field2_NFreqs= 1                 # [RT Field2] Frequency&lt;br /&gt;
 Field2_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00&amp;lt;/span&amp;gt;       kWLm2 # [RT Field2] Intensity&lt;br /&gt;
 Field2_Width=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000  &amp;lt;/span&amp;gt;   fs    # [RT Field2] Width&lt;br /&gt;
 Field2_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;QSSIN&amp;lt;/span&amp;gt;&amp;quot;             # [RT Field2] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field2_pol= &amp;quot;linear&amp;quot;             # [RT Field2] Pol(linear|circular)&lt;br /&gt;
 % Field2_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;        # [RT Field2] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field2_Tstart= 0.010000    fs    # [RT Field2] Initial Time&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note:&#039;&#039;&#039;  by convention in Yambo we consider the first field the probe and the second the pump. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you run the simulation with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_pump_and_probe -J PUMP_AND_PROBE &amp;lt;/span&amp;gt; and then we analyze the result using ypp with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp_nl -u -J PUMP_AND_PROBE &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis &lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;500 &amp;lt;/span&amp;gt;                   # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.00000 | 3.9000 &amp;lt;/span&amp;gt;|         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GAUSSIAN&amp;lt;/span&amp;gt;&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.085000  &amp;lt;/span&amp;gt;     eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;./PUMP/&amp;lt;/span&amp;gt;&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Notice that in this case we are interested in the spectra below the 4 eV, that is was zero without the presence of the pump. We put in the input the pump path in such way to calculate polarization of the pump&amp;amp;probe minus the one of generate by the pump only &amp;lt;math&amp;gt;\Delta P(t) = P_{PnP}(t) - P_{pump}(t)&amp;lt;/math&amp;gt;. Then we analyze the &amp;lt;math&amp;gt;\Delta P(t)&amp;lt;/math&amp;gt; and get the new spectra:&lt;br /&gt;
&lt;br /&gt;
[[File:P and p spectrum.png|800px | center|Pump and probe spectrum]]&lt;br /&gt;
&lt;br /&gt;
The peak that you see in this spectrum, that were not present in when the pump was zero, correspond to the transition between the different excited states. The pump field populates the state at 5.42 eV and then the probe excites electrons from this state to higher states. The energy difference between the higher excited states and the peak at 5.42 define the position of the peaks in the pump and probe spectrum, while their intensity is dictated by the dipole matrix elements between the different excited states, see Ref. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot; /&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Additional comments on pump and probe calculations &#039;&#039;&#039;&lt;br /&gt;
* We used a Gaussian damping factor, this choice is motivated by various tests we have done, and it seems to us that in pump and probe this broadening gives better results.&amp;lt;br&amp;gt;&lt;br /&gt;
* If you plot all spectrum you will notice that the &amp;quot;equilibrium part&amp;quot; is much stronger than the one induced by the pump, this is normal because only a small fraction of electron are promoted in the excited state by the pump.&lt;br /&gt;
* All previous simulation can be run also in presence of excitons, see  Ref. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;/&amp;gt; and group theory can be used to predict dark/bright transition in the pump and probe spectroscopy.&amp;lt;ref&amp;gt;[https://link.springer.com/book/10.1007/978-3-540-32899-5  Group Theory, Application to the Physics of Condensed Matter],   Mildred S. S. Dresselhaus, Gene Dresselhaus, Ado Jorio, Springer Editor&amp;lt;/ref&amp;gt;&lt;br /&gt;
* In principle is it possible to include damping and radiative life-time in the simulation to study retardation effect between the pump and probe. This  approach  exact in the independent particle case, but introduces an error when correlation effects are present, see Refs.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/2106.03592 Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: an abinitio approach], D. Sangalli, Phys. Rev. Materials &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)&amp;lt;/ref&amp;gt; and &amp;lt;ref&amp;gt;[https://arxiv.org/abs/1705.04245 Theory of exciton-phonon coupling], Gabriel Antonius and Steven G. Louie Phys. Rev. B &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)&amp;lt;/ref&amp;gt;for a discussion.&lt;br /&gt;
* Non-linear response (SHG, THG, ...) induced by the pump is not implemented yet... if you have a good idea how to do it, please let us know&lt;br /&gt;
&lt;br /&gt;
== Analysis of the results using YamboPy ==&lt;br /&gt;
&#039;&#039;&#039;This part works only with Lumen 2.0 or the last version available on Gitlab&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Results can be analyzed using YamboPy with the following script:&lt;br /&gt;
&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 from yambopy.plot  import *&lt;br /&gt;
 &lt;br /&gt;
 NLDB_P_and_P=YamboNLDB(calc=&#039;P_and_P&#039;)&lt;br /&gt;
 NLDB_Pump   =YamboNLDB(calc=&#039;PUMP&#039;)&lt;br /&gt;
  &lt;br /&gt;
 pol_pump   =NLDB_Pump.Polarization[0]&lt;br /&gt;
 pol_p_and_p=NLDB_P_and_P.Polarization[0]&lt;br /&gt;
 &lt;br /&gt;
 time=NLDB_P_and_P.IO_TIME_points&lt;br /&gt;
 t_initial=NLDB_P_and_P.Efield[0][&amp;quot;initial_time&amp;quot;]&lt;br /&gt;
 &lt;br /&gt;
 pol_damped=np.empty_like(pol_pump)&lt;br /&gt;
 &lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
     pol_damped[i_d,:]=damp_it(pol_p_and_p[i_d,:]-pol_pump[i_d,:],time,t_initial,damp_type=&#039;GAUSSIAN&#039;,damp_factor=0.085/ha2ev)&lt;br /&gt;
 &lt;br /&gt;
 Plot_Pol(time=time, pol=pol_damped, xlim=[0,55], save_file=&#039;polarization.pdf&#039;)&lt;br /&gt;
 &lt;br /&gt;
 Linear_Response(time=time,pol=pol_damped,efield=NLDB_P_and_P.Efield[0],plot=False,plot_file=&#039;delta_eps.pdf&#039;,e_range=[0.0,3.7],n_freqs=500)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;&amp;gt;D. Sangalli, M. D&#039;Alessandro and C. Attaccalite, &#039;&#039;Exciton - Exciton transitions involving strongly bound excitons: an ab-initio approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.107.205203 Physical Review B &#039;&#039;&#039;107&#039;&#039;&#039; (20), 205203 (2023)], preprint [https://arxiv.org/abs/2211.12241 arXiv: 2211.12241 (2023)] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe&amp;diff=1042</id>
		<title>Pump and Probe</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe&amp;diff=1042"/>
		<updated>2026-10-09T08:04:20Z</updated>

		<summary type="html">&lt;p&gt;Davide: Reference sangalli2023 moved in references section.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
In this tutorial we will show you how to setup two external fields in &#039;&#039;&#039;yambo_nl&#039;&#039;&#039;, to perform pump and probe simulation. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;/&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial is at independent particle level, but the same kind of simulation can be repeated including local field effects, &lt;br /&gt;
quasi-particle correction or electron-hole interaction, see for example the tutorials:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Correlation effects in the non-linear response]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Real time Bethe-Salpeter Equation (TDSE)]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial supposes that you are already familiar with real-time simulation with Yambo&amp;lt;ref name=&amp;quot;dberry&amp;quot;&amp;gt;[https://arxiv.org/abs/1609.09639 Non-linear response in extended systems: a real-time approach], C. Attaccalite &amp;lt;/ref&amp;gt;&lt;br /&gt;
if it is not the case please check these tutorials: [[Tutorials#Non_linear_response]]&lt;br /&gt;
&lt;br /&gt;
We start from the h-BN monolayer with an in place lattice constant a=2.5 Å and a box large 33 a.u. in the z-direction.&lt;br /&gt;
Standard DFT input for hBN monolayer for ABINIT or QuantumEspresso can be found here [[Tutorials]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We used  a 9x9x1 k-points grid and 8 bands in the non-self consistent calculation and 40 Ry cutoff for the wave-function.&lt;br /&gt;
&lt;br /&gt;
In our example we choose direction [0,1,0] for the pump and [1,0,0] for the probe. &lt;br /&gt;
We generate the ypp.in to remove symmetries with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp -y&amp;lt;/span&amp;gt; and we modify it as:&lt;br /&gt;
&lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&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;      # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
&lt;br /&gt;
then we go in the FixSymm directory and run again the setup. &amp;lt;br&amp;gt;&lt;br /&gt;
We will perform three different real-time calculations: &amp;lt;br&amp;gt;&lt;br /&gt;
* the probe field alone; &lt;br /&gt;
* the pump field alone; &lt;br /&gt;
* the pump and probe configuration.&lt;br /&gt;
&lt;br /&gt;
== Probe only ==&lt;br /&gt;
&lt;br /&gt;
We can generate the input file for a generic Pump and Probe calculations with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u p -F yambo.in_probe&amp;lt;/span&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  3 |  6 |    &amp;lt;/span&amp;gt;                       # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 80.000000&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;IPA&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;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot; &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|COS|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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 |  &amp;lt;/span&amp;gt;      # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.00000  &amp;lt;/span&amp;gt;  fs    # [RT Field1] Initial Time&lt;br /&gt;
 [......]&lt;br /&gt;
&lt;br /&gt;
In this input we set only the first field that is the probe, we use a DELTA function as field in such a way to probe all the frequencies, and set the starting point of the delta at t=5 fs. &amp;lt;br&amp;gt;Run this job in a separate folder with the command  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_probe -J PROBE&amp;lt;/span&amp;gt;. Then we can analyze the spectra with &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp -u -J PROBE &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LORENTZIAN&amp;lt;/span&amp;gt;&amp;quot;           # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.100000&amp;lt;/span&amp;gt;       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;           # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
and get the dielectric response. Notice that we introduce a Lorentzian broadening the post-processing. &amp;lt;br&amp;gt;&lt;br /&gt;
Hereafter we plot the damped polarization along the y-direction and the corresponding dielectric constant:&lt;br /&gt;
&lt;br /&gt;
[[File:Eps probe.png|800px|center | Probe only]]&lt;br /&gt;
&lt;br /&gt;
the arrow indicates the position where we will put the Pump in the next simulation.&lt;br /&gt;
&lt;br /&gt;
==Pump only==&lt;br /&gt;
&lt;br /&gt;
Now we run a simulation with the pump field only. We generate the input in the same way &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u p -F yambo.in_pump&amp;lt;/span&amp;gt;. &amp;lt;br&amp;gt;&lt;br /&gt;
These result will be our reference field in the final analysis. Here the input file for the pump:&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;150.0000&amp;lt;/span&amp;gt;           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&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;
 NLDamping=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000&amp;lt;/span&amp;gt;        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.42 | 5.42 &amp;lt;/span&amp;gt;|         eV    # [RT Field2] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field2] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00 &amp;lt;/span&amp;gt;      kWLm2 # [RT Field2] Intensity&lt;br /&gt;
 Field1_Width= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt;     fs    # [RT Field2] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;QSSIN&amp;lt;/span&amp;gt;&amp;quot;             # [RT Field2] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field1_pol= &amp;quot;linear&amp;quot;             # [RT Field2] Pol(linear|circular)&lt;br /&gt;
 % Field1_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;     # [RT Field2] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= 0.010000    fs    # [RT Field2] Initial Time&lt;br /&gt;
 [...]&lt;br /&gt;
In this simulation we used as Pump field QSSIN that is sinus with a Guassian envelope[https://demonstrations.wolfram.com/SineGaussianSignals/ sine-Gaussian wave]. For a list of all possible field in Yambo see the file  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; src/modules/mod_fields.F&amp;lt;/span&amp;gt;. We centred the field frequency at 5.42 eV that is the energy of the highest peak in the previous figure, see arrow there. &lt;br /&gt;
Run the simulation with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_pump -J PUMP &amp;lt;/span&amp;gt;.&lt;br /&gt;
The pump field, column 6th of the file &amp;lt;code&amp;gt;o-PUMP.external_potential_F1&amp;lt;/code&amp;gt;, is shown in the figure below:&lt;br /&gt;
&lt;br /&gt;
[[File:Pump only.png|800px|center|Pump field]]&lt;br /&gt;
&lt;br /&gt;
== Pump and probe==&lt;br /&gt;
&lt;br /&gt;
Now we copy the pump in file in a new file &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; cp yambo.in_pump yambo.in_pump_and_probe&amp;lt;/span&amp;gt; and turn on  the probe field:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
   3 |  6 |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;150.0000 &amp;lt;/span&amp;gt;          fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&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;
 NLDamping=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.00  &amp;lt;/span&amp;gt;     kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|COS|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;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;90.0000  &amp;lt;/span&amp;gt;  fs    # [RT Field1] Initial Time&lt;br /&gt;
 % Field2_Freq&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.42 | 5.42 |  &amp;lt;/span&amp;gt;       eV    # [RT Field2] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field2_NFreqs= 1                 # [RT Field2] Frequency&lt;br /&gt;
 Field2_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00&amp;lt;/span&amp;gt;       kWLm2 # [RT Field2] Intensity&lt;br /&gt;
 Field2_Width=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000  &amp;lt;/span&amp;gt;   fs    # [RT Field2] Width&lt;br /&gt;
 Field2_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;QSSIN&amp;lt;/span&amp;gt;&amp;quot;             # [RT Field2] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field2_pol= &amp;quot;linear&amp;quot;             # [RT Field2] Pol(linear|circular)&lt;br /&gt;
 % Field2_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;        # [RT Field2] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field2_Tstart= 0.010000    fs    # [RT Field2] Initial Time&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note:&#039;&#039;&#039;  by convention in Yambo we consider the first field the probe and the second the pump. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you run the simulation with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_pump_and_probe -J PUMP_AND_PROBE &amp;lt;/span&amp;gt; and then we analyze the result using ypp with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp_nl -u -J PUMP_AND_PROBE &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis &lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;500 &amp;lt;/span&amp;gt;                   # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.00000 | 3.9000 &amp;lt;/span&amp;gt;|         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GAUSSIAN&amp;lt;/span&amp;gt;&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.085000  &amp;lt;/span&amp;gt;     eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;./PUMP/&amp;lt;/span&amp;gt;&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Notice that in this case we are interested in the spectra below the 4 eV, that is was zero without the presence of the pump. We put in the input the pump path in such way to calculate polarization of the pump&amp;amp;probe minus the one of generate by the pump only &amp;lt;math&amp;gt;\Delta P(t) = P_{PnP}(t) - P_{pump}(t)&amp;lt;/math&amp;gt;. Then we analyze the &amp;lt;math&amp;gt;\Delta P(t)&amp;lt;/math&amp;gt; and get the new spectra:&lt;br /&gt;
&lt;br /&gt;
[[File:P and p spectrum.png|800px | center|Pump and probe spectrum]]&lt;br /&gt;
&lt;br /&gt;
The peak that you see in this spectrum, that were not present in when the pump was zero, correspond to the transition between the different excited states. The pump field populates the state at 5.42 eV and then the probe excites electrons from this state to higher states. The energy difference between the higher excited states and the peak at 5.42 define the position of the peaks in the pump and probe spectrum, while their intensity is dictated by the dipole matrix elements between the different excited states, see Ref. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot; /&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Additional comments on pump and probe calculations &#039;&#039;&#039;&lt;br /&gt;
* We used a Gaussian damping factor, this choice is motivated by various tests we have done, and it seems to us that in pump and probe this broadening gives better results.&amp;lt;br&amp;gt;&lt;br /&gt;
* If you plot all spectrum you will notice that the &amp;quot;equilibrium part&amp;quot; is much stronger than the one induced by the pump, this is normal because only a small fraction of electron are promoted in the excited state by the pump.&lt;br /&gt;
* All previous simulation can be run also in presence of excitons, see  Ref. &amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;/&amp;gt; and group theory can be used to predict dark/bright transition in the pump and probe spectroscopy.&amp;lt;ref&amp;gt;[https://link.springer.com/book/10.1007/978-3-540-32899-5  Group Theory, Application to the Physics of Condensed Matter],   Mildred S. S. Dresselhaus, Gene Dresselhaus, Ado Jorio, Springer Editor&amp;lt;/ref&amp;gt;&lt;br /&gt;
* In principle is it possible to include damping and radiative life-time in the simulation to study retardation effect between the pump and probe. This  approach  exact in the independent particle case, but introduces an error when correlation effects are present, see Refs.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/2106.03592 Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: an abinitio approach], D. Sangalli, Phys. Rev. Materials &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)&amp;lt;/ref&amp;gt; and &amp;lt;ref&amp;gt;[https://arxiv.org/abs/1705.04245 Theory of exciton-phonon coupling], Gabriel Antonius and Steven G. Louie Phys. Rev. B &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)&amp;lt;/ref&amp;gt;for a discussion.&lt;br /&gt;
* Non-linear response (SHG, THG, ...) induced by the pump is not implemented yet... if you have a good idea how to do it, please let us know&lt;br /&gt;
&lt;br /&gt;
== Analysis of the results using YamboPy ==&lt;br /&gt;
&#039;&#039;&#039;This part works only with Lumen 2.0 or the last version available on Gitlab&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Results can be analyzed using YamboPy with the following script:&lt;br /&gt;
&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 from yambopy.plot  import *&lt;br /&gt;
 &lt;br /&gt;
 NLDB_P_and_P=YamboNLDB(calc=&#039;P_and_P&#039;)&lt;br /&gt;
 NLDB_Pump   =YamboNLDB(calc=&#039;PUMP&#039;)&lt;br /&gt;
  &lt;br /&gt;
 pol_pump   =NLDB_Pump.Polarization[0]&lt;br /&gt;
 pol_p_and_p=NLDB_P_and_P.Polarization[0]&lt;br /&gt;
 &lt;br /&gt;
 time=NLDB_P_and_P.IO_TIME_points&lt;br /&gt;
 t_initial=NLDB_P_and_P.Efield[0][&amp;quot;initial_time&amp;quot;]&lt;br /&gt;
 &lt;br /&gt;
 pol_damped=np.empty_like(pol_pump)&lt;br /&gt;
 &lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
     pol_damped[i_d,:]=damp_it(pol_p_and_p[i_d,:]-pol_pump[i_d,:],time,t_initial,damp_type=&#039;GAUSSIAN&#039;,damp_factor=0.085/ha2ev)&lt;br /&gt;
 &lt;br /&gt;
 Plot_Pol(time=time, pol=pol_damped, xlim=[0,55], save_file=&#039;polarization.pdf&#039;)&lt;br /&gt;
 &lt;br /&gt;
 Linear_Response(time=time,pol=pol_damped,efield=NLDB_P_and_P.Efield[0],plot=False,plot_file=&#039;delta_eps.pdf&#039;,e_range=[0.0,3.7],n_freqs=500)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2023&amp;quot;&amp;gt;Exciton - Exciton transitions involving strongly bound excitons: an ab-initio approach, D. Sangalli, M. D&#039;Alessandro and C. Attaccalite, Physical Review B &#039;&#039;&#039;107&#039;&#039;&#039; (20), 205203 (2023), [https://arxiv.org/abs/2211.12241 ArXiv 2211.12241] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Inter/Intra_exciton_transitions_from_BSE_post_processing&amp;diff=1041</id>
		<title>Inter/Intra exciton transitions from BSE post processing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Inter/Intra_exciton_transitions_from_BSE_post_processing&amp;diff=1041"/>
		<updated>2026-10-09T07:59:16Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Inter/Intra exciton transitions from BSE post-processing ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TO DO ... See Ref. &amp;lt;ref name=&amp;quot;Qian2026&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-exc-exc-new]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Qian2026&amp;quot;&amp;gt;To ADD&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Inter/Intra_exciton_transitions_from_BSE_post_processing&amp;diff=1040</id>
		<title>Inter/Intra exciton transitions from BSE post processing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Inter/Intra_exciton_transitions_from_BSE_post_processing&amp;diff=1040"/>
		<updated>2026-10-09T07:58:41Z</updated>

		<summary type="html">&lt;p&gt;Davide: Created empty page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Inter/Intra exciton transitions from BSE post-processing ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TO DO ...&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-exc-exc-new]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Qian2026&amp;quot;&amp;gt;To ADD&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1039</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1039"/>
		<updated>2026-10-09T07:55:15Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* ARPES from real-time propagation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons from real time propagation. See Refs. &amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The tutorial describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band. See the tutorial [[NEQ_AREPS_from_BSE_post_processing]] for an alternative approach based on BSE post-processing. See Refs. &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;  &amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-excitons]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with  the &amp;lt;code&amp;gt;IOtime&amp;lt;/code&amp;gt; input variable. Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and to resolve energies of the order of 1 eV. Accordingly a time-step of the order of 10 as is needed. You can try to set 0.05 as for the I/O of the GF&lt;br /&gt;
 % IOtime&lt;br /&gt;
  5.0 | 0.05 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [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;                  # Points coordinates (out) cc/rlu/iku/alat&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;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&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                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=NEQ_AREPS_from_BSE_post_processing&amp;diff=1038</id>
		<title>NEQ AREPS from BSE post processing</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=NEQ_AREPS_from_BSE_post_processing&amp;diff=1038"/>
		<updated>2026-10-09T07:54:43Z</updated>

		<summary type="html">&lt;p&gt;Davide: First version created, imported from what was a section in the ARPES tutorial from real-time propagation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons from post-processing of the BSE. &lt;br /&gt;
See Refs. &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;  &amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show how to reconstruct the ARPES spectral function from a post-porcessing of a BSE simulations at all transferred momenta. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc and Chase. The excitonic population is also needed as an input. The final spectral function will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse. &lt;br /&gt;
&lt;br /&gt;
See the tutorial [[Pump_and_Probe:_Time_resolved_ARPES]] for an alternative approach based on real time propagation. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-excitons]&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
After solving BSE, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
Below the output plotted with python using different excitonic distributions&lt;br /&gt;
&amp;lt;gallery widths=&amp;quot;400&amp;quot; heights=&amp;quot;270&amp;quot; caption=&amp;quot;Reconstructed ARPES spectral function in LiF&amp;quot;&amp;gt;&lt;br /&gt;
File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T0.png|600px|temperature T=0 K&lt;br /&gt;
File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T300.png|600px|temperature T=300 K&lt;br /&gt;
File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T3000.png|600px|temperature T=3000 K&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
While at low temperature the signal is a replica of the valence band, at higher temperature the excitonic dispersion is obtained.&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy. See Ref.&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1037</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1037"/>
		<updated>2026-10-09T07:53:40Z</updated>

		<summary type="html">&lt;p&gt;Davide: removed some spaces&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons from real time propagation. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The tutorial describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band. See the tutorial [[NEQ_AREPS_from_BSE_post_processing]] for an alternative approach based on BSE post-processing. See Refs. &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;  &amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-excitons]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with  the &amp;lt;code&amp;gt;IOtime&amp;lt;/code&amp;gt; input variable. Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and to resolve energies of the order of 1 eV. Accordingly a time-step of the order of 10 as is needed. You can try to set 0.05 as for the I/O of the GF&lt;br /&gt;
 % IOtime&lt;br /&gt;
  5.0 | 0.05 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [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;                  # Points coordinates (out) cc/rlu/iku/alat&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;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&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                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1036</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1036"/>
		<updated>2026-10-09T07:53:16Z</updated>

		<summary type="html">&lt;p&gt;Davide: References fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons from real time propagation. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The tutorial describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band. See the tutorial [[NEQ_AREPS_from_BSE_post_processing]] for an alternative approach based on BSE post-processing. See Refs. &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;  &amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-excitons]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with  the &amp;lt;code&amp;gt;IOtime&amp;lt;/code&amp;gt; input variable. Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and to resolve energies of the order of 1 eV. Accordingly a time-step of the order of 10 as is needed. You can try to set 0.05 as for the I/O of the GF&lt;br /&gt;
 % IOtime&lt;br /&gt;
  5.0 | 0.05 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [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;                  # Points coordinates (out) cc/rlu/iku/alat&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;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&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                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1035</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=1035"/>
		<updated>2026-10-09T07:51:58Z</updated>

		<summary type="html">&lt;p&gt;Davide: bse post processing part moved in an independent tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons from real time propagation. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The tutorial describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band. See the tutorial [[NEQ_AREPS_from_BSE_post_processing]] for an alternative approach based on BSE post-processing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: to perform the following tutorial, it is suggested to work with the following branch: [https://gitlab.com/lumen-code/lumen/-/tree/phys-excitons phys-excitons]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with  the &amp;lt;code&amp;gt;IOtime&amp;lt;/code&amp;gt; input variable. Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and to resolve energies of the order of 1 eV. Accordingly a time-step of the order of 10 as is needed. You can try to set 0.05 as for the I/O of the GF&lt;br /&gt;
 % IOtime&lt;br /&gt;
  5.0 | 0.05 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [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;                  # Points coordinates (out) cc/rlu/iku/alat&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;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&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                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1034</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1034"/>
		<updated>2026-10-09T07:46:34Z</updated>

		<summary type="html">&lt;p&gt;Davide: Added section on BSE post processing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic ==&lt;br /&gt;
* [[First steps: a walk through from DFT to optical properties]] (modular tutorial) &lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)|GW on h-BN]] (standalone version);  [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW on h-BN]] (modular version) &lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[BSE tutorial on hBN standalone|BSE on h-BN]] (standalone version); [[BSE tutorial on hBN|BSE on h-BN]] (modular version); &lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials on GW and Quasi-particles ==&lt;br /&gt;
* [[Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW parallel strategies|GW parallel strategies v1]]; [[GW parallel strategies CECAM|GW parallel strategies v2]];  [[Pushing convergence in parallel|GW convergence in parallel]] (modular tutorials)&lt;br /&gt;
* [[GW tutorial on HPC]] (external tutorial on HackMD)&lt;br /&gt;
* [[Quasi-particles and Self-energy within the Multipole Approximation (MPA)]]&lt;br /&gt;
* [http://www.attaccalite.com/gw-correction-on-an-arbitrary-point-of-the-brillouin-zone GW on arbitrary k point] (external tutorial on www.attaccalite.com)&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials Linear response and BSE ==&lt;br /&gt;
=== Optical properties and more in extended systems ===&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
* [[The magneto-optical Kerr effect|The magneto-optical Kerr effect in bulk iron, RPA]]&lt;br /&gt;
* [[The magneto-optical Kerr effect including excitonic effects|The magneto-optical Kerr effect in XXX, excitonic effects]] (todo)&lt;br /&gt;
* [[Magneto-electric reponse]]&lt;br /&gt;
* [[Magnons with BSE formalism]] (todo)&lt;br /&gt;
* [[Bands selection in BSE and application to semi-core states]] (todo)&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Fast convergence of dielectric constant with double grid]]&lt;br /&gt;
=== Optical properties and more in lower dimensional systems (1D/2D) ===&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]] (1D)&lt;br /&gt;
* [[Si wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&lt;br /&gt;
* [[Si Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
&lt;br /&gt;
=== Optical properties and more in molecules ===&lt;br /&gt;
* [[H2|H2 molecule: Linear Response &amp;amp; TDDFT (0D)]] (to restore from old version)&lt;br /&gt;
* [[SiH4|SiH4: isolated molecule TDDFT &amp;amp; BSE (0D)]] (restored from old version, still to be finalized)&lt;br /&gt;
* [[Dichroism in molecules]]&lt;br /&gt;
&lt;br /&gt;
== Post Processing with ypp and YamboPy ==&lt;br /&gt;
&lt;br /&gt;
=== Basic post-processing features ===&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
* [[First steps in YamboPy]]&lt;br /&gt;
&lt;br /&gt;
=== Post BSE tutorials ===&lt;br /&gt;
* [[NEQ AREPS from BSE post processing]]&lt;br /&gt;
* [[Inter/Intra exciton transitions from BSE post processing]]&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon and exciton-phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling (old tutorial)]]&lt;br /&gt;
* [[Electron Phonon Coupling (new)]]&lt;br /&gt;
* [[Electron and exciton life-time]]&lt;br /&gt;
* [[Optical properties at finite temperature]]&lt;br /&gt;
* [[Phonon-assisted luminescence by finite atomic displacements]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence hBN | Exciton-phonon coupling and luminescence in hBN via yambopy (version 1)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence | Exciton-phonon coupling and luminescence in hBN via yambopy (version 2)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence - Yambo postprocessing | Exciton-phonon coupling and luminescence in hBN, part 2 via yambo_ph]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Real time propagation ==&lt;br /&gt;
&lt;br /&gt;
=== Linear response from real time propagation ===&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response using the density matrix (IP)]]&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase|Linear response using wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response in velocity gauge|Linear response using wave-functions in velocity gauge (IP)]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Linear response using the density matrix (TD-HSEX)]]&lt;br /&gt;
* [[Linear response from real time simulations|Linear response from real time simulations (IP &amp;amp; TD-HSEX)]] (modular tutorial)&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response from real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real time approach to non-linear response (SHG)]]&lt;br /&gt;
* [[Correlation effects in the non-linear response]]&lt;br /&gt;
* [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [[Spin-orbit coupling and non-linear response]]&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]]&lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response in Floquet formulation ===&lt;br /&gt;
* [[SHG from Floquet formulation]]&lt;br /&gt;
=== Pump and Probe experiments ===&lt;br /&gt;
&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon|Pump and Probe: Transient Absorption from BSE with NEQ occupations]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption from real time propagation with pump and probe]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES|Pump and Probe: Time resolved ARPES from real time propagation with pump]]&lt;br /&gt;
&lt;br /&gt;
=== More on real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real-time dynamics with external field read from file]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Developing Lumen ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe&amp;diff=1033</id>
		<title>Pump and Probe</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Pump_and_Probe&amp;diff=1033"/>
		<updated>2026-10-08T13:23:36Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Pump only */  removed probe field from pump only section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
In this tutorial we will show you how to setup two external fields in &#039;&#039;&#039;yambo_nl&#039;&#039;&#039;, to perform pump and probe simulation. &amp;lt;ref name=&amp;quot;pnp&amp;quot;&amp;gt;[https://arxiv.org/abs/2211.12241 Exciton - Exciton transitions involving strongly bound excitons: an ab-initio approach], D. Sangalli, M. D&#039;Alessandro and C. Attaccalite, Physical Review B &#039;&#039;&#039;107&#039;&#039;&#039; (20), 205203 (2023) &amp;lt;/ref&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial is at independent particle level, but the same kind of simulation can be repeated including local field effects, &lt;br /&gt;
quasi-particle correction or electron-hole interaction, see for example the tutorials:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Correlation effects in the non-linear response]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Real time Bethe-Salpeter Equation (TDSE)]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This tutorial supposes that you are already familiar with real-time simulation with Yambo&amp;lt;ref name=&amp;quot;dberry&amp;quot;&amp;gt;[https://arxiv.org/abs/1609.09639 Non-linear response in extended systems: a real-time approach], C. Attaccalite &amp;lt;/ref&amp;gt;&lt;br /&gt;
if it is not the case please check these tutorials: [[Tutorials#Non_linear_response]]&lt;br /&gt;
&lt;br /&gt;
We start from the h-BN monolayer with an in place lattice constant a=2.5 Å and a box large 33 a.u. in the z-direction.&lt;br /&gt;
Standard DFT input for hBN monolayer for ABINIT or QuantumEspresso can be found here [[Tutorials]]. &amp;lt;br&amp;gt;&lt;br /&gt;
We used  a 9x9x1 k-points grid and 8 bands in the non-self consistent calculation and 40 Ry cutoff for the wave-function.&lt;br /&gt;
&lt;br /&gt;
In our example we choose direction [0,1,0] for the pump and [1,0,0] for the probe. &lt;br /&gt;
We generate the ypp.in to remove symmetries with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp -y&amp;lt;/span&amp;gt; and we modify it as:&lt;br /&gt;
&lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&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;      # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
&lt;br /&gt;
then we go in the FixSymm directory and run again the setup. &amp;lt;br&amp;gt;&lt;br /&gt;
We will perform three different real-time calculations: &amp;lt;br&amp;gt;&lt;br /&gt;
* the probe field alone; &lt;br /&gt;
* the pump field alone; &lt;br /&gt;
* the pump and probe configuration.&lt;br /&gt;
&lt;br /&gt;
== Probe only ==&lt;br /&gt;
&lt;br /&gt;
We can generate the input file for a generic Pump and Probe calculations with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u p -F yambo.in_probe&amp;lt;/span&amp;gt;:&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  3 |  6 |    &amp;lt;/span&amp;gt;                       # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 80.000000&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;IPA&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;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot; &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|COS|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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 |  &amp;lt;/span&amp;gt;      # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.00000  &amp;lt;/span&amp;gt;  fs    # [RT Field1] Initial Time&lt;br /&gt;
 [......]&lt;br /&gt;
&lt;br /&gt;
In this input we set only the first field that is the probe, we use a DELTA function as field in such a way to probe all the frequencies, and set the starting point of the delta at t=5 fs. &amp;lt;br&amp;gt;Run this job in a separate folder with the command  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_probe -J PROBE&amp;lt;/span&amp;gt;. Then we can analyze the spectra with &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp -u -J PROBE &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LORENTZIAN&amp;lt;/span&amp;gt;&amp;quot;           # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.100000&amp;lt;/span&amp;gt;       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;           # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
and get the dielectric response. Notice that we introduce a Lorentzian broadening the post-processing. &amp;lt;br&amp;gt;&lt;br /&gt;
Hereafter we plot the damped polarization along the y-direction and the corresponding dielectric constant:&lt;br /&gt;
&lt;br /&gt;
[[File:Eps probe.png|800px|center | Probe only]]&lt;br /&gt;
&lt;br /&gt;
the arrow indicates the position where we will put the Pump in the next simulation.&lt;br /&gt;
&lt;br /&gt;
==Pump only==&lt;br /&gt;
&lt;br /&gt;
Now we run a simulation with the pump field only. We generate the input in the same way &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u p -F yambo.in_pump&amp;lt;/span&amp;gt;. &amp;lt;br&amp;gt;&lt;br /&gt;
These result will be our reference field in the final analysis. Here the input file for the pump:&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;150.0000&amp;lt;/span&amp;gt;           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&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;
 NLDamping=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000&amp;lt;/span&amp;gt;        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.42 | 5.42 &amp;lt;/span&amp;gt;|         eV    # [RT Field2] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field2] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00 &amp;lt;/span&amp;gt;      kWLm2 # [RT Field2] Intensity&lt;br /&gt;
 Field1_Width= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt;     fs    # [RT Field2] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;QSSIN&amp;lt;/span&amp;gt;&amp;quot;             # [RT Field2] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field1_pol= &amp;quot;linear&amp;quot;             # [RT Field2] Pol(linear|circular)&lt;br /&gt;
 % Field1_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;     # [RT Field2] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= 0.010000    fs    # [RT Field2] Initial Time&lt;br /&gt;
 [...]&lt;br /&gt;
In this simulation we used as Pump field QSSIN that is sinus with a Guassian envelope[https://demonstrations.wolfram.com/SineGaussianSignals/ sine-Gaussian wave]. For a list of all possible field in Yambo see the file  &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; src/modules/mod_fields.F&amp;lt;/span&amp;gt;. We centred the field frequency at 5.42 eV that is the energy of the highest peak in the previous figure, see arrow there. &lt;br /&gt;
Run the simulation with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_pump -J PUMP &amp;lt;/span&amp;gt;.&lt;br /&gt;
The pump field, column 6th of the file &amp;lt;code&amp;gt;o-PUMP.external_potential_F1&amp;lt;/code&amp;gt;, is shown in the figure below:&lt;br /&gt;
&lt;br /&gt;
[[File:Pump only.png|800px|center|Pump field]]&lt;br /&gt;
&lt;br /&gt;
== Pump and probe==&lt;br /&gt;
&lt;br /&gt;
Now we copy the pump in file in a new file &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt; cp yambo.in_pump yambo.in_pump_and_probe&amp;lt;/span&amp;gt; and turn on  the probe field:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&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;
   3 |  6 |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;150.0000 &amp;lt;/span&amp;gt;          fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&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;
 NLDamping=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 21817            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 21817            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.00  &amp;lt;/span&amp;gt;     kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|COS|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;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 | &amp;lt;/span&amp;gt;       # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;90.0000  &amp;lt;/span&amp;gt;  fs    # [RT Field1] Initial Time&lt;br /&gt;
 % Field2_Freq&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5.42 | 5.42 |  &amp;lt;/span&amp;gt;       eV    # [RT Field2] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field2_NFreqs= 1                 # [RT Field2] Frequency&lt;br /&gt;
 Field2_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00&amp;lt;/span&amp;gt;       kWLm2 # [RT Field2] Intensity&lt;br /&gt;
 Field2_Width=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000  &amp;lt;/span&amp;gt;   fs    # [RT Field2] Width&lt;br /&gt;
 Field2_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;QSSIN&amp;lt;/span&amp;gt;&amp;quot;             # [RT Field2] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field2_pol= &amp;quot;linear&amp;quot;             # [RT Field2] Pol(linear|circular)&lt;br /&gt;
 % Field2_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;        # [RT Field2] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field2_Tstart= 0.010000    fs    # [RT Field2] Initial Time&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note:&#039;&#039;&#039;  by convention in Yambo we consider the first field the probe and the second the pump. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you run the simulation with the command &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -F yambo.in_pump_and_probe -J PUMP_AND_PROBE &amp;lt;/span&amp;gt; and then we analyze the result using ypp with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp_nl -u -J PUMP_AND_PROBE &amp;lt;/span&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis &lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;500 &amp;lt;/span&amp;gt;                   # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.00000 | 3.9000 &amp;lt;/span&amp;gt;|         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;GAUSSIAN&amp;lt;/span&amp;gt;&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.085000  &amp;lt;/span&amp;gt;     eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;./PUMP/&amp;lt;/span&amp;gt;&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Notice that in this case we are interested in the spectra below the 4 eV, that is was zero without the presence of the pump. We put in the input the pump path in such way to calculate polarization of the pump&amp;amp;probe minus the one of generate by the pump only &amp;lt;math&amp;gt;\Delta P(t) = P_{PnP}(t) - P_{pump}(t)&amp;lt;/math&amp;gt;. Then we analyze the &amp;lt;math&amp;gt;\Delta P(t)&amp;lt;/math&amp;gt; and get the new spectra:&lt;br /&gt;
&lt;br /&gt;
[[File:P and p spectrum.png|800px | center|Pump and probe spectrum]]&lt;br /&gt;
&lt;br /&gt;
The peak that you see in this spectrum, that were not present in when the pump was zero, correspond to the transition between the different excited states. The pump field populates the state at 5.42 eV and then the probe excites electrons from this state to higher states. The energy difference between the higher excited states and the peak at 5.42 define the position of the peaks in the pump and probe spectrum, while their intensity is dictated by the dipole matrix elements between the different excited states, see Ref. &amp;lt;ref name=&amp;quot;pnp&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Additional comments on pump and probe calculations &#039;&#039;&#039;&lt;br /&gt;
* We used a Gaussian damping factor, this choice is motivated by various tests we have done, and it seems to us that in pump and probe this broadening gives better results.&amp;lt;br&amp;gt;&lt;br /&gt;
* If you plot all spectrum you will notice that the &amp;quot;equilibrium part&amp;quot; is much stronger than the one induced by the pump, this is normal because only a small fraction of electron are promoted in the excited state by the pump.&lt;br /&gt;
* All previous simulation can be run also in presence of excitons, see  Ref. &amp;lt;ref name=&amp;quot;pnp&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt; and group theory can be used to predict dark/bright transition in the pump and probe spectroscopy.&amp;lt;ref&amp;gt;[https://link.springer.com/book/10.1007/978-3-540-32899-5  Group Theory, Application to the Physics of Condensed Matter],   Mildred S. S. Dresselhaus, Gene Dresselhaus, Ado Jorio, Springer Editor&amp;lt;/ref&amp;gt;&lt;br /&gt;
* In principle is it possible to include damping and radiative life-time in the simulation to study retardation effect between the pump and probe. This  approach  exact in the independent particle case, but introduces an error when correlation effects are present, see Refs.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/2106.03592 Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: an abinitio approach], D. Sangalli, Phys. Rev. Materials &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)&amp;lt;/ref&amp;gt; and &amp;lt;ref&amp;gt;[https://arxiv.org/abs/1705.04245 Theory of exciton-phonon coupling], Gabriel Antonius and Steven G. Louie Phys. Rev. B &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)&amp;lt;/ref&amp;gt;for a discussion.&lt;br /&gt;
* Non-linear response (SHG, THG, ...) induced by the pump is not implemented yet... if you have a good idea how to do it, please let us know&lt;br /&gt;
&lt;br /&gt;
== Analysis of the results using YamboPy ==&lt;br /&gt;
&#039;&#039;&#039;This part works only with Lumen 2.0 or the last version available on Gitlab&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Results can be analyzed using YamboPy with the following script:&lt;br /&gt;
&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 from yambopy.plot  import *&lt;br /&gt;
 &lt;br /&gt;
 NLDB_P_and_P=YamboNLDB(calc=&#039;P_and_P&#039;)&lt;br /&gt;
 NLDB_Pump   =YamboNLDB(calc=&#039;PUMP&#039;)&lt;br /&gt;
  &lt;br /&gt;
 pol_pump   =NLDB_Pump.Polarization[0]&lt;br /&gt;
 pol_p_and_p=NLDB_P_and_P.Polarization[0]&lt;br /&gt;
 &lt;br /&gt;
 time=NLDB_P_and_P.IO_TIME_points&lt;br /&gt;
 t_initial=NLDB_P_and_P.Efield[0][&amp;quot;initial_time&amp;quot;]&lt;br /&gt;
 &lt;br /&gt;
 pol_damped=np.empty_like(pol_pump)&lt;br /&gt;
 &lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
     pol_damped[i_d,:]=damp_it(pol_p_and_p[i_d,:]-pol_pump[i_d,:],time,t_initial,damp_type=&#039;GAUSSIAN&#039;,damp_factor=0.085/ha2ev)&lt;br /&gt;
 &lt;br /&gt;
 Plot_Pol(time=time, pol=pol_damped, xlim=[0,55], save_file=&#039;polarization.pdf&#039;)&lt;br /&gt;
 &lt;br /&gt;
 Linear_Response(time=time,pol=pol_damped,efield=NLDB_P_and_P.Efield[0],plot=False,plot_file=&#039;delta_eps.pdf&#039;,e_range=[0.0,3.7],n_freqs=500)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1032</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1032"/>
		<updated>2026-10-05T11:26:41Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Electron-phonon and exciton-phonon coupling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic ==&lt;br /&gt;
* [[First steps: a walk through from DFT to optical properties]] (modular tutorial) &lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)|GW on h-BN]] (standalone version);  [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW on h-BN]] (modular version) &lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[BSE tutorial on hBN standalone|BSE on h-BN]] (standalone version); [[BSE tutorial on hBN|BSE on h-BN]] (modular version); &lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials on GW and Quasi-particles ==&lt;br /&gt;
* [[Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW parallel strategies|GW parallel strategies v1]]; [[GW parallel strategies CECAM|GW parallel strategies v2]];  [[Pushing convergence in parallel|GW convergence in parallel]] (modular tutorials)&lt;br /&gt;
* [[GW tutorial on HPC]] (external tutorial on HackMD)&lt;br /&gt;
* [[Quasi-particles and Self-energy within the Multipole Approximation (MPA)]]&lt;br /&gt;
* [http://www.attaccalite.com/gw-correction-on-an-arbitrary-point-of-the-brillouin-zone GW on arbitrary k point] (external tutorial on www.attaccalite.com)&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials Linear response and BSE ==&lt;br /&gt;
=== Optical properties and more in extended systems ===&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
* [[The magneto-optical Kerr effect|The magneto-optical Kerr effect in bulk iron, RPA]]&lt;br /&gt;
* [[The magneto-optical Kerr effect including excitonic effects|The magneto-optical Kerr effect in XXX, excitonic effects]] (todo)&lt;br /&gt;
* [[Magneto-electric reponse]]&lt;br /&gt;
* [[Magnons with BSE formalism]] (todo)&lt;br /&gt;
* [[Bands selection in BSE and application to semi-core states]] (todo)&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Fast convergence of dielectric constant with double grid]]&lt;br /&gt;
=== Optical properties and more in lower dimensional systems (1D/2D) ===&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]] (1D)&lt;br /&gt;
* [[Si wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&lt;br /&gt;
* [[Si Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
&lt;br /&gt;
=== Optical properties and more in molecules ===&lt;br /&gt;
* [[H2|H2 molecule: Linear Response &amp;amp; TDDFT (0D)]] (to restore from old version)&lt;br /&gt;
* [[SiH4|SiH4: isolated molecule TDDFT &amp;amp; BSE (0D)]] (restored from old version, still to be finalized)&lt;br /&gt;
* [[Dichroism in molecules]]&lt;br /&gt;
&lt;br /&gt;
== Post Processing with ypp and YamboPy ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
* [[First steps in YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon and exciton-phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling (old tutorial)]]&lt;br /&gt;
* [[Electron Phonon Coupling (new)]]&lt;br /&gt;
* [[Electron and exciton life-time]]&lt;br /&gt;
* [[Optical properties at finite temperature]]&lt;br /&gt;
* [[Phonon-assisted luminescence by finite atomic displacements]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence hBN | Exciton-phonon coupling and luminescence in hBN via yambopy (version 1)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence | Exciton-phonon coupling and luminescence in hBN via yambopy (version 2)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence - Yambo postprocessing | Exciton-phonon coupling and luminescence in hBN, part 2 via yambo_ph]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Real time propagation ==&lt;br /&gt;
&lt;br /&gt;
=== Linear response from real time propagation ===&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response using the density matrix (IP)]]&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase|Linear response using wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response in velocity gauge|Linear response using wave-functions in velocity gauge (IP)]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Linear response using the density matrix (TD-HSEX)]]&lt;br /&gt;
* [[Linear response from real time simulations|Linear response from real time simulations (IP &amp;amp; TD-HSEX)]] (modular tutorial)&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response from real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real time approach to non-linear response (SHG)]]&lt;br /&gt;
* [[Correlation effects in the non-linear response]]&lt;br /&gt;
* [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [[Spin-orbit coupling and non-linear response]]&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]]&lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response in Floquet formulation ===&lt;br /&gt;
* [[SHG from Floquet formulation]]&lt;br /&gt;
=== Pump and Probe experiments ===&lt;br /&gt;
&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon|Pump and Probe: Transient Absorption from BSE with NEQ occupations]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption from real time propagation with pump and probe]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES|Pump and Probe: Time resolved ARPES from real time propagation with pump]]&lt;br /&gt;
&lt;br /&gt;
=== More on real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real-time dynamics with external field read from file]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Developing Lumen ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1031</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=1031"/>
		<updated>2026-10-05T11:20:43Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Electron-phonon and exciton-phonon coupling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic ==&lt;br /&gt;
* [[First steps: a walk through from DFT to optical properties]] (modular tutorial) &lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)|GW on h-BN]] (standalone version);  [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW on h-BN]] (modular version) &lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[BSE tutorial on hBN standalone|BSE on h-BN]] (standalone version); [[BSE tutorial on hBN|BSE on h-BN]] (modular version); &lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials on GW and Quasi-particles ==&lt;br /&gt;
* [[Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW parallel strategies|GW parallel strategies v1]]; [[GW parallel strategies CECAM|GW parallel strategies v2]];  [[Pushing convergence in parallel|GW convergence in parallel]] (modular tutorials)&lt;br /&gt;
* [[GW tutorial on HPC]] (external tutorial on HackMD)&lt;br /&gt;
* [[Quasi-particles and Self-energy within the Multipole Approximation (MPA)]]&lt;br /&gt;
* [http://www.attaccalite.com/gw-correction-on-an-arbitrary-point-of-the-brillouin-zone GW on arbitrary k point] (external tutorial on www.attaccalite.com)&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials Linear response and BSE ==&lt;br /&gt;
=== Optical properties and more in extended systems ===&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
* [[The magneto-optical Kerr effect|The magneto-optical Kerr effect in bulk iron, RPA]]&lt;br /&gt;
* [[The magneto-optical Kerr effect including excitonic effects|The magneto-optical Kerr effect in XXX, excitonic effects]] (todo)&lt;br /&gt;
* [[Magneto-electric reponse]]&lt;br /&gt;
* [[Magnons with BSE formalism]] (todo)&lt;br /&gt;
* [[Bands selection in BSE and application to semi-core states]] (todo)&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Fast convergence of dielectric constant with double grid]]&lt;br /&gt;
=== Optical properties and more in lower dimensional systems (1D/2D) ===&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]] (1D)&lt;br /&gt;
* [[Si wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&lt;br /&gt;
* [[Si Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
&lt;br /&gt;
=== Optical properties and more in molecules ===&lt;br /&gt;
* [[H2|H2 molecule: Linear Response &amp;amp; TDDFT (0D)]] (to restore from old version)&lt;br /&gt;
* [[SiH4|SiH4: isolated molecule TDDFT &amp;amp; BSE (0D)]] (restored from old version, still to be finalized)&lt;br /&gt;
* [[Dichroism in molecules]]&lt;br /&gt;
&lt;br /&gt;
== Post Processing with ypp and YamboPy ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
* [[First steps in YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon and exciton-phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling (old tutorial)]]&lt;br /&gt;
* [[Electron Phonon Coupling (new)]]&lt;br /&gt;
* [[Electron and exciton life-time]]&lt;br /&gt;
* [[Optical properties at finite temperature]]&lt;br /&gt;
* [[Phonon-assisted luminescence by finite atomic displacements]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence hBN | Exciton-phonon coupling and luminescence in hBN via yambopy (version 1)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence | Exciton-phonon coupling and luminescence in hBN via yambopy (version 2)]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence - Yambo postprocessing | Exciton-phonon coupling and luminescence in hBN via yambo_ph]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Real time propagation ==&lt;br /&gt;
&lt;br /&gt;
=== Linear response from real time propagation ===&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response using the density matrix (IP)]]&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase|Linear response using wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response in velocity gauge|Linear response using wave-functions in velocity gauge (IP)]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Linear response using the density matrix (TD-HSEX)]]&lt;br /&gt;
* [[Linear response from real time simulations|Linear response from real time simulations (IP &amp;amp; TD-HSEX)]] (modular tutorial)&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response from real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real time approach to non-linear response (SHG)]]&lt;br /&gt;
* [[Correlation effects in the non-linear response]]&lt;br /&gt;
* [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [[Spin-orbit coupling and non-linear response]]&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]]&lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response in Floquet formulation ===&lt;br /&gt;
* [[SHG from Floquet formulation]]&lt;br /&gt;
=== Pump and Probe experiments ===&lt;br /&gt;
&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon|Pump and Probe: Transient Absorption from BSE with NEQ occupations]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption from real time propagation with pump and probe]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES|Pump and Probe: Time resolved ARPES from real time propagation with pump]]&lt;br /&gt;
&lt;br /&gt;
=== More on real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real-time dynamics with external field read from file]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Developing Lumen ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_hBN&amp;diff=1030</id>
		<title>Exciton-phonon coupling and luminescence hBN</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Exciton-phonon_coupling_and_luminescence_hBN&amp;diff=1030"/>
		<updated>2026-10-05T11:17:04Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Step 7: Obtain the electron-phonon matrix elements with LetzElPhC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Tdgw-phonon-usc-01-1024x829.jpg| 400px | right]]&lt;br /&gt;
&lt;br /&gt;
This tutorial is alternative  to the tutorial  [[Exciton-phonon coupling and luminescence]] to calculated phonon-assisted luminescence. &lt;br /&gt;
&lt;br /&gt;
(Also this tutorial is based on the following papers: the theory&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;antonius2017&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cudazzo2020&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paleari2019_PhD&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paleari2022&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot; /&amp;gt; and applications&amp;lt;ref name=&amp;quot;paleari2019&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cannuccia2019&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;chen2020&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;zanfrognini2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;lechifflart2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;chan2023&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;marini2024&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;murali2025&amp;quot; /&amp;gt; of exciton-phonon physics. &lt;br /&gt;
&lt;br /&gt;
This tutorial is specific for the Claudia cluster in Marseille &lt;br /&gt;
&lt;br /&gt;
In this tutorial we will use hBN as example.  &lt;br /&gt;
&lt;br /&gt;
== Step 0: Install YamboPy ==&lt;br /&gt;
&lt;br /&gt;
First of all you have to install YamboPY. You can use the Miniconda module on Claudia&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1) Install miniconda in your home directory&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
https://www.anaconda.com/docs/getting-started/miniconda/install#linux-2&lt;br /&gt;
&lt;br /&gt;
reload bash environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2) Download YamboPy from github&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git clone https://github.com/yambo-code/yambopy.git&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout bug-fixes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3) Install YamboPY&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd yambopy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pip install ./&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
(if you want to do developer installation you can do &amp;lt;code&amp;gt;pip install -e ./&amp;lt;/code&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
== Step 1: scf calculation ==&lt;br /&gt;
&lt;br /&gt;
In order to study luminescence in a paradigmatic system, we switch to bulk hexagonal boron nitride and we repeat the workflow. As you can easily see, one can think about automatizing the execution of all these calculations via scripting or more advanced tools. However, in the case of very large simulations (memory-limited or disk-space limited) or for systems whose electronic and lattice properties are fragile with respect to tiny calculation details, one must be very careful and run many basic tests.&lt;br /&gt;
&lt;br /&gt;
Fortunately, we are running a fast underconverged example. We use LDA pseudopotentials from the [https://www.pseudo-dojo.org/ pseudo-dojo library]. &lt;br /&gt;
&lt;br /&gt;
You can download the psuedo-potentials here: [https://www.lumen-code.org/pseudos/B_LDA_dojo.UPF B_LDA_dojo.UPF,] [https://www.lumen-code.org/pseudos/N_LDA_dojo.UPF N_LDA_dojo.UPF]&lt;br /&gt;
&lt;br /&gt;
Create the &#039;&#039;&#039;scf&#039;&#039;&#039; folder and and run the following job:&lt;br /&gt;
&lt;br /&gt;
1. Input &amp;lt;code&amp;gt;hbn.scf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;scf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;,&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
== Step 2: nscf calculation for Yambo ==&lt;br /&gt;
&lt;br /&gt;
Then we run the non self-consistent calculation to get valence and conduction bands that will be our basis for the calculations in Lumen.&lt;br /&gt;
&lt;br /&gt;
Copy the SCF calculation in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder with the command:&lt;br /&gt;
&lt;br /&gt;
 cd nscf&lt;br /&gt;
 cp -r ../scf/hBN.save ./&lt;br /&gt;
&lt;br /&gt;
then run the NSCF with QuantumEspresso:&lt;br /&gt;
 &amp;amp;control&lt;br /&gt;
     calculation=&#039;nscf&#039;,&lt;br /&gt;
     prefix=&#039;hBN&#039;,&lt;br /&gt;
     restart_mode=&#039;from_scratch&#039;&lt;br /&gt;
     pseudo_dir = &#039;$PSEUDO_DIR&#039;&lt;br /&gt;
     outdir = &#039;./&#039;&lt;br /&gt;
     verbosity = &#039;high&#039;&lt;br /&gt;
     wf_collect=.true.&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;system&lt;br /&gt;
     ibrav = 4,&lt;br /&gt;
     celldm(1) = 4.703675849&lt;br /&gt;
     celldm(3) = 2.603711434&lt;br /&gt;
     nat= 4,&lt;br /&gt;
     ntyp= 2,&lt;br /&gt;
     force_symmorphic=.true.&lt;br /&gt;
     ecutwfc = 100,&lt;br /&gt;
 	nbnd = 120&lt;br /&gt;
 /&lt;br /&gt;
 &amp;amp;electrons&lt;br /&gt;
   diago_david_ndim = 2&lt;br /&gt;
   diago_full_acc=.true.&lt;br /&gt;
   diago_thr_init=5.0e-6&lt;br /&gt;
   mixing_mode = &#039;plain&#039;&lt;br /&gt;
   mixing_beta = 0.7&lt;br /&gt;
   conv_thr =  1.0d-16&lt;br /&gt;
 /&lt;br /&gt;
 ATOMIC_SPECIES&lt;br /&gt;
  B 10.81100  B_LDA_dojo.UPF&lt;br /&gt;
  N 14.00674  N_LDA_dojo.UPF&lt;br /&gt;
 ATOMIC_POSITIONS {crystal}&lt;br /&gt;
 N             0.6666666670        0.3333333330        -0.250000000000&lt;br /&gt;
 B             0.3333333330        0.6666666670        -0.250000000000&lt;br /&gt;
 B             0.6666666670        0.3333333330        0.25000000000&lt;br /&gt;
 N             0.3333333330        0.6666666670        0.25000000000&lt;br /&gt;
 K_POINTS {automatic}&lt;br /&gt;
 6 6 2 0 0 0&lt;br /&gt;
&lt;br /&gt;
== Step 3: dvscf phonon calculation ==&lt;br /&gt;
&lt;br /&gt;
Create the &#039;&#039;&#039;ph&#039;&#039;&#039; folder and copy the scf results also here:&lt;br /&gt;
&lt;br /&gt;
 cd ph&lt;br /&gt;
 cp -r ../scf/hBN.save ./&lt;br /&gt;
&lt;br /&gt;
Finally we run phonons on the same grid of the non self-consistent calculations with the intput &amp;lt;code&amp;gt;hbn.ph&amp;lt;/code&amp;gt; :&lt;br /&gt;
 hbn_dvscf&lt;br /&gt;
 &amp;amp;inputph&lt;br /&gt;
   tr2_ph=1.0d-12,&lt;br /&gt;
   verbosity=&#039;high&#039;&lt;br /&gt;
   prefix=&#039;hBN&#039;,&lt;br /&gt;
   fildvscf = &#039;hBN-dvscf&#039;,&lt;br /&gt;
   electron_phonon = &#039;dvscf&#039;,&lt;br /&gt;
   fildyn=&#039;hBN.dyn&#039;,&lt;br /&gt;
   epsil=.false.,&lt;br /&gt;
   ldisp=.true.,&lt;br /&gt;
   recover=.true.,&lt;br /&gt;
   nq1=6,&lt;br /&gt;
   nq2=6,&lt;br /&gt;
   nq3=2&lt;br /&gt;
 /&lt;br /&gt;
&lt;br /&gt;
== Step 4: create Yambo SAVE directory ==&lt;br /&gt;
Go in the &#039;&#039;&#039;nscf&#039;&#039;&#039; folder and read the wave-functions with the command:&lt;br /&gt;
 p2y &lt;br /&gt;
&lt;br /&gt;
and then run the setup &lt;br /&gt;
&lt;br /&gt;
 yambo &lt;br /&gt;
&lt;br /&gt;
== Step 5: run a BSE calculation ==&lt;br /&gt;
Input &amp;lt;code&amp;gt;bse.in&amp;lt;/code&amp;gt; (we include 2 valence and 2 conduction bands),&lt;br /&gt;
&lt;br /&gt;
This input was generated with the command: &amp;lt;code&amp;gt;yambo -X s -o b -k sex -y d -&amp;lt;/code&amp;gt;&amp;lt;code&amp;gt;V resp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bss                              # [R] BSE solver&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 NLogCPUs=0                       # [PARALLEL] Live-timing CPU`s (0 for all)&lt;br /&gt;
 PAR_def_mode= &amp;quot;balanced&amp;quot;         # [PARALLEL] Default distribution mode  &lt;br /&gt;
 DIP_CPU= &amp;quot;&amp;quot;                      # [PARALLEL] CPUs for each role&lt;br /&gt;
 DIP_ROLEs= &amp;quot;&amp;quot;                    # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_and_IO_CPU= &amp;quot;&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 X_and_IO_ROLEs= &amp;quot;&amp;quot;               # [PARALLEL] CPUs roles (q,g,k,c,v)&lt;br /&gt;
 X_and_IO_nCPU_LinAlg_INV=1      # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 BS_CPU= &amp;quot;2 2 4&amp;quot;                       # [PARALLEL] CPUs for each role&lt;br /&gt;
 BS_ROLEs= &amp;quot;k eh t&amp;quot;                     # [PARALLEL] CPUs roles (k,eh,t)&lt;br /&gt;
 BS_nCPU_LinAlg_INV=1            # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 BS_nCPU_LinAlg_DIAGO=1          # [PARALLEL] CPUs for Linear Algebra (if -1 it is automatically set)&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 BSKmod= &amp;quot;SEX&amp;quot;                    # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc &lt;br /&gt;
 BSEmod= &amp;quot;resonant&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSSmod= &amp;quot;d&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx= 31583            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=-1                RL    # [BSK] Screened interaction block size [if -1 uses all the G-vectors of  W(q,G,Gp)]&lt;br /&gt;
 #WehCpl                        # [BSK] eh interaction included also in coupling&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;full&amp;quot;                  # [BSE,X] bar(default)/full/tilde&amp;lt;/span&amp;gt;&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
  1.259970 | 1.088160 | 1.126830 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # Excitonic Temperature (for luminescence spectra and EXCPH)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; % BSEQptR&lt;br /&gt;
    1 | 14 |                           # [BSK] Transferred momenta range&lt;br /&gt;
  %&lt;br /&gt;
  % BSEBands&lt;br /&gt;
   7 | 10 |                           # [BSK] Bands range&lt;br /&gt;
  %&amp;lt;/span&amp;gt;&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  0.500000 | 8.000000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.050000 | 0.050000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 1000                   # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [BSS] [cc] Electric Field versor&lt;br /&gt;
 %&lt;br /&gt;
 BSEprop= &amp;quot;abs&amp;quot;                   # [BSS] Can be any among abs/jdos/kerr/asymm/anHAll/magn/dich&lt;br /&gt;
 BSEdips= &amp;quot;none&amp;quot;                  # [BSS] Can be &amp;quot;trace/none&amp;quot; or &amp;quot;xy/xz/yz&amp;quot; to define off-diagonal &lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;WRbsWF                     &amp;lt;/span&amp;gt;   # [BSS] Write to disk excitonic the WFs&lt;br /&gt;
 BSSldiaLib= &amp;quot;s&amp;quot;                  # [BSS] Library used with ldiago solver `(s)calapack/(e)lpa`&lt;br /&gt;
 BSSNEig=0                        # [SLEPC/DIAGO] Number of eigenvalues to compute&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 | 120 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 10000            mRy   # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
run the BSE in such a way to save rusults in the &amp;lt;code&amp;gt;bse_LFull&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nohup mpirun -np 8 yambo -F bse.in -J bse_Lfull -C bse_Lfull&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Step 6: Run BSE for Lbar ==&lt;br /&gt;
Importantly, since we want to describe the phonon-assisted recombination process of an *optical* exciton (i.e., emitting a transverse photon), this time we also run an additional calculation at `Q=0` omitting the nonanalytic long-range Coulomb exchange. Make a second input &amp;lt;code&amp;gt;bse_Lbar.in&amp;lt;/code&amp;gt; with the following changes:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Lkind= &amp;quot;Lbar&amp;quot;                    # [BSE] Lbar (default) / full&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                     # [BSK] Transferred momenta range&lt;br /&gt;
 %&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4b. So now we make a second BSE run in a different directory specified by &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt;. Here, we also pass to yambo the directory of the previous run as it includes the important screening databases &amp;lt;code&amp;gt;ndb.em1s*&amp;lt;/code&amp;gt; that we do not want to recompute from scratch.&lt;br /&gt;
 mpirun -np 8 yambo -F bse_Lbar.in -J bse_Lbar,bse_Lfull -C bse_Lbar&lt;br /&gt;
in such a way results are stored in the &amp;lt;code&amp;gt;bse_Lbar&amp;lt;/code&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
== Step 7: Obtain the electron-phonon matrix elements with yambopy and LetzElPhC==&lt;br /&gt;
Go in the nscf folrder where it is present the SAVE directory and run&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;module load yambo/5.3.0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;yambopy l2y -ph ../../ph/hbn.ph -b 7 10 -par 1 1 -lelphc /home/attaccalite/SOFTWARE/LetzElPhC/src/lelphc&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;--no_gkkp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Important points:&lt;br /&gt;
&lt;br /&gt;
* We added the flag --no_gkkp to not produce Yambo databases (this part still crashes for me)&lt;br /&gt;
* The  bands in LetzElphC are between 7 and 10  because LetzElPhC use the bands convention of QE starting from 1, while YamboPY starts from 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have a big system you can run this part in parallel, for example if you want to run on 8 cores:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH -J ypy&lt;br /&gt;
 #SBATCH -o %x.%j.out&lt;br /&gt;
 #SBATCH -e %x.%j.status&lt;br /&gt;
 #SBATCH --cpus-per-task=3&lt;br /&gt;
 #SBATCH --ntasks 8&lt;br /&gt;
 #SBATCH -p c6 &lt;br /&gt;
 &lt;br /&gt;
 # Module setup&lt;br /&gt;
 module purge&lt;br /&gt;
 module load gnu12/12.2.0&lt;br /&gt;
 module load openmpi4/4.1.5&lt;br /&gt;
 module load phdf5/1.14.0&lt;br /&gt;
 module load netcdf/4.9.0&lt;br /&gt;
 module load netcdf-fortran/4.6.0&lt;br /&gt;
 module load scalapack/2.2.2&lt;br /&gt;
 module load fftw/3.3.10&lt;br /&gt;
 module load openblas/0.3.21&lt;br /&gt;
 module load petsc/3.22.0_s&lt;br /&gt;
 module load slepc/3.22.0_s&lt;br /&gt;
 module load libxc/5.2.3&lt;br /&gt;
 module load pmix/4.2.9&lt;br /&gt;
 module load prun/2.2&lt;br /&gt;
  &lt;br /&gt;
 # Required parameters&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1}&lt;br /&gt;
 &lt;br /&gt;
 # Report on setup&lt;br /&gt;
 echo &amp;quot;Starting at $(date)&amp;quot;&lt;br /&gt;
 # echo &amp;quot;              QE PATH: ${QE_ROOT}&amp;quot;&lt;br /&gt;
 echo &amp;quot; Running on partition: ${SLURM_JOB_PARTITION}&amp;quot;&lt;br /&gt;
 echo &amp;quot;  Running on machines: ${SLURM_JOB_NODELIST}&amp;quot;&lt;br /&gt;
 module list&lt;br /&gt;
 ulimit -l unlimited&lt;br /&gt;
 &lt;br /&gt;
 # Start actual computation&lt;br /&gt;
 echo &amp;quot;Starting Code&amp;quot;&lt;br /&gt;
 yambopy l2y -ph ../../ph/hbn.ph -b 7 10 -par 4 2 -lelphc /home/attaccalite/SOFTWARE/LetzElPhC/src/lelphc --no_gkkp&lt;br /&gt;
 &lt;br /&gt;
 echo &amp;quot;Finished at $(date)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
do not forget that the number of tasks &amp;lt;code&amp;gt;ntasks=nkpool x nqpool&amp;lt;/code&amp;gt; in our example 8 = 4 x 2&lt;br /&gt;
&lt;br /&gt;
== Step 8: Compute phonon-assisted luminescence ==&lt;br /&gt;
Now you can compute the luminescence with the script:&lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 from yambopy.exciton_phonon.excph_luminescence import exc_ph_luminescence&lt;br /&gt;
 from yambopy.exciton_phonon.excph_input_data import exc_ph_get_inputs&lt;br /&gt;
 &lt;br /&gt;
 path = &#039;./&#039;&lt;br /&gt;
 # Path to BSE calculation (Lout--&amp;gt; response is Lfull)&lt;br /&gt;
 bsepath =  f&#039;{path}/bse_Lfull&#039; # ndb.BS_diago_Q* databases are needed&lt;br /&gt;
 # Path to BSE calculation for optically active exciton (Lin --&amp;gt; response is Lbar)&lt;br /&gt;
 bseBARpath =  f&#039;{path}/bse_Lbar&#039;  # ndb.BS_diago_Q1 database is needed&lt;br /&gt;
 # Path to electron-phonon calculation&lt;br /&gt;
 elphpath = path # ndb.elph is needed&lt;br /&gt;
 # Path to unprojected dipoles matrix elements (optional)&lt;br /&gt;
 dipolespath = bsepath # ndb.dipoles is needed (optional)&lt;br /&gt;
 # Path to lattice and k-space info&lt;br /&gt;
 savepath = f&#039;{path}/SAVE&#039; # ns.db1 database is needed &lt;br /&gt;
  &lt;br /&gt;
 bands_range=[6,10] # 2 valence, 2 conduction bands&lt;br /&gt;
 phonons_range=[0,12] # All phonons&lt;br /&gt;
 nexc_out = 12 # 12 excitonic states at each momentum (Lout)&lt;br /&gt;
 nexc_in  = 12 # 12 excitonic states at Q=0 (Lin)&lt;br /&gt;
 T_ph  = 10 # Lattice temperature&lt;br /&gt;
 T_exc = 10 # Effective excitonic temperature &lt;br /&gt;
 &lt;br /&gt;
 emin=4.2      # Energy range and plot details (in eV)&lt;br /&gt;
 emax=5.0&lt;br /&gt;
 estep=0.0002&lt;br /&gt;
 broad = 0.005 # Broadening parameter for peak width (in eV)&lt;br /&gt;
 # We calculate and load all the inputs:&lt;br /&gt;
 # * Exciton-phonon matrix elements&lt;br /&gt;
 # * Excitonic dipole matrix elements&lt;br /&gt;
 # * Exciton energies&lt;br /&gt;
 # * Phonon energies&lt;br /&gt;
 # * We specify bse_path2=bseBARpath meaning we use Lbar calculation for Q=0 excitons&lt;br /&gt;
 input_data = exc_ph_get_inputs(savepath,elphpath,bsepath,\&lt;br /&gt;
                                bse_path2=bseBARpath,dipoles_path=dipolespath,\&lt;br /&gt;
                                nexc_in=12,nexc_out=12,\&lt;br /&gt;
                                bands_range=[6,10],phonons_range=[0,12]) &lt;br /&gt;
   &lt;br /&gt;
 &lt;br /&gt;
 ph_energies, exc_energies, exc_energies_in, G, exc_dipoles = input_data &lt;br /&gt;
 &lt;br /&gt;
 # We calculate the luminescence spectrum including the input data from before&lt;br /&gt;
 w,PL = exc_ph_luminescence(T_ph,ph_energies,exc_energies,exc_dipoles,G,\&lt;br /&gt;
                            exc_energies_in=exc_energies_in,exc_temp=T_exc,\&lt;br /&gt;
                            nexc_out=nexc_out,nexc_in=nexc_in,emin=emin,emax=emax,\&lt;br /&gt;
                            estep=estep,broad=broad) &lt;br /&gt;
 &lt;br /&gt;
 # Save to file&lt;br /&gt;
 data = np.column_stack((w, PL))&lt;br /&gt;
 np.savetxt(&amp;quot;hBN_luminescence_12x12x1.dat&amp;quot;, data, fmt=&amp;quot;%.8f&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and the result is displayed here:&lt;br /&gt;
&lt;br /&gt;
[[File:HBN_luminescence_satellites.png| 600px | center]]&lt;br /&gt;
&lt;br /&gt;
== Step 9: Exciton lifetimes==&lt;br /&gt;
&lt;br /&gt;
TO BE DONE!!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the exciton-phonon coupling it is possible also to calculate exciton life-time due to the scattering with phonon. For this kind of calculation input file can be generated with the command &#039;&#039;yambo -excph l&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 excph                            # [R] Exction-phonon&lt;br /&gt;
 ExcGkkp                          # [R][EXCPH] Exciton-Phonon Matrix Elelements&lt;br /&gt;
 ExcPhLifeT                       # [R][EXCPH] Exciton-Phonon Life-Times&lt;br /&gt;
 BoseTemp= 0.000000         eV    # Bosonic Temperature&lt;br /&gt;
 % ELPhExcStates&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  4 |&amp;lt;/span&amp;gt;                           # [EXCPH] Incoming (external) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 % ELPhExcSum&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1 |  8 |    &amp;lt;/span&amp;gt;                       # [EXCPH] Outgoing (virtual) exciton states&lt;br /&gt;
 %&lt;br /&gt;
 LoutPath= &amp;quot;none&amp;quot;                 # [EXCPH] Path of the outgoing L&lt;br /&gt;
 FANdEtresh= 0.100000E-5    eV    # [ELPH] Energy treshold for Fan denominator&lt;br /&gt;
 % ElPhModes&lt;br /&gt;
   1 | 12 |                           # [ELPH] Phonon modes included&lt;br /&gt;
 %&lt;br /&gt;
 EXCTemp= 0.000000          eV    # [EXCPH] Excitonic Temperature (for luminescence spectra)&lt;br /&gt;
 AlphaQ= 0.000000                 # [EXCPH] Excitonic band structure 2D distortion&lt;br /&gt;
 #ExcPhOffDiago                 # [EXCPH] Exciton-Phonon off-diagonal self-energy&lt;br /&gt;
 #NoMatrxEl                     # [EXCPH] Set all exciton-phonon matrix elements to one (for testing purpose)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping= 0.1 &amp;lt;/span&amp;gt;     meV               # [EXCPH] Damping of exc-ph self-energy&lt;br /&gt;
&lt;br /&gt;
notice that in this case &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LDamping&amp;lt;/span&amp;gt; is the broadening of the exciton-phonon self energy and it should be a very small value of the order of the phonon life-times around the meV.&amp;lt;ref&amp;gt;[https://arxiv.org/abs/1411.5628 First-principles calculations of phonon frequencies, lifetimes, and spectral functions from weak to strong an-harmonicity: The example of palladium hydrides], L. Paulatto, et al. Phys. Rev. B &#039;&#039;&#039;91&#039;&#039;&#039;, 054304 (2015) &amp;lt;/ref&amp;gt;. Running this input you will get:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton lifetimes:&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [1] Lifetime: xxx meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [2] Lifetime: xxx meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [3] Lifetime: xxx meV&lt;br /&gt;
 &amp;lt;-&amp;gt; Exciton [4] Lifetime: xxx meV&lt;br /&gt;
&lt;br /&gt;
the life-time of the first four excitons. Note that this result is not converged respect to the Q-points. In order to speedup convergence that double-grid&amp;lt;ref name=&#039;lechifflart2023&#039; /&amp;gt; can be used also in the life-time calculations, see tutorial on electron-phonon coupling for tricks on the convergence of the double-grid.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;toyozawa2003&amp;quot; &amp;gt;Toyozawa, Yutaka, and Chris Oxlade, &#039;&#039;Optical processes in solids&#039;&#039;, [https://m.booksee.org/book/1121964?force_lang=en Cambridge University Press, (2003)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;lechifflart2023&#039;&amp;gt;P. Lechifflart, F. Paleari, D. Sangalli, C. Attaccalite, &#039;&#039;First-principles study of luminescence in hexagonal boron nitride single layer: Exciton-phonon coupling and the role of substrate&#039;&#039;, &lt;br /&gt;
[https://doi.org/10.1103/PhysRevMaterials.7.024006 Phys. Rev. M, &#039;&#039;&#039;7&#039;&#039;&#039; (2), 024006 (2023)]; [https://arxiv.org/abs/2212.10407 arXiv2212.1047]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cannuccia2019&#039;&amp;gt;E. Cannuccia, B. Monserrat and C. Attaccalite, &#039;&#039;Theory of phonon-assisted luminescence in solids: Application to hexagonal boron nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevB.99.081109 Phys. Rev. B &#039;&#039;&#039;99&#039;&#039;&#039;, 081109(R) (2019)]; [https://arxiv.org/abs/1807.11797 arXiv1807.11797]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019&#039;&amp;gt;F. Paleari et al., &#039;&#039;Exciton-Phonon Coupling in the Ultraviolet Absorption and Emission Spectra of Bulk Hexagonal Boron Nitride&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.122.187401 Phys. Rev. Lett. &#039;&#039;&#039;122&#039;&#039;&#039;, 187401 (2019)]; [https://arxiv.org/abs/1810.08976 arXiv1810.089776] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chen2020&#039;&amp;gt;&#039;&#039;Exciton-Phonon Interaction and Relaxation Times from First Principles&#039;&#039;,&lt;br /&gt;
Hsiao-Yi Chen, Davide Sangalli, and Marco Bernardi, [https://doi.org/10.1103/PhysRevLett.125.107401  Phys. Rev. Lett. &#039;&#039;&#039;125&#039;&#039;&#039;, 107401 (2020)]; [https://arxiv.org/abs/2002.08913 arXiv 2002.08913 (2020)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;lechifflart2023_PhD&amp;quot;&amp;gt;P. Lechifflart, &#039;&#039;Exciton-phonon coupling and phonon-assisted luminescence in hexagonal Boron Nitride nanostructures&#039;&#039;, [https://hal.science/tel-04266805v1 PhD Thesis, University of Marseille (2023)]; [https://www.yambo-code.eu/wiki/images/5/54/These_final.pdf From the yambo website]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2019_PhD&#039;&amp;gt;F. Paleari, &#039;&#039;First-principles approaches to the description of indirect absorption and luminescence spectroscopy: exciton-phonon coupling in hexagonal boron nitride&#039;&#039;, [https://wwwen.uni.lu/research/fstm/dphyms/people/fulvio_paleari PhD thesis, University of Luxembourg (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;zanfrognini2023&#039;&amp;gt;M. Zanfrognini et al., &#039;&#039;Distinguishing different stackings in layered materials via luminescence spectroscopy&#039;&#039;, [https://doi.org/10.1103/PhysRevLett.131.206902 Phys. Rev. Lett. &#039;&#039;&#039;131&#039;&#039;&#039;, 206902 (2023)]; [https://arxiv.org/abs/2305.17554 arXiv 2305.17554] &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;marini2024&#039;&amp;gt;G. Marini, M. Calandra, P. Cudazzo, &#039;&#039;Optical absorption and photoluminescence of single layer boron nitride from a first principles cumulant approach&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.4c00669 Nano Lett., &#039;&#039;&#039;24&#039;&#039;&#039;, 20, 6017 (2024)]; [https://arxiv.org/abs/2402.03826 arXiv 2402.03826 (2024)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;antonius2017&#039;&amp;gt;G. Antonius, S. G. Louie, &#039;&#039;Theory of exciton-phonon coupling&#039;&#039;, [https://doi.org/10.1103/PhysRevB.105.085111 Phys. Rev. B, &#039;&#039;&#039;105&#039;&#039;&#039;, 085111 (2022)]; [https://arxiv.org/abs/1705.04245 arXiv1705.04245 (2017)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;paleari2022&#039;&amp;gt; F. Paleari, and A. Marini, &#039;&#039;Exciton-phonon interaction calls for a revision of the “exciton” concept&#039;&#039;, [https://doi.org/10.1103/PhysRevB.106.125403 Phys. Rev. B, &#039;&#039;&#039;106&#039;&#039;&#039;, 125403 (2022)]; [https://arxiv.org/abs/2205.02783 arXiv 2205.02783]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;cudazzo2020&#039;&amp;gt; P. Cudazzo, &#039;&#039;First-principles description of the exciton-phonon interaction: A cumulant approach&#039;&#039;, [https://doi.org/10.1103/PhysRevB.102.045136 Phys. Rev. B, &#039;&#039;&#039;102&#039;&#039;&#039;, 045136 (2020)]; [https://orbilu.uni.lu/bitstream/10993/44769/1/main.pdf Open access pdf from Luxembourg University]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;chan2023&#039;&amp;gt;Y-h Chan, J. B. Haber, M. H. Naik, J. B. Neaton, D. Y. Qiu, F. H. da Jornada, S. G. Louie, &#039;&#039;Exciton Lifetime and Optical Line Width Profile via Exciton–Phonon Interactions: Theory and First-Principles Calculations for Monolayer MoS2&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.3c00732 Nano Lett., &#039;&#039;&#039;23&#039;&#039;&#039;, 9 (2023)]; [https://arxiv.org/abs/2212.08451 arXiv 2212.08451 (2023)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&#039;murali2025&#039;&amp;gt;M. Nalabothula, S. Reichardt, L. Wirtz, &#039;&#039;Origin of Interlayer Exciton–Phonon Coupling in 2D Heterostructures&#039;&#039;, [https://doi.org/10.1021/acs.nanolett.5c00355 Nano Lett., &#039;&#039;&#039;25&#039;&#039;&#039;, 15 (2025)], [https://arxiv.org/abs/2407.16111 arXiv 2407.16111 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Linear_response_in_velocity_gauge&amp;diff=1012</id>
		<title>Linear response in velocity gauge</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Linear_response_in_velocity_gauge&amp;diff=1012"/>
		<updated>2026-07-22T21:46:29Z</updated>

		<summary type="html">&lt;p&gt;Davide: References improved&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Lresp.png|thumb|200px]]&lt;br /&gt;
In this tutorial we show how to get the linear response using the velocity gauge instead of the Berry phase approach in length gauge. &amp;lt;br&amp;gt;&lt;br /&gt;
We use the same DFT input files of the tutorial [[Linear response using Dynamical Berry Phase]], run the same setup and remove the symmetries.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Real-time dynamics in velocity gauge==&lt;br /&gt;
Then in order to calculate the response in velocity gauge we use the command &amp;lt;code&amp;gt;yambo_nl -u p -V resp -F input_lr.in&amp;lt;/code&amp;gt; to generate the input:&lt;br /&gt;
&lt;br /&gt;
 nlinear                      # [R NL] Non-linear optics&lt;br /&gt;
 NL_Threads= 1                # [OPENMP/NL] Number of threads for nl-optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |   &amp;lt;/span&amp;gt;                # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLstep=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.0100  &amp;lt;/span&amp;gt;     fs    # [NL] Real Time step length&lt;br /&gt;
 NLtime=55.000000      fs     # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;amp;quot;INVINT&amp;amp;quot;       # [NL] Integrator (&amp;amp;quot;EULEREXP/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;amp;quot;IPA&amp;amp;quot;         # [NL] Correlation (&amp;amp;quot;IPA/HARTREE/TDDFT/LRC/JGM/SEX/HF&amp;amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000         # [NL] Long Range Correction&lt;br /&gt;
 NLDamping=  0.000000   eV    # [NL] Damping&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Gauge= &amp;quot;velocity&amp;quot;                &amp;lt;/span&amp;gt;  # [BSE/X] Gauge (length|velocity)&lt;br /&gt;
 Field1_Freq= 0.100000    eV    # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; &amp;quot;DELTA&amp;quot;   &amp;lt;/span&amp;gt;        # [RT Field1] Kind(SIN|COS|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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.000000 | 1.000000 | 0.000000 |&amp;lt;/span&amp;gt;        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= 0.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
&lt;br /&gt;
Notice that in velocity gauge the current is correct while the polarization is calculated using only intra-band dipoles, that anyway is enough for the linear response.&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results using YamboPy using polarization ==&lt;br /&gt;
&#039;&#039;&#039;This part works only with Yambo 5.3 or the last version available on Github:&#039;&#039;&#039; [https://github.com/yambo-code/yambo https://github.com/yambo-code/yambo]&amp;lt;br&amp;gt;&lt;br /&gt;
You can get the dielectric constant along the field direction using the same procedure of the Berry Phase case, Fourier transforming the polarization:&lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 from yambopy.plot  import * &lt;br /&gt;
 &lt;br /&gt;
 NLDB=YamboNLDB() &lt;br /&gt;
 &lt;br /&gt;
 pol =NLDB.Polarization[0]&lt;br /&gt;
 time=NLDB.IO_TIME_points&lt;br /&gt;
 t_initial=NLDB.Efield[0][&amp;quot;initial_time&amp;quot;]&lt;br /&gt;
 &lt;br /&gt;
 pol_damped=np.empty_like(pol)&lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
    pol_damped[i_d,:]=damp_it(pol[i_d,:],time,t_initial,damp_type=&#039;LORENTZIAN&#039;,damp_factor=0.1/ha2ev)&lt;br /&gt;
 &lt;br /&gt;
 Plot_Pol_or_Curr(time=time, pol=pol_damped, xlim=[0,55], save_file=&#039;polarization.pdf&#039;)&lt;br /&gt;
 &lt;br /&gt;
[[File:Polarization velocity.png|center|Polarization_velocity]]&lt;br /&gt;
&lt;br /&gt;
and then calculate the dielectric constant as in the length gauge&lt;br /&gt;
&lt;br /&gt;
 Linear_Response(time=time,pol=-pol_damped,efield=NLDB.Efield[0],plot=False,plot_file=&#039;eps.pdf&#039;)&lt;br /&gt;
&lt;br /&gt;
notice that in this case, only the linear response along the field is correct.&lt;br /&gt;
&lt;br /&gt;
[[File:Eps velocity.png|center|Eps_velocity]]&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results using YamboPy using current ==&lt;br /&gt;
&lt;br /&gt;
The same analysis can be performed using the current. &amp;lt;br&amp;gt;In this case we remove the constant term then we reconstruct the polarization&lt;br /&gt;
and then the epsilon. &lt;br /&gt;
&lt;br /&gt;
 import numpy as np&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 from yambopy.plot  import *&lt;br /&gt;
 from scipy.interpolate import CubicSpline&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 &lt;br /&gt;
 NLDB=YamboNLDB()&lt;br /&gt;
 &lt;br /&gt;
 current =NLDB.Current[0]&lt;br /&gt;
 time=NLDB.IO_TIME_points&lt;br /&gt;
 t_initial=NLDB.Efield[0][&amp;quot;initial_time&amp;quot;]&lt;br /&gt;
 #&lt;br /&gt;
 # Remove the constant term&lt;br /&gt;
 #&lt;br /&gt;
 ave_current=np.zeros(3,dtype=np.double)&lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
    ave_current[i_d]=np.sum(current[i_d,:])/current.shape[1]&lt;br /&gt;
    current[i_d,:]=current[i_d,:]-ave_current[i_d]   &lt;br /&gt;
 &lt;br /&gt;
 pol=np.empty_like(current)&lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
     spline_j=CubicSpline(time,current[i_d,:])&lt;br /&gt;
     for idx, t in enumerate(time):&lt;br /&gt;
         pol[i_d,idx]=spline_j.integrate(0.0,t) &lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # There is a wrong sign convention in the velocity gauge&lt;br /&gt;
 # somewhere in the code&lt;br /&gt;
 #&lt;br /&gt;
 pol=-pol&lt;br /&gt;
 &lt;br /&gt;
 Plot_Pol_or_Curr(time=time, pol=pol, xlim=[0,55], save_file=&#039;polarization.pdf&#039;)&lt;br /&gt;
 #&lt;br /&gt;
 pol_damped=np.empty_like(pol)&lt;br /&gt;
 for i_d in range(3):&lt;br /&gt;
    pol_damped[i_d,:]=damp_it(pol[i_d,:],time,t_initial,damp_type=&#039;LORENTZIAN&#039;,damp_factor=0.1/ha2ev)&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # Calculate the linear response&lt;br /&gt;
 #&lt;br /&gt;
 Linear_Response(time=time,pol=pol_damped,efield=NLDB.Efield[0],plot=False,plot_file=&#039;eps.pdf&#039; )&lt;br /&gt;
&lt;br /&gt;
and you the get the spectra:&lt;br /&gt;
&lt;br /&gt;
[[File:Eps vel.png|center|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
This procedure produce a small bump at &amp;lt;math&amp;gt;\omega=0&amp;lt;/math&amp;gt;  that is an artifact, different procedure has been discussed in the literature to remove it (see Refs. &amp;lt;ref name=&amp;quot;Zhang2017&amp;quot;/&amp;gt;, &amp;lt;ref name=&amp;quot;Sangalli2017&amp;quot;/&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== References==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Zhang2017&amp;quot;&amp;gt;Manipulation of the dielectric properties of diamond by an ultrashort laser pulse, X. Zhang, F. Wang, L. Jiang, and Y. Yao Phys. Rev. &#039;&#039;&#039;B&#039;&#039;&#039; 95, 184301 (2017)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2017&amp;quot;&amp;gt;Optical properties of periodic systems within the current-current response framework: Pitfalls and remedies,&lt;br /&gt;
D. Sangalli, J.A. Berger, C. Attaccalite, M. Grüning, P. Romaniello,&lt;br /&gt;
Phys. Rev. B &#039;&#039;&#039;95&#039;&#039;&#039;, 155203 (2017)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)&amp;diff=1011</id>
		<title>Real time approach to non-linear response (SHG)</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)&amp;diff=1011"/>
		<updated>2026-07-22T21:12:04Z</updated>

		<summary type="html">&lt;p&gt;Davide: removed useless footer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Second Harmonic Generation in AlAs ==&lt;br /&gt;
In this tutorial, we will calculate the second harmonic generation of bulk AlAs, the Lumen databases can be downloaded here: [https://media.yambo-code.eu/educational/tutorials/files/AlAs_DBs.tar.gz AlAs_DBs.tar.gz] (10 MB). The first steps of this tutorials are the same as the one on [http://www.yambo-code.eu/wiki/index.php?title=Prerequisites_for_Real_Time_propagation_with_Yambo Prerequisites for Real-Time propagation with Yambo] with the only difference that we will work on AlAs and we will consider an external field in the direction &amp;lt;code&amp;gt; 1.000000 | 1.000000 | 0.000000 |&amp;lt;/code&amp;gt;. The DFT input are available here: [https://media.yambo-code.eu/educational/tutorials/files/AlAs_abinit.tar.gz ABINIT] or [https://media.yambo-code.eu/educational/tutorials/files/AlAs_pwscf.tar.gz QuantumEspresso].&lt;br /&gt;
You can run the DFT calculation with ABINIT with the command:&lt;br /&gt;
&lt;br /&gt;
 abinit &amp;lt; AlAs.in &amp;gt; output_AlAs                                             &lt;br /&gt;
&lt;br /&gt;
or using QuantumEspresso:&lt;br /&gt;
&lt;br /&gt;
 pw.x -inp AlAs.scf.in &amp;gt; output_scf&lt;br /&gt;
 pw.x -inp AlAs.nscf.in &amp;gt; output_scf                            &lt;br /&gt;
&lt;br /&gt;
and then import the ABINIT wave-function with the command:&lt;br /&gt;
&lt;br /&gt;
 a2y -F AlAso_DS2_WFK.nc                            &lt;br /&gt;
&lt;br /&gt;
and the QuantumEspresso one, in the folder AlAs.save with the command:&lt;br /&gt;
&lt;br /&gt;
 p2y                              &lt;br /&gt;
Now we consider an external field in the &amp;lt;code&amp;gt;[1,1,0]&amp;lt;/code&amp;gt; direction and remove symmetries not compatible with this field, as explained in the tutorial [http://www.yambo-code.eu/wiki/index.php?title=Prerequisites_for_Real_Time_propagation_with_Yambo Prerequisites for Real-Time propagation with Yambo].&lt;br /&gt;
&lt;br /&gt;
==Real-time simulation for the SHG==&lt;br /&gt;
&lt;br /&gt;
You can generate the input file with the command &amp;lt;code&amp;gt;yambo_nl -u n&amp;lt;/code&amp;gt;:&lt;br /&gt;
                       &lt;br /&gt;
 nloptics                      # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 3 | 6&amp;lt;/span&amp;gt; |                   # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLstep=   0.0100       fs    # [NL] Real Time step length&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLverbosity= &amp;quot;high&amp;quot;&amp;lt;/span&amp;gt;               # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;INVINT&amp;quot;       # [NL] Integrator (&amp;quot;EULEREXP/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&amp;quot;         # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/JGM/SEX/HF&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000         # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  1.000000 | 5.000000 &amp;lt;/span&amp;gt;| eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 10 &amp;lt;/span&amp;gt;              # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.150000  &amp;lt;/span&amp;gt;  eV    # [NL] Damping&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 1.000000 | 0.000000 &amp;lt;/span&amp;gt;|        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_kind= &amp;quot;SOFTSIN&amp;quot;         # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
The line &amp;lt;code&amp;gt;|1.000000 | 1.000000 | 0.000000 | # [RT Field1] Versor&amp;lt;/code&amp;gt; referees to the direction of the external field (x,y,0). &amp;lt;br&amp;gt;&lt;br /&gt;
The default parameters of Lumen are already tuned for second-harmonic generation, so the only thing you have to change is the band range, between 3 and 6 and the energy range between 1.0-5.0 eV and the number of energy steps in this interval that we set to 10.&amp;lt;br&amp;gt; Notice that you cannot set to zero the lowest value of the energy range because this will requires a simulation that lasts infinite time, see below. Finally, consider that Yambo performs a separate calculation for each frequency, so if you set many energy steps the computational time grows linearly with this number.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that we set &amp;lt;code&amp;gt;NLverbosity= &amp;quot;high&amp;quot;&amp;lt;/code&amp;gt; in this way the code will produce a file for each laser frequency containing the time dependent polarization.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;. Calculations will take about fifteen minutes on a single processor PC, you have time to study the next section that explains how non-linear response is extracted from the real-time simulations.&lt;br /&gt;
In order to speed up calculations, you can run them in parallel.&lt;br /&gt;
&lt;br /&gt;
==Non-linear response with Yambo==&lt;br /&gt;
&lt;br /&gt;
In order to calculate the non-linear response, the system is excited with different laser fields with a sinusoidal shape at frequencies &amp;lt;math&amp;gt;\omega_1, \omega_2, .... , \omega_n &amp;lt;/math&amp;gt; determined by the parameters [[Variables#NLEnRangev|NLEnRange]] and [[Variables#NLEnSteps|NLEnSteps]]. A dephasing term is added to the Hamiltonian &amp;lt;math&amp;gt;\gamma = &amp;lt;/math&amp;gt;[[Variables#NLDamping|NLDamping]] to simulate a finite broadening and to remove the eigenmodes that are excited by the sudden turning on of the external field. After the dephasing time the outgoing signal is analyzed to extract the non-linear coefficients as shown in the figure below: &lt;br /&gt;
&lt;br /&gt;
[[File:Pt analysis.png|600px|center|Non-linear response analysis]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the report file &amp;lt;code&amp;gt;r_nlinear&amp;lt;/code&amp;gt; you will find the length of the dephasing part and of the sampling one:&lt;br /&gt;
&lt;br /&gt;
  Dephasing Time          [fs]: 52.65695&lt;br /&gt;
  Sampling  Time          [fs]:  4.18566&lt;br /&gt;
  Total simulation time   [fs]: 56.84262                     &lt;br /&gt;
The length of the dephasing interval is inversely proportional to the damping term &amp;lt;math&amp;gt;T_{depth} \simeq 1/\gamma&amp;lt;/math&amp;gt; while the length of the sampling is dictated by the smallest frequency we are interested in: &amp;lt;math&amp;gt;T_{samp} \simeq 1/\omega_1 &amp;lt;/math&amp;gt;. For this reason if &amp;lt;math&amp;gt; \omega_1=0 &amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; \gamma = 0 &amp;lt;/math&amp;gt; simulation time goes to infinity. The response at zero frequency can be calculated as limit of small frequency perturbation.&lt;br /&gt;
You can have a look to the file &amp;lt;code&amp;gt;src/nloptics/NL_initialize.F&amp;lt;/code&amp;gt; to see how simulation lengths are defined.&lt;br /&gt;
Calculations can take some time, run them in parallel, the best number of processors = number of frequencies or reduce the number of frequencies step in the SHG.&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results==&lt;br /&gt;
&lt;br /&gt;
In the sampling region we suppose that the polarization can be written as: &amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{p}_n e^{-i\omega_n t} &amp;lt;/math&amp;gt; where the coefficient &amp;lt;math&amp;gt;\bf{p}_1,...,\bf{p}_n &amp;lt;/math&amp;gt; are related to &amp;lt;math&amp;gt;\chi^{(1)},...,\chi^{(n)} &amp;lt;/math&amp;gt;. We sample the polarization signal at different times and invert the previous equation by truncating the sum at a finite order &amp;lt;ref&amp;gt;[https://arxiv.org/abs/1309.4012 Nonlinear optics from an ab initio approach by means of the dynamical Berry phase: Application to second- and third-harmonic generation in semiconductors], C. Attaccalite and M. Grüning, Phys. Rev. B 88, 235113(2013)&amp;lt;/ref&amp;gt;.&lt;br /&gt;
This is done with the command &amp;lt;code&amp;gt;ypp_nl -u&amp;lt;/code&amp;gt; that automatically produce an input with the correct values:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder=   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4  &amp;lt;/span&amp;gt;                 # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  52.65695 | -1.00000 | fs    # Time-window where processing is done&lt;br /&gt;
 % &lt;br /&gt;
 ETStpsRt= 200                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 10.00000 | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;             # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor=  0.10000   eV    # Damping parameter&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; is the order where the previous sum is truncated, and the TimeRange specifies the sampling region. Notice that differently from the first tutorial, in this case, we do not need Damping in &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; because we already included it in the real-time dynamics. Run &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; and it will produce a file called &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;. This file contains the different components of &amp;lt;math&amp;gt;\chi^2_{xy*} &amp;lt;/math&amp;gt; and in particular the columns 6 and 7 correspond to the imaginary and real part of &amp;lt;math&amp;gt;\chi^2_{xyz} &amp;lt;/math&amp;gt;. You can plot the result with gnuplot and the command:&lt;br /&gt;
&lt;br /&gt;
 p &#039;o.YPP-X_probe_order_2&#039; u 1:(sqrt($6**2+$7**2)) w lp ps 1.5 pt 7 lw 1.5&lt;br /&gt;
&lt;br /&gt;
the result should look like&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:AlAs results.png|700px|center|SHG in AlAs]]&lt;br /&gt;
&lt;br /&gt;
and compare it with the &amp;lt;math&amp;gt; \chi^2_{zxy} &amp;lt;/math&amp;gt; calculated with more frequencies and with the converged result on a &amp;lt;math&amp;gt; 18x18x18&amp;lt;/math&amp;gt; k-point grid and bands between 2 and 10. In the figure you can find also the comparison with the results of Ref. &amp;lt;ref&amp;gt;Luppi et al. [https://arxiv.org/abs/1006.2649 PRB B, &#039;&#039;&#039;82&#039;&#039;&#039;, 235201(2010)]&amp;lt;/ref&amp;gt;. &lt;br /&gt;
Notice that the QuantumEspresso results are slightly different from the Abinit ones. This is due to the different pseudo-potential employed in the calculations if pseudopotentials were the same calculation would have been identical. You can download the script to generate this plot and the converged results [http://www.attaccalite.com/lumen/tutorials/AlAs/AlAs_results.tgz here].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notice that&#039;&#039;&#039; : the following parameters are not used in the non-linear response analysis: &amp;lt;code&amp;gt; EnRngeRt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ETStpsRt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DampMode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DampFactor&amp;lt;/code&amp;gt;. The damping factor is set directly in the real-time simulation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;System of units in Non-linear Optics&amp;lt;/span&amp;gt;&#039;&#039;&#039;: notice that in Yambo the non-linear response functions are in the gaussian system of units, for example the &amp;lt;math&amp;gt; \chi^2 (\omega) &amp;lt;/math&amp;gt;  is in cm/statvolt. In order to convert the non-linear coefficients between different system of units, you can have a look at the [https://www.attaccalite.com/tutorials_yambo/Appendix_C_Boyd.pdf Appendix C] of the book [https://www.elsevier.com/books/nonlinear-optics/boyd/978-0-12-369470-6 &amp;quot;Non-linear optics&amp;quot;  by Robert W. Boyd].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;More tutorials&amp;lt;/span&amp;gt; on non-linear response (Third harmonic generation, parallelization, spin-orbit etc..) with Yambo can be found here: [http://www.attaccalite.com/lumen/tutorials.html More Tutorials]. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results using YamboPy==&lt;br /&gt;
The analysis of the result performed in the previous section using &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; can be performed using python script [https://github.com/yambo-code/yambopy YamboPy].&amp;lt;br&amp;gt;&lt;br /&gt;
In YamboPy we implemented all necessary functions to reads the Yambo databases and post-process the results. Here we show how to get the SHG signal from the previous &lt;br /&gt;
simulations. We suppose you correctly installed &amp;lt;code&amp;gt;YamboPy&amp;lt;/code&amp;gt; on your PC. Go in the folder where you ran non-linear calculation and type in the python:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 NLDB=YamboNLDB()&lt;br /&gt;
 pol =NLDB.Polarization[0]&lt;br /&gt;
 time=NLDB.IO_TIME_points&lt;br /&gt;
&lt;br /&gt;
in this way you read all the Non-linear databases. If your runs are in a different folder then the &#039;SAVE&#039; one you can specify it using the command:&lt;br /&gt;
 NLDB=YamboNLDB(calc=&#039;MYJOB&#039;)&lt;br /&gt;
&lt;br /&gt;
now in the array &amp;lt;code&amp;gt;pol&amp;lt;/code&amp;gt; you have all the polarization for all laser frequencies in the three Cartesian directions, while the variable &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt; contains all the time series of your simulation.&lt;br /&gt;
Now you can get the non-linear response with the command:&lt;br /&gt;
&lt;br /&gt;
 SIN = Xn_from_sine(NLDB,X_order=5)&lt;br /&gt;
 print(SIN)&lt;br /&gt;
 OUT = SIN.perform_analysis()&lt;br /&gt;
 SIN.output_analysis(OUT)&lt;br /&gt;
&lt;br /&gt;
this command will perform a Fourier analysis of the results in the same way of &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; and generate new files with all the requested harmonics &#039;&#039;o.YamboPy-X_probe_order_1&#039;&#039;, &#039;&#039;o.YamboPy-X_probe_order_2&#039;&#039; etc...&lt;br /&gt;
equivalent to the one generated by &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt;. Results can be plot with gnuplot using the command:&lt;br /&gt;
 &lt;br /&gt;
 p &#039;o.YamboPy-X_probe_order_2&#039; u 1:(sqrt($6**2+$7**2)) w lp ps 1.5 pt 7 lw 1.5&lt;br /&gt;
&lt;br /&gt;
The script that performs non-linear analysis can be found in &amp;lt;code&amp;gt;yambopy/nl/harmonic_analysis.py&amp;lt;/code&amp;gt;. &amp;lt;br&amp;gt; We strongly advice you to have a look to this script and modify it according&lt;br /&gt;
to your needs and in order to extract other non-linear response functions.&lt;br /&gt;
&lt;br /&gt;
==How to choose the external field direction for the different X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
In the X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;abc&amp;lt;/sub&amp;gt; response you have three field directions. The two components &#039;&#039;b&#039;&#039; and &#039;&#039;c&#039;&#039; are determined by the external field and the third &#039;&#039;a&#039;&#039;&lt;br /&gt;
is the direction where you measure the response.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The external field in Yambo is set using the variable&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
   1.000000 | 0.000000 | 0.000000 |        # [NL ExtF] Versor .&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
For example if you set in Yambo field direction as:&lt;br /&gt;
&lt;br /&gt;
 1.0 | 0.0 | 0.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*xx&amp;lt;/sub&amp;gt;&lt;br /&gt;
 0.0 | 1.0 | 0.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*yy&amp;lt;/sub&amp;gt;&lt;br /&gt;
 0.0 | 0.0 | 1.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*zz&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the * correspond to the different direction in the response file &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;.&lt;br /&gt;
In the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt; you have seven columns:&lt;br /&gt;
&lt;br /&gt;
 The first column is the energy [[omega]],&lt;br /&gt;
 the 2nd and 3rd columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;x**&amp;lt;/sub&amp;gt;&lt;br /&gt;
 the 4th and 5th columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;y**&amp;lt;/sub&amp;gt;&lt;br /&gt;
 the 6th and 7th columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;z**&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the ** are the direction of the incoming field, see above.&lt;br /&gt;
&lt;br /&gt;
For example if you want to calculate the &amp;lt;math&amp;gt;\chi^{(2)}_{zxx}&amp;lt;/math&amp;gt; you put the external field in the direction &amp;lt;code&amp;gt; 1.0 | 0.0 | 0.0 |&amp;lt;/code&amp;gt;&lt;br /&gt;
and then plot the column 6 and 7 of the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to get the other components of the  X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; the calculation are more involved. For example if you put field in the&lt;br /&gt;
&lt;br /&gt;
 1.0 | 1.0 | 0.0 | &lt;br /&gt;
&lt;br /&gt;
this corresponds to &amp;lt;math&amp;gt;E(t)=\frac{1}{\sqrt{2}} [ E_x(t) + E_y(t) ]&amp;lt;/math&amp;gt; and so at the second order you will have &amp;lt;math&amp;gt;E^2(t)=\frac{1}{2} \left [ E^2_x(t) + E^2_y(t) +  E_x(t) E_y(t) +  E_y(t) E_x(t) \right]&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
this means that  the X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; in the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;  will correspond to a linear combination of the following different response functions.&amp;lt;br&amp;gt;&lt;br /&gt;
For example in the the 2nd and 3rd columns are the imaginary and real part of:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{x**}=\frac{1}{2} \left [\chi^2_{xxx}+\chi^{(2)}_{xyy} + \chi^{(2)}_{xxy} + \chi^{(2)}_{xyx} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the same for the other column replacing the first &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;y,z&amp;lt;/code&amp;gt;.&lt;br /&gt;
If you know that some components are zero this allow you to extract the corresponding off-diagonal part of &amp;lt;math&amp;gt;\chi^{(2)}_{abc}&amp;lt;/math&amp;gt; otherwise you have to perform different calculations to get the component you are interested in. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now we present &#039;&#039;&#039;a simple example of monolayer hBN (m-hBN)&#039;&#039;&#039;. &amp;lt;br&amp;gt; In m-hBN there is only a non-zero component of the &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt;and all the others are related by symmetry:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{yyy}=-\chi^{(2)}_{yxx}=-\chi^{(2)}_{xxy}=-\chi^{(2)}_{xyx}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
so if you put the field in the &amp;lt;code&amp;gt;|1|1|0|&amp;lt;/code&amp;gt; direction you will get:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{x**} = \frac{1}{2} \left[\chi^{(2)}_{xxy} + \chi^{(2)}_{xyx} \right] = - \chi^{(2)}_{yyy} &amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{y**} =\frac{1}{2} \left[ \chi^{(2)}_{yyy} + \chi^{(2)}_{yxx}  \right] = 0.0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In the figure below you can see the different &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; of monolayer hBN. &lt;br /&gt;
&lt;br /&gt;
[[File:Xhi2 xy.png|center| 800px|xhi2_xy]]&lt;br /&gt;
&lt;br /&gt;
as you can see in the second panel, when the field is in the &amp;lt;code&amp;gt;xy&amp;lt;/code&amp;gt; you get a linear combination of  &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; corresponding to the equation above, in this case the &amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; is zero while the &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; component is equal to &amp;lt;math&amp;gt;-\chi^{(2)}_{yyy}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene:&#039;&#039;&#039; if you change the direction of the external field you must to remove the corresponding symmetries as explained in the tutorial [[Prerequisites for Real Time_propagation with Yambo#Reduce symmetries real-time linear response tutorial]]. If you have to calculate &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; along many directions it can be convenient to remove all symmetries at once.&lt;br /&gt;
&lt;br /&gt;
==Non-linear response of low-dimensional structures: 2D or 1D ==&lt;br /&gt;
&lt;br /&gt;
The Yambo code is a 3D periodic code, so when you want to study a low-dimensional system 2D or 1D, you have to use a supercell approach.&lt;br /&gt;
For example to simulate the non-linear response in a 2D-crystal one, can put the crystal in the xy plane and choose a larger distance in the z-direction&lt;br /&gt;
in order to reduce the interaction between the periodic replica. Clearly in this case k-point sampling will be only in the x,y directions.&lt;br /&gt;
For calculations on this type of systems, these two warnings must be taken into account:&lt;br /&gt;
&lt;br /&gt;
* if you calculate GW corrections or include electron-hole interaction in the linear/non-linear response it is a good idea to use a &#039;&#039;&#039;Coulomb cutoff&#039;&#039;&#039;, similar to the 2D BSE case  [http://www.yambo-code.org/wiki/index.php?title=How_to_treat_low_dimensional_systems How to treat low dimensional systems]. You can add the cutoff just adding the &amp;quot;-r&amp;quot; in the input generation.&lt;br /&gt;
&lt;br /&gt;
* the calculation of SHG and THG are always performed respect to the supercell, therefore you have to &#039;&#039;&#039;re-scale&#039;&#039;&#039; the result to the effective thickness of the layer, usually the inter-layer distance of the corresponding bulk material for 2D systems: &amp;lt;math&amp;gt;\chi_{rescaled}(\omega) = L_z/d_{eff} \cdot \chi(\omega) &amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;L_z&amp;lt;/math&amp;gt; is the z-dimension of the supercell, and &amp;lt;math&amp;gt;d_{eff}&amp;lt;/math&amp;gt; is the effective thickness of the 2D system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene&#039;&#039;&#039;: Non-linear response along &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;non-periodic directions&amp;lt;/span&amp;gt; is not implemented in Yambo, the code will print zero in these directions for all response functions. We plan to implement it in a future version of the code.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)&amp;diff=1010</id>
		<title>Real time approach to non-linear response (SHG)</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)&amp;diff=1010"/>
		<updated>2026-07-20T19:52:53Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Real-time simulation for the SHG */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Second Harmonic Generation in AlAs ==&lt;br /&gt;
In this tutorial, we will calculate the second harmonic generation of bulk AlAs, the Lumen databases can be downloaded here: [https://media.yambo-code.eu/educational/tutorials/files/AlAs_DBs.tar.gz AlAs_DBs.tar.gz] (10 MB). The first steps of this tutorials are the same as the one on [http://www.yambo-code.eu/wiki/index.php?title=Prerequisites_for_Real_Time_propagation_with_Yambo Prerequisites for Real-Time propagation with Yambo] with the only difference that we will work on AlAs and we will consider an external field in the direction &amp;lt;code&amp;gt; 1.000000 | 1.000000 | 0.000000 |&amp;lt;/code&amp;gt;. The DFT input are available here: [https://media.yambo-code.eu/educational/tutorials/files/AlAs_abinit.tar.gz ABINIT] or [https://media.yambo-code.eu/educational/tutorials/files/AlAs_pwscf.tar.gz QuantumEspresso].&lt;br /&gt;
You can run the DFT calculation with ABINIT with the command:&lt;br /&gt;
&lt;br /&gt;
 abinit &amp;lt; AlAs.in &amp;gt; output_AlAs                                             &lt;br /&gt;
&lt;br /&gt;
or using QuantumEspresso:&lt;br /&gt;
&lt;br /&gt;
 pw.x -inp AlAs.scf.in &amp;gt; output_scf&lt;br /&gt;
 pw.x -inp AlAs.nscf.in &amp;gt; output_scf                            &lt;br /&gt;
&lt;br /&gt;
and then import the ABINIT wave-function with the command:&lt;br /&gt;
&lt;br /&gt;
 a2y -F AlAso_DS2_WFK.nc                            &lt;br /&gt;
&lt;br /&gt;
and the QuantumEspresso one, in the folder AlAs.save with the command:&lt;br /&gt;
&lt;br /&gt;
 p2y                              &lt;br /&gt;
Now we consider an external field in the &amp;lt;code&amp;gt;[1,1,0]&amp;lt;/code&amp;gt; direction and remove symmetries not compatible with this field, as explained in the tutorial [http://www.yambo-code.eu/wiki/index.php?title=Prerequisites_for_Real_Time_propagation_with_Yambo Prerequisites for Real-Time propagation with Yambo].&lt;br /&gt;
&lt;br /&gt;
==Real-time simulation for the SHG==&lt;br /&gt;
&lt;br /&gt;
You can generate the input file with the command &amp;lt;code&amp;gt;yambo_nl -u n&amp;lt;/code&amp;gt;:&lt;br /&gt;
                       &lt;br /&gt;
 nloptics                      # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 3 | 6&amp;lt;/span&amp;gt; |                   # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLstep=   0.0100       fs    # [NL] Real Time step length&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLverbosity= &amp;quot;high&amp;quot;&amp;lt;/span&amp;gt;               # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;INVINT&amp;quot;       # [NL] Integrator (&amp;quot;EULEREXP/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&amp;quot;         # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/JGM/SEX/HF&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000         # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  1.000000 | 5.000000 &amp;lt;/span&amp;gt;| eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 10 &amp;lt;/span&amp;gt;              # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.150000  &amp;lt;/span&amp;gt;  eV    # [NL] Damping&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 1.000000 | 0.000000 &amp;lt;/span&amp;gt;|        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_kind= &amp;quot;SOFTSIN&amp;quot;         # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
The line &amp;lt;code&amp;gt;|1.000000 | 1.000000 | 0.000000 | # [RT Field1] Versor&amp;lt;/code&amp;gt; referees to the direction of the external field (x,y,0). &amp;lt;br&amp;gt;&lt;br /&gt;
The default parameters of Lumen are already tuned for second-harmonic generation, so the only thing you have to change is the band range, between 3 and 6 and the energy range between 1.0-5.0 eV and the number of energy steps in this interval that we set to 10.&amp;lt;br&amp;gt; Notice that you cannot set to zero the lowest value of the energy range because this will requires a simulation that lasts infinite time, see below. Finally, consider that Yambo performs a separate calculation for each frequency, so if you set many energy steps the computational time grows linearly with this number.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that we set &amp;lt;code&amp;gt;NLverbosity= &amp;quot;high&amp;quot;&amp;lt;/code&amp;gt; in this way the code will produce a file for each laser frequency containing the time dependent polarization.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;. Calculations will take about fifteen minutes on a single processor PC, you have time to study the next section that explains how non-linear response is extracted from the real-time simulations.&lt;br /&gt;
In order to speed up calculations, you can run them in parallel.&lt;br /&gt;
&lt;br /&gt;
==Non-linear response with Yambo==&lt;br /&gt;
&lt;br /&gt;
In order to calculate the non-linear response, the system is excited with different laser fields with a sinusoidal shape at frequencies &amp;lt;math&amp;gt;\omega_1, \omega_2, .... , \omega_n &amp;lt;/math&amp;gt; determined by the parameters [[Variables#NLEnRangev|NLEnRange]] and [[Variables#NLEnSteps|NLEnSteps]]. A dephasing term is added to the Hamiltonian &amp;lt;math&amp;gt;\gamma = &amp;lt;/math&amp;gt;[[Variables#NLDamping|NLDamping]] to simulate a finite broadening and to remove the eigenmodes that are excited by the sudden turning on of the external field. After the dephasing time the outgoing signal is analyzed to extract the non-linear coefficients as shown in the figure below: &lt;br /&gt;
&lt;br /&gt;
[[File:Pt analysis.png|600px|center|Non-linear response analysis]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the report file &amp;lt;code&amp;gt;r_nlinear&amp;lt;/code&amp;gt; you will find the length of the dephasing part and of the sampling one:&lt;br /&gt;
&lt;br /&gt;
  Dephasing Time          [fs]: 52.65695&lt;br /&gt;
  Sampling  Time          [fs]:  4.18566&lt;br /&gt;
  Total simulation time   [fs]: 56.84262                     &lt;br /&gt;
The length of the dephasing interval is inversely proportional to the damping term &amp;lt;math&amp;gt;T_{depth} \simeq 1/\gamma&amp;lt;/math&amp;gt; while the length of the sampling is dictated by the smallest frequency we are interested in: &amp;lt;math&amp;gt;T_{samp} \simeq 1/\omega_1 &amp;lt;/math&amp;gt;. For this reason if &amp;lt;math&amp;gt; \omega_1=0 &amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; \gamma = 0 &amp;lt;/math&amp;gt; simulation time goes to infinity. The response at zero frequency can be calculated as limit of small frequency perturbation.&lt;br /&gt;
You can have a look to the file &amp;lt;code&amp;gt;src/nloptics/NL_initialize.F&amp;lt;/code&amp;gt; to see how simulation lengths are defined.&lt;br /&gt;
Calculations can take some time, run them in parallel, the best number of processors = number of frequencies or reduce the number of frequencies step in the SHG.&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results==&lt;br /&gt;
&lt;br /&gt;
In the sampling region we suppose that the polarization can be written as: &amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{p}_n e^{-i\omega_n t} &amp;lt;/math&amp;gt; where the coefficient &amp;lt;math&amp;gt;\bf{p}_1,...,\bf{p}_n &amp;lt;/math&amp;gt; are related to &amp;lt;math&amp;gt;\chi^{(1)},...,\chi^{(n)} &amp;lt;/math&amp;gt;. We sample the polarization signal at different times and invert the previous equation by truncating the sum at a finite order &amp;lt;ref&amp;gt;[https://arxiv.org/abs/1309.4012 Nonlinear optics from an ab initio approach by means of the dynamical Berry phase: Application to second- and third-harmonic generation in semiconductors], C. Attaccalite and M. Grüning, Phys. Rev. B 88, 235113(2013)&amp;lt;/ref&amp;gt;.&lt;br /&gt;
This is done with the command &amp;lt;code&amp;gt;ypp_nl -u&amp;lt;/code&amp;gt; that automatically produce an input with the correct values:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder=   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4  &amp;lt;/span&amp;gt;                 # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  52.65695 | -1.00000 | fs    # Time-window where processing is done&lt;br /&gt;
 % &lt;br /&gt;
 ETStpsRt= 200                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 10.00000 | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;             # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor=  0.10000   eV    # Damping parameter&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; is the order where the previous sum is truncated, and the TimeRange specifies the sampling region. Notice that differently from the first tutorial, in this case, we do not need Damping in &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; because we already included it in the real-time dynamics. Run &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; and it will produce a file called &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;. This file contains the different components of &amp;lt;math&amp;gt;\chi^2_{xy*} &amp;lt;/math&amp;gt; and in particular the columns 6 and 7 correspond to the imaginary and real part of &amp;lt;math&amp;gt;\chi^2_{xyz} &amp;lt;/math&amp;gt;. You can plot the result with gnuplot and the command:&lt;br /&gt;
&lt;br /&gt;
 p &#039;o.YPP-X_probe_order_2&#039; u 1:(sqrt($6**2+$7**2)) w lp ps 1.5 pt 7 lw 1.5&lt;br /&gt;
&lt;br /&gt;
the result should look like&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:AlAs results.png|700px|center|SHG in AlAs]]&lt;br /&gt;
&lt;br /&gt;
and compare it with the &amp;lt;math&amp;gt; \chi^2_{zxy} &amp;lt;/math&amp;gt; calculated with more frequencies and with the converged result on a &amp;lt;math&amp;gt; 18x18x18&amp;lt;/math&amp;gt; k-point grid and bands between 2 and 10. In the figure you can find also the comparison with the results of Ref. &amp;lt;ref&amp;gt;Luppi et al. [https://arxiv.org/abs/1006.2649 PRB B, &#039;&#039;&#039;82&#039;&#039;&#039;, 235201(2010)]&amp;lt;/ref&amp;gt;. &lt;br /&gt;
Notice that the QuantumEspresso results are slightly different from the Abinit ones. This is due to the different pseudo-potential employed in the calculations if pseudopotentials were the same calculation would have been identical. You can download the script to generate this plot and the converged results [http://www.attaccalite.com/lumen/tutorials/AlAs/AlAs_results.tgz here].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notice that&#039;&#039;&#039; : the following parameters are not used in the non-linear response analysis: &amp;lt;code&amp;gt; EnRngeRt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ETStpsRt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DampMode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DampFactor&amp;lt;/code&amp;gt;. The damping factor is set directly in the real-time simulation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;System of units in Non-linear Optics&amp;lt;/span&amp;gt;&#039;&#039;&#039;: notice that in Yambo the non-linear response functions are in the gaussian system of units, for example the &amp;lt;math&amp;gt; \chi^2 (\omega) &amp;lt;/math&amp;gt;  is in cm/statvolt. In order to convert the non-linear coefficients between different system of units, you can have a look at the [https://www.attaccalite.com/tutorials_yambo/Appendix_C_Boyd.pdf Appendix C] of the book [https://www.elsevier.com/books/nonlinear-optics/boyd/978-0-12-369470-6 &amp;quot;Non-linear optics&amp;quot;  by Robert W. Boyd].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;More tutorials&amp;lt;/span&amp;gt; on non-linear response (Third harmonic generation, parallelization, spin-orbit etc..) with Yambo can be found here: [http://www.attaccalite.com/lumen/tutorials.html More Tutorials]. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results using YamboPy==&lt;br /&gt;
The analysis of the result performed in the previous section using &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; can be performed using python script [https://github.com/yambo-code/yambopy YamboPy].&amp;lt;br&amp;gt;&lt;br /&gt;
In YamboPy we implemented all necessary functions to reads the Yambo databases and post-process the results. Here we show how to get the SHG signal from the previous &lt;br /&gt;
simulations. We suppose you correctly installed &amp;lt;code&amp;gt;YamboPy&amp;lt;/code&amp;gt; on your PC. Go in the folder where you ran non-linear calculation and type in the python:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 NLDB=YamboNLDB()&lt;br /&gt;
 pol =NLDB.Polarization[0]&lt;br /&gt;
 time=NLDB.IO_TIME_points&lt;br /&gt;
&lt;br /&gt;
in this way you read all the Non-linear databases. If your runs are in a different folder then the &#039;SAVE&#039; one you can specify it using the command:&lt;br /&gt;
 NLDB=YamboNLDB(calc=&#039;MYJOB&#039;)&lt;br /&gt;
&lt;br /&gt;
now in the array &amp;lt;code&amp;gt;pol&amp;lt;/code&amp;gt; you have all the polarization for all laser frequencies in the three Cartesian directions, while the variable &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt; contains all the time series of your simulation.&lt;br /&gt;
Now you can get the non-linear response with the command:&lt;br /&gt;
&lt;br /&gt;
 SIN = Xn_from_sine(NLDB,X_order=5)&lt;br /&gt;
 print(SIN)&lt;br /&gt;
 OUT = SIN.perform_analysis()&lt;br /&gt;
 SIN.output_analysis(OUT)&lt;br /&gt;
&lt;br /&gt;
this command will perform a Fourier analysis of the results in the same way of &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; and generate new files with all the requested harmonics &#039;&#039;o.YamboPy-X_probe_order_1&#039;&#039;, &#039;&#039;o.YamboPy-X_probe_order_2&#039;&#039; etc...&lt;br /&gt;
equivalent to the one generated by &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt;. Results can be plot with gnuplot using the command:&lt;br /&gt;
 &lt;br /&gt;
 p &#039;o.YamboPy-X_probe_order_2&#039; u 1:(sqrt($6**2+$7**2)) w lp ps 1.5 pt 7 lw 1.5&lt;br /&gt;
&lt;br /&gt;
The script that performs non-linear analysis can be found in &amp;lt;code&amp;gt;yambopy/nl/harmonic_analysis.py&amp;lt;/code&amp;gt;. &amp;lt;br&amp;gt; We strongly advice you to have a look to this script and modify it according&lt;br /&gt;
to your needs and in order to extract other non-linear response functions.&lt;br /&gt;
&lt;br /&gt;
==How to choose the external field direction for the different X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
In the X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;abc&amp;lt;/sub&amp;gt; response you have three field directions. The two components &#039;&#039;b&#039;&#039; and &#039;&#039;c&#039;&#039; are determined by the external field and the third &#039;&#039;a&#039;&#039;&lt;br /&gt;
is the direction where you measure the response.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The external field in Yambo is set using the variable&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
   1.000000 | 0.000000 | 0.000000 |        # [NL ExtF] Versor .&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
For example if you set in Yambo field direction as:&lt;br /&gt;
&lt;br /&gt;
 1.0 | 0.0 | 0.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*xx&amp;lt;/sub&amp;gt;&lt;br /&gt;
 0.0 | 1.0 | 0.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*yy&amp;lt;/sub&amp;gt;&lt;br /&gt;
 0.0 | 0.0 | 1.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*zz&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the * correspond to the different direction in the response file &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;.&lt;br /&gt;
In the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt; you have seven columns:&lt;br /&gt;
&lt;br /&gt;
 The first column is the energy [[omega]],&lt;br /&gt;
 the 2nd and 3rd columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;x**&amp;lt;/sub&amp;gt;&lt;br /&gt;
 the 4th and 5th columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;y**&amp;lt;/sub&amp;gt;&lt;br /&gt;
 the 6th and 7th columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;z**&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the ** are the direction of the incoming field, see above.&lt;br /&gt;
&lt;br /&gt;
For example if you want to calculate the &amp;lt;math&amp;gt;\chi^{(2)}_{zxx}&amp;lt;/math&amp;gt; you put the external field in the direction &amp;lt;code&amp;gt; 1.0 | 0.0 | 0.0 |&amp;lt;/code&amp;gt;&lt;br /&gt;
and then plot the column 6 and 7 of the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to get the other components of the  X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; the calculation are more involved. For example if you put field in the&lt;br /&gt;
&lt;br /&gt;
 1.0 | 1.0 | 0.0 | &lt;br /&gt;
&lt;br /&gt;
this corresponds to &amp;lt;math&amp;gt;E(t)=\frac{1}{\sqrt{2}} [ E_x(t) + E_y(t) ]&amp;lt;/math&amp;gt; and so at the second order you will have &amp;lt;math&amp;gt;E^2(t)=\frac{1}{2} \left [ E^2_x(t) + E^2_y(t) +  E_x(t) E_y(t) +  E_y(t) E_x(t) \right]&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
this means that  the X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; in the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;  will correspond to a linear combination of the following different response functions.&amp;lt;br&amp;gt;&lt;br /&gt;
For example in the the 2nd and 3rd columns are the imaginary and real part of:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{x**}=\frac{1}{2} \left [\chi^2_{xxx}+\chi^{(2)}_{xyy} + \chi^{(2)}_{xxy} + \chi^{(2)}_{xyx} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the same for the other column replacing the first &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;y,z&amp;lt;/code&amp;gt;.&lt;br /&gt;
If you know that some components are zero this allow you to extract the corresponding off-diagonal part of &amp;lt;math&amp;gt;\chi^{(2)}_{abc}&amp;lt;/math&amp;gt; otherwise you have to perform different calculations to get the component you are interested in. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now we present &#039;&#039;&#039;a simple example of monolayer hBN (m-hBN)&#039;&#039;&#039;. &amp;lt;br&amp;gt; In m-hBN there is only a non-zero component of the &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt;and all the others are related by symmetry:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{yyy}=-\chi^{(2)}_{yxx}=-\chi^{(2)}_{xxy}=-\chi^{(2)}_{xyx}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
so if you put the field in the &amp;lt;code&amp;gt;|1|1|0|&amp;lt;/code&amp;gt; direction you will get:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{x**} = \frac{1}{2} \left[\chi^{(2)}_{xxy} + \chi^{(2)}_{xyx} \right] = - \chi^{(2)}_{yyy} &amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{y**} =\frac{1}{2} \left[ \chi^{(2)}_{yyy} + \chi^{(2)}_{yxx}  \right] = 0.0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In the figure below you can see the different &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; of monolayer hBN. &lt;br /&gt;
&lt;br /&gt;
[[File:Xhi2 xy.png|center| 800px|xhi2_xy]]&lt;br /&gt;
&lt;br /&gt;
as you can see in the second panel, when the field is in the &amp;lt;code&amp;gt;xy&amp;lt;/code&amp;gt; you get a linear combination of  &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; corresponding to the equation above, in this case the &amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; is zero while the &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; component is equal to &amp;lt;math&amp;gt;-\chi^{(2)}_{yyy}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene:&#039;&#039;&#039; if you change the direction of the external field you must to remove the corresponding symmetries as explained in the tutorial [[Prerequisites for Real Time_propagation with Yambo#Reduce symmetries real-time linear response tutorial]]. If you have to calculate &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; along many directions it can be convenient to remove all symmetries at once.&lt;br /&gt;
&lt;br /&gt;
==Non-linear response of low-dimensional structures: 2D or 1D ==&lt;br /&gt;
&lt;br /&gt;
The Yambo code is a 3D periodic code, so when you want to study a low-dimensional system 2D or 1D, you have to use a supercell approach.&lt;br /&gt;
For example to simulate the non-linear response in a 2D-crystal one, can put the crystal in the xy plane and choose a larger distance in the z-direction&lt;br /&gt;
in order to reduce the interaction between the periodic replica. Clearly in this case k-point sampling will be only in the x,y directions.&lt;br /&gt;
For calculations on this type of systems, these two warnings must be taken into account:&lt;br /&gt;
&lt;br /&gt;
* if you calculate GW corrections or include electron-hole interaction in the linear/non-linear response it is a good idea to use a &#039;&#039;&#039;Coulomb cutoff&#039;&#039;&#039;, similar to the 2D BSE case  [http://www.yambo-code.org/wiki/index.php?title=How_to_treat_low_dimensional_systems How to treat low dimensional systems]. You can add the cutoff just adding the &amp;quot;-r&amp;quot; in the input generation.&lt;br /&gt;
&lt;br /&gt;
* the calculation of SHG and THG are always performed respect to the supercell, therefore you have to &#039;&#039;&#039;re-scale&#039;&#039;&#039; the result to the effective thickness of the layer, usually the inter-layer distance of the corresponding bulk material for 2D systems: &amp;lt;math&amp;gt;\chi_{rescaled}(\omega) = L_z/d_{eff} \cdot \chi(\omega) &amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;L_z&amp;lt;/math&amp;gt; is the z-dimension of the supercell, and &amp;lt;math&amp;gt;d_{eff}&amp;lt;/math&amp;gt; is the effective thickness of the 2D system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene&#039;&#039;&#039;: Non-linear response along &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;non-periodic directions&amp;lt;/span&amp;gt; is not implemented in Yambo, the code will print zero in these directions for all response functions. We plan to implement it in a future version of the code.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links for schools==&lt;br /&gt;
* Back to [[Rome 2023#Tutorials]]&lt;br /&gt;
* Back to [[ICTP2020]]&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:25%; text-align:left&amp;quot;|Prev: [[Linear response from real time simulations]]&lt;br /&gt;
|style=&amp;quot;width:45%; text-align:center&amp;quot;|Now: [[ICTP2020|ICTP  Tutorials]] --&amp;gt; [[Real time approach to non-linear response|Non Linear Response]]&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:left&amp;quot;|Next: [[Correlation effects in the non-linear response]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)&amp;diff=1009</id>
		<title>Real time approach to non-linear response (SHG)</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)&amp;diff=1009"/>
		<updated>2026-07-20T14:31:16Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Real-time simulation for the SHG */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Second Harmonic Generation in AlAs ==&lt;br /&gt;
In this tutorial, we will calculate the second harmonic generation of bulk AlAs, the Lumen databases can be downloaded here: [https://media.yambo-code.eu/educational/tutorials/files/AlAs_DBs.tar.gz AlAs_DBs.tar.gz] (10 MB). The first steps of this tutorials are the same as the one on [http://www.yambo-code.eu/wiki/index.php?title=Prerequisites_for_Real_Time_propagation_with_Yambo Prerequisites for Real-Time propagation with Yambo] with the only difference that we will work on AlAs and we will consider an external field in the direction &amp;lt;code&amp;gt; 1.000000 | 1.000000 | 0.000000 |&amp;lt;/code&amp;gt;. The DFT input are available here: [https://media.yambo-code.eu/educational/tutorials/files/AlAs_abinit.tar.gz ABINIT] or [https://media.yambo-code.eu/educational/tutorials/files/AlAs_pwscf.tar.gz QuantumEspresso].&lt;br /&gt;
You can run the DFT calculation with ABINIT with the command:&lt;br /&gt;
&lt;br /&gt;
 abinit &amp;lt; AlAs.in &amp;gt; output_AlAs                                             &lt;br /&gt;
&lt;br /&gt;
or using QuantumEspresso:&lt;br /&gt;
&lt;br /&gt;
 pw.x -inp AlAs.scf.in &amp;gt; output_scf&lt;br /&gt;
 pw.x -inp AlAs.nscf.in &amp;gt; output_scf                            &lt;br /&gt;
&lt;br /&gt;
and then import the ABINIT wave-function with the command:&lt;br /&gt;
&lt;br /&gt;
 a2y -F AlAso_DS2_WFK.nc                            &lt;br /&gt;
&lt;br /&gt;
and the QuantumEspresso one, in the folder AlAs.save with the command:&lt;br /&gt;
&lt;br /&gt;
 p2y                              &lt;br /&gt;
Now we consider an external field in the &amp;lt;code&amp;gt;[1,1,0]&amp;lt;/code&amp;gt; direction and remove symmetries not compatible with this field, as explained in the tutorial [http://www.yambo-code.eu/wiki/index.php?title=Prerequisites_for_Real_Time_propagation_with_Yambo Prerequisites for Real-Time propagation with Yambo].&lt;br /&gt;
&lt;br /&gt;
==Real-time simulation for the SHG==&lt;br /&gt;
&lt;br /&gt;
You can generate the input file with the command &amp;lt;code&amp;gt;yambo_nl -u n&amp;lt;/code&amp;gt;:&lt;br /&gt;
                       &lt;br /&gt;
 nloptics                      # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 3 | 6&amp;lt;/span&amp;gt; |                   # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLstep=   0.0100       fs    # [NL] Real Time step length&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLverbosity= &amp;quot;high&amp;quot;&amp;lt;/span&amp;gt;               # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;INVINT&amp;quot;       # [NL] Integrator (&amp;quot;EULEREXP/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&amp;quot;         # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/JGM/SEX/HF&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000         # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  1.000000 | 5.000000 &amp;lt;/span&amp;gt;| eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;              # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.150000  &amp;lt;/span&amp;gt;  eV    # [NL] Damping&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 1.000000 | 0.000000 &amp;lt;/span&amp;gt;|        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_kind= &amp;quot;SOFTSIN&amp;quot;         # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
The line &amp;lt;code&amp;gt;|1.000000 | 1.000000 | 0.000000 | # [RT Field1] Versor&amp;lt;/code&amp;gt; referees to the direction of the external field (x,y,0). &amp;lt;br&amp;gt;&lt;br /&gt;
The default parameters of Lumen are already tuned for second-harmonic generation, so the only thing you have to change is the band range, between 3 and 6 and the energy range between 1.0-5.0 eV and the number of energy steps in this interval that we set to 10.&amp;lt;br&amp;gt; Notice that you cannot set to zero the lowest value of the energy range because this will requires a simulation that lasts infinite time, see below. Finally, consider that Yambo performs a separate calculation for each frequency, so if you set many energy steps the computational time grows linearly with this number.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that we set &amp;lt;code&amp;gt;NLverbosity= &amp;quot;high&amp;quot;&amp;lt;/code&amp;gt; in this way the code will produce a file for each laser frequency containing the time dependent polarization.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;. Calculations will take about fifteen minutes on a single processor PC, you have time to study the next section that explains how non-linear response is extracted from the real-time simulations.&lt;br /&gt;
In order to speed up calculations, you can run them in parallel.&lt;br /&gt;
&lt;br /&gt;
==Non-linear response with Yambo==&lt;br /&gt;
&lt;br /&gt;
In order to calculate the non-linear response, the system is excited with different laser fields with a sinusoidal shape at frequencies &amp;lt;math&amp;gt;\omega_1, \omega_2, .... , \omega_n &amp;lt;/math&amp;gt; determined by the parameters [[Variables#NLEnRangev|NLEnRange]] and [[Variables#NLEnSteps|NLEnSteps]]. A dephasing term is added to the Hamiltonian &amp;lt;math&amp;gt;\gamma = &amp;lt;/math&amp;gt;[[Variables#NLDamping|NLDamping]] to simulate a finite broadening and to remove the eigenmodes that are excited by the sudden turning on of the external field. After the dephasing time the outgoing signal is analyzed to extract the non-linear coefficients as shown in the figure below: &lt;br /&gt;
&lt;br /&gt;
[[File:Pt analysis.png|600px|center|Non-linear response analysis]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the report file &amp;lt;code&amp;gt;r_nlinear&amp;lt;/code&amp;gt; you will find the length of the dephasing part and of the sampling one:&lt;br /&gt;
&lt;br /&gt;
  Dephasing Time          [fs]: 52.65695&lt;br /&gt;
  Sampling  Time          [fs]:  4.18566&lt;br /&gt;
  Total simulation time   [fs]: 56.84262                     &lt;br /&gt;
The length of the dephasing interval is inversely proportional to the damping term &amp;lt;math&amp;gt;T_{depth} \simeq 1/\gamma&amp;lt;/math&amp;gt; while the length of the sampling is dictated by the smallest frequency we are interested in: &amp;lt;math&amp;gt;T_{samp} \simeq 1/\omega_1 &amp;lt;/math&amp;gt;. For this reason if &amp;lt;math&amp;gt; \omega_1=0 &amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt; \gamma = 0 &amp;lt;/math&amp;gt; simulation time goes to infinity. The response at zero frequency can be calculated as limit of small frequency perturbation.&lt;br /&gt;
You can have a look to the file &amp;lt;code&amp;gt;src/nloptics/NL_initialize.F&amp;lt;/code&amp;gt; to see how simulation lengths are defined.&lt;br /&gt;
Calculations can take some time, run them in parallel, the best number of processors = number of frequencies or reduce the number of frequencies step in the SHG.&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results==&lt;br /&gt;
&lt;br /&gt;
In the sampling region we suppose that the polarization can be written as: &amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{p}_n e^{-i\omega_n t} &amp;lt;/math&amp;gt; where the coefficient &amp;lt;math&amp;gt;\bf{p}_1,...,\bf{p}_n &amp;lt;/math&amp;gt; are related to &amp;lt;math&amp;gt;\chi^{(1)},...,\chi^{(n)} &amp;lt;/math&amp;gt;. We sample the polarization signal at different times and invert the previous equation by truncating the sum at a finite order &amp;lt;ref&amp;gt;[https://arxiv.org/abs/1309.4012 Nonlinear optics from an ab initio approach by means of the dynamical Berry phase: Application to second- and third-harmonic generation in semiconductors], C. Attaccalite and M. Grüning, Phys. Rev. B 88, 235113(2013)&amp;lt;/ref&amp;gt;.&lt;br /&gt;
This is done with the command &amp;lt;code&amp;gt;ypp_nl -u&amp;lt;/code&amp;gt; that automatically produce an input with the correct values:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder=   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4  &amp;lt;/span&amp;gt;                 # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  52.65695 | -1.00000 | fs    # Time-window where processing is done&lt;br /&gt;
 % &lt;br /&gt;
 ETStpsRt= 200                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 10.00000 | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;             # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor=  0.10000   eV    # Damping parameter&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; is the order where the previous sum is truncated, and the TimeRange specifies the sampling region. Notice that differently from the first tutorial, in this case, we do not need Damping in &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; because we already included it in the real-time dynamics. Run &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; and it will produce a file called &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;. This file contains the different components of &amp;lt;math&amp;gt;\chi^2_{xy*} &amp;lt;/math&amp;gt; and in particular the columns 6 and 7 correspond to the imaginary and real part of &amp;lt;math&amp;gt;\chi^2_{xyz} &amp;lt;/math&amp;gt;. You can plot the result with gnuplot and the command:&lt;br /&gt;
&lt;br /&gt;
 p &#039;o.YPP-X_probe_order_2&#039; u 1:(sqrt($6**2+$7**2)) w lp ps 1.5 pt 7 lw 1.5&lt;br /&gt;
&lt;br /&gt;
the result should look like&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:AlAs results.png|700px|center|SHG in AlAs]]&lt;br /&gt;
&lt;br /&gt;
and compare it with the &amp;lt;math&amp;gt; \chi^2_{zxy} &amp;lt;/math&amp;gt; calculated with more frequencies and with the converged result on a &amp;lt;math&amp;gt; 18x18x18&amp;lt;/math&amp;gt; k-point grid and bands between 2 and 10. In the figure you can find also the comparison with the results of Ref. &amp;lt;ref&amp;gt;Luppi et al. [https://arxiv.org/abs/1006.2649 PRB B, &#039;&#039;&#039;82&#039;&#039;&#039;, 235201(2010)]&amp;lt;/ref&amp;gt;. &lt;br /&gt;
Notice that the QuantumEspresso results are slightly different from the Abinit ones. This is due to the different pseudo-potential employed in the calculations if pseudopotentials were the same calculation would have been identical. You can download the script to generate this plot and the converged results [http://www.attaccalite.com/lumen/tutorials/AlAs/AlAs_results.tgz here].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notice that&#039;&#039;&#039; : the following parameters are not used in the non-linear response analysis: &amp;lt;code&amp;gt; EnRngeRt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ETStpsRt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DampMode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;DampFactor&amp;lt;/code&amp;gt;. The damping factor is set directly in the real-time simulation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;System of units in Non-linear Optics&amp;lt;/span&amp;gt;&#039;&#039;&#039;: notice that in Yambo the non-linear response functions are in the gaussian system of units, for example the &amp;lt;math&amp;gt; \chi^2 (\omega) &amp;lt;/math&amp;gt;  is in cm/statvolt. In order to convert the non-linear coefficients between different system of units, you can have a look at the [https://www.attaccalite.com/tutorials_yambo/Appendix_C_Boyd.pdf Appendix C] of the book [https://www.elsevier.com/books/nonlinear-optics/boyd/978-0-12-369470-6 &amp;quot;Non-linear optics&amp;quot;  by Robert W. Boyd].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;More tutorials&amp;lt;/span&amp;gt; on non-linear response (Third harmonic generation, parallelization, spin-orbit etc..) with Yambo can be found here: [http://www.attaccalite.com/lumen/tutorials.html More Tutorials]. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Analysis of the results using YamboPy==&lt;br /&gt;
The analysis of the result performed in the previous section using &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; can be performed using python script [https://github.com/yambo-code/yambopy YamboPy].&amp;lt;br&amp;gt;&lt;br /&gt;
In YamboPy we implemented all necessary functions to reads the Yambo databases and post-process the results. Here we show how to get the SHG signal from the previous &lt;br /&gt;
simulations. We suppose you correctly installed &amp;lt;code&amp;gt;YamboPy&amp;lt;/code&amp;gt; on your PC. Go in the folder where you ran non-linear calculation and type in the python:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 from yambopy import *&lt;br /&gt;
 NLDB=YamboNLDB()&lt;br /&gt;
 pol =NLDB.Polarization[0]&lt;br /&gt;
 time=NLDB.IO_TIME_points&lt;br /&gt;
&lt;br /&gt;
in this way you read all the Non-linear databases. If your runs are in a different folder then the &#039;SAVE&#039; one you can specify it using the command:&lt;br /&gt;
 NLDB=YamboNLDB(calc=&#039;MYJOB&#039;)&lt;br /&gt;
&lt;br /&gt;
now in the array &amp;lt;code&amp;gt;pol&amp;lt;/code&amp;gt; you have all the polarization for all laser frequencies in the three Cartesian directions, while the variable &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt; contains all the time series of your simulation.&lt;br /&gt;
Now you can get the non-linear response with the command:&lt;br /&gt;
&lt;br /&gt;
 SIN = Xn_from_sine(NLDB,X_order=5)&lt;br /&gt;
 print(SIN)&lt;br /&gt;
 OUT = SIN.perform_analysis()&lt;br /&gt;
 SIN.output_analysis(OUT)&lt;br /&gt;
&lt;br /&gt;
this command will perform a Fourier analysis of the results in the same way of &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt; and generate new files with all the requested harmonics &#039;&#039;o.YamboPy-X_probe_order_1&#039;&#039;, &#039;&#039;o.YamboPy-X_probe_order_2&#039;&#039; etc...&lt;br /&gt;
equivalent to the one generated by &amp;lt;code&amp;gt;ypp_nl&amp;lt;/code&amp;gt;. Results can be plot with gnuplot using the command:&lt;br /&gt;
 &lt;br /&gt;
 p &#039;o.YamboPy-X_probe_order_2&#039; u 1:(sqrt($6**2+$7**2)) w lp ps 1.5 pt 7 lw 1.5&lt;br /&gt;
&lt;br /&gt;
The script that performs non-linear analysis can be found in &amp;lt;code&amp;gt;yambopy/nl/harmonic_analysis.py&amp;lt;/code&amp;gt;. &amp;lt;br&amp;gt; We strongly advice you to have a look to this script and modify it according&lt;br /&gt;
to your needs and in order to extract other non-linear response functions.&lt;br /&gt;
&lt;br /&gt;
==How to choose the external field direction for the different X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
In the X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;abc&amp;lt;/sub&amp;gt; response you have three field directions. The two components &#039;&#039;b&#039;&#039; and &#039;&#039;c&#039;&#039; are determined by the external field and the third &#039;&#039;a&#039;&#039;&lt;br /&gt;
is the direction where you measure the response.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The external field in Yambo is set using the variable&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
   1.000000 | 0.000000 | 0.000000 |        # [NL ExtF] Versor .&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
For example if you set in Yambo field direction as:&lt;br /&gt;
&lt;br /&gt;
 1.0 | 0.0 | 0.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*xx&amp;lt;/sub&amp;gt;&lt;br /&gt;
 0.0 | 1.0 | 0.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*yy&amp;lt;/sub&amp;gt;&lt;br /&gt;
 0.0 | 0.0 | 1.0 | ---&amp;gt; you calculate all components X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;*zz&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the * correspond to the different direction in the response file &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;.&lt;br /&gt;
In the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt; you have seven columns:&lt;br /&gt;
&lt;br /&gt;
 The first column is the energy [[omega]],&lt;br /&gt;
 the 2nd and 3rd columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;x**&amp;lt;/sub&amp;gt;&lt;br /&gt;
 the 4th and 5th columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;y**&amp;lt;/sub&amp;gt;&lt;br /&gt;
 the 6th and 7th columns are the imaginary and real part of X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&amp;lt;sub&amp;gt;z**&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the ** are the direction of the incoming field, see above.&lt;br /&gt;
&lt;br /&gt;
For example if you want to calculate the &amp;lt;math&amp;gt;\chi^{(2)}_{zxx}&amp;lt;/math&amp;gt; you put the external field in the direction &amp;lt;code&amp;gt; 1.0 | 0.0 | 0.0 |&amp;lt;/code&amp;gt;&lt;br /&gt;
and then plot the column 6 and 7 of the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt; file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to get the other components of the  X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; the calculation are more involved. For example if you put field in the&lt;br /&gt;
&lt;br /&gt;
 1.0 | 1.0 | 0.0 | &lt;br /&gt;
&lt;br /&gt;
this corresponds to &amp;lt;math&amp;gt;E(t)=\frac{1}{\sqrt{2}} [ E_x(t) + E_y(t) ]&amp;lt;/math&amp;gt; and so at the second order you will have &amp;lt;math&amp;gt;E^2(t)=\frac{1}{2} \left [ E^2_x(t) + E^2_y(t) +  E_x(t) E_y(t) +  E_y(t) E_x(t) \right]&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
this means that  the X&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; in the &amp;lt;code&amp;gt;o.YPP-X_probe_order_2&amp;lt;/code&amp;gt;  will correspond to a linear combination of the following different response functions.&amp;lt;br&amp;gt;&lt;br /&gt;
For example in the the 2nd and 3rd columns are the imaginary and real part of:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{x**}=\frac{1}{2} \left [\chi^2_{xxx}+\chi^{(2)}_{xyy} + \chi^{(2)}_{xxy} + \chi^{(2)}_{xyx} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the same for the other column replacing the first &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; for &amp;lt;code&amp;gt;y,z&amp;lt;/code&amp;gt;.&lt;br /&gt;
If you know that some components are zero this allow you to extract the corresponding off-diagonal part of &amp;lt;math&amp;gt;\chi^{(2)}_{abc}&amp;lt;/math&amp;gt; otherwise you have to perform different calculations to get the component you are interested in. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now we present &#039;&#039;&#039;a simple example of monolayer hBN (m-hBN)&#039;&#039;&#039;. &amp;lt;br&amp;gt; In m-hBN there is only a non-zero component of the &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt;and all the others are related by symmetry:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{yyy}=-\chi^{(2)}_{yxx}=-\chi^{(2)}_{xxy}=-\chi^{(2)}_{xyx}&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
so if you put the field in the &amp;lt;code&amp;gt;|1|1|0|&amp;lt;/code&amp;gt; direction you will get:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{x**} = \frac{1}{2} \left[\chi^{(2)}_{xxy} + \chi^{(2)}_{xyx} \right] = - \chi^{(2)}_{yyy} &amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\chi^{(2)}_{y**} =\frac{1}{2} \left[ \chi^{(2)}_{yyy} + \chi^{(2)}_{yxx}  \right] = 0.0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In the figure below you can see the different &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; of monolayer hBN. &lt;br /&gt;
&lt;br /&gt;
[[File:Xhi2 xy.png|center| 800px|xhi2_xy]]&lt;br /&gt;
&lt;br /&gt;
as you can see in the second panel, when the field is in the &amp;lt;code&amp;gt;xy&amp;lt;/code&amp;gt; you get a linear combination of  &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; corresponding to the equation above, in this case the &amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; is zero while the &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; component is equal to &amp;lt;math&amp;gt;-\chi^{(2)}_{yyy}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene:&#039;&#039;&#039; if you change the direction of the external field you must to remove the corresponding symmetries as explained in the tutorial [[Prerequisites for Real Time_propagation with Yambo#Reduce symmetries real-time linear response tutorial]]. If you have to calculate &amp;lt;math&amp;gt;\chi^{(2)}&amp;lt;/math&amp;gt; along many directions it can be convenient to remove all symmetries at once.&lt;br /&gt;
&lt;br /&gt;
==Non-linear response of low-dimensional structures: 2D or 1D ==&lt;br /&gt;
&lt;br /&gt;
The Yambo code is a 3D periodic code, so when you want to study a low-dimensional system 2D or 1D, you have to use a supercell approach.&lt;br /&gt;
For example to simulate the non-linear response in a 2D-crystal one, can put the crystal in the xy plane and choose a larger distance in the z-direction&lt;br /&gt;
in order to reduce the interaction between the periodic replica. Clearly in this case k-point sampling will be only in the x,y directions.&lt;br /&gt;
For calculations on this type of systems, these two warnings must be taken into account:&lt;br /&gt;
&lt;br /&gt;
* if you calculate GW corrections or include electron-hole interaction in the linear/non-linear response it is a good idea to use a &#039;&#039;&#039;Coulomb cutoff&#039;&#039;&#039;, similar to the 2D BSE case  [http://www.yambo-code.org/wiki/index.php?title=How_to_treat_low_dimensional_systems How to treat low dimensional systems]. You can add the cutoff just adding the &amp;quot;-r&amp;quot; in the input generation.&lt;br /&gt;
&lt;br /&gt;
* the calculation of SHG and THG are always performed respect to the supercell, therefore you have to &#039;&#039;&#039;re-scale&#039;&#039;&#039; the result to the effective thickness of the layer, usually the inter-layer distance of the corresponding bulk material for 2D systems: &amp;lt;math&amp;gt;\chi_{rescaled}(\omega) = L_z/d_{eff} \cdot \chi(\omega) &amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;L_z&amp;lt;/math&amp;gt; is the z-dimension of the supercell, and &amp;lt;math&amp;gt;d_{eff}&amp;lt;/math&amp;gt; is the effective thickness of the 2D system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene&#039;&#039;&#039;: Non-linear response along &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;non-periodic directions&amp;lt;/span&amp;gt; is not implemented in Yambo, the code will print zero in these directions for all response functions. We plan to implement it in a future version of the code.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links for schools==&lt;br /&gt;
* Back to [[Rome 2023#Tutorials]]&lt;br /&gt;
* Back to [[ICTP2020]]&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:25%; text-align:left&amp;quot;|Prev: [[Linear response from real time simulations]]&lt;br /&gt;
|style=&amp;quot;width:45%; text-align:center&amp;quot;|Now: [[ICTP2020|ICTP  Tutorials]] --&amp;gt; [[Real time approach to non-linear response|Non Linear Response]]&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:left&amp;quot;|Next: [[Correlation effects in the non-linear response]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Compile_the_external_libraries_without_access_to_internet_connection&amp;diff=1008</id>
		<title>Compile the external libraries without access to internet connection</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Compile_the_external_libraries_without_access_to_internet_connection&amp;diff=1008"/>
		<updated>2026-07-07T14:13:24Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If some external libraries are not provided, the configure script will try to download these libraries and compile them automatically.&lt;br /&gt;
However, if you are on a machine without access to the internet, this procedure will fail. Below a solution  to this problem, which is common on many HPC machiens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First of all you have to download the source code on a local machine with access to internet.&lt;br /&gt;
You can take for example the bug-fixes from gitlab version&lt;br /&gt;
 git clone https://gitlab.com/lumen-code/lumen.git lumen-src&lt;br /&gt;
 cd lumen-src &lt;br /&gt;
 git checkout bug-fixes&lt;br /&gt;
or you can download one of the lumen release via wget&lt;br /&gt;
 wget https://gitlab.com/lumen-code/lumen/-/archive/2.1.0/lumen-2.1.0.tar.gz&lt;br /&gt;
 tar -xzf lumen-2.1.0.tar.gz&lt;br /&gt;
 mv lumen-2.1.0 lumen-src&lt;br /&gt;
 cd lumen-src&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then you, to download all the libraries which lumen might need, simply use the command (no configure needed)&lt;br /&gt;
 make download&lt;br /&gt;
(note: the download of some packages might fail, you can safely ignore these fails)&lt;br /&gt;
&lt;br /&gt;
Finally you can compress the whole source and copy it on your hpc machine&lt;br /&gt;
 cd ..&lt;br /&gt;
 tar -zcvf lumen-src.tar.gz lumen-src&lt;br /&gt;
 scp lumen-src.tar.gz USERNAME@YOUR.HPC.MACHINE:&lt;br /&gt;
&lt;br /&gt;
After these steps, the automaitic compilation of external libraries will proceed also on the machine without internet connection.&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Compile_the_external_libraries_without_access_to_internet_connection&amp;diff=1006</id>
		<title>Compile the external libraries without access to internet connection</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Compile_the_external_libraries_without_access_to_internet_connection&amp;diff=1006"/>
		<updated>2026-07-07T12:29:32Z</updated>

		<summary type="html">&lt;p&gt;Davide: removed extra lines not needed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If some external libraries are not provided, the configure script will try to download these libraries and compile them automatically.&lt;br /&gt;
However, if you are on a machine without access to the internet, this procedure will fail. Below a solution  to this problem, which is common on many HPC machiens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First of all you have to download the source code on a local machine with access to internet.&lt;br /&gt;
You can take for example the bug-fixes from gitlab version&lt;br /&gt;
 git clone https://gitlab.com/lumen-code/lumen.git lumen-src&lt;br /&gt;
 cd lumen-src &lt;br /&gt;
 git checkout bug-fixes&lt;br /&gt;
or you can download one of the lumen release via wget&lt;br /&gt;
 wget https://gitlab.com/lumen-code/lumen/-/archive/2.1.0/lumen-2.1.0.tar.gz&lt;br /&gt;
 tar -xzf lumen-2.1.0.tar.gz&lt;br /&gt;
 mv lumen-2.1.0 lumen-src&lt;br /&gt;
 cd lumen-src&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then you have to run configure and download all the necessary libraries, by doing&lt;br /&gt;
 make download&lt;br /&gt;
(note: the download of some packages might fail, you can safely ignore these fails)&lt;br /&gt;
&lt;br /&gt;
Finally you can compress the whole source and copy it on your hpc machine&lt;br /&gt;
 cd ..&lt;br /&gt;
 tar -zcvf lumen-src.tar.gz lumen-src&lt;br /&gt;
 scp lumen-src.tar.gz USERNAME@YOUR.HPC.MACHINE:&lt;br /&gt;
&lt;br /&gt;
After these steps, the automaitic compilation of external libraries will proceed also on the machine without internet connection.&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_on_IRENE_machine_(TGCC_Joliot_Curie)&amp;diff=1005</id>
		<title>Install Lumen on IRENE machine (TGCC Joliot Curie)</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_on_IRENE_machine_(TGCC_Joliot_Curie)&amp;diff=1005"/>
		<updated>2026-07-07T12:28:59Z</updated>

		<summary type="html">&lt;p&gt;Davide: library download info moved in a dedicated page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page we explain how to configure compile and run Lumen on the IRENE machine on [https://www-hpc.cea.fr/en/complexe/tgcc-JoliotCurie.htm TGCC Joliot Curie].&lt;br /&gt;
&lt;br /&gt;
Since Lumen needs some libraries, and these libraries cannot be downloaded directly from IRENE, first of all you to download them on a local machine.&lt;br /&gt;
Please follow the instructions here: [[Compile the external libraries without access to internet connection]]&lt;br /&gt;
&lt;br /&gt;
Now you can copy the file lumen-src.tar.gz on the Irene cluster and use it for the compilation.&lt;br /&gt;
Then you load the following modules:&lt;br /&gt;
 &lt;br /&gt;
 ml feature/intelmpi/mpi_compiler/inteloneapi&lt;br /&gt;
 module load mpi/intelmpi/20.0.4&lt;br /&gt;
 module load inteloneapi/24.0.0&lt;br /&gt;
&lt;br /&gt;
and then configure Lambo with the command:&lt;br /&gt;
&lt;br /&gt;
 ./configure FC=ifx F77=ifx CC=icx MPIF77=mpif90 MPICC=mpicc MPIFC=mpif90 --enable-open-mp  --enable-par-linalg --with-scalapack-libs=mkl --with-blacs-libs=mkl&lt;br /&gt;
&lt;br /&gt;
and now you can compile with&lt;br /&gt;
&lt;br /&gt;
 make core&lt;br /&gt;
&lt;br /&gt;
You can also compile specific projects for example&lt;br /&gt;
&lt;br /&gt;
 make rt-project&lt;br /&gt;
 make nl-project&lt;br /&gt;
&lt;br /&gt;
then you can submite the job:&lt;br /&gt;
&lt;br /&gt;
 ccc_msub job.sh&lt;br /&gt;
&lt;br /&gt;
a typical job file is:&lt;br /&gt;
  &lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #MSUB -r TEST_lumen&lt;br /&gt;
 #MSUB -q rome &lt;br /&gt;
 #MSUB -n 32&lt;br /&gt;
 #MSUB -A gen13493&lt;br /&gt;
 #MSUB -m scratch&lt;br /&gt;
 #MSUB -T 86400&lt;br /&gt;
 #MSUB -x&lt;br /&gt;
 #MSUB -@ your_email@your_istitution.com&lt;br /&gt;
 &lt;br /&gt;
 OMP_NUM_THREADS=1&lt;br /&gt;
 &lt;br /&gt;
 ml feature/intelmpi/mpi_compiler/inteloneapi&lt;br /&gt;
 module load mpi/intelmpi/20.0.4&lt;br /&gt;
 module load inteloneapi/24.0.0&lt;br /&gt;
 &lt;br /&gt;
 ccc_mprun ./yambo -F my_yambo_input.in&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;N.B.&#039;&#039;&#039; We are working on SLEPC and PETSC configuration with Lumen on IRENE, we will update this page soon.&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Compile_the_external_libraries_without_access_to_internet_connection&amp;diff=1004</id>
		<title>Compile the external libraries without access to internet connection</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Compile_the_external_libraries_without_access_to_internet_connection&amp;diff=1004"/>
		<updated>2026-07-07T12:26:35Z</updated>

		<summary type="html">&lt;p&gt;Davide: Created page with instructions for libraries download&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If some external libraries are not provided, the configure script will try to download these libraries and compile them automatically.&lt;br /&gt;
However, if you are on a machine without access to the internet, this procedure will fail. Below a solution  to this problem, which is common on many HPC machiens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First of all you have to download the source code on a local machine with access to internet.&lt;br /&gt;
You can take for example the bug-fixes from gitlab version&lt;br /&gt;
 git clone https://gitlab.com/lumen-code/lumen.git lumen-src&lt;br /&gt;
 cd lumen-src &lt;br /&gt;
 git checkout bug-fixes&lt;br /&gt;
or you can download one of the lumen release via wget&lt;br /&gt;
 wget https://gitlab.com/lumen-code/lumen/-/archive/2.1.0/lumen-2.1.0.tar.gz&lt;br /&gt;
 tar -xzf lumen-2.1.0.tar.gz&lt;br /&gt;
 mv lumen-2.1.0 lumen-src&lt;br /&gt;
 cd lumen-src&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then you have to run configure and download all the necessary libraries, by doing&lt;br /&gt;
 make download&lt;br /&gt;
(note: the download of some packages might fail, you can safely ignore these fails)&lt;br /&gt;
&lt;br /&gt;
Finally you can compress the whole source and copy it on your hpc machine&lt;br /&gt;
 cd ..&lt;br /&gt;
 tar -zcvf lumen-src.tar.gz lumen-src&lt;br /&gt;
 scp lumen-src.tar.gz USERNAME@YOUR.HPC.MACHINE:&lt;br /&gt;
&lt;br /&gt;
After these steps, the automaitic compilation of external libraries will proceed also on the machine without internet connection&lt;br /&gt;
&lt;br /&gt;
finally you can copy the&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=1003</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=1003"/>
		<updated>2026-07-07T12:14:30Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Libraries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page we explain how to install Lumen on different machine with different compiler and configurations.&lt;br /&gt;
&lt;br /&gt;
===General installations===&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint]]&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint with Intel compiler]]&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint with NVfortran compiler]]&lt;br /&gt;
* [[Install Lumenon MacOS (ARM)]]&lt;br /&gt;
* [[Install Lumen on a Debian machine with some libraries provided via modules]]&lt;br /&gt;
* [[Install Lumen on MacOsX (from Yuncheng Mao)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Libraries===&lt;br /&gt;
* [[Compile the external libraries without access to internet connection]]&lt;br /&gt;
* [[Compile the libraries in Lumen independently]]&lt;br /&gt;
* [[Configure library externally]] (this seems a duplicate of the previous one, to check)&lt;br /&gt;
* [[Install Lumen with external HDF5 and NetCDF libraries]]&lt;br /&gt;
* [[Install Lumen with external chase libraries|Install Lumen with external ChASE libraries]]&lt;br /&gt;
* [[Install Lumen with external slepc and petsc libraries|Install Lumen with external Slepc and Petsc libraries]]&lt;br /&gt;
&lt;br /&gt;
===Installations on specific machines===&lt;br /&gt;
* [[Install Lumen Claudia cluster in Marseille|Install Lumen on Claudia cluster (Marseille]])&lt;br /&gt;
* [[Install Lumen on Mesocentre (Marseille)]]&lt;br /&gt;
* [[Install Lumen on IRENE machine  (TGCC Joliot Curie)]]&lt;br /&gt;
* [[Install Lumen on ISM cluster (Rome)]]&lt;br /&gt;
* [[Install Lumen on Leonardo|Install Lumen on Leonardo (Cineca, Bologna)]]&lt;br /&gt;
* [[Install Lumen on Tirant|Install Lumen/LetzElPhC/Yambopy on Tirant (Univ. of Valencia Cluster)]]&lt;br /&gt;
* [[Install Lumen/LetzElPhC/Yambopy on Lynx(Univ. of Valencia)| Install Lumen on Lynx (Univ. of Valencia Cluster)]]&lt;br /&gt;
* [[Install Lumen on Viper (MPCDF, Munich)]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=1002</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=1002"/>
		<updated>2026-07-07T12:14:01Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Libraries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page we explain how to install Lumen on different machine with different compiler and configurations.&lt;br /&gt;
&lt;br /&gt;
===General installations===&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint]]&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint with Intel compiler]]&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint with NVfortran compiler]]&lt;br /&gt;
* [[Install Lumenon MacOS (ARM)]]&lt;br /&gt;
* [[Install Lumen on a Debian machine with some libraries provided via modules]]&lt;br /&gt;
* [[Install Lumen on MacOsX (from Yuncheng Mao)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Libraries===&lt;br /&gt;
* [[Compile the external libraries on machines without access to external links]]&lt;br /&gt;
* [[Compile the libraries in Lumen independently]]&lt;br /&gt;
* [[Configure library externally]] (this seems a duplicate of the previous one, to check)&lt;br /&gt;
* [[Install Lumen with external HDF5 and NetCDF libraries]]&lt;br /&gt;
* [[Install Lumen with external chase libraries|Install Lumen with external ChASE libraries]]&lt;br /&gt;
* [[Install Lumen with external slepc and petsc libraries|Install Lumen with external Slepc and Petsc libraries]]&lt;br /&gt;
&lt;br /&gt;
===Installations on specific machines===&lt;br /&gt;
* [[Install Lumen Claudia cluster in Marseille|Install Lumen on Claudia cluster (Marseille]])&lt;br /&gt;
* [[Install Lumen on Mesocentre (Marseille)]]&lt;br /&gt;
* [[Install Lumen on IRENE machine  (TGCC Joliot Curie)]]&lt;br /&gt;
* [[Install Lumen on ISM cluster (Rome)]]&lt;br /&gt;
* [[Install Lumen on Leonardo|Install Lumen on Leonardo (Cineca, Bologna)]]&lt;br /&gt;
* [[Install Lumen on Tirant|Install Lumen/LetzElPhC/Yambopy on Tirant (Univ. of Valencia Cluster)]]&lt;br /&gt;
* [[Install Lumen/LetzElPhC/Yambopy on Lynx(Univ. of Valencia)| Install Lumen on Lynx (Univ. of Valencia Cluster)]]&lt;br /&gt;
* [[Install Lumen on Viper (MPCDF, Munich)]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Linear_response_from_real_time_simulations_(density_matrix_only)&amp;diff=1001</id>
		<title>Linear response from real time simulations (density matrix only)</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Linear_response_from_real_time_simulations_(density_matrix_only)&amp;diff=1001"/>
		<updated>2026-07-07T10:27:13Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Circular fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN).&lt;br /&gt;
If you didn&#039;t before you can download input files and Yambo databases for this tutorial here: [https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz hBN-2D-RT.tar.gz].&lt;br /&gt;
and/or follow the instructions to generate the databases here: [[Prerequisites for Real Time propagation with Yambo]]&lt;br /&gt;
&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;hBN-2D-RT/YAMBO/&amp;lt;/code&amp;gt;&lt;br /&gt;
Before proceeding with the real-time simulations it is useful to compute the Independent Particles (IP) absorption spectrum of hBN along the y direction.&lt;br /&gt;
If you didn&#039;t before create an Inputs folder and then the input file with the commands&lt;br /&gt;
 mkdir Inputs&lt;br /&gt;
 yambo_rt -o c -F Inputs/01_ip.in&lt;br /&gt;
and set the proper input parameters&lt;br /&gt;
  optics                         # [R OPT] Optics&lt;br /&gt;
  chi                            # [R CHI] Dyson equation for Chi.&lt;br /&gt;
  dipoles                        # [R   ] Compute the 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;
    3 | 6 |                     # [Xd] Polarization function bands&lt;br /&gt;
  %&lt;br /&gt;
  % EnRngeXd&lt;br /&gt;
    0.00000 | 20.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= 2001                  # [Xd] Total Energy steps&lt;br /&gt;
  % LongDrXd&lt;br /&gt;
   0.000000 | 1.000000 | 0.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
  %&lt;br /&gt;
and then run the code&lt;br /&gt;
 yambo_rt -F Inputs/01_ip.in -J CHI_IP -C CHI_IP&lt;br /&gt;
&lt;br /&gt;
The resulting spectrum will give an idea of the energy involved in the real-time simulations&lt;br /&gt;
 gnuplot&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
[[File:Independent Particles absorption for hBN.png|thumb|center|900px|Independent Particles absorptions for hBN comuting using 4 bands and with LDA eigenvalues]]&lt;br /&gt;
&lt;br /&gt;
==Real-time dynamics at the independent particles level ==&lt;br /&gt;
&lt;br /&gt;
Now you should enter the folder &amp;lt;code&amp;gt;hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us first create a folder for the input files to be run with &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 cd FixSymm&lt;br /&gt;
 mkdir Inputs_rt&lt;br /&gt;
&lt;br /&gt;
In order to calculate linear-response in real-time, we will perturb the system with a delta function in time external field.&lt;br /&gt;
&lt;br /&gt;
Use the command&lt;br /&gt;
  yambo_rt -n p -potential ip -F Inputs_rt/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input:&lt;br /&gt;
&lt;br /&gt;
  negf                           # [R] Real-Time dynamics&lt;br /&gt;
  RT_Threads=0                   # [OPENMP/RT] Number of threads for real-time&lt;br /&gt;
  HXC_Potential= &amp;quot;IP&amp;quot;              # [SC] SC HXC Potential&lt;br /&gt;
  % RTBands&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;6&amp;lt;/span&amp;gt; |                     # [RT] Bands&lt;br /&gt;
  %&lt;br /&gt;
  Integrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EULER RK2&amp;lt;/span&amp;gt;&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= 0.000000   fs      # [RT] Dephasing Time&lt;br /&gt;
  RTstep=10.000000       as      # [RT] Real Time step length&lt;br /&gt;
  NETime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.00000       fs&amp;lt;/span&amp;gt;      # [RT] Simulation Time&lt;br /&gt;
  % IOtime&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.00     | 5.00     | 0.10 &amp;lt;/span&amp;gt;    |  fs    # [RT] Time between to consecutive I/O (OBSERVABLEs,CARRIERs - GF - OUTPUT)&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Freq=  0.00      eV      # [RT Field1] Frequency&lt;br /&gt;
  Field1_Int=&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.E3   kWLm2&amp;lt;/span&amp;gt;   # [RT Field1] Intensity&lt;br /&gt;
  Field1_Width= 0.000000 fs      # [RT Field1] Width&lt;br /&gt;
  Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
  Field1_pol= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linear&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Pol(linear|circular)&lt;br /&gt;
  % Field1_Dir&lt;br /&gt;
   0.000000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000&amp;lt;/span&amp;gt; | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Tstart= 0.000000fs      # [RT Field1] Initial Time&lt;br /&gt;
&lt;br /&gt;
Set the field direction along y, the field type to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation to 55 fs, number of bands from 3 to 6, dephasing to zero and the field intensity to 1.E3 [kW/cm2].&lt;br /&gt;
A small intensity is needed to ensure that we remain in the perturbative regime and that the response is dominated by linear term.&lt;br /&gt;
The &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; is optimized for TD-SEX (or even more sophisticated calculations).&lt;br /&gt;
&lt;br /&gt;
Now run the simulation:&lt;br /&gt;
  yambo_rt -F Inputs_rt/01_td_ip.in -J TD-IP_rt -C TD-IP_rt&lt;br /&gt;
The run produces, besides the standard report and (eventually) log files of yambo, 3 output files:&lt;br /&gt;
  TD-IP_rt/01_td_ip.in_TD-IP_rt&lt;br /&gt;
  TD-IP_rt/r-TD-IP_rt_negf&lt;br /&gt;
  TD-IP_rt/o-TD-IP_rt.polarization&lt;br /&gt;
  TD-IP_rt/o-TD-IP_rt.external_field&lt;br /&gt;
  TD-IP_rt/o-TD-IP_rt.current&lt;br /&gt;
Moreover it also makes a copy of the input file. If the run is taking to long you can open the copy of the input file &amp;lt;code&amp;gt;TD-IP_rt/01_td_ip.in_TD-IP_rt&amp;lt;/code&amp;gt; and add there the string&lt;br /&gt;
 STOP_NOW&lt;br /&gt;
It will finish the simulation in a proper way.&lt;br /&gt;
&lt;br /&gt;
You can now plot the resulting time-dependent polarization and obtain something like this&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;
&lt;br /&gt;
[[File:IP Polarization along y direction.png|thumb|center|900px|Time dependent polarization generated with a TD-IP run using yambo_rt]]&lt;br /&gt;
&lt;br /&gt;
The polarization is oscillating very quickly and with the time step for the output file we have chosen (100 as) we can hardly resolve the oscillations. The slowest oscillation is expected at the first absorption peak, which is located slightly above 4 eV. This corresponds to a period of about 1 fs. Higher energy transitions are however also activated by the delta like pulse, which spans all frequencies (remember that the Fourier transform of a delta function is a constant).&lt;br /&gt;
&lt;br /&gt;
The I/O time, which is negligible in such calculations, is less optimized and becomes the most time demanding step here.&lt;br /&gt;
We can overcome this setting the IOtime for the polarization to 50 as (i.e. each 5 time steps). After the run you can have a look at the timing report and you will see that indeed most of the timing was spent in the I/O:&lt;br /&gt;
  RT databases IO :    6.8745 s CPU (    5501 calls,    0.0012 s avg)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; evaluates the coupling with the external field through the dipoles (by default computing the commutator [x,Hnl]); another approach is setting &amp;lt;code&amp;gt;DipApproach=&amp;quot;Covariant&amp;quot;&amp;lt;/code&amp;gt; in the input. --&amp;gt;&lt;br /&gt;
     &lt;br /&gt;
One can test the performance of different integrators. For example, by setting in input &amp;lt;code&amp;gt;Integrator= &amp;quot;INV RK2&amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; uses a similar integration scheme as &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; (the latter is based on a Berry-phase approach).&lt;br /&gt;
&lt;br /&gt;
=== Circularly polarized fields ===&lt;br /&gt;
&lt;br /&gt;
You can also perform a real time simulation under the action of a circularly polarized field. You just need to modify the input as follows&lt;br /&gt;
&lt;br /&gt;
  Field1_pol= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;circular&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Pol(linear|circular)&lt;br /&gt;
  % Field1_Dir&lt;br /&gt;
   0.000000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000&amp;lt;/span&amp;gt; | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
  % Field1_Dir_Cir&lt;br /&gt;
   0.000000 | 0.000000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000&amp;lt;/span&amp;gt; |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
&lt;br /&gt;
Note. This will translate in the superposition of two fields shifted in time by 90 degree. It will result into a circularly polarized field if the two are orthogonal, as in the above input. You can change the sign of the Field1_Dir_Cir variable to switch between plus and minus polarization. Since the simulation is performed in presence of two external fields, the SAVE folder must be compatible with both fields, i.e. you must put both field directions in input when removing symmetries.&lt;br /&gt;
&lt;br /&gt;
==Results Analysis==&lt;br /&gt;
&lt;br /&gt;
We can now proceed to the Fourier transform of the polarization to obtain the dielectric function&lt;br /&gt;
&lt;br /&gt;
We can use&lt;br /&gt;
  ypp_rt -n X -F Inputs_rt/ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file&lt;br /&gt;
&lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 RT_X                             # [R] Response functions Post-Processing&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 10.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                    # Total Energy steps&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LORENTZIAN&amp;lt;/span&amp;gt;&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;       eV    # Damping parameter&lt;br /&gt;
 #SkipOBS_IO                    # Do not dump on file the RT observables (P(t),J(t),D(t)...)&lt;br /&gt;
 &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Notice that due to the finite time of our simulation smearing is always necessary to Fourier transform the result.&lt;br /&gt;
Then we run&lt;br /&gt;
 ypp_rt -F Inputs_rt/ypp_abs.in -J TD-IP_rt -C TD-IP_rt &lt;br /&gt;
and obtain the files for the dielectric constant along with the field direction, the EELS along with the same direction, and the damped polarization.&lt;br /&gt;
 o-TD-IP_rt.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_rt.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_rt.YPP-polarization&lt;br /&gt;
 o-TD-IP_rt.YPP-current&lt;br /&gt;
 o-TD-IP_rt.YPP-E_frequency&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_rt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First let&#039;s have a look to the polarization.&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, &amp;quot;TD-IP_rt/o-TD-IP_rt.YPP-polarization&amp;quot; u 1:3 w l&lt;br /&gt;
We clearly see the effect of the Lorentzian damping added to the time dependent polarization&lt;br /&gt;
[[File:IP Polarization along y direction damped.png|thumb|center|900px|Time dependent polarization generated with the ypp_rt code. Comparing the damped polarization with the one produced by yambo_rt]]&lt;br /&gt;
&lt;br /&gt;
Finally, we can plot the imaginary part of the dielectric function, which is obtained from the Fourier transform of the polarization.&lt;br /&gt;
&lt;br /&gt;
Now we can plot the dielectric constant and compare it with the linear response:&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l, &amp;quot;TD-IP_rt/o-TD-IP_rt.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
&lt;br /&gt;
[[File:Bn optics.png|thumb|900px|center|Imaginary part of the dielectric constant. Comparison between standard IP calculation (yambo), linear response based on the density matrix (yambo_rt,this tutorial) and Berry-phase approach (yambo_nl).]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[Rome 2023#Tutorials]]&lt;br /&gt;
* On to [[Real time Bethe-Salpeter Equation (density matrix only)|TD-BSE tutorial]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Linear_response_from_real_time_simulations_(density_matrix_only)&amp;diff=1000</id>
		<title>Linear response from real time simulations (density matrix only)</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Linear_response_from_real_time_simulations_(density_matrix_only)&amp;diff=1000"/>
		<updated>2026-07-07T10:26:46Z</updated>

		<summary type="html">&lt;p&gt;Davide: Added subsection on circluarly polarized fields&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN).&lt;br /&gt;
If you didn&#039;t before you can download input files and Yambo databases for this tutorial here: [https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz hBN-2D-RT.tar.gz].&lt;br /&gt;
and/or follow the instructions to generate the databases here: [[Prerequisites for Real Time propagation with Yambo]]&lt;br /&gt;
&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;hBN-2D-RT/YAMBO/&amp;lt;/code&amp;gt;&lt;br /&gt;
Before proceeding with the real-time simulations it is useful to compute the Independent Particles (IP) absorption spectrum of hBN along the y direction.&lt;br /&gt;
If you didn&#039;t before create an Inputs folder and then the input file with the commands&lt;br /&gt;
 mkdir Inputs&lt;br /&gt;
 yambo_rt -o c -F Inputs/01_ip.in&lt;br /&gt;
and set the proper input parameters&lt;br /&gt;
  optics                         # [R OPT] Optics&lt;br /&gt;
  chi                            # [R CHI] Dyson equation for Chi.&lt;br /&gt;
  dipoles                        # [R   ] Compute the 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;
    3 | 6 |                     # [Xd] Polarization function bands&lt;br /&gt;
  %&lt;br /&gt;
  % EnRngeXd&lt;br /&gt;
    0.00000 | 20.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= 2001                  # [Xd] Total Energy steps&lt;br /&gt;
  % LongDrXd&lt;br /&gt;
   0.000000 | 1.000000 | 0.000000 |        # [Xd] [cc] Electric Field&lt;br /&gt;
  %&lt;br /&gt;
and then run the code&lt;br /&gt;
 yambo_rt -F Inputs/01_ip.in -J CHI_IP -C CHI_IP&lt;br /&gt;
&lt;br /&gt;
The resulting spectrum will give an idea of the energy involved in the real-time simulations&lt;br /&gt;
 gnuplot&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
[[File:Independent Particles absorption for hBN.png|thumb|center|900px|Independent Particles absorptions for hBN comuting using 4 bands and with LDA eigenvalues]]&lt;br /&gt;
&lt;br /&gt;
==Real-time dynamics at the independent particles level ==&lt;br /&gt;
&lt;br /&gt;
Now you should enter the folder &amp;lt;code&amp;gt;hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;&lt;br /&gt;
Let us first create a folder for the input files to be run with &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 cd FixSymm&lt;br /&gt;
 mkdir Inputs_rt&lt;br /&gt;
&lt;br /&gt;
In order to calculate linear-response in real-time, we will perturb the system with a delta function in time external field.&lt;br /&gt;
&lt;br /&gt;
Use the command&lt;br /&gt;
  yambo_rt -n p -potential ip -F Inputs_rt/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input:&lt;br /&gt;
&lt;br /&gt;
  negf                           # [R] Real-Time dynamics&lt;br /&gt;
  RT_Threads=0                   # [OPENMP/RT] Number of threads for real-time&lt;br /&gt;
  HXC_Potential= &amp;quot;IP&amp;quot;              # [SC] SC HXC Potential&lt;br /&gt;
  % RTBands&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3&amp;lt;/span&amp;gt; |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;6&amp;lt;/span&amp;gt; |                     # [RT] Bands&lt;br /&gt;
  %&lt;br /&gt;
  Integrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EULER RK2&amp;lt;/span&amp;gt;&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= 0.000000   fs      # [RT] Dephasing Time&lt;br /&gt;
  RTstep=10.000000       as      # [RT] Real Time step length&lt;br /&gt;
  NETime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.00000       fs&amp;lt;/span&amp;gt;      # [RT] Simulation Time&lt;br /&gt;
  % IOtime&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.00     | 5.00     | 0.10 &amp;lt;/span&amp;gt;    |  fs    # [RT] Time between to consecutive I/O (OBSERVABLEs,CARRIERs - GF - OUTPUT)&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Freq=  0.00      eV      # [RT Field1] Frequency&lt;br /&gt;
  Field1_Int=&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.E3   kWLm2&amp;lt;/span&amp;gt;   # [RT Field1] Intensity&lt;br /&gt;
  Field1_Width= 0.000000 fs      # [RT Field1] Width&lt;br /&gt;
  Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DELTA&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Kind(SIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
  Field1_pol= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linear&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Pol(linear|circular)&lt;br /&gt;
  % Field1_Dir&lt;br /&gt;
   0.000000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000&amp;lt;/span&amp;gt; | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
  Field1_Tstart= 0.000000fs      # [RT Field1] Initial Time&lt;br /&gt;
&lt;br /&gt;
Set the field direction along y, the field type to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation to 55 fs, number of bands from 3 to 6, dephasing to zero and the field intensity to 1.E3 [kW/cm2].&lt;br /&gt;
A small intensity is needed to ensure that we remain in the perturbative regime and that the response is dominated by linear term.&lt;br /&gt;
The &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; is optimized for TD-SEX (or even more sophisticated calculations).&lt;br /&gt;
&lt;br /&gt;
Now run the simulation:&lt;br /&gt;
  yambo_rt -F Inputs_rt/01_td_ip.in -J TD-IP_rt -C TD-IP_rt&lt;br /&gt;
The run produces, besides the standard report and (eventually) log files of yambo, 3 output files:&lt;br /&gt;
  TD-IP_rt/01_td_ip.in_TD-IP_rt&lt;br /&gt;
  TD-IP_rt/r-TD-IP_rt_negf&lt;br /&gt;
  TD-IP_rt/o-TD-IP_rt.polarization&lt;br /&gt;
  TD-IP_rt/o-TD-IP_rt.external_field&lt;br /&gt;
  TD-IP_rt/o-TD-IP_rt.current&lt;br /&gt;
Moreover it also makes a copy of the input file. If the run is taking to long you can open the copy of the input file &amp;lt;code&amp;gt;TD-IP_rt/01_td_ip.in_TD-IP_rt&amp;lt;/code&amp;gt; and add there the string&lt;br /&gt;
 STOP_NOW&lt;br /&gt;
It will finish the simulation in a proper way.&lt;br /&gt;
&lt;br /&gt;
You can now plot the resulting time-dependent polarization and obtain something like this&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;
&lt;br /&gt;
[[File:IP Polarization along y direction.png|thumb|center|900px|Time dependent polarization generated with a TD-IP run using yambo_rt]]&lt;br /&gt;
&lt;br /&gt;
The polarization is oscillating very quickly and with the time step for the output file we have chosen (100 as) we can hardly resolve the oscillations. The slowest oscillation is expected at the first absorption peak, which is located slightly above 4 eV. This corresponds to a period of about 1 fs. Higher energy transitions are however also activated by the delta like pulse, which spans all frequencies (remember that the Fourier transform of a delta function is a constant).&lt;br /&gt;
&lt;br /&gt;
The I/O time, which is negligible in such calculations, is less optimized and becomes the most time demanding step here.&lt;br /&gt;
We can overcome this setting the IOtime for the polarization to 50 as (i.e. each 5 time steps). After the run you can have a look at the timing report and you will see that indeed most of the timing was spent in the I/O:&lt;br /&gt;
  RT databases IO :    6.8745 s CPU (    5501 calls,    0.0012 s avg)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; evaluates the coupling with the external field through the dipoles (by default computing the commutator [x,Hnl]); another approach is setting &amp;lt;code&amp;gt;DipApproach=&amp;quot;Covariant&amp;quot;&amp;lt;/code&amp;gt; in the input. --&amp;gt;&lt;br /&gt;
     &lt;br /&gt;
One can test the performance of different integrators. For example, by setting in input &amp;lt;code&amp;gt;Integrator= &amp;quot;INV RK2&amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; uses a similar integration scheme as &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; (the latter is based on a Berry-phase approach).&lt;br /&gt;
&lt;br /&gt;
=== Circular fields ===&lt;br /&gt;
&lt;br /&gt;
You can also perform a real time simulation under the action of a circular field. You just need to modify the input as follows&lt;br /&gt;
&lt;br /&gt;
  Field1_pol= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;circular&amp;lt;/span&amp;gt;&amp;quot;           # [RT Field1] Pol(linear|circular)&lt;br /&gt;
  % Field1_Dir&lt;br /&gt;
   0.000000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000&amp;lt;/span&amp;gt; | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
  % Field1_Dir_Cir&lt;br /&gt;
   0.000000 | 0.000000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000&amp;lt;/span&amp;gt; |        # [RT Field1] Versor&lt;br /&gt;
  %&lt;br /&gt;
&lt;br /&gt;
Note. This will translate in the superposition of two fields shifted in time by 90 degree. It will result into a circularly polarized field if the two are orthogonal, as in the above input. You can change the sign of the Field1_Dir_Cir variable to switch between plus and minus polarization. Since the simulation is performed in presence of two external fields, the SAVE folder must be compatible with both fields, i.e. you must put both field directions in input when removing symmetries.&lt;br /&gt;
&lt;br /&gt;
==Results Analysis==&lt;br /&gt;
&lt;br /&gt;
We can now proceed to the Fourier transform of the polarization to obtain the dielectric function&lt;br /&gt;
&lt;br /&gt;
We can use&lt;br /&gt;
  ypp_rt -n X -F Inputs_rt/ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file&lt;br /&gt;
&lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 RT_X                             # [R] Response functions Post-Processing&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 Xorder= 1                        # Max order of the response/exc functions&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 10.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                    # Total Energy steps&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;LORENTZIAN&amp;lt;/span&amp;gt;&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;       eV    # Damping parameter&lt;br /&gt;
 #SkipOBS_IO                    # Do not dump on file the RT observables (P(t),J(t),D(t)...)&lt;br /&gt;
 &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Notice that due to the finite time of our simulation smearing is always necessary to Fourier transform the result.&lt;br /&gt;
Then we run&lt;br /&gt;
 ypp_rt -F Inputs_rt/ypp_abs.in -J TD-IP_rt -C TD-IP_rt &lt;br /&gt;
and obtain the files for the dielectric constant along with the field direction, the EELS along with the same direction, and the damped polarization.&lt;br /&gt;
 o-TD-IP_rt.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_rt.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_rt.YPP-polarization&lt;br /&gt;
 o-TD-IP_rt.YPP-current&lt;br /&gt;
 o-TD-IP_rt.YPP-E_frequency&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_rt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First let&#039;s have a look to the polarization.&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, &amp;quot;TD-IP_rt/o-TD-IP_rt.YPP-polarization&amp;quot; u 1:3 w l&lt;br /&gt;
We clearly see the effect of the Lorentzian damping added to the time dependent polarization&lt;br /&gt;
[[File:IP Polarization along y direction damped.png|thumb|center|900px|Time dependent polarization generated with the ypp_rt code. Comparing the damped polarization with the one produced by yambo_rt]]&lt;br /&gt;
&lt;br /&gt;
Finally, we can plot the imaginary part of the dielectric function, which is obtained from the Fourier transform of the polarization.&lt;br /&gt;
&lt;br /&gt;
Now we can plot the dielectric constant and compare it with the linear response:&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l, &amp;quot;TD-IP_rt/o-TD-IP_rt.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
&lt;br /&gt;
[[File:Bn optics.png|thumb|900px|center|Imaginary part of the dielectric constant. Comparison between standard IP calculation (yambo), linear response based on the density matrix (yambo_rt,this tutorial) and Berry-phase approach (yambo_nl).]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[Rome 2023#Tutorials]]&lt;br /&gt;
* On to [[Real time Bethe-Salpeter Equation (density matrix only)|TD-BSE tutorial]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Real-time_dynamics_with_external_field_read_from_file&amp;diff=999</id>
		<title>Real-time dynamics with external field read from file</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Real-time_dynamics_with_external_field_read_from_file&amp;diff=999"/>
		<updated>2026-07-07T10:18:25Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Modulated-Gaussian-pulse.png|right|500px |external field from file]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In this tutorial we will see how to generate an external field in a format compatible with Lumen and then use it to run real-time simulation (see for instance Ref. &amp;lt;ref name=&amp;quot;sangalli&amp;quot;/&amp;gt;).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We will also prove a simple python script to do it, that you can easily modify to create your own external field.&lt;br /&gt;
&lt;br /&gt;
The tutorial is divided in two sections: 1) generate an external field, either with &#039;&#039;YamboPy&#039;&#039; (1.a) or with &#039;&#039;ypp_rt&#039;&#039; (1.b); 2) use the external field in the real-time calculations.&lt;br /&gt;
&lt;br /&gt;
== Generate external field ==&lt;br /&gt;
&lt;br /&gt;
The idea is to generate a file, which we call here &amp;lt;code&amp;gt;EXTFIELD.time&amp;lt;/code&amp;gt;, containing the time dependent vector . &amp;lt;code&amp;gt;EXTFIELD.time&amp;lt;/code&amp;gt; will be later used in a real-time simulation.&lt;br /&gt;
The structure of the file will be the following&lt;br /&gt;
&lt;br /&gt;
        8001   5.00000035E-03&lt;br /&gt;
   0.00000000       0.00000000       8.00802198E-08   5.33216726E-03&lt;br /&gt;
   5.00000035E-03   0.00000000       1.10453682E-03   5.34489006E-03&lt;br /&gt;
   1.00000007E-02   0.00000000       2.20612506E-03   5.30774519E-03&lt;br /&gt;
   1.50000006E-02   0.00000000       3.29522160E-03   5.22070238E-03&lt;br /&gt;
   2.00000014E-02   0.00000000       4.36120294E-03   5.08422730E-03&lt;br /&gt;
   2.50000022E-02   0.00000000       5.39377611E-03   4.89927875E-03&lt;br /&gt;
   3.00000012E-02   0.00000000       6.38338085E-03   4.66719037E-03&lt;br /&gt;
   3.50000039E-02   0.00000000       7.32029136E-03   4.38982388E-03&lt;br /&gt;
   4.00000028E-02   0.00000000       8.19511060E-03   4.06956300E-03&lt;br /&gt;
   4.50000018E-02   0.00000000       8.99977796E-03   3.70889902E-03&lt;br /&gt;
   5.00000045E-02   0.00000000       9.72598325E-03   3.31101404E-03&lt;br /&gt;
   5.49999997E-02   0.00000000       1.03663849E-02   2.87936884E-03&lt;br /&gt;
   6.00000024E-02   0.00000000       1.09142270E-02   2.41791131E-03&lt;br /&gt;
   6.50000051E-02   0.00000000       1.13641499E-02   1.93037838E-03&lt;br /&gt;
   7.00000077E-02   0.00000000       1.17109315E-02   1.42144389E-03&lt;br /&gt;
   7.50000030E-02   0.00000000       1.19506177E-02   8.95809906E-04&lt;br /&gt;
   8.00000057E-02   0.00000000       1.20803779E-02   3.57942627E-04&lt;br /&gt;
   8.50000083E-02   0.00000000       1.20981205E-02  -1.87048965E-04&lt;br /&gt;
   9.00000036E-02   0.00000000       1.20029533E-02  -7.33944471E-04&lt;br /&gt;
   9.50000063E-02   0.00000000       1.17948940E-02  -1.27798819E-03&lt;br /&gt;
   0.100000009      0.00000000       1.14751300E-02  -1.81389856E-03&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
The first column contains the time, then in order &amp;lt;math&amp;gt;a(t)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&#039;(t)&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;a&#039;&#039;(t)&amp;lt;/math&amp;gt;. Befor this info there is a row indicating the length of the file (number of time steps), and the time step duration (&amp;lt;math&amp;gt;dt_f&amp;lt;/math&amp;gt;).&lt;br /&gt;
Since in the simulation a discrete time step (&amp;lt;math&amp;gt;dt&amp;lt;/math&amp;gt;) is also used, &amp;lt;code&amp;gt;EXTFIELD.time&amp;lt;/code&amp;gt; must contain all the time steps needed. When generating an external field, care must be taken in choosing the time step to ensure compatibility with the integrator.&lt;br /&gt;
&lt;br /&gt;
* EULER and INVINT are single-time integrators; therefore, the field time step must be equal to the one used in the simulation or an integer fraction of it: &amp;lt;math&amp;gt;dt_f=dt/n&amp;lt;/math&amp;gt;.&lt;br /&gt;
* CRANKNIC, RK2EXP and RK2 are two-time integrators; the field time step should be half the one used in the simulation or an integer fraction of it: &amp;lt;math&amp;gt;dt_f=dt/(2n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
* RK4 and RK4EXP are four-time integrators that requires 1/2 and 1/3 of the time-step, therefore the field time-step should be one sixth of the one used in the simulation or and integer fraction of it: &amp;lt;math&amp;gt;dt_f=dt/(6n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The code will check that these prescriptions are respected before start simulations. In practice, if you generate a field with &amp;lt;math&amp;gt;dt_f=dt/(6n)&amp;lt;/math&amp;gt; this will be ok for all available integrators.&lt;br /&gt;
&lt;br /&gt;
=== Generate external field with YamboPy ===&lt;br /&gt;
&lt;br /&gt;
In YamboPy you can find a tutorial to generate external field in the folder &amp;lt;code&amp;gt;yambopy/tutorial/external_field/generate_field.py&amp;lt;/code&amp;gt;You can define your external field in this way:&lt;br /&gt;
&lt;br /&gt;
 def gauss_field(t_steps):&lt;br /&gt;
     # In this example we generate a guassian external field&lt;br /&gt;
     sigma=5.0*fs2aut # Field width&lt;br /&gt;
     T_0  =3.0*sigma&lt;br /&gt;
     Expf =np.exp(-(t_steps-T_0)**2/(2.0*sigma**2) )&lt;br /&gt;
     a_t  =sigma*np.sqrt(math.pi/2.0)*(special.erf((t_steps-T_0)/(sigma*np.sqrt(2.0)))+1.0)&lt;br /&gt;
     ap_t =Expf&lt;br /&gt;
     app_t=-Expf*(t_steps-T_0)/sigma**2&lt;br /&gt;
     return  a_t,ap_t,app_t&lt;br /&gt;
&lt;br /&gt;
Just a function that generate &amp;lt;math&amp;gt;a(t)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&#039;(t)&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;a&#039;&#039;(t)&amp;lt;/math&amp;gt; that will be then read from Yambo_rt/Yambo_nl. You can add you function to &amp;lt;code&amp;gt;generate_field.py&amp;lt;/code&amp;gt;scritp or use the two that are already implemented&lt;br /&gt;
&lt;br /&gt;
SIN and GAUSS fields.  Notice that the electric field correspond to &amp;lt;math&amp;gt;E(t) = -E_{amp} a&#039;(t)&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The field amplitude (intensity) and versor are not required because it will be read from the Yambo input&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; only linear polarized external field can generated with YamboPY (to be generlized)&lt;br /&gt;
&lt;br /&gt;
=== Generate external field with ypp_rt ===&lt;br /&gt;
With &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; one can generate all external fields that implemented in the Yambo code in the file &amp;lt;code&amp;gt;src/modules/mod_fields.F&amp;lt;/code&amp;gt;. This can be usefull to visualize external fields used in Yambo without the need of running a real simulation. However if you want to add a new external field you have to code it in the file &amp;lt;code&amp;gt;src/modules/mod_fields.F&amp;lt;/code&amp;gt;. The command to generate external field on file is: &amp;lt;code&amp;gt;ypp_rt -rtplot f&amp;lt;/code&amp;gt;. This will generate the following input file:&lt;br /&gt;
&lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 RTfields                         # [R] Analize time-dependent fields&lt;br /&gt;
 TimeStep= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.6666667 &amp;lt;/span&amp;gt;         as    # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 |100.000000 | &amp;lt;/span&amp;gt;        fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 ChirpFac= 0.000000         fs    # Prefactor for linear chirping in frequency space&lt;br /&gt;
 Field1_Freq= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;2.000000 &amp;lt;/span&amp;gt;     eV    # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int= 1000.000000       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SIN&amp;lt;/span&amp;gt;&amp;quot;              # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field1_pol= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linear&amp;lt;/span&amp;gt;&amp;quot;               # [RT Field1] Pol(linear|circular)&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
 1.000000 | 0.000000 | 0.000000 |       # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.010000&amp;lt;/span&amp;gt;   fs    # [RT Field1] Initial Time&lt;br /&gt;
In the input file you have to specify a series of parameters, in red: the time step (&amp;lt;code&amp;gt;TimeSpep&amp;lt;/code&amp;gt;), the time range (&amp;lt;code&amp;gt;TimeRange&amp;lt;/code&amp;gt;), the field kind (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;), its parameters (&amp;lt;code&amp;gt;Field1_Width&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Field1_Freq&amp;lt;/code&amp;gt;, etc...) and finally the starting time (&amp;lt;code&amp;gt;Field1_Tstart&amp;lt;/code&amp;gt;), usually the first step of the dynamics. &amp;lt;br&amp;gt; Notice that Field direction (&amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt;) field intensity (&amp;lt;code&amp;gt;Field1_Int&amp;lt;/code&amp;gt;) are not used in the external field generation but read from Yambo input.&amp;lt;br&amp;gt;&lt;br /&gt;
Then you run &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; with this input and it will produce a series of files:  &amp;lt;code&amp;gt;YPP_EXTFIELD1_P1.time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;YPP_EXTFIELD1_P2.time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;YPP_EXTFIELD1_P1.freq&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;YPP_EXTFIELD1_P2.freq&amp;lt;/code&amp;gt;&amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These files contain the external field and its Fourier transform. In the next section we will see how to use them in real-time dynamics.&lt;br /&gt;
&lt;br /&gt;
== Use generated external field with yambo_rt/yambo_nl ==&lt;br /&gt;
In yambo_rt/yambo_nl you can tell to the code to read an external field from file. For example in yambo_nl you generate your input wil the command &amp;lt;code&amp;gt;yambo_nl -u p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&lt;br /&gt;
  7 |  10 |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLstep= 10.0       as&amp;lt;/span&amp;gt;    # [NL] Real Time step length&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLtime=120.000000&amp;lt;/span&amp;gt;           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;INVINT&amp;quot;           # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&amp;quot;             # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX/LSEX/LHF&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative RADLifeTime=Phase_LifeTime)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 HARRLvcs= 11529            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 11529            RL    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 11529            RL    # [GW] Correlation RL components&lt;br /&gt;
 Field1_Freq= 0.100000      eV    # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00  &amp;lt;/span&amp;gt;     kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Field1_kind= &amp;quot;FROM_FILE ./YPP_EXTFIELD1_P1.time&amp;quot;&amp;lt;/span&amp;gt; # [RT Field1] Kind(SIN|COS|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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 |  &amp;lt;/span&amp;gt;      # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
You have to specify the file kind &amp;lt;code&amp;gt;FROM_FILE&amp;lt;/code&amp;gt; and give the path of the file containing the external field. Do not forget also to use the same &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; and  in the &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; inputs. Notice that field intensity and field versor is specified in the &amp;lt;code&amp;gt;Yambo&amp;lt;/code&amp;gt; input only.&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; in the simulation can be larger then the one used in the external field generation, the code will assume that field that after a given time the field is zero.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;sangalli&amp;quot; &amp;gt;D. Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://arxiv.org/pdf/2106.03592 Phys. Rev. Materials 5, 083803, (2021)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Real-time_dynamics_with_external_field_read_from_file&amp;diff=998</id>
		<title>Real-time dynamics with external field read from file</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Real-time_dynamics_with_external_field_read_from_file&amp;diff=998"/>
		<updated>2026-07-07T10:17:18Z</updated>

		<summary type="html">&lt;p&gt;Davide: Removed &amp;quot;with&amp;quot; from section title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Modulated-Gaussian-pulse.png|right|500px |external field from file]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In this tutorial we will see how to generate an external field in a format compatible with Lumen and then use it to run real-time simulation (see for instance Ref. &amp;lt;ref name=&amp;quot;sangalli&amp;quot;/&amp;gt;).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We will also prove a simple python script to do it, that you can easily modify to create your own external field.&lt;br /&gt;
&lt;br /&gt;
The tutorial is divided in three sections: 1) generate external field with &#039;&#039;YamboPy&#039;&#039;; 2) generate external field with &#039;&#039;ypp_rt&#039;&#039;; 3) use the external field in the real-time calculations.&lt;br /&gt;
&lt;br /&gt;
== Generate external field ==&lt;br /&gt;
&lt;br /&gt;
The idea is to generate a file, which we call here &amp;lt;code&amp;gt;EXTFIELD.time&amp;lt;/code&amp;gt;, containing the time dependent vector . &amp;lt;code&amp;gt;EXTFIELD.time&amp;lt;/code&amp;gt; will be later used in a real-time simulation.&lt;br /&gt;
The structure of the file will be the following&lt;br /&gt;
&lt;br /&gt;
        8001   5.00000035E-03&lt;br /&gt;
   0.00000000       0.00000000       8.00802198E-08   5.33216726E-03&lt;br /&gt;
   5.00000035E-03   0.00000000       1.10453682E-03   5.34489006E-03&lt;br /&gt;
   1.00000007E-02   0.00000000       2.20612506E-03   5.30774519E-03&lt;br /&gt;
   1.50000006E-02   0.00000000       3.29522160E-03   5.22070238E-03&lt;br /&gt;
   2.00000014E-02   0.00000000       4.36120294E-03   5.08422730E-03&lt;br /&gt;
   2.50000022E-02   0.00000000       5.39377611E-03   4.89927875E-03&lt;br /&gt;
   3.00000012E-02   0.00000000       6.38338085E-03   4.66719037E-03&lt;br /&gt;
   3.50000039E-02   0.00000000       7.32029136E-03   4.38982388E-03&lt;br /&gt;
   4.00000028E-02   0.00000000       8.19511060E-03   4.06956300E-03&lt;br /&gt;
   4.50000018E-02   0.00000000       8.99977796E-03   3.70889902E-03&lt;br /&gt;
   5.00000045E-02   0.00000000       9.72598325E-03   3.31101404E-03&lt;br /&gt;
   5.49999997E-02   0.00000000       1.03663849E-02   2.87936884E-03&lt;br /&gt;
   6.00000024E-02   0.00000000       1.09142270E-02   2.41791131E-03&lt;br /&gt;
   6.50000051E-02   0.00000000       1.13641499E-02   1.93037838E-03&lt;br /&gt;
   7.00000077E-02   0.00000000       1.17109315E-02   1.42144389E-03&lt;br /&gt;
   7.50000030E-02   0.00000000       1.19506177E-02   8.95809906E-04&lt;br /&gt;
   8.00000057E-02   0.00000000       1.20803779E-02   3.57942627E-04&lt;br /&gt;
   8.50000083E-02   0.00000000       1.20981205E-02  -1.87048965E-04&lt;br /&gt;
   9.00000036E-02   0.00000000       1.20029533E-02  -7.33944471E-04&lt;br /&gt;
   9.50000063E-02   0.00000000       1.17948940E-02  -1.27798819E-03&lt;br /&gt;
   0.100000009      0.00000000       1.14751300E-02  -1.81389856E-03&lt;br /&gt;
   ...&lt;br /&gt;
&lt;br /&gt;
The first column contains the time, then in order &amp;lt;math&amp;gt;a(t)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&#039;(t)&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;a&#039;&#039;(t)&amp;lt;/math&amp;gt;. Befor this info there is a row indicating the length of the file (number of time steps), and the time step duration (&amp;lt;math&amp;gt;dt_f&amp;lt;/math&amp;gt;).&lt;br /&gt;
Since in the simulation a discrete time step (&amp;lt;math&amp;gt;dt&amp;lt;/math&amp;gt;) is also used, &amp;lt;code&amp;gt;EXTFIELD.time&amp;lt;/code&amp;gt; must contain all the time steps needed. When generating an external field, care must be taken in choosing the time step to ensure compatibility with the integrator.&lt;br /&gt;
&lt;br /&gt;
* EULER and INVINT are single-time integrators; therefore, the field time step must be equal to the one used in the simulation or an integer fraction of it: &amp;lt;math&amp;gt;dt_f=dt/n&amp;lt;/math&amp;gt;.&lt;br /&gt;
* CRANKNIC, RK2EXP and RK2 are two-time integrators; the field time step should be half the one used in the simulation or an integer fraction of it: &amp;lt;math&amp;gt;dt_f=dt/(2n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
* RK4 and RK4EXP are four-time integrators that requires 1/2 and 1/3 of the time-step, therefore the field time-step should be one sixth of the one used in the simulation or and integer fraction of it: &amp;lt;math&amp;gt;dt_f=dt/(6n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The code will check that these prescriptions are respected before start simulations. In practice, if you generate a field with &amp;lt;math&amp;gt;dt_f=dt/(6n)&amp;lt;/math&amp;gt; this will be ok for all available integrators.&lt;br /&gt;
&lt;br /&gt;
=== Generate external field with YamboPy ===&lt;br /&gt;
&lt;br /&gt;
In YamboPy you can find a tutorial to generate external field in the folder &amp;lt;code&amp;gt;yambopy/tutorial/external_field/generate_field.py&amp;lt;/code&amp;gt;You can define your external field in this way:&lt;br /&gt;
&lt;br /&gt;
 def gauss_field(t_steps):&lt;br /&gt;
     # In this example we generate a guassian external field&lt;br /&gt;
     sigma=5.0*fs2aut # Field width&lt;br /&gt;
     T_0  =3.0*sigma&lt;br /&gt;
     Expf =np.exp(-(t_steps-T_0)**2/(2.0*sigma**2) )&lt;br /&gt;
     a_t  =sigma*np.sqrt(math.pi/2.0)*(special.erf((t_steps-T_0)/(sigma*np.sqrt(2.0)))+1.0)&lt;br /&gt;
     ap_t =Expf&lt;br /&gt;
     app_t=-Expf*(t_steps-T_0)/sigma**2&lt;br /&gt;
     return  a_t,ap_t,app_t&lt;br /&gt;
&lt;br /&gt;
Just a function that generate &amp;lt;math&amp;gt;a(t)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;a&#039;(t)&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;a&#039;&#039;(t)&amp;lt;/math&amp;gt; that will be then read from Yambo_rt/Yambo_nl. You can add you function to &amp;lt;code&amp;gt;generate_field.py&amp;lt;/code&amp;gt;scritp or use the two that are already implemented&lt;br /&gt;
&lt;br /&gt;
SIN and GAUSS fields.  Notice that the electric field correspond to &amp;lt;math&amp;gt;E(t) = -E_{amp} a&#039;(t)&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The field amplitude (intensity) and versor are not required because it will be read from the Yambo input&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; only linear polarized external field can generated with YamboPY (to be generlized)&lt;br /&gt;
&lt;br /&gt;
=== Generate external field with ypp_rt ===&lt;br /&gt;
With &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; one can generate all external fields that implemented in the Yambo code in the file &amp;lt;code&amp;gt;src/modules/mod_fields.F&amp;lt;/code&amp;gt;. This can be usefull to visualize external fields used in Yambo without the need of running a real simulation. However if you want to add a new external field you have to code it in the file &amp;lt;code&amp;gt;src/modules/mod_fields.F&amp;lt;/code&amp;gt;. The command to generate external field on file is: &amp;lt;code&amp;gt;ypp_rt -rtplot f&amp;lt;/code&amp;gt;. This will generate the following input file:&lt;br /&gt;
&lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 RTfields                         # [R] Analize time-dependent fields&lt;br /&gt;
 TimeStep= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.6666667 &amp;lt;/span&amp;gt;         as    # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 |100.000000 | &amp;lt;/span&amp;gt;        fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 ChirpFac= 0.000000         fs    # Prefactor for linear chirping in frequency space&lt;br /&gt;
 Field1_Freq= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;2.000000 &amp;lt;/span&amp;gt;     eV    # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int= 1000.000000       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SIN&amp;lt;/span&amp;gt;&amp;quot;              # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field1_pol= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;linear&amp;lt;/span&amp;gt;&amp;quot;               # [RT Field1] Pol(linear|circular)&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
 1.000000 | 0.000000 | 0.000000 |       # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 Field1_Tstart= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.010000&amp;lt;/span&amp;gt;   fs    # [RT Field1] Initial Time&lt;br /&gt;
In the input file you have to specify a series of parameters, in red: the time step (&amp;lt;code&amp;gt;TimeSpep&amp;lt;/code&amp;gt;), the time range (&amp;lt;code&amp;gt;TimeRange&amp;lt;/code&amp;gt;), the field kind (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;), its parameters (&amp;lt;code&amp;gt;Field1_Width&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Field1_Freq&amp;lt;/code&amp;gt;, etc...) and finally the starting time (&amp;lt;code&amp;gt;Field1_Tstart&amp;lt;/code&amp;gt;), usually the first step of the dynamics. &amp;lt;br&amp;gt; Notice that Field direction (&amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt;) field intensity (&amp;lt;code&amp;gt;Field1_Int&amp;lt;/code&amp;gt;) are not used in the external field generation but read from Yambo input.&amp;lt;br&amp;gt;&lt;br /&gt;
Then you run &amp;lt;code&amp;gt;ypp_rt&amp;lt;/code&amp;gt; with this input and it will produce a series of files:  &amp;lt;code&amp;gt;YPP_EXTFIELD1_P1.time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;YPP_EXTFIELD1_P2.time&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;YPP_EXTFIELD1_P1.freq&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;YPP_EXTFIELD1_P2.freq&amp;lt;/code&amp;gt;&amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These files contain the external field and its Fourier transform. In the next section we will see how to use them in real-time dynamics.&lt;br /&gt;
&lt;br /&gt;
== Use generated external field with yambo_rt/yambo_nl ==&lt;br /&gt;
In yambo_rt/yambo_nl you can tell to the code to read an external field from file. For example in yambo_nl you generate your input wil the command &amp;lt;code&amp;gt;yambo_nl -u p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&lt;br /&gt;
  7 |  10 |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLstep= 10.0       as&amp;lt;/span&amp;gt;    # [NL] Real Time step length&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLtime=120.000000&amp;lt;/span&amp;gt;           fs    # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;INVINT&amp;quot;           # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;IPA&amp;quot;             # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX/LSEX/LHF&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative RADLifeTime=Phase_LifeTime)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 HARRLvcs= 11529            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 11529            RL    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 11529            RL    # [GW] Correlation RL components&lt;br /&gt;
 Field1_Freq= 0.100000      eV    # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000.00  &amp;lt;/span&amp;gt;     kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Field1_kind= &amp;quot;FROM_FILE ./YPP_EXTFIELD1_P1.time&amp;quot;&amp;lt;/span&amp;gt; # [RT Field1] Kind(SIN|COS|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;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1.000000 | 0.000000 | 0.000000 |  &amp;lt;/span&amp;gt;      # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
You have to specify the file kind &amp;lt;code&amp;gt;FROM_FILE&amp;lt;/code&amp;gt; and give the path of the file containing the external field. Do not forget also to use the same &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; and  in the &amp;lt;code&amp;gt;ypp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; inputs. Notice that field intensity and field versor is specified in the &amp;lt;code&amp;gt;Yambo&amp;lt;/code&amp;gt; input only.&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; in the simulation can be larger then the one used in the external field generation, the code will assume that field that after a given time the field is zero.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;sangalli&amp;quot; &amp;gt;D. Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://arxiv.org/pdf/2106.03592 Phys. Rev. Materials 5, 083803, (2021)]. &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Lumen_release_notes&amp;diff=997</id>
		<title>Lumen release notes</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_release_notes&amp;diff=997"/>
		<updated>2026-07-06T13:29:03Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Lumen Releases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the list of the releases of the lumen code.&lt;br /&gt;
&lt;br /&gt;
Starting from version 2.0, the release notes are available in a dedicated page on the wiki, while the source code is available on gitlab. &lt;br /&gt;
&lt;br /&gt;
== Lumen Releases ==&lt;br /&gt;
&lt;br /&gt;
* Lumen 2.1: [[Lumen 2.1|Release Notes]]&lt;br /&gt;
** [https://gitlab.com/lumen-code/lumen/-/releases/2.1.0 Version 2.1.0] (06/07/2026)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Lumen 2.0: [[Lumen 2.0|Release Notes]]&lt;br /&gt;
** [https://gitlab.com/lumen-code/lumen/-/releases/2.0.1 Version 2.0.1] (29/01/2026); [https://zenodo.org/records/20121198 Zenodo 20121198]&lt;br /&gt;
** [https://gitlab.com/lumen-code/lumen/-/releases/2.0.0 Version 2.0.0] (04/12/2025);&lt;br /&gt;
&lt;br /&gt;
== Previous versions ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.attaccalite.com/lumen/ Lumen 1.X] (2018)&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Lumen_release_notes&amp;diff=996</id>
		<title>Lumen release notes</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_release_notes&amp;diff=996"/>
		<updated>2026-07-06T13:26:00Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Lumen Releases */  tag 2.1.0 created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the list of the releases of the lumen code.&lt;br /&gt;
&lt;br /&gt;
Starting from version 2.0, the release notes are available in a dedicated page on the wiki, while the source code is available on gitlab. &lt;br /&gt;
&lt;br /&gt;
== Lumen Releases ==&lt;br /&gt;
&lt;br /&gt;
* Lumen 2.1: [[Lumen 2.1|Release Notes]]&lt;br /&gt;
** [https://gitlab.com/lumen-code/lumen/-/releases/2.1.0 Tag 2.1.0] (06/07/2026)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Lumen 2.0: [[Lumen 2.0|Release Notes]]&lt;br /&gt;
** [https://gitlab.com/lumen-code/lumen/-/releases/2.0.1 Tag 2.0.1] (29/01/2026); [https://zenodo.org/records/20121198 Zenodo 20121198]&lt;br /&gt;
** [https://gitlab.com/lumen-code/lumen/-/releases/2.0.0 Tag 2.0.0] (04/12/2025);&lt;br /&gt;
&lt;br /&gt;
== Previous versions ==&lt;br /&gt;
&lt;br /&gt;
* [https://www.attaccalite.com/lumen/ Lumen 1.X] (2018)&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=992</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=992"/>
		<updated>2026-06-24T06:18:33Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Electron-phonon and exciton-phonon coupling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic ==&lt;br /&gt;
* [[First steps: a walk through from DFT to optical properties]] (modular tutorial) &lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)|GW on h-BN]] (standalone version);  [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW on h-BN]] (modular version) &lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[BSE tutorial on hBN standalone|BSE on h-BN]] (standalone version); [[BSE tutorial on hBN|BSE on h-BN]] (modular version); &lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials on GW and Quasi-particles ==&lt;br /&gt;
* [[Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW parallel strategies|GW parallel strategies v1]]; [[GW parallel strategies CECAM|GW parallel strategies v2]];  [[Pushing convergence in parallel|GW convergence in parallel]] (modular tutorials)&lt;br /&gt;
* [[GW tutorial on HPC]] (external tutorial on HackMD)&lt;br /&gt;
* [[Quasi-particles and Self-energy within the Multipole Approximation (MPA)]]&lt;br /&gt;
* [http://www.attaccalite.com/gw-correction-on-an-arbitrary-point-of-the-brillouin-zone GW on arbitrary k point] (external tutorial on www.attaccalite.com)&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials Linear response and BSE ==&lt;br /&gt;
=== Optical properties and more in extended systems ===&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
* [[The magneto-optical Kerr effect|The magneto-optical Kerr effect in bulk iron, RPA]]&lt;br /&gt;
* [[The magneto-optical Kerr effect including excitonic effects|The magneto-optical Kerr effect in XXX, excitonic effects]] (todo)&lt;br /&gt;
* [[Magneto-electric reponse]]&lt;br /&gt;
* [[Magnons with BSE formalism]] (todo)&lt;br /&gt;
* [[Bands selection in BSE and application to semi-core states]] (todo)&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Fast convergence of dielectric constant with double grid]]&lt;br /&gt;
=== Optical properties and more in lower dimensional systems (1D/2D) ===&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]] (1D)&lt;br /&gt;
* [[Si wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&lt;br /&gt;
* [[Si Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
&lt;br /&gt;
=== Optical properties and more in molecules ===&lt;br /&gt;
* [[H2|H2 molecule: Linear Response &amp;amp; TDDFT (0D)]] (to restore from old version)&lt;br /&gt;
* [[SiH4|SiH4: isolated molecule TDDFT &amp;amp; BSE (0D)]] (restored from old version, still to be finalized)&lt;br /&gt;
* [[Dichroism in molecules]]&lt;br /&gt;
&lt;br /&gt;
== Post Processing with ypp and YamboPy ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
* [[First steps in YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon and exciton-phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling (old tutorial)]]&lt;br /&gt;
* [[Electron Phonon Coupling (new)]]&lt;br /&gt;
* [[Electron and exciton life-time]]&lt;br /&gt;
* [[Optical properties at finite temperature]]&lt;br /&gt;
* [[Phonon-assisted luminescence by finite atomic displacements]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence hBN]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Real time propagation ==&lt;br /&gt;
&lt;br /&gt;
=== Linear response from real time propagation ===&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response using the density matrix (IP)]]&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase|Linear response using wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response in velocity gauge|Linear response using wave-functions in velocity gauge (IP)]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Linear response using the density matrix (TD-HSEX)]]&lt;br /&gt;
* [[Linear response from real time simulations|Linear response from real time simulations (IP &amp;amp; TD-HSEX)]] (modular tutorial)&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response from real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real time approach to non-linear response (SHG)]]&lt;br /&gt;
* [[Correlation effects in the non-linear response]]&lt;br /&gt;
* [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [[Spin-orbit coupling and non-linear response]]&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]]&lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response in Floquet formulation ===&lt;br /&gt;
* [[SHG from Floquet formulation]]&lt;br /&gt;
=== Pump and Probe experiments ===&lt;br /&gt;
&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon|Pump and Probe: Transient Absorption from BSE with NEQ occupations]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption from real time propagation with pump and probe]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES|Pump and Probe: Time resolved ARPES from real time propagation with pump]]&lt;br /&gt;
&lt;br /&gt;
=== More on real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real-time dynamics with external field read from file]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Developing Lumen ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Main_Page&amp;diff=991</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Main_Page&amp;diff=991"/>
		<updated>2026-06-24T06:17:52Z</updated>

		<summary type="html">&lt;p&gt;Davide: Removed link to unesed page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;Lumen wiki&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Installation]]&lt;br /&gt;
* [[Tutorials]]&lt;br /&gt;
* [https://enccs.github.io/max-coe-workshop/day5-tutorials/ Yambo tutorials on Markdown]&lt;br /&gt;
* [[Lumen release notes|Lumen Releases]]&lt;br /&gt;
* [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy YamboPy]&lt;br /&gt;
* [https://www.lumen-code.org/ford/index.html Ford documentation]&lt;br /&gt;
* [[Test-suite]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Internal_wiki&amp;diff=990</id>
		<title>Internal wiki</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Internal_wiki&amp;diff=990"/>
		<updated>2026-06-24T06:15:31Z</updated>

		<summary type="html">&lt;p&gt;Davide: Page made empty, links moved somewhere else&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=989</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Tutorials&amp;diff=989"/>
		<updated>2026-06-24T06:14:37Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Electron-phonon and exciton-phonon coupling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic ==&lt;br /&gt;
* [[First steps: a walk through from DFT to optical properties]] (modular tutorial) &lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)|GW on h-BN]] (standalone version);  [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW on h-BN]] (modular version) &lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[BSE tutorial on hBN standalone|BSE on h-BN]] (standalone version); [[BSE tutorial on hBN|BSE on h-BN]] (modular version); &lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials on GW and Quasi-particles ==&lt;br /&gt;
* [[Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW parallel strategies|GW parallel strategies v1]]; [[GW parallel strategies CECAM|GW parallel strategies v2]];  [[Pushing convergence in parallel|GW convergence in parallel]] (modular tutorials)&lt;br /&gt;
* [[GW tutorial on HPC]] (external tutorial on HackMD)&lt;br /&gt;
* [[Quasi-particles and Self-energy within the Multipole Approximation (MPA)]]&lt;br /&gt;
* [http://www.attaccalite.com/gw-correction-on-an-arbitrary-point-of-the-brillouin-zone GW on arbitrary k point] (external tutorial on www.attaccalite.com)&lt;br /&gt;
&lt;br /&gt;
== Advanced tutorials Linear response and BSE ==&lt;br /&gt;
=== Optical properties and more in extended systems ===&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
* [[The magneto-optical Kerr effect|The magneto-optical Kerr effect in bulk iron, RPA]]&lt;br /&gt;
* [[The magneto-optical Kerr effect including excitonic effects|The magneto-optical Kerr effect in XXX, excitonic effects]] (todo)&lt;br /&gt;
* [[Magneto-electric reponse]]&lt;br /&gt;
* [[Magnons with BSE formalism]] (todo)&lt;br /&gt;
* [[Bands selection in BSE and application to semi-core states]] (todo)&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Fast convergence of dielectric constant with double grid]]&lt;br /&gt;
=== Optical properties and more in lower dimensional systems (1D/2D) ===&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]] (1D)&lt;br /&gt;
* [[Si wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&lt;br /&gt;
* [[Si Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
&lt;br /&gt;
=== Optical properties and more in molecules ===&lt;br /&gt;
* [[H2|H2 molecule: Linear Response &amp;amp; TDDFT (0D)]] (to restore from old version)&lt;br /&gt;
* [[SiH4|SiH4: isolated molecule TDDFT &amp;amp; BSE (0D)]] (restored from old version, still to be finalized)&lt;br /&gt;
* [[Dichroism in molecules]]&lt;br /&gt;
&lt;br /&gt;
== Post Processing with ypp and YamboPy ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
* [[First steps in YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Electron-phonon and exciton-phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling (old tutorial)]]&lt;br /&gt;
* [[Electron Phonon Coupling (new)]]&lt;br /&gt;
* [[Electron_and_exciton_life-time]]&lt;br /&gt;
* [[Optical properties at finite temperature]]&lt;br /&gt;
* [[Phonon-assisted luminescence by finite atomic displacements]]&lt;br /&gt;
* [[Exciton-phonon_coupling_and_luminescence_hBN]]&lt;br /&gt;
* [[Exciton-phonon coupling and luminescence]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Real time propagation ==&lt;br /&gt;
&lt;br /&gt;
=== Linear response from real time propagation ===&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response using the density matrix (IP)]]&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase|Linear response using wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response in velocity gauge|Linear response using wave-functions in velocity gauge (IP)]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Linear response using the density matrix (TD-HSEX)]]&lt;br /&gt;
* [[Linear response from real time simulations|Linear response from real time simulations (IP &amp;amp; TD-HSEX)]] (modular tutorial)&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response from real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real time approach to non-linear response (SHG)]]&lt;br /&gt;
* [[Correlation effects in the non-linear response]]&lt;br /&gt;
* [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [[Spin-orbit coupling and non-linear response]]&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]]&lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
&lt;br /&gt;
=== Non-linear response in Floquet formulation ===&lt;br /&gt;
* [[SHG from Floquet formulation]]&lt;br /&gt;
=== Pump and Probe experiments ===&lt;br /&gt;
&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon|Pump and Probe: Transient Absorption from BSE with NEQ occupations]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption from real time propagation with pump and probe]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES|Pump and Probe: Time resolved ARPES from real time propagation with pump]]&lt;br /&gt;
&lt;br /&gt;
=== More on real time propagation ===&lt;br /&gt;
&lt;br /&gt;
* [[Real-time dynamics with external field read from file]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Developing Lumen ==&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Configure_library_externally&amp;diff=988</id>
		<title>Configure library externally</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Configure_library_externally&amp;diff=988"/>
		<updated>2026-06-21T21:45:08Z</updated>

		<summary type="html">&lt;p&gt;Davide: removed extra newline&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== In this page we explain how to configure HDF5 and NetCDFc and NetCDF-Fortran ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gfortran Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 export INSTALL_DIR={your installation directory}&lt;br /&gt;
&lt;br /&gt;
Configuration of HDF5 1.14.6 with gfortran:&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --enable-fortran --disable-shared --enable-static --without-pic --disable-cxx --enable-parallel  CC=mpicc CPP=&amp;quot;mpicc -E&amp;quot; CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot;  FC=mpif90 --enable-build-mode=production&lt;br /&gt;
&lt;br /&gt;
Configure NetCDFC-4.9.0 with gfortran&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --without-pic --enable-static --disable-shared --disable-dap --enable-netcdf-4 CC=gcc CPP=&amp;quot;gcc -E&amp;quot; CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; FC=mpif90 CPPFLAGS=&amp;quot;-DpgiFortran -I${INSTALLDIR}&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR} -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5&amp;quot; F77=mpif90 LDFLAGS=&amp;quot;-Wl,--copy-dt-needed-entries&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Configure NetCDF-fortran 4.6.2 with gfortran&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --libdir=&amp;quot;${INSTALL_DIR}/lib&amp;quot; --without-pic --enable-static --disable-shared CC=gcc CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; CPP=&amp;quot;mpif90 -E&amp;quot; FC=mpif90 CPPFLAGS=&amp;quot;-DpgiFortran -I${INSTALLDIR}/include&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR}/lib/ -lnetcdf -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -hdf5&amp;quot; F77=mpif90&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Intel ONEAPI Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 export INSTALLDIR={your installation directory}&lt;br /&gt;
&lt;br /&gt;
Configuration of HDF5 1.14.6 with intel:&lt;br /&gt;
&lt;br /&gt;
 /configure --prefix=${INSTALL_DIR} --enable-fortran --enable-parallel CC=mpiicx CPP=&amp;quot;mpiicx -E&amp;quot; FC=mpiifx --enable-build-mode=production --enable-fortran --disable-shared --enable-static --without-pic --disable-cxx&lt;br /&gt;
&lt;br /&gt;
Configure NetCDFC-4.9.0 with intel&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --without-pic --enable-static --disable-shared --disable-dap --disable-libxml2 --enable-netcdf-4  CC=mpiicx CPP=&amp;quot;mpiicx -E&amp;quot; CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; FC=mpiifort CPPFLAGS=&amp;quot;-DpgiFortran -I${INSTALL_DIR}/include&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR}/lib  -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5&amp;quot; F77=mpiifx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configure NetCDF-fortran 4.6.2 with intel&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --libdir=/home/attacc/local_intel/lib --without-pic --enable-static --disable-shared CC=mpiicx CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; CPP=&amp;quot;mpiicx -E&amp;quot; FC=mpiifx CPPFLAGS=&amp;quot;-DpgiFortran -I ${INSTALL_DIR}/include&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR}/lib/ -lnetcdf -lhdf5hl_fortran -lhdf5_fortran  -lhdf5_hl -lhdf5&amp;quot; F77=mpiifx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Linking libraries to Lumen&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 ./configure  --with-netcdf-path=&amp;quot;${INSTALL_DIR}&amp;quot; --with-netcdff-path=&amp;quot;${INSTALL_DIR}&amp;quot; --with-hdf5-path=&amp;quot;${INSTALL_DIR}&amp;quot;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Configure_library_externally&amp;diff=987</id>
		<title>Configure library externally</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Configure_library_externally&amp;diff=987"/>
		<updated>2026-06-21T21:44:35Z</updated>

		<summary type="html">&lt;p&gt;Davide: Style improved&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== In this page we explain how to configure HDF5 and NetCDFc and NetCDF-Fortran ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gfortran Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 export INSTALL_DIR={your installation directory}&lt;br /&gt;
&lt;br /&gt;
Configuration of HDF5 1.14.6 with gfortran:&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --enable-fortran --disable-shared --enable-static --without-pic --disable-cxx --enable-parallel  CC=mpicc CPP=&amp;quot;mpicc -E&amp;quot; CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot;  FC=mpif90 --enable-build-mode=production&lt;br /&gt;
&lt;br /&gt;
Configure NetCDFC-4.9.0 with gfortran&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --without-pic --enable-static --disable-shared --disable-dap --enable-netcdf-4 CC=gcc CPP=&amp;quot;gcc -E&amp;quot; CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; FC=mpif90 CPPFLAGS=&amp;quot;-DpgiFortran -I${INSTALLDIR}&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR} -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5&amp;quot; F77=mpif90 LDFLAGS=&amp;quot;-Wl,--copy-dt-needed-entries&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Configure NetCDF-fortran 4.6.2 with gfortran&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --libdir=&amp;quot;${INSTALL_DIR}/lib&amp;quot; --without-pic --enable-static --disable-shared CC=gcc CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; CPP=&amp;quot;mpif90 -E&amp;quot; FC=mpif90 CPPFLAGS=&amp;quot;-DpgiFortran&lt;br /&gt;
-I${INSTALLDIR}/include&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR}/lib/ -lnetcdf -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -hdf5&amp;quot; F77=mpif90&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Intel ONEAPI Installation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 export INSTALLDIR={your installation directory}&lt;br /&gt;
&lt;br /&gt;
Configuration of HDF5 1.14.6 with intel:&lt;br /&gt;
&lt;br /&gt;
 /configure --prefix=${INSTALL_DIR} --enable-fortran --enable-parallel CC=mpiicx CPP=&amp;quot;mpiicx -E&amp;quot; FC=mpiifx --enable-build-mode=production --enable-fortran --disable-shared --enable-static --without-pic --disable-cxx&lt;br /&gt;
&lt;br /&gt;
Configure NetCDFC-4.9.0 with intel&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --without-pic --enable-static --disable-shared --disable-dap --disable-libxml2 --enable-netcdf-4  CC=mpiicx CPP=&amp;quot;mpiicx -E&amp;quot; CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; FC=mpiifort CPPFLAGS=&amp;quot;-DpgiFortran -I${INSTALL_DIR}/include&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR}/lib  -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5&amp;quot; F77=mpiifx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configure NetCDF-fortran 4.6.2 with intel&lt;br /&gt;
&lt;br /&gt;
 ./configure --prefix=${INSTALL_DIR} --libdir=/home/attacc/local_intel/lib --without-pic --enable-static --disable-shared CC=mpiicx CFLAGS=&amp;quot;-O2 -std=gnu99 -D_C_US -D_FORTRAN_US&amp;quot; CPP=&amp;quot;mpiicx -E&amp;quot; FC=mpiifx CPPFLAGS=&amp;quot;-DpgiFortran -I ${INSTALL_DIR}/include&amp;quot; LIBS=&amp;quot;-L${INSTALL_DIR}/lib/ -lnetcdf -lhdf5hl_fortran -lhdf5_fortran  -lhdf5_hl -lhdf5&amp;quot; F77=mpiifx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Linking libraries to Lumen&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 ./configure  --with-netcdf-path=&amp;quot;${INSTALL_DIR}&amp;quot; --with-netcdff-path=&amp;quot;${INSTALL_DIR}&amp;quot; --with-hdf5-path=&amp;quot;${INSTALL_DIR}&amp;quot;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=986</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=986"/>
		<updated>2026-06-21T21:42:37Z</updated>

		<summary type="html">&lt;p&gt;Davide: moved here link from main page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this page we explain how to install Lumen on different machine with different compiler and configurations.&lt;br /&gt;
&lt;br /&gt;
===General installations===&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint]]&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint with Intel compiler]]&lt;br /&gt;
* [[Install Lumen on Ubuntu/LinuxMint with NVfortran compiler]]&lt;br /&gt;
* [[Install Lumenon MacOS (ARM)]]&lt;br /&gt;
* [[Install Lumen on a Debian machine with some libraries provided via modules]]&lt;br /&gt;
* [[Install Lumen on MacOsX (from Yuncheng Mao)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Libraries===&lt;br /&gt;
* [[Compile the libraries in Lumen independently]]&lt;br /&gt;
* [[Configure library externally]] (this seems a duplicate of the previous one, to check)&lt;br /&gt;
* [[Install Lumen with external HDF5 and NetCDF libraries]]&lt;br /&gt;
* [[Install Lumen with external chase libraries|Install Lumen with external ChASE libraries]]&lt;br /&gt;
* [[Install Lumen with external slepc and petsc libraries|Install Lumen with external Slepc and Petsc libraries]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Installations on specific machines===&lt;br /&gt;
* [[Install Lumen Claudia cluster in Marseille|Install Lumen on Claudia cluster (Marseille]])&lt;br /&gt;
* [[Install Lumen on Mesocentre (Marseille)]]&lt;br /&gt;
* [[Install Lumen on IRENE machine  (TGCC Joliot Curie)]]&lt;br /&gt;
* [[Install Lumen on ISM cluster (Rome)]]&lt;br /&gt;
* [[Install Lumen on Leonardo|Install Lumen on Leonardo (Cineca, Bologna)]]&lt;br /&gt;
* [[Install Lumen on Tirant|Install Lumen/LetzElPhC/Yambopy on Tirant (Univ. of Valencia Cluster)]]&lt;br /&gt;
* [[Install Lumen/LetzElPhC/Yambopy on Lynx(Univ. of Valencia)| Install Lumen on Lynx (Univ. of Valencia Cluster)]]&lt;br /&gt;
* [[Install Lumen on Viper (MPCDF, Munich)]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Main_Page&amp;diff=985</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Main_Page&amp;diff=985"/>
		<updated>2026-06-21T21:41:33Z</updated>

		<summary type="html">&lt;p&gt;Davide: Link moved under installation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;Lumen wiki&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Installation]]&lt;br /&gt;
* [[Tutorials]]&amp;lt;nowiki/&amp;gt;&lt;br /&gt;
* [https://enccs.github.io/max-coe-workshop/day5-tutorials/ Yambo tutorials on Markdown]&lt;br /&gt;
* [[Lumen release notes|Lumen Releases]]&lt;br /&gt;
* [https://wiki.yambo-code.eu/wiki/index.php?title=First_steps_in_Yambopy YamboPy]&lt;br /&gt;
* [https://www.lumen-code.org/ford/index.html Ford documentation]&lt;br /&gt;
* [[Internal wiki]]&lt;br /&gt;
* [[Test-suite]]&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
</feed>