<?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-08-27T01:19:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<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>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=984</id>
		<title>Lumen 2.1</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=984"/>
		<updated>2026-06-16T11:26:30Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Times_logo_red.png|right|thumb|250px|TIMES logo red|Lumen 2.1 release was supported by the EU through the [https://times.uv.es/ TIMES MSCA-DN]]]&lt;br /&gt;
&lt;br /&gt;
==Release Notes==&lt;br /&gt;
&lt;br /&gt;
This is the second release of the lumen code, after the reboot based on yambo 5.3. A Partial sync with branch 5.4 of the yambo code was done.&lt;br /&gt;
&lt;br /&gt;
===Main new features===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Non-linear response with the Floquet formalism:&amp;lt;/u&amp;gt; in Lumen 2.1 it is possible to calculate non-linear response functions using Floquet formalism, &amp;lt;br&amp;gt; for the moment this implementation is limited to the independent particle approximation with or without quasi-particle correction. &amp;lt;br&amp;gt;Tutorial: [[SHG from Floquet formulation]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton symmetries&amp;lt;/u&amp;gt;: Lumen 2.1 is now able to detect the point group of the system based on the list of symmetry operations. It is then possible to compute exciton symmetries via ypp after solving BSE with diagonalization solver. &amp;lt;br&amp;gt;Tutorials: [[LiF#Detection of excitons symmetries (requires lumen 2.1 or better)| Excitons symmetries in LiF]]; [[How to analyse excitons#Detection of excitons symmetries (requires lumen 2.1 or better)| Excitons symmetries in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
* Exciton radiative lifetimes: old implementation of exciton radiative lifetimes in ypp has been recovered.&lt;br /&gt;
* Excitonic TR-ARPES: with ypp it is possible to compute TR-ARPES from BSE post-processing&lt;br /&gt;
* Exciton-exciton transitions: with ypp it is possible to compute exciton-exciton transitions from BSE post-processing&lt;br /&gt;
* Coded symmetry average of the dielectric constant for q=0 momentum &lt;br /&gt;
* Added interface to the [https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_with_external_chase_libraries CHASE library] as [[BSE solvers overview|BSE solver]]&lt;br /&gt;
* In spin polarized systems, it is now possible to get the contribution of a given spin-channel to absorption&lt;br /&gt;
* Added Gaussian smearing for the phonon-assisted response functions&lt;br /&gt;
* Added preliminary support for system with non-symmorphic symmetry operations. At present the database conversion can be done, and later the non-symmorphic symmetry operation can be removed via ypp&lt;br /&gt;
* Added support to Covariant dipoles in shifted grids with multiple shifts&lt;br /&gt;
* Plotting of exciton wave-function: it is now possible to plot both fixed electron and fixed hole case. Moreover it is possible to plot the coefficients of the excitonic WF in k-space. File bxsf is produced.&lt;br /&gt;
&lt;br /&gt;
===Code optimization===&lt;br /&gt;
* Memory is now distributed in the old diagonalization solver (without using the ldiago library) interfaced with scalapack&lt;br /&gt;
* Fixed memory duplication in Slepc solver&lt;br /&gt;
* I/O in BSE can now be controlled by input as none/low/medium/high&lt;br /&gt;
&lt;br /&gt;
===Fixes===&lt;br /&gt;
&lt;br /&gt;
* Fixed compilation on MacOsX&lt;br /&gt;
* Fixed reading imaginary part from ndb.QP in yambo_nl&lt;br /&gt;
* Different compilation issues fixed: with intel compilers, hdf5, openACC, etc....&lt;br /&gt;
* Collisions table: added missing n_sp_pol variable&lt;br /&gt;
&lt;br /&gt;
===More===&lt;br /&gt;
* added support to llvm compiler&lt;br /&gt;
* upgraded internal version of the following libraries: libxc, slepc, petsc, devxlib &lt;br /&gt;
* upgraded interface with libxc to work with version 7.0, and to handle different versions (with different API)&lt;br /&gt;
* upgraded interface with slepc/petsc to handle different versions (with different API)&lt;br /&gt;
* ExcPh databases now can be loaded also if requested band ranges is smaller than available one&lt;br /&gt;
* support for BSE with frozen states improved&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=983</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=983"/>
		<updated>2026-06-16T11:23:39Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
Diagonalization of the full Hamiltonian can be done in serial, using the standard LAPACK library. Also, it is possible to do full diagonalization asking only for a subset of eigenvalues of eigenvectors.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell). However, thanks to modern libraries like scalapack and ELPA, it is nowadays possible to fully diagonalize very large BSE matrices exploiting MPI and GPUs&amp;lt;ref name=&amp;quot;Milev2025&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Lumen we have two working interfaces with Scalapack and one with ELPA. The modern one, which requires the interface with the [https://gitlab.com/lumen-code/Ldiago ldiago library] developed by M. Nalabothula, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;d&amp;quot;&lt;br /&gt;
The old one, which was recently revised to include memory distribution, but it is still significantly less efficient, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;o&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial doing full diagonalization can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial using Haydock can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This solver is also compatible with the double-grid&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot; /&amp;gt;, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot; /&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the slepc solver, you need to link the code with Slepc and Petsc library.&lt;br /&gt;
See here for more info: [Install Lumen with external slepc and petsc libraries].&lt;br /&gt;
&lt;br /&gt;
An example of tutorial using Slepc can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;c&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the chase solver, you need to link the code with the ChASE library.&lt;br /&gt;
See here for more info: [Install Lumen with external chase libraries].&lt;br /&gt;
&lt;br /&gt;
TODO: add a tutorial and few more info&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
The inversion solver was designed to invert the Dyson equation frequency by frequency. For each frequency the inversion (which can be done with Lapack) has roughly the same cost of a diagonalization. Needing to do so for every frequency, this solver easily becomes very expensive. It was designed to deal with frequency dependent kernel, and also extended with an old implementation of the double-grid see Ref.&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; /&amp;gt;. However, it is not used much anymore.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;i&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
A first summary about, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Below some performances on the performance of the solvers able to extract the eigenvectors on two BSE matrices:&lt;br /&gt;
* Matrix of size 25920 x 25920 (5,006 GB), Requested eigenvalues: 500, runs on 72 CPU (3 nodesx24 cores), BLACS 8x9  &lt;br /&gt;
* Matrix of size 61440 x 61440 (28,125 GB). Requested eigenvalues: 500. Runs on 100 CPU (4 nodesx25 cores, 500 GB), BLACS 10x10  &lt;br /&gt;
&lt;br /&gt;
 Solver :    Slepc    -   Chase      - Ldiago(ELPA2) - Ldiago(ELPA1) - Ldiago(heevr) - Odiago(heevx)&lt;br /&gt;
 25920  :  104.7396s  -  127.4608s   -    53.8467s   -   212.3914s   -   240.1606s   -   1045.s&lt;br /&gt;
 61440  :  499.0757s  -  497.0590s   -   361.0130s   -     1269.s    -     2134.s    -  12660.s&lt;br /&gt;
&lt;br /&gt;
As you can see, the new interface with diagonalization library (Ldiago) using ELPA2 solver on CPU (unfortunately ELPA2 is not GPU ported) is even more efficient that iterative solvers like Slepc and Chase. However, it has a larger memory footprint (peak memory is about 6 times the BSE matrix).&lt;br /&gt;
The timing of the Haydock solver is not reported, but it remains the fastest method.&lt;br /&gt;
&lt;br /&gt;
More info about the performances of different solvers can be found in this Merge Request:&lt;br /&gt;
[https://gitlab.com/lumen-code/lumen/-/merge_requests/304#note_3161882534 Performances of BSE solvers] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&lt;br /&gt;
&lt;br /&gt;
=References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;&amp;gt;R. Haydock, &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot;&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; &amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot;&amp;gt;I.M. Alliati, D. Sangalli, M. Gruning, &#039;&#039;Double k-Grid Method for Solving the Bethe-Salpeter Equation via Lanczos Approaches&#039;&#039;, [https://www.frontiersin.org/journals/chemistry/articles/10.3389/fchem.2021.763946/full Frontiers in Chemistry, &#039;&#039;&#039;9&#039;&#039;&#039;, p.763946 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Milev2025&amp;quot;&amp;gt;P. Milev, et al. TO FIX&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=BSE_solvers_overview&amp;diff=982</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=982"/>
		<updated>2026-06-16T11:21:43Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Full diagonalization solver (-y d) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
Diagonalization of the full Hamiltonian can be done in serial, using the standard LAPACK library. Also, it is possible to do full diagonalization asking only for a subset of eigenvalues of eigenvectors.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell). However, thanks to modern libraries like scalapack and ELPA, it is nowadays possible to fully diagonalize very large BSE matrices exploiting MPI and GPUs&amp;lt;ref name=&amp;quot;Milev2025&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In Lumen we have two working interfaces with Scalapack and one with ELPA. The modern one, which requires the interface with the [https://gitlab.com/lumen-code/Ldiago ldiago library] developed by M. Nalabothula, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;d&amp;quot;&lt;br /&gt;
The old one, which was recently revised to include memory distribution, but it is still significantly less efficient, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;o&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial doing full diagonalization can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial using Haydock can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This solver is also compatible with the double-grid&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot; /&amp;gt;, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot; /&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the slepc solver, you need to link the code with Slepc and Petsc library.&lt;br /&gt;
See here for more info: [Install Lumen with external slepc and petsc libraries].&lt;br /&gt;
&lt;br /&gt;
An example of tutorial using Slepc can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;c&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the chase solver, you need to link the code with the ChASE library.&lt;br /&gt;
See here for more info: [Install Lumen with external chase libraries].&lt;br /&gt;
&lt;br /&gt;
TODO: add a tutorial and few more info&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
The inversion solver was designed to invert the Dyson equation frequency by frequency. For each frequency the inversion (which can be done with Lapack) has roughly the same cost of a diagonalization. Needing to do so for every frequency, this solver easily becomes very expensive. It was designed to deal with frequency dependent kernel, and also extended with an old implementation of the double-grid see Ref.&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; /&amp;gt;. However, it is not used much anymore.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;i&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
A first summary about, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Also some performances on the performance of solvers able to extract the eigenvectors on a matrix of size 61440 x 61440 (28,125 GB). Requested eigenvalues: 500. Runs on 100 CPU (4 nodesx25 cores, 500 GB), BLACS 10x10  &lt;br /&gt;
&lt;br /&gt;
 Solver :    Slepc    -   Chase      - Ldiago(ELPA2) - Ldiago(ELPA1) - Ldiago(heevr) - Odiago(heevx)&lt;br /&gt;
 25920  :  104.7396s  -  127.4608s   -    53.8467s   -   212.3914s   -   240.1606s   -   1045.s&lt;br /&gt;
 61440  :  499.0757s  -  497.0590s   -   361.0130s   -     1269.s    -     2134.s    -  12660.s&lt;br /&gt;
&lt;br /&gt;
As you can see, the new interface with diagonalization library (Ldiago) using ELPA2 solver on CPU (unfortunately ELPA2 is not GPU ported) is even more efficient that iterative solvers like Slepc and Chase. However, it has a larger memory footprint (peak memory is about 6 times the BSE matrix).&lt;br /&gt;
The timing of the Haydock solver is not reported, but it remains the fastest method.&lt;br /&gt;
&lt;br /&gt;
More info about the performances of different solvers can be found in this Merge Request:&lt;br /&gt;
[https://gitlab.com/lumen-code/lumen/-/merge_requests/304#note_3161882534 Performances of BSE solvers] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&lt;br /&gt;
&lt;br /&gt;
=References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;&amp;gt;R. Haydock, &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot;&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; &amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot;&amp;gt;I.M. Alliati, D. Sangalli, M. Gruning, &#039;&#039;Double k-Grid Method for Solving the Bethe-Salpeter Equation via Lanczos Approaches&#039;&#039;, [https://www.frontiersin.org/journals/chemistry/articles/10.3389/fchem.2021.763946/full Frontiers in Chemistry, &#039;&#039;&#039;9&#039;&#039;&#039;, p.763946 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Milev2025&amp;quot;&amp;gt;P. Milev, et al. TO FIX&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=BSE_solvers_overview&amp;diff=981</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=981"/>
		<updated>2026-06-16T11:20:05Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
Diagonalization of the full Hamiltonian can be done in serial, using the standard LAPACK library. Also, it is possible to do full diagonalization asking only for a subset of eigenvalues of eigenvectors.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell). However, thanks to modern libraries like scalapack and ELPA, it is nowadays possible to fully diagonalize very large BSE matrices exploiting MPI and GPUs&amp;lt;ref name=&amp;quot;Milev2025&amp;quot; /&amp;gt;. In Lumen we have two working interfaces with Scalapack and one with ELPA. &lt;br /&gt;
&lt;br /&gt;
The modern one, which requires the interface with the ldiago library, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;d&amp;quot;&lt;br /&gt;
The old one, which was recently revised to include memory distribution, but it is still significantly less efficient, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;o&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial doing full diagonalization can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial using Haydock can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This solver is also compatible with the double-grid&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot; /&amp;gt;, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot; /&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the slepc solver, you need to link the code with Slepc and Petsc library.&lt;br /&gt;
See here for more info: [Install Lumen with external slepc and petsc libraries].&lt;br /&gt;
&lt;br /&gt;
An example of tutorial using Slepc can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;c&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the chase solver, you need to link the code with the ChASE library.&lt;br /&gt;
See here for more info: [Install Lumen with external chase libraries].&lt;br /&gt;
&lt;br /&gt;
TODO: add a tutorial and few more info&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
The inversion solver was designed to invert the Dyson equation frequency by frequency. For each frequency the inversion (which can be done with Lapack) has roughly the same cost of a diagonalization. Needing to do so for every frequency, this solver easily becomes very expensive. It was designed to deal with frequency dependent kernel, and also extended with an old implementation of the double-grid see Ref.&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; /&amp;gt;. However, it is not used much anymore.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;i&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
A first summary about, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Also some performances on the performance of solvers able to extract the eigenvectors on a matrix of size 61440 x 61440 (28,125 GB). Requested eigenvalues: 500. Runs on 100 CPU (4 nodesx25 cores, 500 GB), BLACS 10x10  &lt;br /&gt;
&lt;br /&gt;
 Solver :    Slepc    -   Chase      - Ldiago(ELPA2) - Ldiago(ELPA1) - Ldiago(heevr) - Odiago(heevx)&lt;br /&gt;
 25920  :  104.7396s  -  127.4608s   -    53.8467s   -   212.3914s   -   240.1606s   -   1045.s&lt;br /&gt;
 61440  :  499.0757s  -  497.0590s   -   361.0130s   -     1269.s    -     2134.s    -  12660.s&lt;br /&gt;
&lt;br /&gt;
As you can see, the new interface with diagonalization library (Ldiago) using ELPA2 solver on CPU (unfortunately ELPA2 is not GPU ported) is even more efficient that iterative solvers like Slepc and Chase. However, it has a larger memory footprint (peak memory is about 6 times the BSE matrix).&lt;br /&gt;
The timing of the Haydock solver is not reported, but it remains the fastest method.&lt;br /&gt;
&lt;br /&gt;
More info about the performances of different solvers can be found in this Merge Request:&lt;br /&gt;
[https://gitlab.com/lumen-code/lumen/-/merge_requests/304#note_3161882534 Performances of BSE solvers] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&lt;br /&gt;
&lt;br /&gt;
=References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;&amp;gt;R. Haydock, &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot;&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; &amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot;&amp;gt;I.M. Alliati, D. Sangalli, M. Gruning, &#039;&#039;Double k-Grid Method for Solving the Bethe-Salpeter Equation via Lanczos Approaches&#039;&#039;, [https://www.frontiersin.org/journals/chemistry/articles/10.3389/fchem.2021.763946/full Frontiers in Chemistry, &#039;&#039;&#039;9&#039;&#039;&#039;, p.763946 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Milev2025&amp;quot;&amp;gt;P. Milev, et al. TO FIX&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=BSE_solvers_overview&amp;diff=980</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=980"/>
		<updated>2026-06-16T10:44:35Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
Diagonalization of the full Hamiltonian can be done in serial, using the standard LAPACK library. Also, it is possible to do full diagonalization asking only for a subset of eigenvalues of eigenvectors.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell). However, thanks to modern libraries like scalapack and ELPA, it is nowadays possible to fully diagonalize very large BSE matrices exploiting MPI and GPUs&amp;lt;ref name=&amp;quot;Milev2025&amp;quot; /&amp;gt;. In Lumen we have two working interfaces with Scalapack and one with ELPA. &lt;br /&gt;
&lt;br /&gt;
The modern one, which requires the interface with the ldiago library, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;d&amp;quot;&lt;br /&gt;
The old one, which was recently revised to include memory distribution, but it is still significantly less efficient, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;o&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial doing full diagonalization can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial using Haydock can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This solver is also compatible with the double-grid&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot; /&amp;gt;, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot; /&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the slepc solver, you need to link the code with Slepc and Petsc library.&lt;br /&gt;
See here for more info: [Install Lumen with external slepc and petsc libraries].&lt;br /&gt;
&lt;br /&gt;
An example of tutorial using Slepc can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;c&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the chase solver, you need to link the code with the ChASE library.&lt;br /&gt;
See here for more info: [Install Lumen with external chase libraries].&lt;br /&gt;
&lt;br /&gt;
TODO: add a tutorial and few more info&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
The inversion solver was designed to invert the Dyson equation frequency by frequency. For each frequency the inversion (which can be done with Lapack) has roughly the same cost of a diagonalization. Needing to do so for every frequency, this solver easily becomes very expensive. It was designed to deal with frequency dependent kernel, and also extended with an old implementation of the double-grid see Ref.&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; /&amp;gt;. However, it is not used much anymore.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;i&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
A first summary about, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Here more info about the performances of different solvers:&lt;br /&gt;
[https://gitlab.com/lumen-code/lumen/-/merge_requests/304#note_3161882534 Performances of BSE solvers] &amp;lt;br&amp;gt;&lt;br /&gt;
As you can see, the ELPA2 solver on CPU is even more efficient that iterative solvers like Slepc and Chase&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&lt;br /&gt;
&lt;br /&gt;
=References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;&amp;gt;R. Haydock, &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot;&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; &amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot;&amp;gt;I.M. Alliati, D. Sangalli, M. Gruning, &#039;&#039;Double k-Grid Method for Solving the Bethe-Salpeter Equation via Lanczos Approaches&#039;&#039;, [https://www.frontiersin.org/journals/chemistry/articles/10.3389/fchem.2021.763946/full Frontiers in Chemistry, &#039;&#039;&#039;9&#039;&#039;&#039;, p.763946 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Milev2025&amp;quot;&amp;gt;P. Milev, et al. TO FIX&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=BSE_solvers_overview&amp;diff=979</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=979"/>
		<updated>2026-06-16T10:43:36Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
Diagonalization of the full Hamiltonian can be done in serial, using the standard LAPACK library. Also, it is possible to do full diagonalization asking only for a subset of eigenvalues of eigenvectors.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell). However, thanks to modern libraries like scalapack and ELPA, it is nowadays possible to fully diagonalize very large BSE matrices exploiting MPI and GPUs&amp;lt;ref name=&amp;quot;Milev2025&amp;quot; /&amp;gt;. In Lumen we have two working interfaces with Scalapack and one with ELPA. &lt;br /&gt;
&lt;br /&gt;
The modern one, which requires the interface with the ldiago library, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;d&amp;quot;&lt;br /&gt;
The old one, which was recently revised to include memory distribution, but it is still significantly less efficient, is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;o&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial doing full diagonalization can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial using Haydock can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This solver is also compatible with the double-grid&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot; /&amp;gt;, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot; /&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the slepc solver, you need to link the code with Slepc and Petsc library.&lt;br /&gt;
See here for more info: [Install Lumen with external slepc and petsc libraries].&lt;br /&gt;
&lt;br /&gt;
An example of tutorial using Slepc can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;c&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the chase solver, you need to link the code with the ChASE library.&lt;br /&gt;
See here for more info: [Install Lumen with external chase libraries].&lt;br /&gt;
&lt;br /&gt;
TODO: add a tutorial and few more info&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
The inversion solver was designed to invert the Dyson equation frequency by frequency. For each frequency the inversion (which can be done with Lapack) has roughly the same cost of a diagonalization. Needing to do so for every frequency, this solver easily becomes very expensive. It was designed to deal with frequency dependent kernel, and also extended with an old implementation of the double-grid see Ref.&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; /&amp;gt;. However, it is not used much anymore.&lt;br /&gt;
&lt;br /&gt;
This solver is controlled by&lt;br /&gt;
 BSSmod=&amp;quot;i&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
A first summary about, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Here more info about the performances of different solvers:&lt;br /&gt;
[https://gitlab.com/lumen-code/lumen/-/merge_requests/304#note_3161882534 Performances of BSE solvers]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&lt;br /&gt;
&lt;br /&gt;
=References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;&amp;gt;R. Haydock, &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot;&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; &amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot;&amp;gt;I.M. Alliati, D. Sangalli, M. Gruning, &#039;&#039;Double k-Grid Method for Solving the Bethe-Salpeter Equation via Lanczos Approaches&#039;&#039;, [https://www.frontiersin.org/journals/chemistry/articles/10.3389/fchem.2021.763946/full Frontiers in Chemistry, &#039;&#039;&#039;9&#039;&#039;&#039;, p.763946 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Milev2025&amp;quot;&amp;gt;P. Milev, et al. TO FIX&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=BSE_solvers_overview&amp;diff=978</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=978"/>
		<updated>2026-06-16T10:35:30Z</updated>

		<summary type="html">&lt;p&gt;Davide: Improving info on solvers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
Diagonalization of the full Hamiltonian can be done in serial, using the standard LAPACK library. Also, it is possible to do full diagonalization asking only for a subset of eigenvalues of eigenvectors.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell). However, thanks to modern libraries like scalapack and ELPA, it is nowadays possible to fully diagonalize very large BSE matrices exploiting MPI and GPUs&amp;lt;ref name=&amp;quot;Milev2025&amp;quot; /&amp;gt;. In Lumen we have two working interfaces with Scalapack and one with ELPA.&lt;br /&gt;
 &lt;br /&gt;
An example of a tutorial doing full diagonalization can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
An example of a tutorial using Haydock can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This solver is also compatible with the double-grid&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot; /&amp;gt;, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot; /&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039;&lt;br /&gt;
To exploit the slepc solver, you need to link the code with Slepc and Petsc library.&lt;br /&gt;
See here for more infoL [Install Lumen with external slepc and petsc libraries].&lt;br /&gt;
&lt;br /&gt;
An example of tutorial using Slepc can be found here: &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
TO ADD INFO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
The inversion solver was designed to invert the Dyson equation frequency by frequency. For each frequency the inversion (which can be done with Lapack) has roughly the same cost of a diagonalization. Needing to do so for every frequency, this solver easily becomes very expensive. It was designed to deal with frequency dependent kernel, and also extended with an old implementation of the double-grid see Ref.&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; /&amp;gt;. However, it is not used much anymore.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
To summarise, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&lt;br /&gt;
&lt;br /&gt;
=References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Haydock1980&amp;quot;&amp;gt;R. Haydock, &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Hernandez2005&amp;quot;&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Kammerland2012&amp;quot; &amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Alliati2022&amp;quot;&amp;gt;I.M. Alliati, D. Sangalli, M. Gruning, &#039;&#039;Double k-Grid Method for Solving the Bethe-Salpeter Equation via Lanczos Approaches&#039;&#039;, [https://www.frontiersin.org/journals/chemistry/articles/10.3389/fchem.2021.763946/full Frontiers in Chemistry, &#039;&#039;&#039;9&#039;&#039;&#039;, p.763946 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Milev2025&amp;quot;&amp;gt;P. Milev, et al. TO FIX&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=Install_Lumen_with_external_slepc_and_petsc_libraries&amp;diff=977</id>
		<title>Install Lumen with external slepc and petsc libraries</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_with_external_slepc_and_petsc_libraries&amp;diff=977"/>
		<updated>2026-06-16T10:32:36Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You need available Slepc and Petsc libraries compiled (eventually with gpu support).&lt;br /&gt;
&lt;br /&gt;
To get the Petsc and Slepc libraries see here: TODO&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can try the automatic compilation of the internal Petsc and Slepc library by adding to the configure script:&lt;br /&gt;
 --enable-slepc-linalg&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=Install_Lumen_with_external_slepc_and_petsc_libraries&amp;diff=976</id>
		<title>Install Lumen with external slepc and petsc libraries</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_with_external_slepc_and_petsc_libraries&amp;diff=976"/>
		<updated>2026-06-16T10:30:26Z</updated>

		<summary type="html">&lt;p&gt;Davide: First version of the page created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You need available Slepc and Petsc libraries compiled (eventually with gpu support).&lt;br /&gt;
&lt;br /&gt;
To get the Petsc and Slepc libraries see here: TODO&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can try the automatic compilation of the internal Petsc and Slepc library by adding to the configure script ...&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_with_external_chase_libraries&amp;diff=975</id>
		<title>Install Lumen with external chase libraries</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Install_Lumen_with_external_chase_libraries&amp;diff=975"/>
		<updated>2026-06-16T10:28:38Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Available since Lumen 2.1.&lt;br /&gt;
You need an available Chase library compiled (eventually with gpu support).&lt;br /&gt;
To get the chase library see here: https://github.com/ChASE-library/ChASE&lt;br /&gt;
&lt;br /&gt;
For tests and discussion on the chase interface with lumen see here: https://gitlab.com/lumen-code/lumen/-/merge_requests/304&lt;br /&gt;
&lt;br /&gt;
== Compile chase with nvfortran ==&lt;br /&gt;
 module load nvidia_profile&lt;br /&gt;
 &lt;br /&gt;
 cmake \&lt;br /&gt;
 	-DCMAKE_CXX_COMPILER=nvc++ \&lt;br /&gt;
 	-DCMAKE_C_COMPILER=nvc   \&lt;br /&gt;
 	-DCMAKE_Fortran_COMPILER=nvfortran \&lt;br /&gt;
 	-DCMAKE_BUILD_TYPE=RelWithDebInfo \&lt;br /&gt;
  	-DCMAKE_CXX_STANDARD_REQUIRED=ON \&lt;br /&gt;
 	-DCMAKE_CXX_STANDARD=17 \&lt;br /&gt;
 	-DCMAKE_CUDA_ARCHITECTURES=120 \&lt;br /&gt;
 	-DMPI_C_COMPILER=mpicc \&lt;br /&gt;
 	-DMPI_CXX_COMPILER=mpicxx \&lt;br /&gt;
 	-DMPI_Fortran_COMPILER=mpifort \&lt;br /&gt;
 	-DSCALAPACK_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/2025/comm_libs/13.0/hpcx/hpcx-2.25.1/ompi/lib -DSCALAPACK_VERBOSE=ON \&lt;br /&gt;
 	-DCMAKE_INSTALL_PREFIX=&amp;quot;SET_PATH_HERE&amp;quot; \&lt;br /&gt;
        ../../	&lt;br /&gt;
&lt;br /&gt;
== Compile chase with gfortran ==&lt;br /&gt;
 module load gnu_profile&lt;br /&gt;
 &lt;br /&gt;
 cmake \&lt;br /&gt;
 	-DCMAKE_CXX_COMPILER=mpicxx \&lt;br /&gt;
 	-DCMAKE_C_COMPILER=mpicc   \&lt;br /&gt;
 	-DCMAKE_Fortran_COMPILER=mpif90 \&lt;br /&gt;
 	-DCMAKE_BUILD_TYPE=RelWithDebInfo \&lt;br /&gt;
 	-DMPI_C_COMPILER=mpicc \&lt;br /&gt;
 	-DMPI_CXX_COMPILER=mpicxx \&lt;br /&gt;
 	-DMPI_Fortran_COMPILER=mpif90 \&lt;br /&gt;
 	-DSCALAPACK_DIR=/opt/gcc/15.2.0/scalapack-2.2.2/ -DSCALAPACK_VERBOSE=ON \&lt;br /&gt;
 	-DCMAKE_INSTALL_PREFIX=/home/sangalli/data/local-libs/ChASE-github/gfortran15.2_openmpi5.0/install \&lt;br /&gt;
         ../../	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Link chase ==&lt;br /&gt;
 --enable-chase \&lt;br /&gt;
 --with-chase-libdir=&amp;quot;${CHASE_LIBS}/lib&amp;quot; \&lt;br /&gt;
 --with-chase-includedir=&amp;quot;${CHASE_LIBS}/include&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=974</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Installation&amp;diff=974"/>
		<updated>2026-06-16T10:28:06Z</updated>

		<summary type="html">&lt;p&gt;Davide: &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;
* [[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=BSE_solvers_overview&amp;diff=972</id>
		<title>BSE solvers overview</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=BSE_solvers_overview&amp;diff=972"/>
		<updated>2026-06-16T08:54:02Z</updated>

		<summary type="html">&lt;p&gt;Davide: updating solvers info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial explores the options available in Yambo for the numerical solution of the Bethe-Salpeter equation. Before running this tutorial, you should have carried out the tutorial &#039;&#039;&#039;[[Calculating optical spectra including excitonic effects: a step-by-step guide]]&#039;&#039;&#039;. We will use the same example system (bulk hBN). The various options correspond to different numerical methods for solving (large) eigenvalue problems. The numerical methods are not covered in this tutorial and the interested user is directed to the references.&lt;br /&gt;
&lt;br /&gt;
After completion of this tutorial, you are expected to recognize which solver to use depending on the system, computational load and desired output. Also, for each of the solver, you should be able to choose the values for the key input parameters. &lt;br /&gt;
&lt;br /&gt;
Three main solvers are available in Yambo:&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Full diagonalization solver (-y d)==&lt;br /&gt;
TODO: Update info on ldiago vs odiago, and mentions to scalapack and Elpa&lt;br /&gt;
&lt;br /&gt;
Diagonalization of the full Hamiltonian using the standard LAPACK library.  &lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It also calculates all exciton energies and composition in terms of electron-hole pairs. Upon user&#039;s choice, the latter is stored on disk for use in postprocessing for exciton analysis and plotting as seen in the tutorial &#039;&#039;&#039;[[How to analyse excitons - CECAM 2021 school|How to analyse excitons]]&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Unfortunately, the computational cost of full diagonalization is cubic in the number of electron-hole pairs so this solver can be used for small system only (few light atoms per unit cell).   &lt;br /&gt;
 &lt;br /&gt;
You should have already carried out the  &#039;&#039;&#039;[[Bethe-Salpeter solver: diagonalization]]&#039;&#039;&#039;. If you wish, you can run again this part and then &#039;&#039;&#039;return to this tutorial&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Lanczos-Haydock solver (-y h)==&lt;br /&gt;
Subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] which by-pass diagonalization with the Haydock approach&amp;lt;ref&amp;gt;R. Haydock, in&lt;br /&gt;
 &#039;&#039;Solid State Phys.&#039;&#039;, &#039;&#039;&#039;35&#039;&#039;&#039; 215 (1980) edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This solver outputs the macroscopic dielectric function over a range of energies chosen by the user. It can be applied to medium-large systems as it is substantially cheaper than the full diagonalization (quadratic with the number of electron-hole pairs). However, this approach &#039;&#039;does not provide&#039;&#039; the individual exciton energies and composition in terms of electron-hole pairs.&lt;br /&gt;
&lt;br /&gt;
Follow the link to &#039;&#039;&#039;[[Bethe-Salpeter solver: Lanczos-Haydock]]&#039;&#039;&#039; then  &#039;&#039;&#039;return to this tutorial&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This solver is compatible with the double-grid, see tutorial: [[Fast convergence of dielectric constant with double grid]].&lt;br /&gt;
&lt;br /&gt;
==SLEPc solver (-y s) ==&lt;br /&gt;
Subspace iterative algorithm using the [https://slepc.upv.es SLEPc library]&amp;lt;ref&amp;gt;V. Hernandez, J.E. Roman and V. Vidal in &#039;&#039; ACM Transactions on Mathematical Software&#039;&#039;, &#039;&#039;&#039;31&#039;&#039;&#039; 315 (2005)&amp;lt;/ref&amp;gt; (SLEPC solver).&lt;br /&gt;
&lt;br /&gt;
This solver outputs the individual exciton energies and composition about an energy value chosen by the user. It can be applied to medium-large systems but does not provide the overall spectrum. This solver is typically used after obtaining the spectra from the Lanczos-Haydock solver to either analyze a specific peak or getting the energy and composition of a few low-lying excitons. It can be used for large-medium systems. The computational cost grows with the number of excitons one asks to compute.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Optional:&#039;&#039;&#039;&lt;br /&gt;
Advanced users can recompile Yambo with the &#039;&#039;--enable-slepc-linalg&#039;&#039; option if they hadn&#039;t done so. &lt;br /&gt;
If/Once you have a Yambo version compiled with the SLEPc, or you have the Virtual Machine or the Docker (with the yambo-gcc_openmp_petsc [[CECAM VIRTUAL 2021| container]]), follow the link to &#039;&#039;&#039;[[Bethe-Salpeter solver: SLEPC]]&#039;&#039;&#039; then  &#039;&#039;&#039;return to this tutorial&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==ChASE solver (-y c) ==&lt;br /&gt;
TO ADD INFO&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==INVERSION solver (-y i) ==&lt;br /&gt;
This solver is not used anymore, it was used in an old implementation of the double-grid see Ref.&amp;lt;ref&amp;gt;David Kammerlander, Silvana Botti, Miguel A. L Marques, Andrea Marini, and Claudio Attaccalite, Phys. Rev. B 86, 125203 (2012) &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
To summarise, the output (dielectric function, exciton energies and composition) and cost of the three solvers are summarized in this table.&lt;br /&gt;
&lt;br /&gt;
[[File:Solver.png|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Navigate==&lt;br /&gt;
* Back to [[BSE tutorial on hBN]] module&lt;br /&gt;
* Back to [[Tutorials]] main page&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=Lumen_2.1&amp;diff=971</id>
		<title>Lumen 2.1</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=971"/>
		<updated>2026-06-16T08:51:00Z</updated>

		<summary type="html">&lt;p&gt;Davide: Added link to Exciton symmetries tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Times_logo_red.png|right|thumb|250px|TIMES logo red|Lumen 2.1 release was supported by the EU through the [https://times.uv.es/ TIMES MSCA-DN]]]&lt;br /&gt;
&lt;br /&gt;
==Release Notes==&lt;br /&gt;
&lt;br /&gt;
This is the second release of the lumen code, after the reboot based on yambo 5.3. A Partial sync with branch 5.4 of the yambo code was done.&lt;br /&gt;
&lt;br /&gt;
===Main new features===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Non-linear response with the Floquet formalism:&amp;lt;/u&amp;gt; in Lumen 2.1 it is possible to calculate non-linear response functions using Floquet formalism, &amp;lt;br&amp;gt; for the moment this implementation is limited to the independent particle approximation with or without quasi-particle correction. &amp;lt;br&amp;gt;Tutorial: [[SHG from Floquet formulation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton symmetries&amp;lt;/u&amp;gt;: Lumen 2.1 is now able to detect the point group of the system based on the list of symmetry operations. It is then possible to compute exciton symmetries via ypp after solving BSE with diagonalization solver. &amp;lt;br&amp;gt;Tutorials: [[LiF#Detection_of_excitons_symmetries_(requires_lumen_2.1_or_better)| Excitons symmetries in LiF]]; [[How_to_analyse_excitons#Detection_of_excitons_symmetries_(requires_lumen_2.1_or_better)| Excitons symmetries in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Exciton radiative lifetimes: old implementation of exciton radiative lifetimes in ypp has been recovered.&lt;br /&gt;
* Excitonic TR-ARPES: with ypp it is possible to compute TR-ARPES from BSE post-processing&lt;br /&gt;
* Exciton-exciton transitions: with ypp it is possible to compute exciton-exciton transitions from BSE post-processing&lt;br /&gt;
* Coded symmetry average of the dielectric constant for q=0 momentum &lt;br /&gt;
* Added interface to the CHASE library as BSE solver&lt;br /&gt;
* In spin polarized systems, it is now possible to get the contribution of a given spin-channel to absorption&lt;br /&gt;
* Added Gaussian smearing for the phonon-assisted response functions&lt;br /&gt;
* Added preliminary support for system with non-symmorphic symmetry operations. At present the database conversion can be done, and later the non-symmorphic symmetry operation can be removed via ypp&lt;br /&gt;
* Added support to Covariant dipoles in shifted grids with multiple shifts&lt;br /&gt;
* Plotting of exciton wave-function: it is now possible to plot both fixed electron and fixed hole case. Moreover it is possible to plot the coefficients of the excitonic WF in k-space. File bxsf is produced.&lt;br /&gt;
&lt;br /&gt;
===Code optimization===&lt;br /&gt;
* Memory is now distributed in the old diagonalization solver (without using the ldiago library) interfaced with scalapack&lt;br /&gt;
* Fixed memory duplication in Slepc solver&lt;br /&gt;
* I/O in BSE can now be controlled by input as none/low/medium/high&lt;br /&gt;
&lt;br /&gt;
===Fixes===&lt;br /&gt;
&lt;br /&gt;
* Fixed compilation on MacOsX&lt;br /&gt;
* Fixed reading imaginary part from ndb.QP in yambo_nl&lt;br /&gt;
* Different compilation issues fixed: with intel compilers, hdf5, openACC, etc....&lt;br /&gt;
* Collisions table: added missing n_sp_pol variable&lt;br /&gt;
&lt;br /&gt;
===More===&lt;br /&gt;
* added support to llvm compiler&lt;br /&gt;
* upgraded internal version of the following libraries: libxc, slepc, petsc, devxlib &lt;br /&gt;
* upgraded interface with libxc to work with version 7.0, and to handle different versions (with different API)&lt;br /&gt;
* upgraded interface with slepc/petsc to handle different versions (with different API)&lt;br /&gt;
* ExcPh databases now can be loaded also if requested band ranges is smaller than available one&lt;br /&gt;
* support for BSE with frozen states improved&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=How_to_analyse_excitons&amp;diff=970</id>
		<title>How to analyse excitons</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=How_to_analyse_excitons&amp;diff=970"/>
		<updated>2026-06-16T08:49:32Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn (for a 2D-hBN)  how to: &lt;br /&gt;
* analyze a BSE optical spectrum in terms of excitonic eigenvectors and eigenvalues&lt;br /&gt;
* look at the spatial distribution of the exciton&lt;br /&gt;
* For a similar tutorial focusing on 3D-hBN, go to [[How to analyse excitons - CECAM 2021 school|this page]].&lt;br /&gt;
 &lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* You must have completed the [[How to treat low dimensional systems]] tutorial&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* &amp;lt;code&amp;gt;ypp &amp;lt;/code&amp;gt; executable&lt;br /&gt;
* &amp;lt;code&amp;gt;xcrysden&amp;lt;/code&amp;gt; executable&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot or xmgrace&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== YAMBO calculations ==&lt;br /&gt;
If you have completed the tutorials of 2D hBN you should have all the databases required to do this tutorial in your &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D/SAVE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;2D_WR_WC&amp;lt;/code&amp;gt; (databases generated with RIM and cutoff) directories&lt;br /&gt;
&lt;br /&gt;
 $ ls ./SAVE&lt;br /&gt;
 ndb.gops ndb.kindx ns.db1  ns.kb_pp_pwscf_fragment_1 ....&lt;br /&gt;
 $ ls ./2D_WR_WC&lt;br /&gt;
 ndb.BS_Q1_CPU_0	ndb.cutoff	ndb.dip_iR_and_P_fragment_1	ndb.pp_fragment_1 ...&lt;br /&gt;
&lt;br /&gt;
==Sort the excitonic eigenvalues==&lt;br /&gt;
&lt;br /&gt;
 $ ypp -J 2D_WR_WC -e s -b 1&lt;br /&gt;
&lt;br /&gt;
We are sorting the excitons for the q-index = 1 (optical limit q=0).&lt;br /&gt;
The new generated file &#039;&#039;o-2D_WR_WC.exc_qpt1_E_sorted &#039;&#039; (&#039;&#039;o-2D_WR_WC.exc_qpt1_I_sorted &#039;&#039;) reports &lt;br /&gt;
the energies of the excitons and their Dipole Oscillator Strengths sorted by energy  (Index).&lt;br /&gt;
[[File:strengh.png|none|x120px|]]&lt;br /&gt;
Open the first file and look inside. The first exciton is at 4.83 eV and the second one has the highest strength (normalized to 1)&lt;br /&gt;
&lt;br /&gt;
Or you can make a plot&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
gnuplot&amp;gt; set style line 2 lc rgb &#039;black&#039; pt 7   # circle&lt;br /&gt;
gnuplot&amp;gt; plot &#039;o-2D_WR_WC.exc_qpt1_E_sorted&#039;  with points ls 2 title &#039;Strenghts&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:strenght.png|none|600px|]]&lt;br /&gt;
&lt;br /&gt;
Attention the convergence of these results with different k-points grids is mandatory!&lt;br /&gt;
&lt;br /&gt;
== Calculate the exciton oscillator strenght and amplitude ==&lt;br /&gt;
&lt;br /&gt;
We can now analyze the excitons in terms of single-particle states, to do that create the appropriate input &lt;br /&gt;
 $ ypp -F ypp_AMPL.in -J 2D_WR_WC -e a 1 &lt;br /&gt;
&lt;br /&gt;
Suppose you wish to analyze the first 5 excitons then change this line as:&lt;br /&gt;
 States= &amp;quot;1 - 5&amp;quot;              # Index of the BS state(s)&lt;br /&gt;
&lt;br /&gt;
Close the input and run ypp&lt;br /&gt;
&lt;br /&gt;
 $ ypp -F ypp_AMPL.in -J 2D_WR_WC&lt;br /&gt;
&lt;br /&gt;
 $ls  o*exc*at*&lt;br /&gt;
 o-2D_WR_WC.exc_qpt1_amplitude_at_1 o-2D_WR_WC.exc_qpt1_weights_at_1 ...&lt;br /&gt;
 &lt;br /&gt;
For an exciton  &amp;lt;math&amp;gt;|\lambda&amp;gt;&amp;lt;/math&amp;gt; , &#039;&#039;o-2D_WR_WC.exc_qpt1_weights_at_*&#039;&#039; report the Weights&lt;br /&gt;
[[File:Weights.png|none|x60px|]]&lt;br /&gt;
and &#039;&#039;o-2D_WR_WC.exc_qpt1_amplitude_**&#039;&#039; report the amplitudes &lt;br /&gt;
[[File:Ampl.png|none|x70px|]]&lt;br /&gt;
&lt;br /&gt;
Open the file  &#039;&#039;o-2D_WR_WC.exc_weights_at_1&#039;&#039; &lt;br /&gt;
 #  Band_V     Band_C     K  ibz     Symm.      Weight     Energy&lt;br /&gt;
 #&lt;br /&gt;
  4.000000   5.000000   7.000000   2.000000   0.922095   4.401093&lt;br /&gt;
  4.000000   5.000000   7.000000   1.000000   0.922086   4.401093&lt;br /&gt;
&lt;br /&gt;
The first exciton is  essentially done of only single particle transitions from VBM to CBM at K (last k-point of the grid).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: the transistion Energy reported in the weight file are Kohn-Sham energy difference and not Quasiparticle energies.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Amplitude_plot.png|none|600px|]]&lt;br /&gt;
&lt;br /&gt;
== Plot the exciton spatial distribution ==&lt;br /&gt;
&lt;br /&gt;
To see the spatial character of the exciton YPP writes the exciton spatial distribution, in other words the probability to find the electron somewhere in the space when the hole is fixed in a give position.&lt;br /&gt;
Different output formats can be selected and 1D,2D,3D plots done.&lt;br /&gt;
Create the input and change the size of the cell where to see the exciton.&lt;br /&gt;
Note that  If the k-grid of the BSE simulation is a NxNx1  the exciton has an induced fictitious periodicity every Nx Nx1 Cell  of the simulation.&lt;br /&gt;
For hBN-2D this is not a problem because the exciton is strongly localized but in other systems with  more delocalized excitons to look at the real exciton size it is necessary to use &lt;br /&gt;
very large k-grids in the BSE&lt;br /&gt;
 $ ypp -F ypp_WF.in -J 2D_WR_WC  -e w  1&lt;br /&gt;
&lt;br /&gt;
 excitons                     # [R] Excitons&lt;br /&gt;
 wavefunction                 # [R] Wavefunction&lt;br /&gt;
 Format= &amp;quot;x&amp;quot;                  # Output format [(c)ube/(g)nuplot/(x)crysden]&lt;br /&gt;
 Direction= &amp;quot;12&amp;quot;               # [rlu] [1/2/3] for 1d or [12/13/23] for 2d [123] for 3D&lt;br /&gt;
 FFTGvecs=  3951        RL    # [FFT] Plane-waves&lt;br /&gt;
 States= &amp;quot;1 - 1&amp;quot;              # Index of the BS state(s)&lt;br /&gt;
 Degen_Step=   0.0100   eV    # Maximum energy separation of two degenerate states&lt;br /&gt;
 % Cells&lt;br /&gt;
  5 | 5 | 1 |                             # Number of cell repetitions in each direction (odd or 1)&lt;br /&gt;
 %&lt;br /&gt;
 % Hole&lt;br /&gt;
 2.4     | 1.400     | 0.00     |        # [cc] Hole position in unit cell&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Close the input and run ypp&lt;br /&gt;
 $ ypp -F ypp_WF.in -J 2D_WR_WC &lt;br /&gt;
&lt;br /&gt;
 $ xcrysden --xsf o-2D_WR_WC.exc_2d_1.xsf&lt;br /&gt;
&lt;br /&gt;
[[File:exc_BN2D.png|none|400px|]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Or alternatively &lt;br /&gt;
 $ xcrysden --sushi&lt;br /&gt;
 [[File:SUSHI.JPG|none|400px|]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Plot electron/hole average density==&lt;br /&gt;
&lt;br /&gt;
Another way to analyze excitons, it is the possibility to plot the average electron/hole densities defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:Electron hole density.png|400px]]&lt;br /&gt;
&lt;br /&gt;
to generate the corresponding input just type&lt;br /&gt;
&lt;br /&gt;
 ypp -F ypp_WF.in -e w -avehole&lt;br /&gt;
&lt;br /&gt;
and choose the exciton you want to plot. The electron/hole average densities correspond to generalized valence/conduction orbitals for a given exciton. They are interesting in particular for molecular crystals because they allow to distinguishing charge-transfer exctions from Frenkel or Wannier ones, by looking the relative position of the electron/hole densities.&lt;br /&gt;
For example see the electron/hole average density calculated in a Metal Organic Framework (MOF) that contains azobenzene:&lt;br /&gt;
&lt;br /&gt;
[[File:Average electron hole.png|center |600px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
this figure is taken from  ref. &amp;lt;ref&amp;gt;Strongly Bound Excitons in Metal-Organic Framework MOF-5: A Many-Body Perturbation Theory Study, A. R. Kshirsagar et al., [https://doi.org/10.26434/chemrxiv.14034917.v1 preprint ChemRxiv]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Interpolate exciton dispersion (only in Yambo 5.x)==&lt;br /&gt;
&lt;br /&gt;
Starting from Yambo 5.x it is possible to calculate excitons at finite momentum &#039;&#039;&#039;q&#039;&#039;&#039;. The momentum can be specified with the variable&lt;br /&gt;
 %BSEQptR&lt;br /&gt;
  iq_start | iq_end |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
where iq_start and iq_end is the first and last index of momentum in the irreducible Brillouin zone (IBZ). You can find the list of q-vectors in the r_setup report.&lt;br /&gt;
If you calculate the BSE for all q-points of the IBZ, then you can interpolate  exciton dispersion along any direction of the full Brillouin zone(BZ) using the&lt;br /&gt;
interpolation scheme of ref. &amp;lt;ref&amp;gt;Warren E. Pickett, Henry Krakauer, and Philip B. Allen  [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.38.2721 PRB 38 p2721 (1988)]&amp;lt;/ref&amp;gt;, by doing:&lt;br /&gt;
&lt;br /&gt;
 ypp -e i &lt;br /&gt;
&lt;br /&gt;
and then setting:&lt;br /&gt;
&lt;br /&gt;
 excitons                         # [R] Excitonic properties&lt;br /&gt;
 interpolate                      # [R] Interpolate&lt;br /&gt;
 States= &amp;quot;1 - 4&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;                # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 % INTERP_Grid&lt;br /&gt;
  -1 |-1 |-1 |                             # Interpolation BZ Grid &lt;br /&gt;
 %&lt;br /&gt;
 #PrtDOS                          # Print Exciton Density of States&lt;br /&gt;
 BANDS_steps= 100                 # Number of divisions&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;
 %BANDS_kpts                      # K points of the bands circuit&lt;br /&gt;
 0 | 0 | 0 |&lt;br /&gt;
 0.333333333333333 | 0.33333333333333 | 0 | &lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Running ypp, it will interpolate the first 4 excitons energies on 100 points along with the line Gamma-&amp;gt;K. If you plot the output file &amp;quot;o.excitons_interpolated&amp;quot;,&lt;br /&gt;
you can compare the interpolated results with the original points calculated in the BSE, that are available in the report &amp;quot;r_excitons_interpolate&amp;quot;, and you get something like:&lt;br /&gt;
&lt;br /&gt;
[[File:Excitons dispersion.png|center | Yambo exciton dispersion]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is also possible to interpolate excitons on a given regular grid by setting &amp;lt;code&amp;gt;INTERP_Grid&amp;lt;/code&amp;gt;, for example in the figure below we interpolate the dispersion of the lowest exciton in MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; calculated on a 39x39x1 and interpolated in a 117x117x1 grid in all the Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot from 2021-03-24 11-38-46.png|center| 700px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Finally if you turn on the flag &amp;lt;code&amp;gt;PrtDOS&amp;lt;/code&amp;gt; the code calculate the excitonic density of states on the excitons interpolated on the regular grid given by  &amp;lt;code&amp;gt;INTERP_Grid&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Detection of excitons symmetries (requires lumen 2.1 or better) =&lt;br /&gt;
&lt;br /&gt;
Here we show how to detect excitons symmetries in hBN&amp;lt;ref name=&amp;quot;Nalabothula2026&amp;quot;/&amp;gt; from the BSE eigenvectors.&lt;br /&gt;
&lt;br /&gt;
TO DO ...&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;Nalabothula2026&amp;quot;&amp;gt; M. Nalabothula, D. Sangalli, F. Paleari, S. Reichardt, L. Wirtz, [https://doi.org/10.1103/7h2w-ys9h  Phys. Rev. B. &#039;&#039;&#039;113&#039;&#039;&#039;, 205130 (2026)] &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=How_to_analyse_excitons&amp;diff=969</id>
		<title>How to analyse excitons</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=How_to_analyse_excitons&amp;diff=969"/>
		<updated>2026-06-16T08:49:05Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn (for a 2D-hBN)  how to: &lt;br /&gt;
* analyze a BSE optical spectrum in terms of excitonic eigenvectors and eigenvalues&lt;br /&gt;
* look at the spatial distribution of the exciton&lt;br /&gt;
* For a similar tutorial focusing on 3D-hBN, go to [[How to analyse excitons - CECAM 2021 school|this page]].&lt;br /&gt;
 &lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&#039;&#039;&#039;Previous modules&#039;&#039;&#039;&lt;br /&gt;
* You must have completed the [[How to treat low dimensional systems]] tutorial&lt;br /&gt;
&#039;&#039;&#039;You will need&#039;&#039;&#039;:&lt;br /&gt;
* &amp;lt;code&amp;gt;ypp &amp;lt;/code&amp;gt; executable&lt;br /&gt;
* &amp;lt;code&amp;gt;xcrysden&amp;lt;/code&amp;gt; executable&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot or xmgrace&amp;lt;/code&amp;gt; executable&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== YAMBO calculations ==&lt;br /&gt;
If you have completed the tutorials of 2D hBN you should have all the databases required to do this tutorial in your &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D/SAVE&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;2D_WR_WC&amp;lt;/code&amp;gt; (databases generated with RIM and cutoff) directories&lt;br /&gt;
&lt;br /&gt;
 $ ls ./SAVE&lt;br /&gt;
 ndb.gops ndb.kindx ns.db1  ns.kb_pp_pwscf_fragment_1 ....&lt;br /&gt;
 $ ls ./2D_WR_WC&lt;br /&gt;
 ndb.BS_Q1_CPU_0	ndb.cutoff	ndb.dip_iR_and_P_fragment_1	ndb.pp_fragment_1 ...&lt;br /&gt;
&lt;br /&gt;
==Sort the excitonic eigenvalues==&lt;br /&gt;
&lt;br /&gt;
 $ ypp -J 2D_WR_WC -e s -b 1&lt;br /&gt;
&lt;br /&gt;
We are sorting the excitons for the q-index = 1 (optical limit q=0).&lt;br /&gt;
The new generated file &#039;&#039;o-2D_WR_WC.exc_qpt1_E_sorted &#039;&#039; (&#039;&#039;o-2D_WR_WC.exc_qpt1_I_sorted &#039;&#039;) reports &lt;br /&gt;
the energies of the excitons and their Dipole Oscillator Strengths sorted by energy  (Index).&lt;br /&gt;
[[File:strengh.png|none|x120px|]]&lt;br /&gt;
Open the first file and look inside. The first exciton is at 4.83 eV and the second one has the highest strength (normalized to 1)&lt;br /&gt;
&lt;br /&gt;
Or you can make a plot&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
gnuplot&amp;gt; set style line 2 lc rgb &#039;black&#039; pt 7   # circle&lt;br /&gt;
gnuplot&amp;gt; plot &#039;o-2D_WR_WC.exc_qpt1_E_sorted&#039;  with points ls 2 title &#039;Strenghts&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:strenght.png|none|600px|]]&lt;br /&gt;
&lt;br /&gt;
Attention the convergence of these results with different k-points grids is mandatory!&lt;br /&gt;
&lt;br /&gt;
== Calculate the exciton oscillator strenght and amplitude ==&lt;br /&gt;
&lt;br /&gt;
We can now analyze the excitons in terms of single-particle states, to do that create the appropriate input &lt;br /&gt;
 $ ypp -F ypp_AMPL.in -J 2D_WR_WC -e a 1 &lt;br /&gt;
&lt;br /&gt;
Suppose you wish to analyze the first 5 excitons then change this line as:&lt;br /&gt;
 States= &amp;quot;1 - 5&amp;quot;              # Index of the BS state(s)&lt;br /&gt;
&lt;br /&gt;
Close the input and run ypp&lt;br /&gt;
&lt;br /&gt;
 $ ypp -F ypp_AMPL.in -J 2D_WR_WC&lt;br /&gt;
&lt;br /&gt;
 $ls  o*exc*at*&lt;br /&gt;
 o-2D_WR_WC.exc_qpt1_amplitude_at_1 o-2D_WR_WC.exc_qpt1_weights_at_1 ...&lt;br /&gt;
 &lt;br /&gt;
For an exciton  &amp;lt;math&amp;gt;|\lambda&amp;gt;&amp;lt;/math&amp;gt; , &#039;&#039;o-2D_WR_WC.exc_qpt1_weights_at_*&#039;&#039; report the Weights&lt;br /&gt;
[[File:Weights.png|none|x60px|]]&lt;br /&gt;
and &#039;&#039;o-2D_WR_WC.exc_qpt1_amplitude_**&#039;&#039; report the amplitudes &lt;br /&gt;
[[File:Ampl.png|none|x70px|]]&lt;br /&gt;
&lt;br /&gt;
Open the file  &#039;&#039;o-2D_WR_WC.exc_weights_at_1&#039;&#039; &lt;br /&gt;
 #  Band_V     Band_C     K  ibz     Symm.      Weight     Energy&lt;br /&gt;
 #&lt;br /&gt;
  4.000000   5.000000   7.000000   2.000000   0.922095   4.401093&lt;br /&gt;
  4.000000   5.000000   7.000000   1.000000   0.922086   4.401093&lt;br /&gt;
&lt;br /&gt;
The first exciton is  essentially done of only single particle transitions from VBM to CBM at K (last k-point of the grid).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: the transistion Energy reported in the weight file are Kohn-Sham energy difference and not Quasiparticle energies.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Amplitude_plot.png|none|600px|]]&lt;br /&gt;
&lt;br /&gt;
== Plot the exciton spatial distribution ==&lt;br /&gt;
&lt;br /&gt;
To see the spatial character of the exciton YPP writes the exciton spatial distribution, in other words the probability to find the electron somewhere in the space when the hole is fixed in a give position.&lt;br /&gt;
Different output formats can be selected and 1D,2D,3D plots done.&lt;br /&gt;
Create the input and change the size of the cell where to see the exciton.&lt;br /&gt;
Note that  If the k-grid of the BSE simulation is a NxNx1  the exciton has an induced fictitious periodicity every Nx Nx1 Cell  of the simulation.&lt;br /&gt;
For hBN-2D this is not a problem because the exciton is strongly localized but in other systems with  more delocalized excitons to look at the real exciton size it is necessary to use &lt;br /&gt;
very large k-grids in the BSE&lt;br /&gt;
 $ ypp -F ypp_WF.in -J 2D_WR_WC  -e w  1&lt;br /&gt;
&lt;br /&gt;
 excitons                     # [R] Excitons&lt;br /&gt;
 wavefunction                 # [R] Wavefunction&lt;br /&gt;
 Format= &amp;quot;x&amp;quot;                  # Output format [(c)ube/(g)nuplot/(x)crysden]&lt;br /&gt;
 Direction= &amp;quot;12&amp;quot;               # [rlu] [1/2/3] for 1d or [12/13/23] for 2d [123] for 3D&lt;br /&gt;
 FFTGvecs=  3951        RL    # [FFT] Plane-waves&lt;br /&gt;
 States= &amp;quot;1 - 1&amp;quot;              # Index of the BS state(s)&lt;br /&gt;
 Degen_Step=   0.0100   eV    # Maximum energy separation of two degenerate states&lt;br /&gt;
 % Cells&lt;br /&gt;
  5 | 5 | 1 |                             # Number of cell repetitions in each direction (odd or 1)&lt;br /&gt;
 %&lt;br /&gt;
 % Hole&lt;br /&gt;
 2.4     | 1.400     | 0.00     |        # [cc] Hole position in unit cell&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Close the input and run ypp&lt;br /&gt;
 $ ypp -F ypp_WF.in -J 2D_WR_WC &lt;br /&gt;
&lt;br /&gt;
 $ xcrysden --xsf o-2D_WR_WC.exc_2d_1.xsf&lt;br /&gt;
&lt;br /&gt;
[[File:exc_BN2D.png|none|400px|]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Or alternatively &lt;br /&gt;
 $ xcrysden --sushi&lt;br /&gt;
 [[File:SUSHI.JPG|none|400px|]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Plot electron/hole average density (only in Yambo 5.x)==&lt;br /&gt;
&lt;br /&gt;
Another way to analyze excitons, it is the possibility to plot the average electron/hole densities defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:Electron hole density.png|400px]]&lt;br /&gt;
&lt;br /&gt;
to generate the corresponding input just type&lt;br /&gt;
&lt;br /&gt;
 ypp -F ypp_WF.in -e w -avehole&lt;br /&gt;
&lt;br /&gt;
and choose the exciton you want to plot. The electron/hole average densities correspond to generalized valence/conduction orbitals for a given exciton. They are interesting in particular for molecular crystals because they allow to distinguishing charge-transfer exctions from Frenkel or Wannier ones, by looking the relative position of the electron/hole densities.&lt;br /&gt;
For example see the electron/hole average density calculated in a Metal Organic Framework (MOF) that contains azobenzene:&lt;br /&gt;
&lt;br /&gt;
[[File:Average electron hole.png|center |600px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
this figure is taken from  ref. &amp;lt;ref&amp;gt;Strongly Bound Excitons in Metal-Organic Framework MOF-5: A Many-Body Perturbation Theory Study, A. R. Kshirsagar et al., [https://doi.org/10.26434/chemrxiv.14034917.v1 preprint ChemRxiv]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Interpolate exciton dispersion (only in Yambo 5.x)==&lt;br /&gt;
&lt;br /&gt;
Starting from Yambo 5.x it is possible to calculate excitons at finite momentum &#039;&#039;&#039;q&#039;&#039;&#039;. The momentum can be specified with the variable&lt;br /&gt;
 %BSEQptR&lt;br /&gt;
  iq_start | iq_end |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
where iq_start and iq_end is the first and last index of momentum in the irreducible Brillouin zone (IBZ). You can find the list of q-vectors in the r_setup report.&lt;br /&gt;
If you calculate the BSE for all q-points of the IBZ, then you can interpolate  exciton dispersion along any direction of the full Brillouin zone(BZ) using the&lt;br /&gt;
interpolation scheme of ref. &amp;lt;ref&amp;gt;Warren E. Pickett, Henry Krakauer, and Philip B. Allen  [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.38.2721 PRB 38 p2721 (1988)]&amp;lt;/ref&amp;gt;, by doing:&lt;br /&gt;
&lt;br /&gt;
 ypp -e i &lt;br /&gt;
&lt;br /&gt;
and then setting:&lt;br /&gt;
&lt;br /&gt;
 excitons                         # [R] Excitonic properties&lt;br /&gt;
 interpolate                      # [R] Interpolate&lt;br /&gt;
 States= &amp;quot;1 - 4&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;                # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 % INTERP_Grid&lt;br /&gt;
  -1 |-1 |-1 |                             # Interpolation BZ Grid &lt;br /&gt;
 %&lt;br /&gt;
 #PrtDOS                          # Print Exciton Density of States&lt;br /&gt;
 BANDS_steps= 100                 # Number of divisions&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;
 %BANDS_kpts                      # K points of the bands circuit&lt;br /&gt;
 0 | 0 | 0 |&lt;br /&gt;
 0.333333333333333 | 0.33333333333333 | 0 | &lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
Running ypp, it will interpolate the first 4 excitons energies on 100 points along with the line Gamma-&amp;gt;K. If you plot the output file &amp;quot;o.excitons_interpolated&amp;quot;,&lt;br /&gt;
you can compare the interpolated results with the original points calculated in the BSE, that are available in the report &amp;quot;r_excitons_interpolate&amp;quot;, and you get something like:&lt;br /&gt;
&lt;br /&gt;
[[File:Excitons dispersion.png|center | Yambo exciton dispersion]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is also possible to interpolate excitons on a given regular grid by setting &amp;lt;code&amp;gt;INTERP_Grid&amp;lt;/code&amp;gt;, for example in the figure below we interpolate the dispersion of the lowest exciton in MoS&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; calculated on a 39x39x1 and interpolated in a 117x117x1 grid in all the Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot from 2021-03-24 11-38-46.png|center| 700px|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
Finally if you turn on the flag &amp;lt;code&amp;gt;PrtDOS&amp;lt;/code&amp;gt; the code calculate the excitonic density of states on the excitons interpolated on the regular grid given by  &amp;lt;code&amp;gt;INTERP_Grid&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Detection of excitons symmetries (requires lumen 2.1 or better) =&lt;br /&gt;
&lt;br /&gt;
Here we show how to detect excitons symmetries in hBN&amp;lt;ref name=&amp;quot;Nalabothula2026&amp;quot;/&amp;gt; from the BSE eigenvectors.&lt;br /&gt;
&lt;br /&gt;
TO DO ...&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;Nalabothula2026&amp;quot;&amp;gt; M. Nalabothula, D. Sangalli, F. Paleari, S. Reichardt, L. Wirtz, [https://doi.org/10.1103/7h2w-ys9h  Phys. Rev. B. &#039;&#039;&#039;113&#039;&#039;&#039;, 205130 (2026)] &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=LiF&amp;diff=968</id>
		<title>LiF</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=LiF&amp;diff=968"/>
		<updated>2026-06-16T08:42:52Z</updated>

		<summary type="html">&lt;p&gt;Davide: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
== The material ==&lt;br /&gt;
&lt;br /&gt;
[[File:LiF-crystal.jpg|x300px|frameless|LiF crystal]]&lt;br /&gt;
[[File:LiF_lif_structure.jpg|x300px|frameless|LiF structure]]&lt;br /&gt;
[[File:lif_rholf.png|x350px|frameless|Optical absorption of solid LiF. Dots: experiment. Continuous line: BSE. Dashed line: RPA-QP]]&lt;br /&gt;
&lt;br /&gt;
LiF is an isulator with a wide band-ga and the following characteristics:&lt;br /&gt;
* FCC lattice&lt;br /&gt;
* Two atoms per cell, Li and F (8 electrons) &lt;br /&gt;
* Lattice constant 7.61 [a.u.]&lt;br /&gt;
* Plane waves cutoff 40 Hartree (1800 RL vectors)&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will use LiF to show the importance of excitonic effects in the optical properites of materials with weak screening.&lt;br /&gt;
We will start the TDDFT tutorial exactly where standard local approximations for f&amp;lt;sub&amp;gt;xc&amp;lt;/sub&amp;gt; (like ALDA) do not work at all. The optical spectrum of solid&lt;br /&gt;
[[LiF]] &amp;lt;ref name=&amp;quot;wikipedia/&amp;gt; is dominated by a strongly bound exciton (3 eV binding energy) &amp;lt;ref name=&amp;quot;Rohlfing&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;Marini&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;Adragna&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;Sottile&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;Reining&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;Botti&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;Sangalli&amp;quot;/&amp;gt; and will immediately see that any independent particle approximation drastically fails to describe the complex structures that are observed experimentally.&lt;br /&gt;
&lt;br /&gt;
Follow the instructions in [[Tutorials_download]] and download/unpack the [https://media.yambo-code.eu/educational/tutorials/files/LiF.tar.gz LiF.tar.gz]. &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; Increase the number of bands in the NSCF DFT up to 50&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Computing the ground state properties with PWscf ==&lt;br /&gt;
&lt;br /&gt;
 $ cd YAMBO_TUTORIALS/LiF/PWSCF&lt;br /&gt;
 $ ls&lt;br /&gt;
 inputs	outputs  psps&lt;br /&gt;
&lt;br /&gt;
First run the SCF calculation to generate the ground-state charge density, occupations, Fermi level, and so on:&lt;br /&gt;
 $ pw.x &amp;lt; inputs/scf.in &amp;gt; scf.out&lt;br /&gt;
&lt;br /&gt;
Next run a non-SCF calculation to generate a set of Kohn-Sham eigenvalues and eigenvectors for both occupied and unoccupied states (100 bands): &lt;br /&gt;
 $ pw.x &amp;lt; inputs/nscf.in &amp;gt; nscf.out  &lt;br /&gt;
&lt;br /&gt;
Note the presence of the following flags in the input file:&lt;br /&gt;
 wf_collect=.true.&lt;br /&gt;
 force_symmorphic=.true.&lt;br /&gt;
 diago_full_acc=.true.&lt;br /&gt;
which are needed for generating the Yambo databases accurately. Full explanations of these variables are given on the [http://www.quantum-espresso.org/wp-content/uploads/Doc/INPUT_PW.html quantum-ESPRESSO input variables page]. &lt;br /&gt;
&lt;br /&gt;
After these two runs, you should have a &#039;&#039;LiF.save&#039;&#039; directory:&lt;br /&gt;
 $ ls LiF.save&lt;br /&gt;
 charge-density.dat  data-file-schema.xml  F.LDA.cpi.UPF  Li.LDA.cpi.UPF  wfc10.dat  wfc1.dat  wfc2.dat	wfc3.dat  wfc4.dat  wfc5.dat  wfc6.dat	wfc7.dat  wfc8.dat  wfc9.dat&lt;br /&gt;
&lt;br /&gt;
== Conversion to Yambo format ==&lt;br /&gt;
The PWscf &#039;&#039;LiF.save&#039;&#039; output is converted to the Yambo format using the &amp;lt;code&amp;gt;p2y&amp;lt;/code&amp;gt; executable (pwscf to yambo), found in the yambo &#039;&#039;bin&#039;&#039; directory.&lt;br /&gt;
Enter &#039;&#039;LiF.save&#039;&#039; and launch &amp;lt;code&amp;gt;p2y&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 $ cd LiF.save&lt;br /&gt;
 $ p2y&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;---&amp;gt; DBs path set to .&lt;br /&gt;
 &amp;lt;---&amp;gt; Index file set to data-file.xml&lt;br /&gt;
 &amp;lt;---&amp;gt; Header/K-points/Energies... done&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;---&amp;gt; == DB1 (Gvecs and more) ...&lt;br /&gt;
 &amp;lt;---&amp;gt; ... Database done&lt;br /&gt;
 &amp;lt;---&amp;gt; == DB2 (wavefunctions)  ... done ==&lt;br /&gt;
 &amp;lt;---&amp;gt; == DB3 (PseudoPotential) ... done ==&lt;br /&gt;
 &amp;lt;---&amp;gt;  == P2Y completed ==&lt;br /&gt;
&lt;br /&gt;
This output repeats some information about the system and generates a &#039;&#039;SAVE&#039;&#039; directory:&lt;br /&gt;
 $ ls SAVE&lt;br /&gt;
 ns.db1  ns.wf  ns.kb_pp_pwscf&lt;br /&gt;
 ns.wf_fragments_1_1 ...&lt;br /&gt;
 ns.kb_pp_pwscf_fragment_1 ...&lt;br /&gt;
These files, with an &#039;&#039;n&#039;&#039; prefix, indicate that they are in netCDF format, and thus not human readable. However, they are perfectly transferable across different architectures. &lt;br /&gt;
&lt;br /&gt;
In practice we suggest to move the &#039;&#039;SAVE&#039;&#039; folder into a new clean folder. &lt;br /&gt;
&lt;br /&gt;
In this tutorial however, we ask instead that you continue using a &#039;&#039;SAVE&#039;&#039; folder that we prepared previously:&lt;br /&gt;
 $ cd ../../Optics/YAMBO&lt;br /&gt;
 $ ls&lt;br /&gt;
 SAVE&lt;br /&gt;
&lt;br /&gt;
In the following we will describe in detail the different TDDFT related calculations. For each example you can find a link to the Input file with a brief explanation of the variables meaning.&lt;br /&gt;
&lt;br /&gt;
We will also use this first system to explain in detail some of the most relevant technical aspects of yambo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Initialization (yambo -i -V RL) =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section describes the standard initialization procedure. As this initialization is common to all yambo runs it will be described extensively only in this case.&lt;br /&gt;
&lt;br /&gt;
To run this example enter the &#039;&#039;YAMBO&#039;&#039; directory (where you have previously created the SAVE folder) and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; localhost:&amp;gt;yambo -F Inputs/01_init -J 01_init&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
and you will see&lt;br /&gt;
&amp;lt;pre&amp;gt; &amp;lt;---&amp;gt; [01] Game Summary&lt;br /&gt;
 &amp;lt;---&amp;gt; [02] Input variables setup&lt;br /&gt;
 &amp;lt;---&amp;gt; RL-shells |                    | [000%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt; RL-shells |####################| [100%] --(E) --(X)&lt;br /&gt;
 &amp;lt;---&amp;gt; [02.01] K-grid lattice&lt;br /&gt;
 &amp;lt;---&amp;gt; [02.02] Input (E)nergies[ev] &amp;amp;amp; Occupations&lt;br /&gt;
 &amp;lt;---&amp;gt; [03] Transferred momenta grid: Indexes&lt;br /&gt;
 &amp;lt;---&amp;gt; [04] Game Over &amp;amp;amp; Game summary&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
If now you edit the &#039;&#039;r-01_setup&#039;&#039; you will find a lot of useless ([[File:LiF_smile.gif|60x23px]]) informations about your system like, the Fermi level&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;   [02.02] Input (E)nergies[ev] &amp;amp;amp; Occupations&lt;br /&gt;
  ========&lt;br /&gt;
 &lt;br /&gt;
  Fermi Energy[ev] - T[ev/K] :-0.241627  0.000100  1.160400&lt;br /&gt;
  Bands summary              : Full        Empty&lt;br /&gt;
                               0001-0004   0005-0050&lt;br /&gt;
  Indirect Gap  [ev][min-max]:  9.11330  14.79631&amp;lt;/pre&amp;gt;&lt;br /&gt;
confirming that, yes, our bulk LiF is a &#039;&#039;&#039;wide&#039;&#039;&#039; gap insulator. Then you can see the effect of using&lt;br /&gt;
&amp;lt;pre&amp;gt; MaxGvecs=  800           RL  # [INI] Max number of G-vectors planned to use&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
in the &#039;&#039;Inputs/01_init&#039;&#039; file. In the report file we notice that&lt;br /&gt;
&amp;lt;pre&amp;gt;  G-vectors             [RL space]: 1807&lt;br /&gt;
                   [wavefunctions]: 1807&amp;lt;/pre&amp;gt;&lt;br /&gt;
whereas the Reciprocal Space shells found by yambo are&lt;br /&gt;
&amp;lt;pre&amp;gt; G-vector (S)hells. Format: [Snn] G`s&lt;br /&gt;
  [S0030]:   773 [S0029]:   749 [S0028]:   725 [S0027]:   701 [S0026]:   645&lt;br /&gt;
  [S0025]:   609 [S0024]:   561 [S0023]:   537 [S0022]:   531 [S0021]:   459&lt;br /&gt;
  [S0020]:   411 [S0019]:   387 [S0018]:   339 [S0017]:   331 [S0016]:   307&lt;br /&gt;
  [S0015]:   283 [S0014]:   259 [S0013]:   229 [S0012]:   181 [S0011]:   169&lt;br /&gt;
  [S0010]:   137 [S0009]:   113 [S0008]:    89 [S0007]:    65 [S0006]:    59&lt;br /&gt;
  [S0005]:    51 [S0004]:    27 [S0003]:    15 [S0002]:     9 [S0001]:     1&amp;lt;/pre&amp;gt;&lt;br /&gt;
so that the highest number of RL vectors we can use is 773, lower than the charge number given by Abinit and different from the value for &#039;&#039;MaxGvecs&#039;&#039; we provided. This happens because yambo has calculated the Reciprocal Space shells up to 800 to find that the highest closed shell corresponds to 773 RL vectors. Note that, independently of the value you set for any variable that defines a dimension in the RL space, yambo redefines it, in order to match it to the nearest closed shell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;02&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;03&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Random-Phase approximation (yambo -o c) (yambo -o c -k hartree) (yambo -o c -k hartree -V qp) =&lt;br /&gt;
&lt;br /&gt;
The simplest approximation that can be used to calculate the absorption spectrum of LiF is the independent particle approximation. This is done in &#039;&#039;Inputs/02_RPA_no_LF&#039;&#039;, that is generated directly by &amp;amp;quot;yambo -o c&amp;amp;quot; command line without specifying an approximation for the kernel (in fact there is no kernel!), To run this example type&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; localhost:&amp;gt;yambo -F Inputs/02_RPA_no_LF -J 02_RPA_no_LF&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
The optional &#039;&#039;-J&#039;&#039; flag is used to label the output/report/log files.&lt;br /&gt;
In &#039;&#039;Inputs/03_RPA_LF&#039;&#039; we include a kernel in the Hartree approximation. This correspond to the Random-Phase-Approximation (RPA). The response function size is changed to 51 RL. This means including Local Field Effects corresponding to charge oscillations expanded up to the 51&amp;lt;sup&amp;gt;st&amp;lt;/sup&amp;gt; RL component. The converged value for &#039;&#039;NGsBlkXd&#039;&#039; shall be determined by doing several calculations with different values and checking the effect on the final physical result (the absorption spectrum, in this case).&lt;br /&gt;
&lt;br /&gt;
After having run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; localhost:&amp;gt;yambo -F Inputs/03_RPA_LF -J 03_RPA_LF&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
we can compare the result of our calculations with the experimental curve (that you find in the &#039;&#039;Experiment&#039;&#039; folder).&lt;br /&gt;
&lt;br /&gt;
[[File:LiF_02_03.png|512x384px&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
The comparison with the experiment clearly show that the RPA is not at all adequate in the case of LiF. We notice two main discrepancies between theory and experiment: the RPA absorption onset is too low and the shape lacks the sharp peak observed experimentally at around 12 eV. The onset position can be artificially corrected using a scissor operator (representing the QP gap correction) of 5.19 eV that simply opens rigidly the LDA gap. This is shown in &#039;&#039;Inputs/03_RPA_LF_QP&#039;&#039; with the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;% XfnQP_E&lt;br /&gt;
 5.190000 | 1.000000 | 1.000000 |      # [EXTQP Xd] E parameters (c/v)&lt;br /&gt;
%&amp;lt;/pre&amp;gt;&lt;br /&gt;
The resulting spectrum fits better with the experiment but now there seems to be an even more serious problem:&lt;br /&gt;
&lt;br /&gt;
[[File:LiF_03.png|512x384px]]&lt;br /&gt;
&lt;br /&gt;
there is an experimental peak well below the QP absorption onset:&lt;br /&gt;
&lt;br /&gt;
an [http://en.wikipedia.org/wiki/Exciton EXCITON!]&lt;br /&gt;
&lt;br /&gt;
[[File:LiF_exciton.jpg|160x202px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;04&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= ALDA (yambo -o c -k alda) =&lt;br /&gt;
&lt;br /&gt;
Our first attempt to go beyond RPA is using TDDFT in the Adiabatic LDA approximation. Depending on the exchange-correlation(xc) functional used in the ground state calculation yambo will produce a corresponding xc-kernel. In this case, as reported by the &#039;&#039;a2y&#039;&#039; command we are using a Perdew Wang parametrization.&lt;br /&gt;
Generate input file with the command: &amp;lt;code&amp;gt; yambo -o c -k alda -F tdlda.in&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 chi                              # [R][CHI] Dyson equation for Chi.&lt;br /&gt;
 tddft                            # [R][K] Use TDDFT kernel&lt;br /&gt;
 #DegFix                        # Force the code to impose the energy levels to respect their degeneracy&lt;br /&gt;
 Chimod= &amp;quot;ALDA&amp;quot;                   # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 FxcGRLc= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;51 &amp;lt;/span&amp;gt;                RL    # [TDDFT] XC-kernel RL size&lt;br /&gt;
 NGsBlkXd= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;51 &amp;lt;/span&amp;gt;               RL    # [Xd] Response block size&lt;br /&gt;
 % QpntsRXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 1 | 1 | &amp;lt;/span&amp;gt;                    # [Xd] Transferred momenta&lt;br /&gt;
 %&lt;br /&gt;
 % BndsRnXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   1 | 10 | &amp;lt;/span&amp;gt;                  # [Xd] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 % EnRngeXd&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  7.50000 | 25.00000 | &amp;lt;/span&amp;gt;  eV  # [Xd] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.100000 | 0.100000 |   eV  # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;300 &amp;lt;/span&amp;gt;               # [Xd] Total Energy steps&lt;br /&gt;
 % LongDrXd&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |      # [Xd] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
In this input we set to 51 RL (reciprocal lattice vectors) the size of the dielectric constant. This is also the number of RL vectors&lt;br /&gt;
used for the exchange correlation functional (FxcGRLc).&lt;br /&gt;
You can run the input with the command: &amp;lt;code&amp;gt;yambo -F tdlda.in&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output will be in the file &amp;lt;code&amp;gt;o.eps_q1_inv_alda_dyson&amp;lt;/code&amp;gt;, where the first column is the energy while the second and third are the imaginary&lt;br /&gt;
and real parts of the dielectric constant.  &lt;br /&gt;
&lt;br /&gt;
[[File:LiF_04.png|512x384px]]&lt;br /&gt;
&lt;br /&gt;
Unfortunately ALDA only slightly changes the RPA result. The situation will change in more isolated system (reduced dimensionality).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;05&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=The Statically screened Electron-electron interaction (yambo -X s) =&lt;br /&gt;
&lt;br /&gt;
As simple RPA and ALDA approximations have not described correctly the experimental spectrum we have to move towards more elaborate techniques like the Bethe-Salpeter (BS) equation.&lt;br /&gt;
&lt;br /&gt;
A key ingredient in the BS kernel is the electron-electron interaction commonly evaluated in the static approximation. The input file &#039;&#039;Inputs/05_W&#039;&#039; describes how to calculate it. The variables used in this input file have the same physical meaning of those used in the optical absorption calculation. The only difference is that, in general, the response function dimension obtained in the examples (03-04), gives an upper bound to the number of RL vectors needed here. This is because the size of response matrix in an RPA calculation defines also the size of the Hartree potential, whose short-range components are not screened. In the present case, instead, the electron-electron interaction is screened and, for this reason, the RL vectors needed are considerably smaller than in the RPA case. So let&#039;s type (no &#039;&#039;-J&#039;&#039; option here) ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; localhost:&amp;gt;yambo -F Inputs/05_W &amp;lt;/pre&amp;gt;&lt;br /&gt;
... and after waiting for some minutes the result, that is the database SAVE/ndb.em1s. Do not use the &#039;&#039;-J&#039;&#039; option here as we will need to read this database in the next examples.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;06&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=The Bethe-Salpeter equation, Excitons (yambo -o b -k sex -y h -V qp) =&lt;br /&gt;
&lt;br /&gt;
The input file of BSE describes how to calculate an excitonic absorption spectrum, by solving the BS equation using the recursive Haydock Method. &lt;br /&gt;
The input file can be generated with the command above. Before running &#039;&#039;yambo&#039;&#039; we must have set the paramteter of the input file, in red the one we changed:&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;
 #DegFix                        # Force the code to impose the energy levels to respect their degeneracy&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 X_Threads=0                      # [OPENMP/X] Number of threads for response functions&lt;br /&gt;
 K_Threads=0                      # [OPENMP/BSK] Number of threads for response functions&lt;br /&gt;
 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;
 BSEdiskIO= &amp;quot;medium&amp;quot;              # [BSE] medium (restart possible only in corr.)|low (writes at the end)|none&lt;br /&gt;
 BSSmod= &amp;quot;h&amp;quot;                      # [BSS] (h)aydock/(d)iagonalization/(s)lepc/(i)nversion/(t)ddft`&lt;br /&gt;
 BSENGexx=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 773&amp;lt;/span&amp;gt;            RL    # [BSK] Exchange components&lt;br /&gt;
 BSENGBlk=  51              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;
 KfnQP_DbGd_INTERP_mode= &amp;quot;NN&amp;quot;     # [EXTQP BSK BSS] Interpolation DbGd mode&lt;br /&gt;
 % KfnQP_E&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5.800000 &amp;lt;/span&amp;gt; | 1.000000 | 1.000000 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
 % BSEQptR&lt;br /&gt;
  1 | 1 |                             # [BSK] Transferred momenta range&lt;br /&gt;
 %&lt;br /&gt;
 % BSEBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   2 |  7 |  &amp;lt;/span&amp;gt;                         # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.00000 | 20.00000 |   &amp;lt;/span&amp;gt;      eV    # [BSS] Energy range&lt;br /&gt;
 % &lt;br /&gt;
 %BDmRange&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps= 100                    # [BSS] Energy steps&lt;br /&gt;
 % BLongDir&lt;br /&gt;
  1.000000 | 0.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/photolum/esrt&lt;br /&gt;
 BSEdips= &amp;quot;none&amp;quot;                  # [BSS] Can be &amp;quot;trace/none&amp;quot; or &amp;quot;xy/xz/yz&amp;quot; to define off-diagonal rotation plane&lt;br /&gt;
 BSHayTrs=-0.020000               # [BSS] Relative [o/o] Haydock threshold. Strict(&amp;gt;0)/Average(&amp;lt;0) &lt;br /&gt;
&lt;br /&gt;
The line&lt;br /&gt;
&amp;lt;pre&amp;gt;% KfnQP_E&lt;br /&gt;
 5.80000 | 1.000000 | 1.000000 |      # [EXTQP BSK BSS] E parameters (c/v)&lt;br /&gt;
%&amp;lt;/pre&amp;gt;&lt;br /&gt;
applies a 5.8 eV scissor in order to open the LDA gap.&lt;br /&gt;
&amp;lt;pre&amp;gt;BSKmod= &amp;amp;quot;SEX&amp;amp;quot;                # [BSE] IP/Hartree/HF/ALDA/SEX&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we are using the screened exchange (SEX) approximation for the kernel that includes both exchange and correlation terms.&lt;br /&gt;
The line &lt;br /&gt;
 %BEnRange&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  0.00000 | 20.00000 |   &amp;lt;/span&amp;gt;      eV    # [BSS] Energy range&lt;br /&gt;
  % &lt;br /&gt;
specify the energy range where we want to calculate the dielectric response.&lt;br /&gt;
The lines&lt;br /&gt;
&amp;lt;pre&amp;gt;% BSEBands&lt;br /&gt;
  2 |  7 |                   # [BSK] Bands range&lt;br /&gt;
%&lt;br /&gt;
BSENGBlk=  51            RL  # [BSK] Screened interaction block size&lt;br /&gt;
BSENGexx=  773           RL  # [BSK] Exchange components&amp;lt;/pre&amp;gt;&lt;br /&gt;
specify the range of bands to be used and the RL components for the screened interaction (51) (read from the ndb.em1s file) and for the Hartree term (773, the maximal available). &#039;&#039;&#039;Remember&#039;&#039;&#039; that the BS kernel is written in Bloch space and its size is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;BS kernel size = Valence Bands × Conduction Bands  × K-points in the whole BZ&amp;lt;/pre&amp;gt;&lt;br /&gt;
In our case the size is 2304. The BS bands range must be converged with care trying to keep as a few bands as possible.&lt;br /&gt;
Running&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; localhost:&amp;gt;yambo -F Inputs/06_BSE -J 06_BSE&amp;lt;/pre&amp;gt;&lt;br /&gt;
will calculate the BS kernel and store in in the &#039;&#039;06_BSE&#039;&#039; folder. Before analyzing the BS absorption spectrum we can edit the log file &#039;&#039;l-06_BSE_optics_bse_bss&#039;&#039; to observe the on-the-fly live timing feature of yambo:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; [...]&lt;br /&gt;
  &amp;lt;---&amp;gt; BSK |                    | [000%] --(E) --(X)&lt;br /&gt;
 &amp;lt;05s&amp;gt; BSK |#                   | [007%] 05s(E) 01m-07s(X)&lt;br /&gt;
 &amp;lt;11s&amp;gt; BSK |###                 | [015%] 10s(E) 01m-06s(X)&lt;br /&gt;
 [...]&lt;br /&gt;
 &amp;lt;01m-02s&amp;gt; BSK |##################  | [093%] 01m-01s(E) 01m-06s(X)&lt;br /&gt;
 &amp;lt;01m-07s&amp;gt; BSK |####################| [100%] 01m-06s(E) 01m-06s(X)&lt;br /&gt;
 [...]&amp;lt;/pre&amp;gt;&lt;br /&gt;
The two numbers at the end of each line represents the elapsed time(E) and the expected time(X). The latter estimates the time needed to complete that particular section (the BS kernel construction in this case).&lt;br /&gt;
&lt;br /&gt;
Finally we can compare the resulting BS optical absorption with the experimental result. We see how strong is the excitonic effect, if compared to the RPA calculation. The BS equation is, then, able to describe the bound electron-hole state responsible for the peak observed experimentally below the QP gap.&lt;br /&gt;
&lt;br /&gt;
[[File:LiF_06.png|512x384px&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notice that in the input there is variable called &amp;lt;code&amp;gt;BSEdiskIO&amp;lt;/code&amp;gt;to tune the BSE-IO. If you have problem with IO on your cluster you can select &amp;quot;low&amp;quot; in this case the BSE matrix will be written only at the end of the calculation, restart will not be possible.&lt;br /&gt;
&lt;br /&gt;
You can also decide to store only the results: eigelvalues, eigenvectors or spectrum is you select &amp;lt;code&amp;gt;BSEdiskIO&amp;lt;/code&amp;gt;&amp;lt;code&amp;gt;=&amp;quot;none&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt;There is also the possibility to set it to &#039;high&#039; in this case restart will be possible also in the exchange part of the calculations.&lt;br /&gt;
&lt;br /&gt;
=A Bethe-Salpeter based F&amp;lt;sub&amp;gt;xc&amp;lt;/sub&amp;gt;(yambo -o c -k lrc -V qp) =&lt;br /&gt;
&lt;br /&gt;
As for TDDFT we might be a little bit disappointed at this stage as the only method that yields a reasonable absorption spectrum for LiF is based on MBPT. It is possible, however, to extract from the BS kernel a possible approximation for the xc-kernel. This approach is efficient, but is far too complicated, and requires the prior computation of the BS kernel. An alternative possibility is to use a simple Long Range Component model, as introduced in [[LiF#Reining|Reining]]. In this model, the yambo input file &#039;&#039;Inputs/07_LRC&#039;&#039; describes a model where&lt;br /&gt;
&lt;br /&gt;
[[File:LiF_PIC_LiF_equations-14.png|190x55px]]&lt;br /&gt;
with F&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;= &#039;&#039;LRC_alpha&#039;&#039;=-8.7.&lt;br /&gt;
&lt;br /&gt;
[[File:LiF_07.png|512x384px&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
We see from the previous figure that the agreement with the BS calculation is not very good. Nevertheless this simple model captures the presence of an exciton and works quite well for a large number of simple semiconductors, as show in [[LiF#silvana|Botti]]:&lt;br /&gt;
&lt;br /&gt;
[[File:F_silvana.png|371x352px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;exercises&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Additional Exercises =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Calculate the absorption spectra like in section [[LiF#02|02]]-[[LiF#03|03]] increasing the polarization RL size, the polarization bands to find the converged values.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Plot the EELS spectrum obtained in section [[LiF#02|02]]-[[LiF#03|03]] and check the effect of increasing the polarization bands. Do a resonant only calculation (using the -V option) to see that the EELS cannot be described using only the resonant part of the response function.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;See the effect of using a denser BZ sampling grid running Abinit with, for example&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;ngkpt2  6 6 6&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Repeat the [[LiF#06|BSE]] calculation increasing the bands.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Calculate the [[LiF#06|BSE]] spectrum using a diagonal only interaction.&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Detection of excitons symmetries (requires lumen 2.1 or better) =&lt;br /&gt;
&lt;br /&gt;
Here we show how to detect excitons symmetries in LiF&amp;lt;ref name=&amp;quot;Nalabothula2026&amp;quot;/&amp;gt; after extracting the BSE eigenvectors, either via full diagonalization or via recursive solvers.&lt;br /&gt;
&lt;br /&gt;
TO DO ...&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;wikipedia&amp;quot;&amp;gt; [http://en.wikipedia.org/wiki/Lithium_fluoride| LiF on wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Rohlfing&amp;quot;&amp;gt; M. Rohlfing, S. Louie, Phys. Rev. Lett. &#039;&#039;&#039;81&#039;&#039;&#039;, 2312 (2000)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Marini&amp;quot;&amp;gt; A. Marini, R. Del Sole, and A. Rubio, Phys. Rev. Lett., &#039;&#039;&#039;91&#039;&#039;&#039;, 256402 (2003)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Adragna&amp;quot;&amp;gt; G. Adragna, R. Del Sole, and A. Marini, Phys. Rev. B &#039;&#039;&#039;68&#039;&#039;&#039;, 165108 (2003)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sottile&amp;quot;&amp;gt; F. Sottile, V. Olevano, and L. Reining, Phys. Rev. Lett. &#039;&#039;&#039;91&#039;&#039;&#039;, 056402 (2003)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Reining&amp;quot;&amp;gt;  Reining, V. Olevano, A. Rubio, and G. Onida, Phys. Rev. Lett. &#039;&#039;&#039;88&#039;&#039;&#039;, 066404 (2002)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Botti&amp;quot;&amp;gt;  S. Botti, Phys. Rev. B &#039;&#039;&#039;69&#039;&#039;&#039;, 155112 (2004)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli&amp;quot;&amp;gt; D. Sangalli, [https://doi.org/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;Nalabothula2026&amp;quot;&amp;gt; M. Nalabothula, D. Sangalli, F. Paleari, S. Reichardt, L. Wirtz, [https://doi.org/10.1103/7h2w-ys9h  Phys. Rev. B. &#039;&#039;&#039;113&#039;&#039;&#039;, 205130 (2026)] &amp;lt;/ref&amp;gt;&lt;br /&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_2.1&amp;diff=967</id>
		<title>Lumen 2.1</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=967"/>
		<updated>2026-06-16T08:27:19Z</updated>

		<summary type="html">&lt;p&gt;Davide: Left only two highlighted main features&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Times_logo_red.png|right|thumb|250px|TIMES logo red|Lumen 2.1 release was supported by the EU through the [https://times.uv.es/ TIMES MSCA-DN]]]&lt;br /&gt;
&lt;br /&gt;
==Release Notes==&lt;br /&gt;
&lt;br /&gt;
This is the second release of the lumen code, after the reboot based on yambo 5.3. A Partial sync with branch 5.4 of the yambo code was done.&lt;br /&gt;
&lt;br /&gt;
===Main new features===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Non-linear response with the Floquet formalism:&amp;lt;/u&amp;gt; in Lumen 2.1 it is possible to calculate non-linear response functions using Floquet formalism, &amp;lt;br&amp;gt; for the moment this implementation is limited to the independent particle approximation with or without quasi-particle correction. &amp;lt;br&amp;gt;See tutorial: [[SHG from Floquet formulation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton symmetries&amp;lt;/u&amp;gt;: Lumen 2.1 is now able to detect the point group of the system based on the list of symmetry operations. It is then possible to compute exciton symmetries via ypp after solving BSE with diagonalization solver.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Exciton radiative lifetimes: old implementation of exciton radiative lifetimes in ypp has been recovered.&lt;br /&gt;
* Excitonic TR-ARPES: with ypp it is possible to compute TR-ARPES from BSE post-processing&lt;br /&gt;
* Exciton-exciton transitions: with ypp it is possible to compute exciton-exciton transitions from BSE post-processing&lt;br /&gt;
* Coded symmetry average of the dielectric constant for q=0 momentum &lt;br /&gt;
* Added interface to the CHASE library as BSE solver&lt;br /&gt;
* In spin polarized systems, it is now possible to get the contribution of a given spin-channel to absorption&lt;br /&gt;
* Added Gaussian smearing for the phonon-assisted response functions&lt;br /&gt;
* Added preliminary support for system with non-symmorphic symmetry operations. At present the database conversion can be done, and later the non-symmorphic symmetry operation can be removed via ypp&lt;br /&gt;
* Added support to Covariant dipoles in shifted grids with multiple shifts&lt;br /&gt;
* Plotting of exciton wave-function: it is now possible to plot both fixed electron and fixed hole case. Moreover it is possible to plot the coefficients of the excitonic WF in k-space. File bxsf is produced.&lt;br /&gt;
&lt;br /&gt;
===Code optimization===&lt;br /&gt;
* Memory is now distributed in the old diagonalization solver (without using the ldiago library) interfaced with scalapack&lt;br /&gt;
* Fixed memory duplication in Slepc solver&lt;br /&gt;
* I/O in BSE can now be controlled by input as none/low/medium/high&lt;br /&gt;
&lt;br /&gt;
===Fixes===&lt;br /&gt;
&lt;br /&gt;
* Fixed compilation on MacOsX&lt;br /&gt;
* Fixed reading imaginary part from ndb.QP in yambo_nl&lt;br /&gt;
* Different compilation issues fixed: with intel compilers, hdf5, openACC, etc....&lt;br /&gt;
* Collisions table: added missing n_sp_pol variable&lt;br /&gt;
&lt;br /&gt;
===More===&lt;br /&gt;
* added support to llvm compiler&lt;br /&gt;
* upgraded internal version of the following libraries: libxc, slepc, petsc, devxlib &lt;br /&gt;
* upgraded interface with libxc to work with version 7.0, and to handle different versions (with different API)&lt;br /&gt;
* upgraded interface with slepc/petsc to handle different versions (with different API)&lt;br /&gt;
* ExcPh databases now can be loaded also if requested band ranges is smaller than available one&lt;br /&gt;
* support for BSE with frozen states improved&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=965</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=965"/>
		<updated>2026-06-15T14:30:50Z</updated>

		<summary type="html">&lt;p&gt;Davide: Add spacing between 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;
** Tag 2.1.0 (XX/06/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=Lumen_release_notes&amp;diff=964</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=964"/>
		<updated>2026-06-15T09:07:12Z</updated>

		<summary type="html">&lt;p&gt;Davide: Reorganizing shape&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;
** Tag 2.1.0 (XX/06/2026)&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=Lumen_2.1&amp;diff=962</id>
		<title>Lumen 2.1</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=962"/>
		<updated>2026-06-11T13:15:03Z</updated>

		<summary type="html">&lt;p&gt;Davide: /* Release Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Times_logo_red.png|right|thumb|250px|TIMES logo red|Lumen 2.1 release was supported by the EU through the [https://times.uv.es/ TIMES MSCA-DN]]]&lt;br /&gt;
&lt;br /&gt;
==Release Notes==&lt;br /&gt;
&lt;br /&gt;
This is the second release of the lumen code, after the reboot based on yambo 5.3. A Partial sync with branch 5.4 of the yambo code was done.&lt;br /&gt;
&lt;br /&gt;
===Main new features===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Non-linear response with the Floquet formalism:&amp;lt;/u&amp;gt; in Lumen 2.1 it is possible to calculate non-linear response functions using Floquet formalism, &amp;lt;br&amp;gt; for the moment this implementation is limited to the independent particle approximation with or without quasi-particle correction. See tutorial: [[SHG from Floquet formulation]]&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton symmetries&amp;lt;/u&amp;gt;: Lumen 2.1 is now able to detect the point group of the system based on the list of symmetry operations. It is then possible to compute exciton symmetries via ypp after solving BSE with diagonalization solver.&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton radiative lifetimes&amp;lt;/u&amp;gt;: old implementation of exciton radiative lifetimes in ypp has been recovered.&lt;br /&gt;
* &amp;lt;u&amp;gt;Excitonic TR-ARPES&amp;lt;/u&amp;gt;: with ypp it is possible to compute TR-ARPES from BSE post-processing&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton-exciton transitions&amp;lt;/u&amp;gt;: with ypp it is possible to compute exciton-exciton transitions from BSE post-processing&lt;br /&gt;
* Coded symmetry average of the dielectric constant for q=0 momentum &lt;br /&gt;
* Added interface to the CHASE library as BSE solver&lt;br /&gt;
* In spin polarized systems, it is now possible to get the contribution of a given spin-channel to absorption&lt;br /&gt;
* Added Gaussian smearing for the phonon-assisted response functions&lt;br /&gt;
* Added preliminary support for system with non-symmorphic symmetry operations. At present the database conversion can be done, and later the non-symmorphic symmetry operation can be removed via ypp&lt;br /&gt;
* Added support to Covariant dipoles in shifted grids with multiple shifts&lt;br /&gt;
* Plotting of exciton wave-function: it is now possible to plot both fixed electron and fixed hole case. Moreover it is possible to plot the coefficients of the excitonic WF in k-space. File bxsf is produced.&lt;br /&gt;
&lt;br /&gt;
===Code optimization===&lt;br /&gt;
* Memory is now distributed in the old diagonalization solver (without using the ldiago library) interfaced with scalapack&lt;br /&gt;
* Fixed memory duplication in Slepc solver&lt;br /&gt;
* I/O in BSE can now be controlled by input as none/low/medium/high&lt;br /&gt;
&lt;br /&gt;
===Fixes===&lt;br /&gt;
&lt;br /&gt;
* Fixed compilation on MacOsX&lt;br /&gt;
* Fixed reading imaginary part from ndb.QP in yambo_nl&lt;br /&gt;
* Different compilation issues fixed: with intel compilers, hdf5, openACC, etc....&lt;br /&gt;
* Collisions table: added missing n_sp_pol variable&lt;br /&gt;
&lt;br /&gt;
===More===&lt;br /&gt;
* added support to llvm compiler&lt;br /&gt;
* upgraded internal version of the following libraries: libxc, slepc, petsc, devxlib &lt;br /&gt;
* upgraded interface with libxc to work with version 7.0, and to handle different versions (with different API)&lt;br /&gt;
* upgraded interface with slepc/petsc to handle different versions (with different API)&lt;br /&gt;
* ExcPh databases now can be loaded also if requested band ranges is smaller than available one&lt;br /&gt;
* support for BSE with frozen states improved&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=961</id>
		<title>Lumen 2.1</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=961"/>
		<updated>2026-06-11T13:13:03Z</updated>

		<summary type="html">&lt;p&gt;Davide: Updating list of changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Times_logo_red.png|right|thumb|250px|TIMES logo red|Lumen 2.1 release was supported by the EU through the [https://times.uv.es/ TIMES MSCA-DN]]]&lt;br /&gt;
&lt;br /&gt;
==Release Notes==&lt;br /&gt;
&lt;br /&gt;
This is the second release of the lumen code, after the reboot based on yambo 5.3&lt;br /&gt;
&lt;br /&gt;
===Main new features===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Non-linear response with the Floquet formalism:&amp;lt;/u&amp;gt; in Lumen 2.1 it is possible to calculate non-linear response functions using Floquet formalism, &amp;lt;br&amp;gt; for the moment this implementation is limited to the independent particle approximation with or without quasi-particle correction. See tutorial: [[SHG from Floquet formulation]]&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton symmetries&amp;lt;/u&amp;gt;: Lumen 2.1 is now able to detect the point group of the system based on the list of symmetry operations. It is then possible to compute exciton symmetries via ypp after solving BSE with diagonalization solver.&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton radiative lifetimes&amp;lt;/u&amp;gt;: old implementation of exciton radiative lifetimes in ypp has been recovered.&lt;br /&gt;
* &amp;lt;u&amp;gt;Excitonic TR-ARPES&amp;lt;/u&amp;gt;: with ypp it is possible to compute TR-ARPES from BSE post-processing&lt;br /&gt;
* &amp;lt;u&amp;gt;Exciton-exciton transitions&amp;lt;/u&amp;gt;: with ypp it is possible to compute exciton-exciton transitions from BSE post-processing&lt;br /&gt;
* Coded symmetry average of the dielectric constant for q=0 momentum &lt;br /&gt;
* Added interface to the CHASE library as BSE solver&lt;br /&gt;
* In spin polarized systems, it is now possible to get the contribution of a given spin-channel to absorption&lt;br /&gt;
* Added Gaussian smearing for the phonon-assisted response functions&lt;br /&gt;
* Added preliminary support for system with non-symmorphic symmetry operations. At present the database conversion can be done, and later the non-symmorphic symmetry operation can be removed via ypp&lt;br /&gt;
* Added support to Covariant dipoles in shifted grids with multiple shifts&lt;br /&gt;
* Plotting of exciton wave-function: it is now possible to plot both fixed electron and fixed hole case. Moreover it is possible to plot the coefficients of the excitonic WF in k-space. File bxsf is produced.&lt;br /&gt;
&lt;br /&gt;
===Code optimization===&lt;br /&gt;
* Memory is now distributed in the old diagonalization solver (without using the ldiago library) interfaced with scalapack&lt;br /&gt;
* Fixed memory duplication in Slepc solver&lt;br /&gt;
* I/O in BSE can now be controlled by input as none/low/medium/high&lt;br /&gt;
&lt;br /&gt;
===Fixes===&lt;br /&gt;
&lt;br /&gt;
* Fixed compilation on MacOsX&lt;br /&gt;
* Fixed reading imaginary part from ndb.QP in yambo_nl&lt;br /&gt;
* Different compilation issues fixed: with intel compilers, hdf5, openACC, etc....&lt;br /&gt;
* Collisions table: added missing n_sp_pol variable&lt;br /&gt;
&lt;br /&gt;
===More===&lt;br /&gt;
* added support to llvm compiler&lt;br /&gt;
* upgraded internal version of the following libraries: libxc, slepc, petsc, devxlib &lt;br /&gt;
* upgraded interface with libxc to work with version 7.0, and to handle different versions (with different API)&lt;br /&gt;
* upgraded interface with slepc/petsc to handle different versions (with different API)&lt;br /&gt;
* ExcPh databases now can be loaded also if requested band ranges is smaller than available one&lt;br /&gt;
* support for BSE with frozen states improved&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=960</id>
		<title>Lumen 2.1</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Lumen_2.1&amp;diff=960"/>
		<updated>2026-06-11T12:47:37Z</updated>

		<summary type="html">&lt;p&gt;Davide: Updating list of changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Times_logo_red.png|right|thumb|250px|TIMES logo red|Lumen 2.1 release was supported by the EU through the [https://times.uv.es/ TIMES MSCA-DN]]]&lt;br /&gt;
&lt;br /&gt;
==Release Notes==&lt;br /&gt;
&lt;br /&gt;
This is the second release of the lumen code, after the reboot based on yambo 5.3&lt;br /&gt;
&lt;br /&gt;
===Main new features===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;u&amp;gt;Non-linear response with the Floquet formalism:&amp;lt;/u&amp;gt; in Lumen 2.1 it is possible to calculate non-linear response functions using Floquet formalism, &amp;lt;br&amp;gt; for the moment this implementation is limited to the independent particle approximation with or without quasi-particle correction. See tutorial: [[SHG from Floquet formulation]]&lt;br /&gt;
* Symmetry average of the dielectric constant for q=0 momentum &lt;br /&gt;
* Added interface to the CHASE library as BSE solver&lt;br /&gt;
* Added Gaussian smearing for the phonon-assisted response functions&lt;br /&gt;
* ExcPh databases now can be loaded also if requested band ranges is smaller than available one&lt;br /&gt;
&lt;br /&gt;
===Code optimization===&lt;br /&gt;
* Memory is now distributed in the old diagonalization solver (without using the ldiago library) interfaced with scalapack&lt;br /&gt;
* Fixed memory duplication in Slepc solver&lt;br /&gt;
&lt;br /&gt;
===Fixes===&lt;br /&gt;
&lt;br /&gt;
* Fixed compilation on MacOsX&lt;br /&gt;
* Fixed reading imaginary part from ndb.QP in yambo_nl&lt;br /&gt;
* Different compilation issues fixed: with intel compilers, hdf5, openACC, etc....&lt;br /&gt;
* Collisions table: added missing n_sp_pol variable&lt;br /&gt;
&lt;br /&gt;
===More===&lt;br /&gt;
* added support to llvm compiler&lt;br /&gt;
* upgraded interface with libxc to work with version 7.0&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
	<entry>
		<id>https://www.lumen-code.org/wiki/index.php?title=Dichroism_in_molecules&amp;diff=946</id>
		<title>Dichroism in molecules</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Dichroism_in_molecules&amp;diff=946"/>
		<updated>2026-05-19T07:35:15Z</updated>

		<summary type="html">&lt;p&gt;Davide: Fixed reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Chirality with hands.svg.png|x300px|frameless|right|Chirality representation with hands, from wikipedia]]&lt;br /&gt;
&lt;br /&gt;
Circular dichroism (CD) is dichroism involving circularly polarized light, i.e., the differential absorption of left- and right-handed light&amp;lt;ref name=&amp;quot;wiki_CD&amp;quot;/&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n(\omega) = n_R(\omega) - n_L(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dichroism in absorption can originate from an asymmetry in the dielectric tensor, which can be induced by the presence of either an external magnetic field or a spontaneous magnetization (MCD). This can be computed from the off-diagonal elements of the dielectric tensor. See the tutorial on [[The magneto-optical Kerr effect]] (MOKE). Another form of dichroism can be due to the chiral nature of molecules or materials&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;/&amp;gt; and goes under the name of natural circular dichroism (NCD). This latter can be related to the beta tensor and will be discussed in the present tutorial. See these references for NCD with the Lumen code: Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;, Ref.&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Few equations ==&lt;br /&gt;
&lt;br /&gt;
NCD is described by the trace of the so called beta tensor&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n(\omega) = \frac{8\pi N\omega}{3c} Tr[\beta_{\alpha\beta}(\omega)]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which related the electronic dipole to the time derivative of the applied magnetic field, and the magnetic dipole to the time derivative of the applied electric field  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu_{\alpha}(\omega) = \alpha_{\alpha\beta}(\omega) E_\beta(\omega) - \frac{i \omega}{c}\beta_{\alpha\beta}(\omega) B_\beta(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;m_{\alpha}(\omega) = \chi_{\alpha\beta}(\omega) B_\beta(\omega) + \frac{i \omega}{c}\beta_{\alpha\beta}(\omega) E_\beta(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latter can be obtained via the so called G tensor, which is similar to the dipole-dipole response function, but with electric and magnetic dipoles&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\beta_{\alpha\beta}(\omega) = -\frac{i\hbar m_e}{\omega q_e^2} G_{\alpha\beta}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;G_{ij}(\omega) = \frac{q_e^2}{2m\hbar}\sum_{nm} &lt;br /&gt;
\left( \frac{r^i_{nm} m^j_{mn}}{\omega_{nm}-\omega-i\gamma} &lt;br /&gt;
+ \frac{m^i_{mn} r^j_{nm}}{\omega_{nm}+\omega+i\gamma} \right) &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculation of the magnetic dipoles is what makes NCD difficult to be computed in PBC, since these are not easily defined (solutions have been recently proposed in the literature). For isolated systems instead a simple sum over states can be employed (this is not possible in PBC because it involves diagonal intra-band dipoles):  &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbf{m}_{nm} = \sum_{l=l_{min}}^{l_{max}} \mathbf{r}_{nl} \times \mathbf{v}_{lm}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A detailed study of the convergence of the sum over states can be found in Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;. The same approach is also used in the Siesta code.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
=== Databases ===&lt;br /&gt;
[[File:R methyloxirane structure.png|x150px|frameless|right|R methyloxirane structure]]&lt;br /&gt;
In this tutorial we will compute NCD on Propylene oxide, also known as R-Methyloxirane&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;/&amp;gt;. R-Methyloxirane has often been used in the literature as a benchmark molecule for NCD calculations against experimental data, due to its rigidity.  To this end we provide a &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; database (DB) for R_methyloxirane. &lt;br /&gt;
&lt;br /&gt;
* Yambo core databases (9 Mb): [https://media.yambo-code.eu/educational/tutorials/files/R_methyloxirane_DBs.tar.gz R_methyloxirane_DBs.tar.gz]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Alternatively you can re-generate the DB by your-self (also because the DB provided have been generated with small convergence parameters). To this end you just need to download and compile quantum espresso, and generate the DB using the input files and the pseudo-potentials provided. &#039;&#039;&#039;(TODO: input files still missing)&#039;&#039;&#039;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Input files ===&lt;br /&gt;
To compute NCD a standard calculation of response function in transition space needs to be performed, also setting &amp;quot;dich&amp;quot; (short for dichroism) and eventually &amp;quot;trace&amp;quot; in the &amp;quot;BSE_prop&amp;quot; variable as below&lt;br /&gt;
 BSEprop= &amp;quot;abs &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;dich trace&amp;lt;/span&amp;gt;&amp;quot;   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
&lt;br /&gt;
Since the dipoles are obtained from a sum over states it is important to converge the number of states used in the equation, this can be controlled via the input variables&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DipBandsALL&amp;lt;/span&amp;gt;                    # [DIP] Compute all bands range, not only valence and conduction&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;100&amp;lt;/span&amp;gt; |                       # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
A standard input file for response function in transition space is (IP approximation)&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 BSEmod= &amp;quot;retarded&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;IP&amp;quot;                     # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 % BSEBands&lt;br /&gt;
   1 |  20 |                       # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  4.0000 | 7.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.10000 | 0.10000 |        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps=  1001                  # [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;
&lt;br /&gt;
A part from this, it is suggested to set the input variable which helps the convergence in isolated systems&lt;br /&gt;
 rim_cut                          # [R] Coulomb potential&lt;br /&gt;
 NonPDirs= &amp;quot;XYZ&amp;quot;                  # [X/BSS] Non periodic chartesian directions (X,Y,Z,XY...)&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1                RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;quot;ws xyz&amp;quot;                 # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere/ws X/Y/Z/XY..&lt;br /&gt;
 % CUTBox&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # [CUT] [au] Box sides&lt;br /&gt;
 %&lt;br /&gt;
 CUTRadius= 0.000000              # [CUT] [au] Sphere/Cylinder radius&lt;br /&gt;
 CUTCylLen= 0.000000              # [CUT] [au] Cylinder length&lt;br /&gt;
 CUTwsGvec= 0.700000              # [CUT] WS cutoff: number of G to be modified&lt;br /&gt;
&lt;br /&gt;
== Methyloxirane ==&lt;br /&gt;
&lt;br /&gt;
=== CD at the Independent Particles approximation ===&lt;br /&gt;
Here we use it to show how to compute NCD using the yambo code.&lt;br /&gt;
Here we provide a poorly converged database, just to show how a calculation of NCD works with the yambo code.&lt;br /&gt;
Using the input file provided above you will obtain the following plots for absorption (alpha file, on the left) and NCD (CD file, on the right): &lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Methylox abs tuto.png|450px|frameless|center|Yambo tutorial, absorption in methyloxirane]]&lt;br /&gt;
| [[File:Methylox cd tuto.png|450px|frameless|center|Yambo tutorial, circular dichroism in methyloxirane]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Below we also report the results with converged parameters from &amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;.&lt;br /&gt;
This simulation was done with an FCC supercell of size 50 and an energy cutoff of 90 Ry, while for the tutorial we used a supercell of size 20 and an energy cutoff of 70 Ry in the QE run.&lt;br /&gt;
Moreover a shift of X.XX eV was applied to align the spectra with the experimental data.&lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Absorption spectrum of methyloxirane.png|620px|frameless|center|Absorption spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
| [[File:Circular Dichroism spectrum of methyloxirane.png|590px|frameless|center|Circular Dichroism spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Beyond the Independent Particles approximation ===&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;wiki_CD&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Circular_dichroism Circular Dichroism] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Chiral_media Chiral Media] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Propylene_oxide Propylene oxide] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;&amp;gt;E. Molteni, G. Cappellini, and D. Sangalli, &#039;&#039;Ab initio circular dichroism with the Yambo code: applications to dipeptides&#039;&#039; [https://www.doi.org/10.1088/1757-899X/1265/1/012005 IOP Conf. Series: Materials Science and Engineering 1265, 012005 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;&amp;gt; E Molteni, G Mattioli, D Sangalli, &#039;&#039;Ab initio Circular Dichroism with the Yambo code: beyond the Independent Particle approximation&#039;&#039;, [https://www.sif.it/riviste/sif/ncc/econtents/2022/045/06/article/18 Il Nuovo Cimento 4 (C), 175 (2022)], [https://arxiv.org/abs/2202.12702 arXiv2202.12720]&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=Dichroism_in_molecules&amp;diff=945</id>
		<title>Dichroism in molecules</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Dichroism_in_molecules&amp;diff=945"/>
		<updated>2026-05-19T07:34:39Z</updated>

		<summary type="html">&lt;p&gt;Davide: All equations fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Chirality with hands.svg.png|x300px|frameless|right|Chirality representation with hands, from wikipedia]]&lt;br /&gt;
&lt;br /&gt;
Circular dichroism (CD) is dichroism involving circularly polarized light, i.e., the differential absorption of left- and right-handed light&amp;lt;ref name=&amp;quot;wiki_CD&amp;quot;/&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n(\omega) = n_R(\omega) - n_L(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dichroism in absorption can originate from an asymmetry in the dielectric tensor, which can be induced by the presence of either an external magnetic field or a spontaneous magnetization (MCD). This can be computed from the off-diagonal elements of the dielectric tensor. See the tutorial on [[The magneto-optical Kerr effect]] (MOKE). Another form of dichroism can be due to the chiral nature of molecules or materials&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;/&amp;gt; and goes under the name of natural circular dichroism (NCD). This latter can be related to the beta tensor and will be discussed in the present tutorial. See these references for NCD with the Lumen code: Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;, Ref.&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Few equations ==&lt;br /&gt;
&lt;br /&gt;
NCD is described by the trace of the so called beta tensor&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n(\omega) = \frac{8\pi N\omega}{3c} Tr[\beta_{\alpha\beta}(\omega)]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which related the electronic dipole to the time derivative of the applied magnetic field, and the magnetic dipole to the time derivative of the applied electric field  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu_{\alpha}(\omega) = \alpha_{\alpha\beta}(\omega) E_\beta(\omega) - \frac{i \omega}{c}\beta_{\alpha\beta}(\omega) B_\beta(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;m_{\alpha}(\omega) = \chi_{\alpha\beta}(\omega) B_\beta(\omega) + \frac{i \omega}{c}\beta_{\alpha\beta}(\omega) E_\beta(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latter can be obtained via the so called G tensor, which is similar to the dipole-dipole response function, but with electric and magnetic dipoles&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\beta_{\alpha\beta}(\omega) = -\frac{i\hbar m_e}{\omega q_e^2} G_{\alpha\beta}(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;G_{ij}(\omega) = \frac{q_e^2}{2m\hbar}\sum_{nm} &lt;br /&gt;
\left( \frac{r^i_{nm} m^j_{mn}}{\omega_{nm}-\omega-i\gamma} &lt;br /&gt;
+ \frac{m^i_{mn} r^j_{nm}}{\omega_{nm}+\omega+i\gamma} \right) &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculation of the magnetic dipoles is what makes NCD difficult to be computed in PBC, since these are not easily defined (solutions have been recently proposed in the literature). For isolated systems instead a simple sum over states can be employed (this is not possible in PBC because it involves diagonal intra-band dipoles):  &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathbf{m}_{nm} = \sum_{l=l_{min}}^{l_{max}} \mathbf{r}_{nl} \times \mathbf{v}_{lm}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A detailed study of the convergence of the sum over states can be found in Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;. The same approach is also used in the Siesta code.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
=== Databases ===&lt;br /&gt;
[[File:R methyloxirane structure.png|x150px|frameless|right|R methyloxirane structure]]&lt;br /&gt;
In this tutorial we will compute NCD on Propylene oxide, also known as R-Methyloxirane&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;/&amp;gt;. R-Methyloxirane has often been used in the literature as a benchmark molecule for NCD calculations against experimental data, due to its rigidity.  To this end we provide a &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; database (DB) for R_methyloxirane. &lt;br /&gt;
&lt;br /&gt;
* Yambo core databases (9 Mb): [https://media.yambo-code.eu/educational/tutorials/files/R_methyloxirane_DBs.tar.gz R_methyloxirane_DBs.tar.gz]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Alternatively you can re-generate the DB by your-self (also because the DB provided have been generated with small convergence parameters). To this end you just need to download and compile quantum espresso, and generate the DB using the input files and the pseudo-potentials provided. &#039;&#039;&#039;(TODO: input files still missing)&#039;&#039;&#039;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Input files ===&lt;br /&gt;
To compute NCD a standard calculation of response function in transition space needs to be performed, also setting &amp;quot;dich&amp;quot; (short for dichroism) and eventually &amp;quot;trace&amp;quot; in the &amp;quot;BSE_prop&amp;quot; variable as below&lt;br /&gt;
 BSEprop= &amp;quot;abs &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;dich trace&amp;lt;/span&amp;gt;&amp;quot;   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
&lt;br /&gt;
Since the dipoles are obtained from a sum over states it is important to converge the number of states used in the equation, this can be controlled via the input variables&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DipBandsALL&amp;lt;/span&amp;gt;                    # [DIP] Compute all bands range, not only valence and conduction&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;100&amp;lt;/span&amp;gt; |                       # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
A standard input file for response function in transition space is (IP approximation)&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 BSEmod= &amp;quot;retarded&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;IP&amp;quot;                     # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 % BSEBands&lt;br /&gt;
   1 |  20 |                       # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  4.0000 | 7.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.10000 | 0.10000 |        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps=  1001                  # [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;
&lt;br /&gt;
A part from this, it is suggested to set the input variable which helps the convergence in isolated systems&lt;br /&gt;
 rim_cut                          # [R] Coulomb potential&lt;br /&gt;
 NonPDirs= &amp;quot;XYZ&amp;quot;                  # [X/BSS] Non periodic chartesian directions (X,Y,Z,XY...)&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1                RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;quot;ws xyz&amp;quot;                 # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere/ws X/Y/Z/XY..&lt;br /&gt;
 % CUTBox&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # [CUT] [au] Box sides&lt;br /&gt;
 %&lt;br /&gt;
 CUTRadius= 0.000000              # [CUT] [au] Sphere/Cylinder radius&lt;br /&gt;
 CUTCylLen= 0.000000              # [CUT] [au] Cylinder length&lt;br /&gt;
 CUTwsGvec= 0.700000              # [CUT] WS cutoff: number of G to be modified&lt;br /&gt;
&lt;br /&gt;
== Methyloxirane ==&lt;br /&gt;
&lt;br /&gt;
=== CD at the Independent Particles approximation ===&lt;br /&gt;
Here we use it to show how to compute NCD using the yambo code.&lt;br /&gt;
Here we provide a poorly converged database, just to show how a calculation of NCD works with the yambo code.&lt;br /&gt;
Using the input file provided above you will obtain the following plots for absorption (alpha file, on the left) and NCD (CD file, on the right): &lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Methylox abs tuto.png|450px|frameless|center|Yambo tutorial, absorption in methyloxirane]]&lt;br /&gt;
| [[File:Methylox cd tuto.png|450px|frameless|center|Yambo tutorial, circular dichroism in methyloxirane]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Below we also report the results with converged parameters from &amp;lt;ref name=&amp;quot;Molteni2022&amp;quot;/&amp;gt;.&lt;br /&gt;
This simulation was done with an FCC supercell of size 50 and an energy cutoff of 90 Ry, while for the tutorial we used a supercell of size 20 and an energy cutoff of 70 Ry in the QE run.&lt;br /&gt;
Moreover a shift of X.XX eV was applied to align the spectra with the experimental data.&lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Absorption spectrum of methyloxirane.png|620px|frameless|center|Absorption spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
| [[File:Circular Dichroism spectrum of methyloxirane.png|590px|frameless|center|Circular Dichroism spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Beyond the Independent Particles approximation ===&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;wiki_CD&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Circular_dichroism Circular Dichroism] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Chiral_media Chiral Media] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Propylene_oxide Propylene oxide] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;&amp;gt;E. Molteni, G. Cappellini, and D. Sangalli, &#039;&#039;Ab initio circular dichroism with the Yambo code: applications to dipeptides&#039;&#039; [https://www.doi.org/10.1088/1757-899X/1265/1/012005 IOP Conf. Series: Materials Science and Engineering 1265, 012005 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;&amp;gt; E Molteni, G Mattioli, D Sangalli, &#039;&#039;Ab initio Circular Dichroism with the Yambo code: beyond the Independent Particle approximation&#039;&#039;, [https://www.sif.it/riviste/sif/ncc/econtents/2022/045/06/article/18 Il Nuovo Cimento 4 (C), 175 (2022)], [https://arxiv.org/abs/2202.12702 arXiv2202.12720]&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=Dichroism_in_molecules&amp;diff=944</id>
		<title>Dichroism in molecules</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Dichroism_in_molecules&amp;diff=944"/>
		<updated>2026-05-19T07:28:13Z</updated>

		<summary type="html">&lt;p&gt;Davide: Fixing some equations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Chirality with hands.svg.png|x300px|frameless|right|Chirality representation with hands, from wikipedia]]&lt;br /&gt;
&lt;br /&gt;
Circular dichroism (CD) is dichroism involving circularly polarized light, i.e., the differential absorption of left- and right-handed light&amp;lt;ref name=&amp;quot;wiki_CD&amp;quot;/&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n(\omega) = n_R(\omega) - n_L(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dichroism in absorption can originate from an asymmetry in the dielectric tensor, which can be induced by the presence of either an external magnetic field or a spontaneous magnetization (MCD). This can be computed from the off-diagonal elements of the dielectric tensor. See the tutorial on [[The magneto-optical Kerr effect]] (MOKE). Another form of dichroism can be due to the chiral nature of molecules or materials&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;/&amp;gt; and goes under the name of natural circular dichroism (NCD). This latter can be related to the beta tensor and will be discussed in the present tutorial. See these references for NCD with the Lumen code: Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;, Ref.&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Few equations ==&lt;br /&gt;
&lt;br /&gt;
NCD is described by the trace of the so called beta tensor&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n(\omega) = \frac{8\pi N\omega}{3c} Tr[\beta_{\alpha\beta}(\omega)]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which related the electronic dipole to the time derivative of the applied magnetic field, and the magnetic dipole to the time derivative of the applied electric field  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu_{\alpha}(\omega) = \alpha_{\alpha\beta}(\omega) E_\beta(\omega) - \frac{i \omega}{c}\beta_{\alpha\beta}(\omega) B_\beta(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;m_{\alpha}(\omega) = \chi_{\alpha\beta}(\omega) B_\beta(\omega) + \frac{i \omega}{c}\beta_{\alpha\beta}(\omega) E_\beta(\omega)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The latter can be obtained via the so called G tensor, which is similar to the dipole-dipole response function, but with electric and magnetic dipoles&lt;br /&gt;
&lt;br /&gt;
[[File:Beta G tensor relation.png|x60px|frameless|Beta G tensor relation]]  &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Gtensor.png|x120px|frameless|Yambo tutorial image]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculation of the magnetic dipoles is what makes NCD difficult to be computed in PBC, since these are not easily defined (solutions have been recently proposed in the literature). For isolated systems instead a simple sum over states can be employed (this is not possible in PBC because it involves diagonal intra-band dipoles):  &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Mdipoles sum over states.png|x70px|frameless|Yambo tutorial image]] &lt;br /&gt;
&lt;br /&gt;
A detailed study of the convergence of the sum over states can be found in Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;. The same approach is also used in the Siesta code.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
=== Databases ===&lt;br /&gt;
[[File:R methyloxirane structure.png|x150px|frameless|right|R methyloxirane structure]]&lt;br /&gt;
In this tutorial we will compute NCD on Propylene oxide, also known as R-Methyloxirane&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;/&amp;gt;. R-Methyloxirane has often been used in the literature as a benchmark molecule for NCD calculations against experimental data, due to its rigidity.  To this end we provide a &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; database (DB) for R_methyloxirane. &lt;br /&gt;
&lt;br /&gt;
* Yambo core databases (9 Mb): [https://media.yambo-code.eu/educational/tutorials/files/R_methyloxirane_DBs.tar.gz R_methyloxirane_DBs.tar.gz]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Alternatively you can re-generate the DB by your-self (also because the DB provided have been generated with small convergence parameters). To this end you just need to download and compile quantum espresso, and generate the DB using the input files and the pseudo-potentials provided. &#039;&#039;&#039;(TODO: input files still missing)&#039;&#039;&#039;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Input files ===&lt;br /&gt;
To compute NCD a standard calculation of response function in transition space needs to be performed, also setting &amp;quot;dich&amp;quot; (short for dichroism) and eventually &amp;quot;trace&amp;quot; in the &amp;quot;BSE_prop&amp;quot; variable as below&lt;br /&gt;
 BSEprop= &amp;quot;abs &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;dich trace&amp;lt;/span&amp;gt;&amp;quot;   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
&lt;br /&gt;
Since the dipoles are obtained from a sum over states it is important to converge the number of states used in the equation, this can be controlled via the input variables&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DipBandsALL&amp;lt;/span&amp;gt;                    # [DIP] Compute all bands range, not only valence and conduction&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;100&amp;lt;/span&amp;gt; |                       # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
A standard input file for response function in transition space is (IP approximation)&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 BSEmod= &amp;quot;retarded&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;IP&amp;quot;                     # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 % BSEBands&lt;br /&gt;
   1 |  20 |                       # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  4.0000 | 7.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.10000 | 0.10000 |        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps=  1001                  # [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;
&lt;br /&gt;
A part from this, it is suggested to set the input variable which helps the convergence in isolated systems&lt;br /&gt;
 rim_cut                          # [R] Coulomb potential&lt;br /&gt;
 NonPDirs= &amp;quot;XYZ&amp;quot;                  # [X/BSS] Non periodic chartesian directions (X,Y,Z,XY...)&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1                RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;quot;ws xyz&amp;quot;                 # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere/ws X/Y/Z/XY..&lt;br /&gt;
 % CUTBox&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # [CUT] [au] Box sides&lt;br /&gt;
 %&lt;br /&gt;
 CUTRadius= 0.000000              # [CUT] [au] Sphere/Cylinder radius&lt;br /&gt;
 CUTCylLen= 0.000000              # [CUT] [au] Cylinder length&lt;br /&gt;
 CUTwsGvec= 0.700000              # [CUT] WS cutoff: number of G to be modified&lt;br /&gt;
&lt;br /&gt;
== Methyloxirane ==&lt;br /&gt;
&lt;br /&gt;
=== CD at the Independent Particles approximation ===&lt;br /&gt;
Here we use it to show how to compute NCD using the yambo code.&lt;br /&gt;
Here we provide a poorly converged database, just to show how a calculation of NCD works with the yambo code.&lt;br /&gt;
Using the input file provided above you will obtain the following plots for absorption (alpha file, on the left) and NCD (CD file, on the right): &lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Methylox abs tuto.png|450px|frameless|center|Yambo tutorial, absorption in methyloxirane]]&lt;br /&gt;
| [[File:Methylox cd tuto.png|450px|frameless|center|Yambo tutorial, circular dichroism in methyloxirane]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Below we also report the results with converged parameters from &amp;lt;ref name=&amp;quot;Molteni2022&amp;quot;/&amp;gt;.&lt;br /&gt;
This simulation was done with an FCC supercell of size 50 and an energy cutoff of 90 Ry, while for the tutorial we used a supercell of size 20 and an energy cutoff of 70 Ry in the QE run.&lt;br /&gt;
Moreover a shift of X.XX eV was applied to align the spectra with the experimental data.&lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Absorption spectrum of methyloxirane.png|620px|frameless|center|Absorption spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
| [[File:Circular Dichroism spectrum of methyloxirane.png|590px|frameless|center|Circular Dichroism spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Beyond the Independent Particles approximation ===&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;wiki_CD&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Circular_dichroism Circular Dichroism] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Chiral_media Chiral Media] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Propylene_oxide Propylene oxide] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;&amp;gt;E. Molteni, G. Cappellini, and D. Sangalli, &#039;&#039;Ab initio circular dichroism with the Yambo code: applications to dipeptides&#039;&#039; [https://www.doi.org/10.1088/1757-899X/1265/1/012005 IOP Conf. Series: Materials Science and Engineering 1265, 012005 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;&amp;gt; E Molteni, G Mattioli, D Sangalli, &#039;&#039;Ab initio Circular Dichroism with the Yambo code: beyond the Independent Particle approximation&#039;&#039;, [https://www.sif.it/riviste/sif/ncc/econtents/2022/045/06/article/18 Il Nuovo Cimento 4 (C), 175 (2022)], [https://arxiv.org/abs/2202.12702 arXiv2202.12720]&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=Dichroism_in_molecules&amp;diff=943</id>
		<title>Dichroism in molecules</title>
		<link rel="alternate" type="text/html" href="https://www.lumen-code.org/wiki/index.php?title=Dichroism_in_molecules&amp;diff=943"/>
		<updated>2026-05-19T07:23:51Z</updated>

		<summary type="html">&lt;p&gt;Davide: Fixed initial equation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Chirality with hands.svg.png|x300px|frameless|right|Chirality representation with hands, from wikipedia]]&lt;br /&gt;
&lt;br /&gt;
Circular dichroism (CD) is dichroism involving circularly polarized light, i.e., the differential absorption of left- and right-handed light&amp;lt;ref name=&amp;quot;wiki_CD&amp;quot;/&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Delta n = n_R-n_L&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dichroism in absorption can originate from an asymmetry in the dielectric tensor, which can be induced by the presence of either an external magnetic field or a spontaneous magnetization (MCD). This can be computed from the off-diagonal elements of the dielectric tensor. See the tutorial on [[The magneto-optical Kerr effect]] (MOKE). Another form of dichroism can be due to the chiral nature of molecules or materials&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;/&amp;gt; and goes under the name of natural circular dichroism (NCD). This latter can be related to the beta tensor and will be discussed in the present tutorial. See these references for NCD with the Lumen code: Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;, Ref.&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Few equations ==&lt;br /&gt;
&lt;br /&gt;
NCD is described by the trace of the so called beta tensor&lt;br /&gt;
&lt;br /&gt;
[[File:Deltan Beta relation.png|x60px|frameless|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
which related the electronic dipole to the time derivative of the applied magnetic field, and the magnetic dipole to the time derivative of the applied electric field  &lt;br /&gt;
&lt;br /&gt;
[[File:Dipoles fields relations.png|x120px|frameless|Yambo tutorial image]]&lt;br /&gt;
&lt;br /&gt;
The latter can be obtained via the so called G tensor, which is similar to the dipole-dipole response function, but with electric and magnetic dipoles&lt;br /&gt;
&lt;br /&gt;
[[File:Beta G tensor relation.png|x60px|frameless|Beta G tensor relation]]  &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Gtensor.png|x120px|frameless|Yambo tutorial image]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculation of the magnetic dipoles is what makes NCD difficult to be computed in PBC, since these are not easily defined (solutions have been recently proposed in the literature). For isolated systems instead a simple sum over states can be employed (this is not possible in PBC because it involves diagonal intra-band dipoles):  &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Mdipoles sum over states.png|x70px|frameless|Yambo tutorial image]] &lt;br /&gt;
&lt;br /&gt;
A detailed study of the convergence of the sum over states can be found in Ref.&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;/&amp;gt;. The same approach is also used in the Siesta code.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
=== Databases ===&lt;br /&gt;
[[File:R methyloxirane structure.png|x150px|frameless|right|R methyloxirane structure]]&lt;br /&gt;
In this tutorial we will compute NCD on Propylene oxide, also known as R-Methyloxirane&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;/&amp;gt;. R-Methyloxirane has often been used in the literature as a benchmark molecule for NCD calculations against experimental data, due to its rigidity.  To this end we provide a &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; database (DB) for R_methyloxirane. &lt;br /&gt;
&lt;br /&gt;
* Yambo core databases (9 Mb): [https://media.yambo-code.eu/educational/tutorials/files/R_methyloxirane_DBs.tar.gz R_methyloxirane_DBs.tar.gz]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Alternatively you can re-generate the DB by your-self (also because the DB provided have been generated with small convergence parameters). To this end you just need to download and compile quantum espresso, and generate the DB using the input files and the pseudo-potentials provided. &#039;&#039;&#039;(TODO: input files still missing)&#039;&#039;&#039;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Input files ===&lt;br /&gt;
To compute NCD a standard calculation of response function in transition space needs to be performed, also setting &amp;quot;dich&amp;quot; (short for dichroism) and eventually &amp;quot;trace&amp;quot; in the &amp;quot;BSE_prop&amp;quot; variable as below&lt;br /&gt;
 BSEprop= &amp;quot;abs &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;dich trace&amp;lt;/span&amp;gt;&amp;quot;   # [BSS] abs/kerr/magn/dichr trace&lt;br /&gt;
&lt;br /&gt;
Since the dipoles are obtained from a sum over states it is important to converge the number of states used in the equation, this can be controlled via the input variables&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;DipBandsALL&amp;lt;/span&amp;gt;                    # [DIP] Compute all bands range, not only valence and conduction&lt;br /&gt;
 DipApproach= &amp;quot;G-space v&amp;quot;         # [DIP] [G-space v/R-space x/Covariant/Shifted grids]&lt;br /&gt;
 % DipBands&lt;br /&gt;
    1 |  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;100&amp;lt;/span&amp;gt; |                       # [DIP] Bands range for dipoles&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
A standard input file for response function in transition space is (IP approximation)&lt;br /&gt;
 optics                           # [R] Linear Response optical properties&lt;br /&gt;
 bse                              # [R][BSE] Bethe Salpeter Equation.&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 BSEmod= &amp;quot;retarded&amp;quot;               # [BSE] resonant/retarded/coupling&lt;br /&gt;
 BSKmod= &amp;quot;IP&amp;quot;                     # [BSE] IP/Hartree/HF/ALDA/SEX/BSfxc&lt;br /&gt;
 % BSEBands&lt;br /&gt;
   1 |  20 |                       # [BSK] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 % BEnRange&lt;br /&gt;
  4.0000 | 7.00000 |         eV    # [BSS] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % BDmRange&lt;br /&gt;
  0.10000 | 0.10000 |        eV    # [BSS] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 BEnSteps=  1001                  # [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;
&lt;br /&gt;
A part from this, it is suggested to set the input variable which helps the convergence in isolated systems&lt;br /&gt;
 rim_cut                          # [R] Coulomb potential&lt;br /&gt;
 NonPDirs= &amp;quot;XYZ&amp;quot;                  # [X/BSS] Non periodic chartesian directions (X,Y,Z,XY...)&lt;br /&gt;
 RandQpts=0                       # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 1                RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;quot;ws xyz&amp;quot;                 # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere/ws X/Y/Z/XY..&lt;br /&gt;
 % CUTBox&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # [CUT] [au] Box sides&lt;br /&gt;
 %&lt;br /&gt;
 CUTRadius= 0.000000              # [CUT] [au] Sphere/Cylinder radius&lt;br /&gt;
 CUTCylLen= 0.000000              # [CUT] [au] Cylinder length&lt;br /&gt;
 CUTwsGvec= 0.700000              # [CUT] WS cutoff: number of G to be modified&lt;br /&gt;
&lt;br /&gt;
== Methyloxirane ==&lt;br /&gt;
&lt;br /&gt;
=== CD at the Independent Particles approximation ===&lt;br /&gt;
Here we use it to show how to compute NCD using the yambo code.&lt;br /&gt;
Here we provide a poorly converged database, just to show how a calculation of NCD works with the yambo code.&lt;br /&gt;
Using the input file provided above you will obtain the following plots for absorption (alpha file, on the left) and NCD (CD file, on the right): &lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Methylox abs tuto.png|450px|frameless|center|Yambo tutorial, absorption in methyloxirane]]&lt;br /&gt;
| [[File:Methylox cd tuto.png|450px|frameless|center|Yambo tutorial, circular dichroism in methyloxirane]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Below we also report the results with converged parameters from &amp;lt;ref name=&amp;quot;Molteni2022&amp;quot;/&amp;gt;.&lt;br /&gt;
This simulation was done with an FCC supercell of size 50 and an energy cutoff of 90 Ry, while for the tutorial we used a supercell of size 20 and an energy cutoff of 70 Ry in the QE run.&lt;br /&gt;
Moreover a shift of X.XX eV was applied to align the spectra with the experimental data.&lt;br /&gt;
{|style=&amp;quot;margin: 10px auto;&amp;quot;&lt;br /&gt;
| [[File:Absorption spectrum of methyloxirane.png|620px|frameless|center|Absorption spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
| [[File:Circular Dichroism spectrum of methyloxirane.png|590px|frameless|center|Circular Dichroism spectrum of methyloxirane. Yambo results compared with experimental data.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Beyond the Independent Particles approximation ===&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;wiki_CD&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Circular_dichroism Circular Dichroism] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_chiral&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Chiral_media Chiral Media] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;wiki_PropOxide&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/Propylene_oxide Propylene oxide] on wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022a&amp;quot;&amp;gt;E. Molteni, G. Cappellini, and D. Sangalli, &#039;&#039;Ab initio circular dichroism with the Yambo code: applications to dipeptides&#039;&#039; [https://www.doi.org/10.1088/1757-899X/1265/1/012005 IOP Conf. Series: Materials Science and Engineering 1265, 012005 (2022)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Molteni2022b&amp;quot;&amp;gt; E Molteni, G Mattioli, D Sangalli, &#039;&#039;Ab initio Circular Dichroism with the Yambo code: beyond the Independent Particle approximation&#039;&#039;, [https://www.sif.it/riviste/sif/ncc/econtents/2022/045/06/article/18 Il Nuovo Cimento 4 (C), 175 (2022)], [https://arxiv.org/abs/2202.12702 arXiv2202.12720]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Davide</name></author>
	</entry>
</feed>