<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yambo-code.eu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yambowikiadmin</id>
	<title>The Yambo Project - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yambo-code.eu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yambowikiadmin"/>
	<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Special:Contributions/Yambowikiadmin"/>
	<updated>2026-04-11T04:01:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=9183</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=9183"/>
		<updated>2025-10-13T19:49:16Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Non-Linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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]]&lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
* [[Thermal lines and special displacements with YamboPy]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
=== Linear response ===&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 ===&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;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (external tutorial on www.attaccalite.com)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
=== Pump and Probe experiments ===&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;
* [[Pump and Probe: reading electronic occuations from Perturbo code]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=SHG_within_the_TD-aGW_level_(also_called_TD-HSEX,_TD-BSE)&amp;diff=9182</id>
		<title>SHG within the TD-aGW level (also called TD-HSEX, TD-BSE)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=SHG_within_the_TD-aGW_level_(also_called_TD-HSEX,_TD-BSE)&amp;diff=9182"/>
		<updated>2025-10-13T19:48:16Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Yambowikiadmin moved page SHG within the TD-aGW level (also called TD-HSEX, TD-BSE) to SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=SHG_within_the_TD-HSEX_level_(also_called_TD-aGW_or_TD-BSE)&amp;diff=9181</id>
		<title>SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=SHG_within_the_TD-HSEX_level_(also_called_TD-aGW_or_TD-BSE)&amp;diff=9181"/>
		<updated>2025-10-13T19:48:16Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Yambowikiadmin moved page SHG within the TD-aGW level (also called TD-HSEX, TD-BSE) to SHG within the TD-HSEX level (also called TD-aGW or TD-BSE)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TD-aGW.png|right|300px |Sum frequency generation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial we show step by step how to calculate SHG within the TD-aGW approximation.&amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;/&amp;gt;&lt;br /&gt;
This approximation was also called TD-BSE or TD-HSEX in previous papers.&amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This calculation is quite complicated, here we present a simple strategy to do it.&lt;br /&gt;
We will consider hBN monolayer as example because calculations are very fast.&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
Download the code from github&lt;br /&gt;
&lt;br /&gt;
 [https://github.com/yambo-code/yambo https://github.com/yambo-code/yambo]&lt;br /&gt;
&lt;br /&gt;
and compiler all yambo projects by doing&lt;br /&gt;
&lt;br /&gt;
 ./configure&lt;br /&gt;
 make all&lt;br /&gt;
&lt;br /&gt;
because this tutorial will require different yambo executables&lt;br /&gt;
&lt;br /&gt;
== Calculations for the quasi-particle band structure ==&lt;br /&gt;
&lt;br /&gt;
We start from a self-consistent(scf) and a non-self-consistent (nscf) of hBN with QuantumEspresso.&lt;br /&gt;
All inputs file are here: [https://www.attaccalite.com/tutorials_yambo/hBNsymm.tgz hBNsymm.tgz]&lt;br /&gt;
&lt;br /&gt;
We included 40 bands in the DFT calculation that are used to converge the dielectric constant the enters in the GW and in the COLLISIONS calculations.&amp;lt;br&amp;gt;&lt;br /&gt;
We run all the calculation in the folder &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;hBNsymm&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Run the SCF and NSCF calculations with QuantumEspresso&lt;br /&gt;
* Go in the &amp;lt;code&amp;gt;bn.save&amp;lt;/code&amp;gt; folder and run &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;p2y&amp;lt;/span&amp;gt;&lt;br /&gt;
* Run the setup, just execute &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo&amp;lt;/span&amp;gt;&lt;br /&gt;
* Generate the input file for the GW calculation: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo -g n -r -X p -gw0 p -F gw.in&amp;lt;/span&amp;gt;. &amp;lt;br&amp;gt;Notice that if you want to use a scissor operator in the non-linear response you can skip this calculation. &amp;lt;br&amp;gt;Notice also that we added the flag &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; to introduce a cut-off to the Coulomb interaction for low-dimensional systems.&lt;br /&gt;
&lt;br /&gt;
 dyson                            # [R] Dyson Equation solver&lt;br /&gt;
 rim_cut                          # [R] Coulomb potential&lt;br /&gt;
 ppa                              # [R][Xp] Plasmon Pole Approximation for the Screened Interaction&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 el_el_corr                       # [R] Electron-Electron Correlation&lt;br /&gt;
 HF_and_locXC                     # [R] Hartree-Fock&lt;br /&gt;
 em1d                             # [R][X] Dynamically Screened Interaction&lt;br /&gt;
 RandQpts=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5000000&amp;lt;/span&amp;gt;               # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;29&amp;lt;/span&amp;gt;             RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
  CUTGeo= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;quot;slab z&amp;quot;&amp;lt;/span&amp;gt;                 # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere/ws/slab 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;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 |  40 |                         # [Xp] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp=  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3000  &amp;lt;/span&amp;gt;         mHa   # [Xp] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  0.000000 | 1.000000 | 0.000000 |        # [Xp] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 PPAPntXp= 27.21138         eV    # [Xp] PPA imaginary energy&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 |  40 |                         # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 GTermKind= &amp;quot;none&amp;quot;                # [GW] GW terminator (&amp;quot;none&amp;quot;,&amp;quot;BG&amp;quot; Bruneval-Gonze,&amp;quot;BRS&amp;quot; Berger-Reining-Sottile)&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                   # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;,&amp;quot;q&amp;quot;)&lt;br /&gt;
 %QPkrange                        # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1|14|3|6|&amp;lt;/span&amp;gt;&lt;br /&gt;
 %&lt;br /&gt;
Notice that we calculate the GW corrections only for the bands &#039;&#039;&#039;3-6&#039;&#039;&#039; we want to use in the non-linear response.&lt;br /&gt;
&lt;br /&gt;
* Run the calculation with the command: &amp;lt;code&amp;gt;yambo -F gw.in&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional step: you can calculate the BSE response that can be usefull to interprate the non-linear response with the command: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo -o b -k sex -r -X p -V qp -y d -F bse.in&amp;lt;/span&amp;gt; &amp;lt;br&amp;gt; (do not forget to read the Quasi-Particle database by setting &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;KfnQPdb= &amp;quot;E &amp;lt; SAVE/ndb.QP&amp;quot;&amp;lt;/span&amp;gt; in the bse.in file.&lt;br /&gt;
&lt;br /&gt;
== Calculations of the non-linear response ==&lt;br /&gt;
* Generate input file to remove symmatries: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp_nl -y&amp;lt;/span&amp;gt;&lt;br /&gt;
 fixsyms                          &lt;br /&gt;
 # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 | 1.000000 | 0.000000 |   &amp;lt;/span&amp;gt;     # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RRmTimeRev    &amp;lt;/span&amp;gt;                 # Remove Time Reversal&lt;br /&gt;
&lt;br /&gt;
here we remove all symmetries but you it is possible to remove only the ones not compatible with the external field,&amp;lt;br&amp;gt;&lt;br /&gt;
by putting the field version in the ypp input and removing the time reversal symmetry (&amp;lt;code&amp;gt;RmTimeRev&amp;lt;/code&amp;gt;) that is not compatible with the real-time dynamics, &amp;lt;br&amp;gt;&lt;br /&gt;
see for instance here: [[Prerequisites for Real Time propagation with Yambo]]&lt;br /&gt;
&lt;br /&gt;
* Go in the  &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt; folder and run setup again&lt;br /&gt;
&lt;br /&gt;
* Calculate the static dielectric constant and the collisions integrals: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_rt -X s -collisions -potential h+sex -r -F collisions.in&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 collisions                       # [R] Collisions&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 rim_cut                          # [R] Coulomb potential&lt;br /&gt;
 RandQpts=&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;5000000   &amp;lt;/span&amp;gt;                   # [RIM] Number of random q-points in the BZ&lt;br /&gt;
 RandGvec= 29                RL    # [RIM] Coulomb interaction RS components&lt;br /&gt;
 CUTGeo= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;quot;slab z&amp;quot;  &amp;lt;/span&amp;gt;                 # [CUT] Coulomb Cutoff geometry: box/cylinder/sphere/ws/slab 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;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  1 |  40 |     &amp;lt;/span&amp;gt;                    # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3000 mHa &amp;lt;/span&amp;gt;  # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  0.000000 |  1.00000    |  0.00000    # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % COLLBands&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;   4 |  5 |      &amp;lt;/span&amp;gt;                   # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;     # [SC] SC HXC Potential&lt;br /&gt;
 HARRLvcs=&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 3000 mHa   &amp;lt;/span&amp;gt; # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3000 mHa   &amp;lt;/span&amp;gt; # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3000 mHa   &amp;lt;/span&amp;gt; # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
For the Collisions it is important to use &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt; because it is in single-precision and much faster than &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;. &amp;lt;br&amp;gt;&lt;br /&gt;
Notice that we also use the cutoff on the Coulomb interaction &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; because this is a 2D system.&lt;br /&gt;
&lt;br /&gt;
* Run the calculations &amp;lt;code&amp;gt;yambo_rt -F collisions.in&amp;lt;/code&amp;gt;. &lt;br /&gt;
* Generate input file for the non-linear response: &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -u n -V qp -F nonlinear.in &amp;lt;/span&amp;gt;&lt;br /&gt;
* Run the SHG calculation including collisions, with the command:  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;yambo_nl -nl n -V qp&amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 DIP_Threads=0                    # [OPENMP/X] Number of threads for dipoles&lt;br /&gt;
 NL_Threads=0                     # [OPENMP/NL] Number of threads for nl-optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 |    &amp;lt;/span&amp;gt;                       # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLtime=42.000000&amp;lt;/span&amp;gt;          fs    # [NL] Simulation Time&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLintegrator= &amp;quot;CRANKNIC&amp;quot;        &amp;lt;/span&amp;gt; # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;NLCorrelation= &amp;quot;SEX&amp;quot;          &amp;lt;/span&amp;gt;   # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;  2.000000 | 8.000000 |  &amp;lt;/span&amp;gt;       eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps=  80                   # [NL] Energy steps&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;HARRLvcs= 3000             mHa &amp;lt;/span&amp;gt;  # [HA] Hartree     RL components&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;EXXRLvcs= 3000             mHa &amp;lt;/span&amp;gt;  # [XX] Exchange    RL components&lt;br /&gt;
 GfnQPdb= &amp;quot; &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;E &amp;lt; SAVE/ndb.QP&amp;lt;/span&amp;gt;&amp;quot;                  # [EXTQP G] Database action&lt;br /&gt;
 .............&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;quot;SOFTSIN&amp;quot;           # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 Field1_pol= &amp;quot;linear&amp;quot;         # [RT Field1] Pol(linear|circular)&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 0.000000 | 1.000000 | 0.000000 |    &amp;lt;/span&amp;gt;    # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
== Analysis of the non-linear response ==&lt;br /&gt;
* Use the command  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp_nl -u &amp;lt;/span&amp;gt; to analyze the result&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Xorder= 4  &amp;lt;/span&amp;gt;                      # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;40.000 | -1.00000 |   &amp;lt;/span&amp;gt;      fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= 0.000000       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
now you can plot columns 4 and 5 of the o.YPP-X_probe_order_2 file that are the real and imaginary part of Xhi2 along yyy direction.&lt;br /&gt;
Using gnuplot, just plot &lt;br /&gt;
 &lt;br /&gt;
 p &#039;o.YPP-X_probe_order_2&#039; u 1:(sqrt($4**2+$5**2)) t &#039;SHG in hBN monolayer&#039; w lp&lt;br /&gt;
&lt;br /&gt;
and you will get &lt;br /&gt;
&lt;br /&gt;
[[File:Xhi2 hbn.png|center]]&lt;br /&gt;
&lt;br /&gt;
Alternative to  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;ypp_nl&amp;lt;/span&amp;gt; you can also use &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt;YamboPy&amp;lt;/span&amp;gt; to analyze and plot the data see here: [https://wiki.yambo-code.eu/wiki/index.php?title=Real_time_approach_to_non-linear_response_(SHG)#Analysis_of_the_results_using_YamboPy Analysis of the results using_YamboPy]&lt;br /&gt;
&lt;br /&gt;
Here after we resume with a simple scheme all the steps to calculate SHG at the GoWo+BSE level (courtesy of Sohan, Central University of Punjab, India):&lt;br /&gt;
&lt;br /&gt;
[[File:SHG including GoWo BSE.png|center|SHG GoWo+BSE]]&lt;br /&gt;
&lt;br /&gt;
If you arrived up here, you have the right to listen to the [https://www.youtube.com/watch?v=gz2WMvHCJOU Yambo song].&lt;br /&gt;
&lt;br /&gt;
== Tips and tricks ==&lt;br /&gt;
&lt;br /&gt;
* When you calculate the dielectric constant add the flag -V par to set the parallelization and put as much as possible processors on conduction &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; bands&lt;br /&gt;
to decrease the memory&lt;br /&gt;
* Regenerate inputs with flag -V RL and decrease the number of total plane-wave to half, this will speed up calculation and save memory, results are the same&lt;br /&gt;
* In the non-linear calculation put all processors on the frequencies &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; this is a super-efficent parallelization but does not distributed the memory&lt;br /&gt;
&lt;br /&gt;
== References == &lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;C. Attaccalite, M. Grüning, and A. Marini, &#039;&#039;Real-time approach to the optical properties of solids and nanostructures: Time-dependent Bethe-Salpeter equation&#039;&#039;, [https://doi.org/10.1103/PhysRevB.84.245110 Phys. Rev. B &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Grüning, Nonlinear optics from an ab initio approach by means of the dynamical Berry phase: Application to second- and third-harmonic generation in semiconductors, [ https://doi.org/10.1103/PhysRevB.88.235113  Phys. Rev. B &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=MediaWiki:Sidebar&amp;diff=8909</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=MediaWiki:Sidebar&amp;diff=8909"/>
		<updated>2025-07-04T10:58:48Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* navigation&lt;br /&gt;
** mainpage| Wiki-edu Home&lt;br /&gt;
** https://www.yambo-code.eu| WWW Home&lt;br /&gt;
* Documentation&lt;br /&gt;
** Theory|Theory&lt;br /&gt;
** Lectures|Lectures&lt;br /&gt;
** Cheatsheets|Cheatsheets&lt;br /&gt;
** Variables|Input file variables&lt;br /&gt;
** Selected Readings|Selected Readings&lt;br /&gt;
** Thesis|Thesis&lt;br /&gt;
* Get Yambo&lt;br /&gt;
** Setting_up_Yambo | Yambo and yambopy&lt;br /&gt;
** Download| Download&lt;br /&gt;
** Installation| Install&lt;br /&gt;
** Virtual_Machines| Virtual Machines (Cloud, docker, VBox)&lt;br /&gt;
* Tutorials&lt;br /&gt;
** Tutorials|Overview&lt;br /&gt;
** Tutorials_download|Files Download&lt;br /&gt;
** Tutorials_all|All tutorials&lt;br /&gt;
** Tutorials_modular|Modular only&lt;br /&gt;
*** Modules|Modules&lt;br /&gt;
** First steps in Yambopy|Yambopy&lt;br /&gt;
&lt;br /&gt;
* Schools&lt;br /&gt;
** Schools|List of Schools&lt;br /&gt;
** Modena_2025 | Modena 2025&lt;br /&gt;
** Colombia_2024|HPC Workshop 2024 (Barranquilla)&lt;br /&gt;
** ASESMA_2023|ASESMA 2023 (Kigali)&lt;br /&gt;
** Rome_2023|Rome 2023&lt;br /&gt;
** RASESMA_2023_Nairobi|RASESMA 2023 (Nairobi)&lt;br /&gt;
** ICTP_2022|ICTP 2022&lt;br /&gt;
** CECAM_VIRTUAL_2021|CECAM 2021&lt;br /&gt;
** ICTP2020|ICTP 2020&lt;br /&gt;
* SEARCH&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* navigation&lt;br /&gt;
* Wikitools&lt;br /&gt;
** recentchanges-url|recentchanges&lt;br /&gt;
** randompage-url|randompage&lt;br /&gt;
** helppage|help&lt;br /&gt;
** Developers Corner| Developers Corner&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8842</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8842"/>
		<updated>2025-05-26T12:28:03Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* ARPES as BSE post processing */  added figures&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;.&lt;br /&gt;
You can download and use the following yambo fork if you are interested:  https://gitlab.com/sangallidavide/lumen/-/tree/phys-excitons&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy. See Ref.&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery  widths=400 heights=270&amp;gt;&lt;br /&gt;
File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T0.png|600px|Reconstructed ARPES spectral function in LiF at temperature T=0 K&lt;br /&gt;
File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T300.png|600px|Reconstructed ARPES spectral function in LiF at temperature T=300 K&lt;br /&gt;
File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T3000.png|600px|Reconstructed ARPES spectral function in LiF at temperature T=3000 K&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:TD-PE_ypp_5b_e60_kx6_kx24_ALL_12.50.1_cond_distr_T3000.png&amp;diff=8841</id>
		<title>File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T3000.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:TD-PE_ypp_5b_e60_kx6_kx24_ALL_12.50.1_cond_distr_T3000.png&amp;diff=8841"/>
		<updated>2025-05-26T12:26:17Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ARPES spectral function in LiF at 3000 K&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:TD-PE_ypp_5b_e60_kx6_kx24_ALL_12.50.1_cond_distr_T300.png&amp;diff=8840</id>
		<title>File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T300.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:TD-PE_ypp_5b_e60_kx6_kx24_ALL_12.50.1_cond_distr_T300.png&amp;diff=8840"/>
		<updated>2025-05-26T12:25:42Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ARPES spectral function in LiF at 300 K&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:TD-PE_ypp_5b_e60_kx6_kx24_ALL_12.50.1_cond_distr_T0.png&amp;diff=8839</id>
		<title>File:TD-PE ypp 5b e60 kx6 kx24 ALL 12.50.1 cond distr T0.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:TD-PE_ypp_5b_e60_kx6_kx24_ALL_12.50.1_cond_distr_T0.png&amp;diff=8839"/>
		<updated>2025-05-26T12:13:40Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Reconstructed ARPES spectral function in LiF with excitonic distribution at T=0 K&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8838</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8838"/>
		<updated>2025-05-26T12:11:38Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* ARPES as BSE post processing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;.&lt;br /&gt;
You can download and use the following yambo fork if you are interested:  https://gitlab.com/sangallidavide/lumen/-/tree/phys-excitons&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy. See Ref.&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8837</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8837"/>
		<updated>2025-05-26T12:01:17Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: fixed missing end of ref&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy. See Ref.&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8836</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8836"/>
		<updated>2025-05-26T12:00:39Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* ARPES as BSE post processing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy. See Ref.&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8835</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8835"/>
		<updated>2025-05-26T12:00:23Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Cervantes2025&amp;quot;&amp;gt;V. Gosetti, J. Cervantes-Villanueva, S. Mor, D. Sangalli, A. García-Cristóbal, et al., &#039;&#039;Unveiling exciton formation: exploring the early stages in time, energy and momentum domain&#039;&#039;&lt;br /&gt;
[https://arxiv.org/abs/2412.02507 preprint arXiv:2412.02507 (2025)]&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8834</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8834"/>
		<updated>2025-05-26T11:58:05Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* ARPES as BSE post processing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8833</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8833"/>
		<updated>2025-05-26T11:56:33Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Adding references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons. See Refs.&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;/&amp;gt; &amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Perfetto2019&amp;quot;&amp;gt;E. Perfetto, D Sangalli, A Marini, G Stefanucci, &#039;&#039;Pump-driven normal-to-excitonic insulator transition: Josephson oscillations and signatures of BEC-BCS crossover in time-resolved ARPES&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.3.124601 Physical Review Materials &#039;&#039;&#039;3&#039;&#039;&#039;, 124601 (2019)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Sangalli2021&amp;quot;&amp;gt;  D Sangalli, &#039;&#039;Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach&#039;&#039;, [https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.5.083803 Phys. Rev. Mat. &#039;&#039;&#039;5&#039;&#039;&#039;, 083803 (2021)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8832</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8832"/>
		<updated>2025-05-26T11:48:47Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* ARPES as BSE post processing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
 &lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
 &lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
 &lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
 &lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
and finally run ypp_rt&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;br /&gt;
&lt;br /&gt;
A similar feature was implemented in yambopy&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8831</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8831"/>
		<updated>2025-05-26T11:48:07Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Creating page for ARPES signal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the TR-ARPES spectral function in presence of excitons&lt;br /&gt;
&lt;br /&gt;
== ARPES from real-time propagation ==&lt;br /&gt;
&lt;br /&gt;
The first part describes how to reconstruct the spectral function from after real-time propagation. If the real-time propagation has been done at the TD-HSEX level in a material with (strongly) bound excitons, and the pump pulse is tuned in resonance with an excitonic peak, the spectral function will show a fingerprint of the excitonic state, e.g. a replica of the valence band.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Store the history of the density matrix to disk ===&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]]) and add the following line to the input file&lt;br /&gt;
 SaveGhistory&lt;br /&gt;
&lt;br /&gt;
Please be aware that this will create a very large file containing the whole history of the density matrix. You can control how often the density matrix is written to disk with the second value in this input variable&lt;br /&gt;
 % IOtime&lt;br /&gt;
  0.5 |5.0 |0.5 |  fs    # [RT] Time between to consecutive I/O (J,P,OCCs - GF - OUTPUT)&lt;br /&gt;
 %&lt;br /&gt;
Usually the density matrix is used for restart only, and saving every 5 fs or so is reasonable. To reconstruct the TR-ARPES response function however, one needs to perform a Fourier transform, and it is usually need to write data more often to disk.&lt;br /&gt;
&lt;br /&gt;
Run the real time simulation&lt;br /&gt;
 yambo_rt -F inputs/td_run -J TD-RUN-NAME -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use the GKBA approach to reconstruct the spectral function ===&lt;br /&gt;
&lt;br /&gt;
After the history is saved to disk, you can use `ypp_rt` to reconstruct the spectral function. Here an input file to be used to this end&lt;br /&gt;
&lt;br /&gt;
 TDplots                       # [R] Real-Time Post-Processing&lt;br /&gt;
 RTGtwotimes                      # [R] Construct G&amp;lt;(t,tp)&lt;br /&gt;
 RTtime                         # [R] Post-Processing kind: function of time&lt;br /&gt;
 TimeStep= 0.01      fs      # Time step&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  25.00000 | 75.0000 | fs      # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 LoadGhistory                  # [NEGF] Build the NEQ density from the G_lesser&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
  -2.00000 | 14.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 501                 # Total Energy steps&lt;br /&gt;
&lt;br /&gt;
 BuildGles&lt;br /&gt;
 KeepCC        # This includes the contribiution from the c and c&#039; terms of the density matrix in conduction&lt;br /&gt;
 &lt;br /&gt;
 DampFactor= 50.0    meV&lt;br /&gt;
 RhoDeph= 5.0    meV&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 OutputAlat= 3.851738           # [a.u.] Lattice constant used for &amp;quot;alat&amp;quot; ouput format&lt;br /&gt;
 cooIn= &amp;quot;rlu&amp;quot;                   # Points coordinates (in) cc/rlu/iku/alat&lt;br /&gt;
 cooOut= &amp;quot;rlu&amp;quot;                  # Points coordinates (out) cc/rlu/iku/alat&lt;br /&gt;
&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 #BANDS_path= &amp;quot;L G X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 BANDS_built_in                 # Print the bands of the generating points of the circuit using the nearest internal point&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
    0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
    0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
    0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
You can also replace &lt;br /&gt;
 BuildGles&lt;br /&gt;
with&lt;br /&gt;
 BuildGret&lt;br /&gt;
&lt;br /&gt;
Some extra options, which you can add to the input file, are available. For example&lt;br /&gt;
 IncludeEQocc  # This includes the contribiution of the equilibrium occupations&lt;br /&gt;
 KeepCV        # This includes the contribiution from the c and v  terms of the density matrix&lt;br /&gt;
 KeepVC        # This includes the contribiution from the v and v&#039; terms of the density matrix in valence&lt;br /&gt;
&lt;br /&gt;
After your input file is ready just run &lt;br /&gt;
 ypp_rt -F inputs/Gless_reconstruc -J &amp;quot;Gless,TD-RUN-NAME&amp;quot; -C TD-RUN-NAME&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ARPES as BSE post processing ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: this is not yet available in the GPL release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In this second part we show instead how to simply reconstruct the spectral function from a post-porcessing of a BSE simulations at all transferred momenta in the IBZ. The BSE eigenvectors are needed. They can be obtained either via direct diagonalization or via iterative solvers like Slepc. The excitonic population is also needed as an input. The final the spectral functio will very similar to the real time approach if the population is assumed to be peaked at the bright excitonic state resonant with the pump pulse.&lt;br /&gt;
&lt;br /&gt;
After solving BSE as discussed above, with `yambo_rt`&lt;br /&gt;
 yambo_rt -F inputs/bse -J bse_allq -C bse_allq&lt;br /&gt;
&lt;br /&gt;
just use the following input file (change it according to your needs) with `ypp_rt` &lt;br /&gt;
 TDplots                          # [R] TD observables plot&lt;br /&gt;
 TDplotmode                       # [R] TD plot control&lt;br /&gt;
 RTARPES                          # [R] Transient ARPES&lt;br /&gt;
 RTtime                           # [R] Post-Processing kind: function of time&lt;br /&gt;
&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   8.00000 | 17.00000 | eV      # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt=  901                  # Total Energy steps&lt;br /&gt;
 DampFactor= 0.10000       eV    # Damping parameter&lt;br /&gt;
&lt;br /&gt;
 Gauge= &amp;quot;length&amp;quot;                  # [RT] Gauge (length|velocity)&lt;br /&gt;
 #FullExpansion&lt;br /&gt;
&lt;br /&gt;
 EXCTemp = 300.00 Kn&lt;br /&gt;
 #TRabsNExc= 6&lt;br /&gt;
 States= &amp;quot;1 - 100&amp;quot;                  # Index of the BS state(s)&lt;br /&gt;
&lt;br /&gt;
 INTERP_mode= &amp;quot;BOLTZ&amp;quot;              # Interpolation mode (NN=nearest point, BOLTZ=boltztrap aproach)&lt;br /&gt;
 INTERP_Shell_Fac= 20.00000     # The bigger it is a higher number of shells is used&lt;br /&gt;
 BANDS_path= &amp;quot;L,G,X&amp;quot;            # BANDS path points labels (G,M,K,L...)&lt;br /&gt;
 BANDS_steps= 50                # Number of divisions&lt;br /&gt;
 %BANDS_kpts                    # K points of the bands circuit&lt;br /&gt;
   0.5000000 |  0.5000000 |  0.5000000 | #L(111)&lt;br /&gt;
   0.0000000 |  0.0000000 |  0.0000000 | #G&lt;br /&gt;
   0.0000000 |  0.5000000 |  0.5000000 | #X&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 ypp_rt -F inputs/arpes_from_bse -J &amp;quot;ARPES,bse_allq&amp;quot; -C ARPES&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8829</id>
		<title>Pump and Probe: Time resolved ARPES</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Pump_and_Probe:_Time_resolved_ARPES&amp;diff=8829"/>
		<updated>2025-05-26T11:06:51Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial we show how to reconstruct the ARPES spectral function after real-time propagation&lt;br /&gt;
(under construction)&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
In order to reconstruct the ARPES response function, just run any real time propagation tutorial base on the `yambo_rt` executable (see for example this one: [[Real_time_Bethe-Salpeter_Equation_(density_matrix_only)]])&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8828</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8828"/>
		<updated>2025-05-26T11:03:59Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Real time &amp;amp; Non linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
=== Linear response ===&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 and 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;
=== Non-Linear response ===&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (external tutorial on www.attaccalite.com)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
=== Pump and Probe experiments ===&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;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8827</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8827"/>
		<updated>2025-05-26T11:00:41Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Real time &amp;amp; Non linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&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 and 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;
* [[Nonequilibrium absorption in bulk silicon]]&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (external tutorial on www.attaccalite.com)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8826</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8826"/>
		<updated>2025-05-26T10:59:57Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Real time &amp;amp; Non linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&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 wave-functions and Dynamical Berry Phase (IP)]]&lt;br /&gt;
* [[Linear response using wave-functions and 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;
* [[Nonequilibrium absorption in bulk silicon]]&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (external tutorial on www.attaccalite.com)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8823</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8823"/>
		<updated>2025-05-26T10:54:42Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Real time &amp;amp; Non linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response from real time simulations]] (standalone version); [[Linear response from real time simulations]] (modular version)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]]&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (external tutorial on www.attaccalite.com)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8822</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8822"/>
		<updated>2025-05-26T10:52:43Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Real time &amp;amp; Non linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response from real time simulations]] (standalone version); [[Linear response from real time simulations]] (modular version)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]]&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8821</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8821"/>
		<updated>2025-05-26T10:52:19Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Real time &amp;amp; Non linear response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Linear response from real time simulations]] (standalone version); [[Linear response from real time simulations]] (modular version)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8819</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8819"/>
		<updated>2025-05-26T10:47:18Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* More on GW and Quasi-particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations]] (modular tutorial)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8818</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8818"/>
		<updated>2025-05-26T10:46:47Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* More on GW and Quasi-particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|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] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations]] (modular tutorial)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8817</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8817"/>
		<updated>2025-05-26T10:40:02Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* Basic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&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;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&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] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations]] (modular tutorial)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8816</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8816"/>
		<updated>2025-05-26T10:36:49Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: /* More on GW and Quasi-particles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Basic ==&lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)| GW in practice: how to obtain the quasi-particle band structure of a bulk material]]&lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&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] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations]] (modular tutorial)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8815</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8815"/>
		<updated>2025-05-26T10:35:33Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Page upgraded to contain the full list of tutorials&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains the full list of available tutorials. These cover a variety of mixed topics, both physical and methodological. Some of these are om &amp;quot;Standalone mode&amp;quot; and are designed to be followed from start to finish in one page. Others have been ported in &amp;quot;Modular form&amp;quot;. These are also available under the link [[Tutorials modular]]. The tutorials do not require previous knowledge of yambo, unless explicitly specified. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Basic ==&lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)| GW in practice: how to obtain the quasi-particle band structure of a bulk material]]&lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW tutorial on HPC]]&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] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations]] (modular tutorial)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=MediaWiki:Sidebar&amp;diff=8814</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=MediaWiki:Sidebar&amp;diff=8814"/>
		<updated>2025-05-26T10:31:54Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: One page contains all tutorials&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* navigation&lt;br /&gt;
** mainpage| Wiki-edu Home&lt;br /&gt;
** https://www.yambo-code.eu| WWW Home&lt;br /&gt;
* Documentation&lt;br /&gt;
** Theory|Theory&lt;br /&gt;
** Lectures|Lectures&lt;br /&gt;
** Cheatsheets|Cheatsheets&lt;br /&gt;
** Variables|Input file variables&lt;br /&gt;
** Selected Readings|Selected Readings&lt;br /&gt;
** Thesis|Thesis&lt;br /&gt;
* Get Yambo&lt;br /&gt;
** Setting_up_Yambo | Yambo and yambopy&lt;br /&gt;
** Download| Download&lt;br /&gt;
** Installation| Install&lt;br /&gt;
** Virtual_Machines| Virtual Machines (Cloud, docker, VBox)&lt;br /&gt;
* Tutorials&lt;br /&gt;
** Tutorials|Overview&lt;br /&gt;
** Tutorials_download|Files Download&lt;br /&gt;
** Tutorials_all|All tutorials&lt;br /&gt;
** Tutorials_modular|Modular only&lt;br /&gt;
*** Modules|Modules&lt;br /&gt;
** First steps in Yambopy|Yambopy&lt;br /&gt;
&lt;br /&gt;
* Schools&lt;br /&gt;
** Schools|List of Schools&lt;br /&gt;
** Modena_2025 | Modena 2025&lt;br /&gt;
** Colombia_2024|HPC Workshop 2024 (Barranquilla)&lt;br /&gt;
** ASESMA_2023|ASESMA 2023 (Kigali)&lt;br /&gt;
** Rome_2023|Rome 2023&lt;br /&gt;
** RASESMA_2023_Nairobi|RASESMA 2022 (Nairobi)&lt;br /&gt;
** ICTP_2022|ICTP 2022&lt;br /&gt;
** CECAM_VIRTUAL_2021|CECAM 2021&lt;br /&gt;
** ICTP2020|ICTP 2020&lt;br /&gt;
* SEARCH&lt;br /&gt;
* TOOLBOX&lt;br /&gt;
* navigation&lt;br /&gt;
* Wikitools&lt;br /&gt;
** recentchanges-url|recentchanges&lt;br /&gt;
** randompage-url|randompage&lt;br /&gt;
** helppage|help&lt;br /&gt;
** Developers Corner| Developers Corner&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_standalone&amp;diff=8813</id>
		<title>Tutorials standalone</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_standalone&amp;diff=8813"/>
		<updated>2025-05-26T10:30:33Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Yambowikiadmin moved page Tutorials standalone to Tutorials all: Need for a page which collects all tutorials&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Tutorials all]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8812</id>
		<title>Tutorials all</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Tutorials_all&amp;diff=8812"/>
		<updated>2025-05-26T10:30:33Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Yambowikiadmin moved page Tutorials standalone to Tutorials all: Need for a page which collects all tutorials&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These tutorials are self-contained and cover a variety of mixed topics, both physical and methodological. They are designed to be followed from start to finish in one page and do not require previous knowledge of yambo. Each tutorial requires download of a specific core database, and typically they cover a specific physical system (like bulk GaSb or a hydrogen chain). Ground state input files and pseudopotentials are provided. Output files are also provided for reference.&lt;br /&gt;
&lt;br /&gt;
These tutorials can be accessed directly from this page of from the side bar. They include different kind of subjects:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: These tutorials were prepared using previous version of the Yambo code: some command lines, variables, reports and outputs can be  slightly different from the last version of the code.  Scripts for parsing output cannot work anymore and should be edited to work with the new outputs. New command lines can be accessed typing &amp;lt;code&amp;gt;yambo -h &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Basic ==&lt;br /&gt;
* [[Silicon|GW on bulk silicon]]&lt;br /&gt;
* [[GW on h-BN (standalone)| GW in practice: how to obtain the quasi-particle band structure of a bulk material]]&lt;br /&gt;
* [[LiF|BSE in lithium-floride]]&lt;br /&gt;
* [[How to analyse excitons]]&lt;br /&gt;
&lt;br /&gt;
== More on GW and Quasi-particles ==&lt;br /&gt;
* [[Real_Axis_and_Lifetimes|Real Axis and Lifetimes]]&lt;br /&gt;
* [[Self-consistent GW on eigenvalues only]]&lt;br /&gt;
* [[GW tutorial on HPC]]&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] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[SOC|Spin-orbit coupling in GaSb]]&lt;br /&gt;
&lt;br /&gt;
== More on Linear response and BSE ==&lt;br /&gt;
* [[Hydrogen chain|TDDFT Failure and long range correlations]]&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;
* [[Dichroism in molecules]]&lt;br /&gt;
* [[Surface spectroscopy]] (to restore from older version)&lt;br /&gt;
* [[Si_Surface|Linear Response of a silicon surface (2D)]]&lt;br /&gt;
* [http://www.attaccalite.com/speed-up-dielectric-constant-calculations-using-the-double-grid-method-with-yambo/ Speed up dielectric constant calculations using the double-grid method] (to be imported)&lt;br /&gt;
* [[Si_wire|Linear Response from a silicon wire (1D)]] (to restore from old version)&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;
&lt;br /&gt;
== Post Processing with ypp ==&lt;br /&gt;
* [[Yambo Post Processing (ypp)]]&lt;br /&gt;
&lt;br /&gt;
== Electron phonon coupling ==&lt;br /&gt;
* [[Electron Phonon Coupling|Electron Phonon Coupling]]&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]]&lt;br /&gt;
&lt;br /&gt;
== Real time &amp;amp; Non linear response ==&lt;br /&gt;
* [[Linear response using Dynamical Berry Phase]]&lt;br /&gt;
* [[Linear response in velocity gauge]]&lt;br /&gt;
* [[Linear response from real time simulations]] (modular tutorial)&lt;br /&gt;
* [[Nonequilibrium absorption in bulk silicon]] (under construction)&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-aGW level (also called TD-HSEX, TD-BSE)]]&lt;br /&gt;
* [[A fast approach to excitonic effects in linear/non-linear response]]&lt;br /&gt;
* [[Angular dependence of non-linear response]]&lt;br /&gt;
* [[Third Harmonic Generation (THG)]]&lt;br /&gt;
* [http://www.attaccalite.com/lumen/spin_orbit.html Spin-orbit coupling and non-linear response] (tutorial to be imported into the wiki)&lt;br /&gt;
* [[Two-photon absorption]]&lt;br /&gt;
* [[Sum frequency generation]] &lt;br /&gt;
* [[Shift current]]&lt;br /&gt;
* [[Pump and Probe|Pump and Probe: Transient Absorption]]&lt;br /&gt;
* [[Pump and Probe: Time resolved ARPES]]&lt;br /&gt;
* [[Parallelization for non-linear response calculations]]&lt;br /&gt;
&lt;br /&gt;
== Developing Yambo ==&lt;br /&gt;
* [[How to create a new project in Yambo]]&lt;br /&gt;
* [[How to create a new ypp interface]]&lt;br /&gt;
* [[Some hints on github]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SOC|Spin-Orbit Coupling MBPT]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- For each TUTORIAL (Solid_LiF, Solid_Al, ...) , therefore, you can download the ground state files (zip archive named TUTORIAL_ground_state.zip) and generate the Yambo databases from your own by running abinit/PWscf and a2y/p2y. In this case the Yambo input and reference files are contained in the zip file (TUTORIAL_reference_files.zip). Alternatively, if (and only if) you have compiled yambo with the NetCDF support you can directly download the zip files containing the Yambo core databases (TUTORIAL_NETCDF_databases_and_reference_files.zip). These are generated using the NetCDF interface in order to be readable in any platform.&lt;br /&gt;
After you have downloaded the tutorial zip files and unziped them you should have now a tutorial tree:&lt;br /&gt;
localhost:&amp;gt; ls &lt;br /&gt;
YAMBO_TUTORIALS/&lt;br /&gt;
localhost:&amp;gt; ls  YAMBO_TUTORIALS/&lt;br /&gt;
COPYING  Fantastic_Dimensions/  Hydrogen_Chain/  README  Solid_LiF/ Solid_Al/ SiH4/ ...&lt;br /&gt;
In each folder you will find an Abinit or Pwscf subfolder in case you have downloaded the ground state zip files and the YAMBO subfolder. The tutorials start by entering the YAMBO subfolder and followinf the informations provided in the tutorial documentation.  --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8804</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8804"/>
		<updated>2025-05-22T13:55:39Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 0                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. These are the eigenfrequencies of the system excited by the delta-kick. &lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function. As the polarization oscillates at all eigenfrequencies of the system, the real/imaginary part of the dielectric function obtained by the Fourier transform have poles/zeros at the eigenfrequencies of the system. &lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available - or you can generate it as an exercise):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation within the IPA]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 0                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l title &amp;quot;HSEX/BSE&amp;quot;, &lt;br /&gt;
 gnuplot&amp;gt; rep  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u ($1+3):2 w l title &amp;quot;IPA + 3 eV scissor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra BSE Delta.png|600px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption (with a scissor of 3 eV)]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8803</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8803"/>
		<updated>2025-05-22T13:18:38Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 0                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. These are the eigenfrequencies of the system excited by the delta-kick. &lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function. As the polarization oscillates at all eigenfrequencies of the system, the real/imaginary part of the dielectric function obtained by the Fourier transform have poles/zeros at the eigenfrequencies of the system. &lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available - or you can generate it as an exercise):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation within the IPA]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 0                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l title &amp;quot;HSEX/BSE&amp;quot;, &lt;br /&gt;
 gnuplot&amp;gt; rep  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u ($1+3):2 w l title &amp;quot;IPA + 3 eV scissor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra BSE Delta.png|600px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption (with a scissor of 3 eV)]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8802</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8802"/>
		<updated>2025-05-22T13:07:23Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 0                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. These are the eigenfrequencies of the system excited by the delta-kick. &lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function. As the polarization oscillates at all eigenfrequencies of the system, the real/imaginary part of the dielectric function obtained by the Fourier transform have poles/zeros at the eigenfrequencies of the system. &lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available - or you can generate it as an exercise):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation within the IPA]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l title &amp;quot;HSEX/BSE&amp;quot;, &lt;br /&gt;
 gnuplot&amp;gt; rep  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u ($1+3):2 w l title &amp;quot;IPA + 3 eV scissor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra BSE Delta.png|600px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption (with a scissor of 3 eV)]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8765</id>
		<title>Modena 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8765"/>
		<updated>2025-05-19T13:32:40Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A general description of the goal(s) of the school can be found on the [https://www.yambo-code.eu/2025/01/17/yambo-school-modena-2025/ Yambo main website]&lt;br /&gt;
&lt;br /&gt;
== Use CINECA computational resources ==&lt;br /&gt;
Yambo tutorials will be run on the Leonardo-DCGP partition. You can find info about Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section here].&lt;br /&gt;
In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.&lt;br /&gt;
&lt;br /&gt;
=== Connect to the cluster using ssh ===&lt;br /&gt;
&lt;br /&gt;
You can access Leonardo via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; protocol in different ways.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using username and password &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Use the following command replacing your username:&lt;br /&gt;
 ssh username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
However, in this way you have to type your password each time you want to connect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using ssh key &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can setup a ssh key pair to avoid typing the password each time you want to connect to Leonardo. To do so, run the &amp;lt;code&amp;gt;ssh-keygen&amp;lt;/code&amp;gt; command to generate a private/public key pair:&lt;br /&gt;
 ssh-keygen -t rsa -b 4096 -f ~/.ssh/leonardo_rsa&lt;br /&gt;
 Generating public/private rsa key pair.&lt;br /&gt;
 Created directory &#039;/home/username/.ssh&#039;.&lt;br /&gt;
 Enter passphrase (empty for no passphrase): &lt;br /&gt;
 Enter same passphrase again: &lt;br /&gt;
 Your identification has been saved in /home/username/.ssh/leonardo_rsa&lt;br /&gt;
 Your public key has been saved in /home/username/.ssh/leonardo_rsa.pub&lt;br /&gt;
 The key fingerprint is:&lt;br /&gt;
 [...]&lt;br /&gt;
 The key&#039;s randomart image is:&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Now you need to copy the &#039;&#039;&#039;public&#039;&#039;&#039; key to Leonardo. You can do that with the following command (for this step you need to type your password):&lt;br /&gt;
 ssh-copy-id -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Be aware that when running the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command, after typing &amp;quot;yes&amp;quot; at the prompt, you might see an error message like the one shown below. Don’t worry—just follow the instructions provided in this CINECA [https://wiki.u-gov.it/confluence/display/SCAIUS/FAQ#FAQ-Ikeepreceivingtheerrormessage%22WARNING:REMOTEHOSTIDENTIFICATIONHASCHANGED!%22evenifImodifyknown_hostfile guide to resolve the issue]. Once done, run the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command again.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 /usr/bin/ssh-copy-id: &lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Once the public key has been copied, you can connect to Leonardo without having to type the password using the &amp;lt;code&amp;gt;-i&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
To simplify even more, you can paste the following lines in a file named &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; located inside the &amp;lt;code&amp;gt;.ssh&amp;lt;/code&amp;gt; directory adjusting the username:&lt;br /&gt;
 Host leonardo &lt;br /&gt;
  HostName login.leonardo.cineca.it&lt;br /&gt;
  User username&lt;br /&gt;
  IdentityFile ~/.ssh/leonardo_rsa&lt;br /&gt;
&lt;br /&gt;
With the &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; file setup you can connect simply with&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
&lt;br /&gt;
=== General instructions to run tutorials ===&lt;br /&gt;
&lt;br /&gt;
Before proceeding, it is useful to know the different workspaces you have available on Leonardo, which can be accessed using environment variables. The main ones are:&lt;br /&gt;
* &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;home&amp;lt;/code&amp;gt; directory associated to your username; &lt;br /&gt;
* &amp;lt;code&amp;gt;$WORK&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;work&amp;lt;/code&amp;gt; directory associated to the account where the computational resources dedicated to this school are allocated;&lt;br /&gt;
* &amp;lt;code&amp;gt;$SCRATCH&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;scratch&amp;lt;/code&amp;gt; directory associated to your username.&lt;br /&gt;
You can find more details about storage and FileSystems [https://wiki.u-gov.it/confluence/display/SCAIUS/4%3A+Data+storage+and+FileSystems here].&lt;br /&gt;
&lt;br /&gt;
Please don&#039;t forget to &#039;&#039;&#039;run all tutorials in your scratch directory&#039;&#039;&#039;:&lt;br /&gt;
 echo $SCRATCH&lt;br /&gt;
 /leonardo_scratch/large/userexternal/username&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
&lt;br /&gt;
Computational resources on Leonardo are managed by the job scheduling system [https://slurm.schedmd.com/overview.html Slurm]. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Run a job using a batch script &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script &amp;lt;code&amp;gt;job.sh&amp;lt;/code&amp;gt;, whose generic structure is the following:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --account=tra25_yambo           # Charge resources used by this job to specified account&lt;br /&gt;
 #SBATCH --time=00:10:00                 # Set a limit on the total run time of the job allocation in hh:mm:ss&lt;br /&gt;
 #SBATCH --job-name=JOB                  # Specify a name for the job allocation&lt;br /&gt;
 #SBATCH --partition= dcgp_usr_prod      # Request a specific partition for the resource allocation&lt;br /&gt;
 #SBATCH --gres=tmpfs:10g                # List of generic consumable resources&lt;br /&gt;
 #SBATCH --qos=normal                    # Quality of service &lt;br /&gt;
 #SBATCH --reservation=s_tra_yambo       # Reservation specific to this school&lt;br /&gt;
 #          &lt;br /&gt;
 #SBATCH --nodes=&amp;lt;N&amp;gt;                     # Number of nodes to be allocated for the job&lt;br /&gt;
 #SBATCH --ntasks-per-node=&amp;lt;n&amp;gt;           # Number of MPI tasks invoked per node&lt;br /&gt;
 #SBATCH --ntasks-per-socket=&amp;lt;n/2&amp;gt;       # Tasks invoked on each socket&lt;br /&gt;
 #SBATCH --cpus-per-task=&amp;lt;c&amp;gt;             # Number of OMP threads per task&lt;br /&gt;
 &lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np ${SLURM_NTASKS} \&lt;br /&gt;
        yambo -F &amp;lt;input&amp;gt; -J &amp;lt;output&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section#DCGPSection-SLURMpartitions resources]. The complete list of Slurm options can be found [https://slurm.schedmd.com/sbatch.html here]. However you will find &#039;&#039;&#039;ready-to-use&#039;&#039;&#039; batch scripts in locations specified during the tutorials. &lt;br /&gt;
&lt;br /&gt;
To submit the job, use the &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 sbatch job.sh&lt;br /&gt;
 Submitted batch job 15696508&lt;br /&gt;
&lt;br /&gt;
To check the job status, use the &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 squeue --me&lt;br /&gt;
            JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
         15696508 dcgp_usr_   job.sh username  R       0:01      1 lrdn4135&lt;br /&gt;
&lt;br /&gt;
If you need to cancel your job, do:&lt;br /&gt;
 scancel &amp;lt;JOBID&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Open an interactive session &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hours:&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 srun: job 15694182 queued and waiting for resources&lt;br /&gt;
 srun: job 15694182 has been allocated resources&lt;br /&gt;
&lt;br /&gt;
We ask for 4 cpus-per-task (-c) because we can exploit OpenMP parallelization with the available resources.&lt;br /&gt;
&lt;br /&gt;
Then, you need to manually load &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; as in the batch script above:&lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
&lt;br /&gt;
Finally, set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable to 4 using the appropriate Slurm environment variable:&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
To close the interactive session when you have finished, log out of the compute node with the &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Plot results with gnuplot &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the tutorials you will often need to plot the results of the calculations. In order to do so on Leonardo, &#039;&#039;&#039;open a new terminal window&#039;&#039;&#039; and connect to Leonardo enabling X11 forwarding with the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -X leonardo&lt;br /&gt;
&lt;br /&gt;
Please note that &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt; can be used in this way only from the login nodes:&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ cd &amp;lt;directory_with_data&amp;gt;&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ gnuplot&lt;br /&gt;
 ...&lt;br /&gt;
 Terminal type is now &#039;...&#039;&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;lt;...&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Set up yambopy &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to run yambopy on Leonardo, you must first activate the python environment:&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 source /leonardo_work/tra25_yambo/env_yambopy/bin/activate&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
Quick recap.&lt;br /&gt;
Before every tutorial, if you run on Leonardo, do the following steps&lt;br /&gt;
&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
 mkdir -p YAMBO_TUTORIALS &#039;&#039;&#039;#(Only if you didn&#039;t before)&#039;&#039;&#039;&lt;br /&gt;
 cd YAMBO_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
Since the compute nodes are not connected to the external network, the tarballs must be downloaded before starting the interactive session.&lt;br /&gt;
Alternatively, once the interactive session has started, it is possible to access the tarballs by copying them from the following directories:&lt;br /&gt;
&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBO_TUTORIALS&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
After that you can start the interactive session&lt;br /&gt;
&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
set the environment variable for openMP &lt;br /&gt;
&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
and load yambo or yambopy as explained above in the general instructions.&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May === &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:15 - 18:30 From the DFT ground state to the complete setup of a Many Body calculation using Yambo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN&#039;&#039;&#039; hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now that you have all the files, you may open the interactive job session with &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; as explained above and proceed with the tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[First steps: walk through from DFT(standalone)|First steps: Initialization and more ]]&lt;br /&gt;
* [[Next steps: RPA calculations (standalone)|Next steps: RPA calculations ]]&lt;br /&gt;
&lt;br /&gt;
At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let&#039;s create a dedicated directory, download and extract the related files.&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ mkdir -p YAMBOPY_TUTORIALS&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS&lt;br /&gt;
 $ rsync -avzP /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS/yambopy_tutorial_Modena_2025.tar.gz .&lt;br /&gt;
 $ tar --strip-components=1 -xvzf yambopy_tutorial_Modena_2025.tar.gz&lt;br /&gt;
&lt;br /&gt;
Then, follow part 1 of the tutorial, which is related to DFT band structures, YAMBO initialization and linear response.&lt;br /&gt;
* [[Modena 2025 : Yambopy part 1]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 A tour through GW simulation in a complex material (from the blackboard to numerical computation: convergence, algorithms, parallel usage)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get all the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ tar -xvf MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ cd hBN&lt;br /&gt;
&lt;br /&gt;
Now you can start the first tutorial:&lt;br /&gt;
&lt;br /&gt;
* [[GW tutorial Rome 2023 | GW computations on practice: how to obtain the quasi-particle band structure of a bulk material ]]&lt;br /&gt;
&lt;br /&gt;
If you have gone through the first tutorial, pass now to the second one:&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBO_TUTORIALS&lt;br /&gt;
 $ cd MoS2_HPC_tutorial&lt;br /&gt;
&lt;br /&gt;
* [[Quasi-particles of a 2D system | Quasi-particles of a 2D system ]]&lt;br /&gt;
&lt;br /&gt;
As for yambopy, the tutorial related to GW calculations is contained in the first section of Part 2&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#GW calculations| Modena 2025 : Yambopy part 2 (GW calculations)]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 Bethe-Salpeter equation (BSE)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz &lt;br /&gt;
 $ tar -xvf hBN-convergence-kpoints.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now, you may open the interactive job session with &amp;lt;code&amp;gt;salloc&amp;lt;/code&amp;gt; and proceed with the following tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[Calculating optical spectra including excitonic effects: a step-by-step guide|Perform a BSE calculation from beginning to end ]]&lt;br /&gt;
* [[How to analyse excitons - ICTP 2022 school|Analyse your results (exciton wavefunctions in real and reciprocal space, etc.) ]]&lt;br /&gt;
* [[BSE solvers overview|Solve the BSE eigenvalue problem with different numerical methods]]&lt;br /&gt;
* [[How to choose the input parameters|Choose the input parameters for a meaningful converged calculation]]&lt;br /&gt;
&lt;br /&gt;
Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:&lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS/databases_yambopy&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#Excitons| Modena 2025 : Yambopy part 2 (BSE calculations)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;17:00 - 18:30 Bethe-Salpeter equation in real time (TD-HSEX)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
The files needed for the following tutorials can be downloaded following these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Introduction_to_Real_Time_propagation_in_Yambo#Time_Dependent_Equation_for_the_Reduced_One--Body_Density--Matrix|Read the introductive section to real-time propagation for the one-body density matrix]] (the part about time-dependent Schrödinger equation will be covered on DAY 4 and you can skip it for now)&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Calculate the linear response in real time]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Calculate the BSE in real time]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, May 22 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14:30 - 16:00 Bethe-Salpeter (part 2)&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:30 - 17:30 Nonlinear response with the time dependent berry phase&#039;&#039;&#039; Myrta Gruning (Queen&#039;s University Belfast), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
For the tutorials we will use first the &amp;lt;code&amp;gt;hBN-2D-RT&amp;lt;/code&amp;gt; folder (k-sampling 10x10x1) and then the &amp;lt;code&amp;gt;hBN-2D&amp;lt;/code&amp;gt; folder (k-sampling 6x6x1)&lt;br /&gt;
You may already have them in the &amp;lt;code&amp;gt;YAMBO_TUTORIALS&amp;lt;/code&amp;gt; folder&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN-2D-RT&#039;&#039;&#039; hBN-2D.tar.gz  hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
If you need to download again the tutorial files, follow these steps (or see the above instructions):&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo (5.3)|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]&lt;br /&gt;
* [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 5 - Friday, 23 May ===&lt;br /&gt;
&lt;br /&gt;
== Lectures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May ===&lt;br /&gt;
&lt;br /&gt;
* D. Varsano, [Description and goal of the school].&lt;br /&gt;
* C. Franchini, [https://drive.google.com/file/d/1Z6GCjP4K1dM28ULsyYg2eckgUdYUSRph/view?usp=share_link First principles and data-driven correlated materials]&lt;br /&gt;
* F. Mohamed, [https://drive.google.com/file/d/1ITddkGTM12Gw5QxnZjAQpfZgYH0FvJL1/view?usp=share_link A tour on Density Functional Theory]&lt;br /&gt;
* E. Cannuccia, [https://drive.google.com/file/d/1mBTcPrnfoqwcA5wXE8gXQMO_qttClHAd/view?usp=share_link Electronic screening and linear response theory]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
* A. Marini, [https://drive.google.com/file/d/1HTIPHkH2sBaVDLFwwS34T-fJ9x8FhVPq/view?usp=share_link Introduction to Many-Body Perturbation Theory]&lt;br /&gt;
* C. Cardoso, Quasiparticles and the GW Approximation&lt;br /&gt;
* A. Guandalini, [https://drive.google.com/file/d/1dgcdHMfA0b7jjyrCs4r9OrG6qpiu1v39/view?usp=share_link GW in practice: algorithms and approximations]&lt;br /&gt;
* G. Sesti, [https://drive.google.com/file/d/1te_85k9jgSymr3Av86rKOu0-tA-7sGWq/view?usp=sharing  GW advanced algorithms]&lt;br /&gt;
* M. Govoni, GW without empty states and investigation of neutral excitations by embedding full configuration interaction in DFT+GW&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&lt;br /&gt;
* M. Palummo, [https://drive.google.com/file/d/1pQ491hqpETVLchL92QPy4f_jWqfMK5xf/view?usp=share_link Optical absorption and excitons via the Bethe-Salpeter Equation]&lt;br /&gt;
* D. Sangalli, Real-time simulations&lt;br /&gt;
* F. Paleari, Introduction to YamboPy (automation and post-processing)&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, 22 May ===&lt;br /&gt;
&lt;br /&gt;
* E. Luppi, An introduction to Non-linear spectroscopy&lt;br /&gt;
* M. Grüning, Non-linear spectroscopy in Yambo&lt;br /&gt;
* F. Affinito, Frontiers in High-Performance Computing&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8764</id>
		<title>Modena 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8764"/>
		<updated>2025-05-19T13:31:05Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A general description of the goal(s) of the school can be found on the [https://www.yambo-code.eu/2025/01/17/yambo-school-modena-2025/ Yambo main website]&lt;br /&gt;
&lt;br /&gt;
== Use CINECA computational resources ==&lt;br /&gt;
Yambo tutorials will be run on the Leonardo-DCGP partition. You can find info about Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section here].&lt;br /&gt;
In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.&lt;br /&gt;
&lt;br /&gt;
=== Connect to the cluster using ssh ===&lt;br /&gt;
&lt;br /&gt;
You can access Leonardo via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; protocol in different ways.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using username and password &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Use the following command replacing your username:&lt;br /&gt;
 ssh username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
However, in this way you have to type your password each time you want to connect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using ssh key &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can setup a ssh key pair to avoid typing the password each time you want to connect to Leonardo. To do so, run the &amp;lt;code&amp;gt;ssh-keygen&amp;lt;/code&amp;gt; command to generate a private/public key pair:&lt;br /&gt;
 ssh-keygen -t rsa -b 4096 -f ~/.ssh/leonardo_rsa&lt;br /&gt;
 Generating public/private rsa key pair.&lt;br /&gt;
 Created directory &#039;/home/username/.ssh&#039;.&lt;br /&gt;
 Enter passphrase (empty for no passphrase): &lt;br /&gt;
 Enter same passphrase again: &lt;br /&gt;
 Your identification has been saved in /home/username/.ssh/leonardo_rsa&lt;br /&gt;
 Your public key has been saved in /home/username/.ssh/leonardo_rsa.pub&lt;br /&gt;
 The key fingerprint is:&lt;br /&gt;
 [...]&lt;br /&gt;
 The key&#039;s randomart image is:&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Now you need to copy the &#039;&#039;&#039;public&#039;&#039;&#039; key to Leonardo. You can do that with the following command (for this step you need to type your password):&lt;br /&gt;
 ssh-copy-id -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Be aware that when running the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command, after typing &amp;quot;yes&amp;quot; at the prompt, you might see an error message like the one shown below. Don’t worry—just follow the instructions provided in this CINECA [https://wiki.u-gov.it/confluence/display/SCAIUS/FAQ#FAQ-Ikeepreceivingtheerrormessage%22WARNING:REMOTEHOSTIDENTIFICATIONHASCHANGED!%22evenifImodifyknown_hostfile guide to resolve the issue]. Once done, run the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command again.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 /usr/bin/ssh-copy-id: &lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Once the public key has been copied, you can connect to Leonardo without having to type the password using the &amp;lt;code&amp;gt;-i&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
To simplify even more, you can paste the following lines in a file named &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; located inside the &amp;lt;code&amp;gt;.ssh&amp;lt;/code&amp;gt; directory adjusting the username:&lt;br /&gt;
 Host leonardo &lt;br /&gt;
  HostName login.leonardo.cineca.it&lt;br /&gt;
  User username&lt;br /&gt;
  IdentityFile ~/.ssh/leonardo_rsa&lt;br /&gt;
&lt;br /&gt;
With the &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; file setup you can connect simply with&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
&lt;br /&gt;
=== General instructions to run tutorials ===&lt;br /&gt;
&lt;br /&gt;
Before proceeding, it is useful to know the different workspaces you have available on Leonardo, which can be accessed using environment variables. The main ones are:&lt;br /&gt;
* &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;home&amp;lt;/code&amp;gt; directory associated to your username; &lt;br /&gt;
* &amp;lt;code&amp;gt;$WORK&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;work&amp;lt;/code&amp;gt; directory associated to the account where the computational resources dedicated to this school are allocated;&lt;br /&gt;
* &amp;lt;code&amp;gt;$SCRATCH&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;scratch&amp;lt;/code&amp;gt; directory associated to your username.&lt;br /&gt;
You can find more details about storage and FileSystems [https://wiki.u-gov.it/confluence/display/SCAIUS/4%3A+Data+storage+and+FileSystems here].&lt;br /&gt;
&lt;br /&gt;
Please don&#039;t forget to &#039;&#039;&#039;run all tutorials in your scratch directory&#039;&#039;&#039;:&lt;br /&gt;
 echo $SCRATCH&lt;br /&gt;
 /leonardo_scratch/large/userexternal/username&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
&lt;br /&gt;
Computational resources on Leonardo are managed by the job scheduling system [https://slurm.schedmd.com/overview.html Slurm]. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Run a job using a batch script &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script &amp;lt;code&amp;gt;job.sh&amp;lt;/code&amp;gt;, whose generic structure is the following:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --account=tra25_yambo           # Charge resources used by this job to specified account&lt;br /&gt;
 #SBATCH --time=00:10:00                 # Set a limit on the total run time of the job allocation in hh:mm:ss&lt;br /&gt;
 #SBATCH --job-name=JOB                  # Specify a name for the job allocation&lt;br /&gt;
 #SBATCH --partition= dcgp_usr_prod      # Request a specific partition for the resource allocation&lt;br /&gt;
 #SBATCH --gres=tmpfs:10g                # List of generic consumable resources&lt;br /&gt;
 #SBATCH --qos=normal                    # Quality of service &lt;br /&gt;
 #SBATCH --reservation=s_tra_yambo       # Reservation specific to this school&lt;br /&gt;
 #          &lt;br /&gt;
 #SBATCH --nodes=&amp;lt;N&amp;gt;                     # Number of nodes to be allocated for the job&lt;br /&gt;
 #SBATCH --ntasks-per-node=&amp;lt;n&amp;gt;           # Number of MPI tasks invoked per node&lt;br /&gt;
 #SBATCH --ntasks-per-socket=&amp;lt;n/2&amp;gt;       # Tasks invoked on each socket&lt;br /&gt;
 #SBATCH --cpus-per-task=&amp;lt;c&amp;gt;             # Number of OMP threads per task&lt;br /&gt;
 &lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np ${SLURM_NTASKS} \&lt;br /&gt;
        yambo -F &amp;lt;input&amp;gt; -J &amp;lt;output&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section#DCGPSection-SLURMpartitions resources]. The complete list of Slurm options can be found [https://slurm.schedmd.com/sbatch.html here]. However you will find &#039;&#039;&#039;ready-to-use&#039;&#039;&#039; batch scripts in locations specified during the tutorials. &lt;br /&gt;
&lt;br /&gt;
To submit the job, use the &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 sbatch job.sh&lt;br /&gt;
 Submitted batch job 15696508&lt;br /&gt;
&lt;br /&gt;
To check the job status, use the &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 squeue --me&lt;br /&gt;
            JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
         15696508 dcgp_usr_   job.sh username  R       0:01      1 lrdn4135&lt;br /&gt;
&lt;br /&gt;
If you need to cancel your job, do:&lt;br /&gt;
 scancel &amp;lt;JOBID&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Open an interactive session &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hours:&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 srun: job 15694182 queued and waiting for resources&lt;br /&gt;
 srun: job 15694182 has been allocated resources&lt;br /&gt;
&lt;br /&gt;
We ask for 4 cpus-per-task (-c) because we can exploit OpenMP parallelization with the available resources.&lt;br /&gt;
&lt;br /&gt;
Then, you need to manually load &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; as in the batch script above:&lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
&lt;br /&gt;
Finally, set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable to 4 using the appropriate Slurm environment variable:&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
To close the interactive session when you have finished, log out of the compute node with the &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Plot results with gnuplot &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the tutorials you will often need to plot the results of the calculations. In order to do so on Leonardo, &#039;&#039;&#039;open a new terminal window&#039;&#039;&#039; and connect to Leonardo enabling X11 forwarding with the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -X leonardo&lt;br /&gt;
&lt;br /&gt;
Please note that &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt; can be used in this way only from the login nodes:&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ cd &amp;lt;directory_with_data&amp;gt;&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ gnuplot&lt;br /&gt;
 ...&lt;br /&gt;
 Terminal type is now &#039;...&#039;&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;lt;...&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Set up yambopy &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to run yambopy on Leonardo, you must first activate the python environment:&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 source /leonardo_work/tra25_yambo/env_yambopy/bin/activate&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
Quick recap.&lt;br /&gt;
Before every tutorial, if you run on Leonardo, do the following steps&lt;br /&gt;
&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
 mkdir -p YAMBO_TUTORIALS &#039;&#039;&#039;#(Only if you didn&#039;t before)&#039;&#039;&#039;&lt;br /&gt;
 cd YAMBO_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
Since the compute nodes are not connected to the external network, the tarballs must be downloaded before starting the interactive session.&lt;br /&gt;
Alternatively, once the interactive session has started, it is possible to access the tarballs by copying them from the following directories:&lt;br /&gt;
&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBO_TUTORIALS&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
After that you can start the interactive session&lt;br /&gt;
&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
set the environment variable for openMP &lt;br /&gt;
&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
and load yambo or yambopy as explained above in the general instructions.&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May === &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:15 - 18:30 From the DFT ground state to the complete setup of a Many Body calculation using Yambo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN&#039;&#039;&#039; hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now that you have all the files, you may open the interactive job session with &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; as explained above and proceed with the tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[First steps: walk through from DFT(standalone)|First steps: Initialization and more ]]&lt;br /&gt;
* [[Next steps: RPA calculations (standalone)|Next steps: RPA calculations ]]&lt;br /&gt;
&lt;br /&gt;
At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let&#039;s create a dedicated directory, download and extract the related files.&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ mkdir -p YAMBOPY_TUTORIALS&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS&lt;br /&gt;
 $ rsync -avzP /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS/yambopy_tutorial_Modena_2025.tar.gz .&lt;br /&gt;
 $ tar --strip-components=1 -xvzf yambopy_tutorial_Modena_2025.tar.gz&lt;br /&gt;
&lt;br /&gt;
Then, follow part 1 of the tutorial, which is related to DFT band structures, YAMBO initialization and linear response.&lt;br /&gt;
* [[Modena 2025 : Yambopy part 1]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 A tour through GW simulation in a complex material (from the blackboard to numerical computation: convergence, algorithms, parallel usage)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get all the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ tar -xvf MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ cd hBN&lt;br /&gt;
&lt;br /&gt;
Now you can start the first tutorial:&lt;br /&gt;
&lt;br /&gt;
* [[GW tutorial Rome 2023 | GW computations on practice: how to obtain the quasi-particle band structure of a bulk material ]]&lt;br /&gt;
&lt;br /&gt;
If you have gone through the first tutorial, pass now to the second one:&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBO_TUTORIALS&lt;br /&gt;
 $ cd MoS2_HPC_tutorial&lt;br /&gt;
&lt;br /&gt;
* [[Quasi-particles of a 2D system | Quasi-particles of a 2D system ]]&lt;br /&gt;
&lt;br /&gt;
As for yambopy, the tutorial related to GW calculations is contained in the first section of Part 2&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#GW calculations| Modena 2025 : Yambopy part 2 (GW calculations)]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 Bethe-Salpeter equation (BSE)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz &lt;br /&gt;
 $ tar -xvf hBN-convergence-kpoints.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now, you may open the interactive job session with &amp;lt;code&amp;gt;salloc&amp;lt;/code&amp;gt; and proceed with the following tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[Calculating optical spectra including excitonic effects: a step-by-step guide|Perform a BSE calculation from beginning to end ]]&lt;br /&gt;
* [[How to analyse excitons - ICTP 2022 school|Analyse your results (exciton wavefunctions in real and reciprocal space, etc.) ]]&lt;br /&gt;
* [[BSE solvers overview|Solve the BSE eigenvalue problem with different numerical methods]]&lt;br /&gt;
* [[How to choose the input parameters|Choose the input parameters for a meaningful converged calculation]]&lt;br /&gt;
&lt;br /&gt;
Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:&lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS/databases_yambopy&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#Excitons| Modena 2025 : Yambopy part 2 (BSE calculations)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;17:00 - 18:30 Bethe-Salpeter equation in real time (TD-HSEX)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
The files needed for the following tutorials can be downloaded following these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Introduction_to_Real_Time_propagation_in_Yambo#Time_Dependent_Equation_for_the_Reduced_One--Body_Density--Matrix|Read the introductive section to real-time propagation for the one-body density matrix]] (the part about time-dependent Schrödinger equation will be covered on DAY 4 and you can skip it for now)&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Calculate the linear response in real time]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Calculate the BSE in real time]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, May 22 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14:30 - 16:00 Bethe-Salpeter (part 2)&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:30 - 17:30 Nonlinear response with the time dependent berry phase&#039;&#039;&#039; Myrta Gruning (Queen&#039;s University Belfast), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
For the tutorials we will use first the &amp;lt;code&amp;gt;hBN-2D-RT&amp;lt;/code&amp;gt; folder (k-sampling 10x10x1) and then the &amp;lt;code&amp;gt;hBN-2D&amp;lt;/code&amp;gt; folder (k-sampling 6x6x1)&lt;br /&gt;
You may already have them in the &amp;lt;code&amp;gt;YAMBO_TUTORIALS&amp;lt;/code&amp;gt; folder&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN-2D-RT&#039;&#039;&#039; hBN-2D.tar.gz  hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
If you need to downoload again the tutorial files, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo (5.3)|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]&lt;br /&gt;
* [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 5 - Friday, 23 May ===&lt;br /&gt;
&lt;br /&gt;
== Lectures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May ===&lt;br /&gt;
&lt;br /&gt;
* D. Varsano, [Description and goal of the school].&lt;br /&gt;
* C. Franchini, [https://drive.google.com/file/d/1Z6GCjP4K1dM28ULsyYg2eckgUdYUSRph/view?usp=share_link First principles and data-driven correlated materials]&lt;br /&gt;
* F. Mohamed, [https://drive.google.com/file/d/1ITddkGTM12Gw5QxnZjAQpfZgYH0FvJL1/view?usp=share_link A tour on Density Functional Theory]&lt;br /&gt;
* E. Cannuccia, [https://drive.google.com/file/d/1mBTcPrnfoqwcA5wXE8gXQMO_qttClHAd/view?usp=share_link Electronic screening and linear response theory]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
* A. Marini, [https://drive.google.com/file/d/1HTIPHkH2sBaVDLFwwS34T-fJ9x8FhVPq/view?usp=share_link Introduction to Many-Body Perturbation Theory]&lt;br /&gt;
* C. Cardoso, Quasiparticles and the GW Approximation&lt;br /&gt;
* A. Guandalini, [https://drive.google.com/file/d/1dgcdHMfA0b7jjyrCs4r9OrG6qpiu1v39/view?usp=share_link GW in practice: algorithms and approximations]&lt;br /&gt;
* G. Sesti, [https://drive.google.com/file/d/1te_85k9jgSymr3Av86rKOu0-tA-7sGWq/view?usp=sharing  GW advanced algorithms]&lt;br /&gt;
* M. Govoni, GW without empty states and investigation of neutral excitations by embedding full configuration interaction in DFT+GW&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&lt;br /&gt;
* M. Palummo, [https://drive.google.com/file/d/1pQ491hqpETVLchL92QPy4f_jWqfMK5xf/view?usp=share_link Optical absorption and excitons via the Bethe-Salpeter Equation]&lt;br /&gt;
* D. Sangalli, Real-time simulations&lt;br /&gt;
* F. Paleari, Introduction to YamboPy (automation and post-processing)&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, 22 May ===&lt;br /&gt;
&lt;br /&gt;
* E. Luppi, An introduction to Non-linear spectroscopy&lt;br /&gt;
* M. Grüning, Non-linear spectroscopy in Yambo&lt;br /&gt;
* F. Affinito, Frontiers in High-Performance Computing&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8763</id>
		<title>Modena 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8763"/>
		<updated>2025-05-19T13:28:18Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A general description of the goal(s) of the school can be found on the [https://www.yambo-code.eu/2025/01/17/yambo-school-modena-2025/ Yambo main website]&lt;br /&gt;
&lt;br /&gt;
== Use CINECA computational resources ==&lt;br /&gt;
Yambo tutorials will be run on the Leonardo-DCGP partition. You can find info about Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section here].&lt;br /&gt;
In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.&lt;br /&gt;
&lt;br /&gt;
=== Connect to the cluster using ssh ===&lt;br /&gt;
&lt;br /&gt;
You can access Leonardo via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; protocol in different ways.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using username and password &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Use the following command replacing your username:&lt;br /&gt;
 ssh username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
However, in this way you have to type your password each time you want to connect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using ssh key &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can setup a ssh key pair to avoid typing the password each time you want to connect to Leonardo. To do so, run the &amp;lt;code&amp;gt;ssh-keygen&amp;lt;/code&amp;gt; command to generate a private/public key pair:&lt;br /&gt;
 ssh-keygen -t rsa -b 4096 -f ~/.ssh/leonardo_rsa&lt;br /&gt;
 Generating public/private rsa key pair.&lt;br /&gt;
 Created directory &#039;/home/username/.ssh&#039;.&lt;br /&gt;
 Enter passphrase (empty for no passphrase): &lt;br /&gt;
 Enter same passphrase again: &lt;br /&gt;
 Your identification has been saved in /home/username/.ssh/leonardo_rsa&lt;br /&gt;
 Your public key has been saved in /home/username/.ssh/leonardo_rsa.pub&lt;br /&gt;
 The key fingerprint is:&lt;br /&gt;
 [...]&lt;br /&gt;
 The key&#039;s randomart image is:&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Now you need to copy the &#039;&#039;&#039;public&#039;&#039;&#039; key to Leonardo. You can do that with the following command (for this step you need to type your password):&lt;br /&gt;
 ssh-copy-id -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Be aware that when running the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command, after typing &amp;quot;yes&amp;quot; at the prompt, you might see an error message like the one shown below. Don’t worry—just follow the instructions provided in this CINECA [https://wiki.u-gov.it/confluence/display/SCAIUS/FAQ#FAQ-Ikeepreceivingtheerrormessage%22WARNING:REMOTEHOSTIDENTIFICATIONHASCHANGED!%22evenifImodifyknown_hostfile guide to resolve the issue]. Once done, run the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command again.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 /usr/bin/ssh-copy-id: &lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Once the public key has been copied, you can connect to Leonardo without having to type the password using the &amp;lt;code&amp;gt;-i&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
To simplify even more, you can paste the following lines in a file named &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; located inside the &amp;lt;code&amp;gt;.ssh&amp;lt;/code&amp;gt; directory adjusting the username:&lt;br /&gt;
 Host leonardo &lt;br /&gt;
  HostName login.leonardo.cineca.it&lt;br /&gt;
  User username&lt;br /&gt;
  IdentityFile ~/.ssh/leonardo_rsa&lt;br /&gt;
&lt;br /&gt;
With the &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; file setup you can connect simply with&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
&lt;br /&gt;
=== General instructions to run tutorials ===&lt;br /&gt;
&lt;br /&gt;
Before proceeding, it is useful to know the different workspaces you have available on Leonardo, which can be accessed using environment variables. The main ones are:&lt;br /&gt;
* &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;home&amp;lt;/code&amp;gt; directory associated to your username; &lt;br /&gt;
* &amp;lt;code&amp;gt;$WORK&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;work&amp;lt;/code&amp;gt; directory associated to the account where the computational resources dedicated to this school are allocated;&lt;br /&gt;
* &amp;lt;code&amp;gt;$SCRATCH&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;scratch&amp;lt;/code&amp;gt; directory associated to your username.&lt;br /&gt;
You can find more details about storage and FileSystems [https://wiki.u-gov.it/confluence/display/SCAIUS/4%3A+Data+storage+and+FileSystems here].&lt;br /&gt;
&lt;br /&gt;
Please don&#039;t forget to &#039;&#039;&#039;run all tutorials in your scratch directory&#039;&#039;&#039;:&lt;br /&gt;
 echo $SCRATCH&lt;br /&gt;
 /leonardo_scratch/large/userexternal/username&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
&lt;br /&gt;
Computational resources on Leonardo are managed by the job scheduling system [https://slurm.schedmd.com/overview.html Slurm]. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Run a job using a batch script &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script &amp;lt;code&amp;gt;job.sh&amp;lt;/code&amp;gt;, whose generic structure is the following:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --account=tra25_yambo           # Charge resources used by this job to specified account&lt;br /&gt;
 #SBATCH --time=00:10:00                 # Set a limit on the total run time of the job allocation in hh:mm:ss&lt;br /&gt;
 #SBATCH --job-name=JOB                  # Specify a name for the job allocation&lt;br /&gt;
 #SBATCH --partition= dcgp_usr_prod      # Request a specific partition for the resource allocation&lt;br /&gt;
 #SBATCH --gres=tmpfs:10g                # List of generic consumable resources&lt;br /&gt;
 #SBATCH --qos=normal                    # Quality of service &lt;br /&gt;
 #SBATCH --reservation=s_tra_yambo       # Reservation specific to this school&lt;br /&gt;
 #          &lt;br /&gt;
 #SBATCH --nodes=&amp;lt;N&amp;gt;                     # Number of nodes to be allocated for the job&lt;br /&gt;
 #SBATCH --ntasks-per-node=&amp;lt;n&amp;gt;           # Number of MPI tasks invoked per node&lt;br /&gt;
 #SBATCH --ntasks-per-socket=&amp;lt;n/2&amp;gt;       # Tasks invoked on each socket&lt;br /&gt;
 #SBATCH --cpus-per-task=&amp;lt;c&amp;gt;             # Number of OMP threads per task&lt;br /&gt;
 &lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np ${SLURM_NTASKS} \&lt;br /&gt;
        yambo -F &amp;lt;input&amp;gt; -J &amp;lt;output&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section#DCGPSection-SLURMpartitions resources]. The complete list of Slurm options can be found [https://slurm.schedmd.com/sbatch.html here]. However you will find &#039;&#039;&#039;ready-to-use&#039;&#039;&#039; batch scripts in locations specified during the tutorials. &lt;br /&gt;
&lt;br /&gt;
To submit the job, use the &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 sbatch job.sh&lt;br /&gt;
 Submitted batch job 15696508&lt;br /&gt;
&lt;br /&gt;
To check the job status, use the &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 squeue --me&lt;br /&gt;
            JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
         15696508 dcgp_usr_   job.sh username  R       0:01      1 lrdn4135&lt;br /&gt;
&lt;br /&gt;
If you need to cancel your job, do:&lt;br /&gt;
 scancel &amp;lt;JOBID&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Open an interactive session &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hours:&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 srun: job 15694182 queued and waiting for resources&lt;br /&gt;
 srun: job 15694182 has been allocated resources&lt;br /&gt;
&lt;br /&gt;
We ask for 4 cpus-per-task (-c) because we can exploit OpenMP parallelization with the available resources.&lt;br /&gt;
&lt;br /&gt;
Then, you need to manually load &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; as in the batch script above:&lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
&lt;br /&gt;
Finally, set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable to 4 using the appropriate Slurm environment variable:&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
To close the interactive session when you have finished, log out of the compute node with the &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Plot results with gnuplot &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the tutorials you will often need to plot the results of the calculations. In order to do so on Leonardo, &#039;&#039;&#039;open a new terminal window&#039;&#039;&#039; and connect to Leonardo enabling X11 forwarding with the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -X leonardo&lt;br /&gt;
&lt;br /&gt;
Please note that &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt; can be used in this way only from the login nodes:&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ cd &amp;lt;directory_with_data&amp;gt;&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ gnuplot&lt;br /&gt;
 ...&lt;br /&gt;
 Terminal type is now &#039;...&#039;&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;lt;...&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Set up yambopy &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to run yambopy on Leonardo, you must first activate the python environment:&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 source /leonardo_work/tra25_yambo/env_yambopy/bin/activate&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
Quick recap.&lt;br /&gt;
Before every tutorial, if you run on Leonardo, do the following steps&lt;br /&gt;
&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
 mkdir -p YAMBO_TUTORIALS &#039;&#039;&#039;#(Only if you didn&#039;t before)&#039;&#039;&#039;&lt;br /&gt;
 cd YAMBO_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
Since the compute nodes are not connected to the external network, the tarballs must be downloaded before starting the interactive session.&lt;br /&gt;
Alternatively, once the interactive session has started, it is possible to access the tarballs by copying them from the following directories:&lt;br /&gt;
&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBO_TUTORIALS&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
After that you can start the interactive session&lt;br /&gt;
&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
set the environment variable for openMP &lt;br /&gt;
&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
and load yambo or yambopy as explained above in the general instructions.&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May === &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:15 - 18:30 From the DFT ground state to the complete setup of a Many Body calculation using Yambo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN&#039;&#039;&#039; hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now that you have all the files, you may open the interactive job session with &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; as explained above and proceed with the tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[First steps: walk through from DFT(standalone)|First steps: Initialization and more ]]&lt;br /&gt;
* [[Next steps: RPA calculations (standalone)|Next steps: RPA calculations ]]&lt;br /&gt;
&lt;br /&gt;
At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let&#039;s create a dedicated directory, download and extract the related files.&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ mkdir -p YAMBOPY_TUTORIALS&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS&lt;br /&gt;
 $ rsync -avzP /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS/yambopy_tutorial_Modena_2025.tar.gz .&lt;br /&gt;
 $ tar --strip-components=1 -xvzf yambopy_tutorial_Modena_2025.tar.gz&lt;br /&gt;
&lt;br /&gt;
Then, follow part 1 of the tutorial, which is related to DFT band structures, YAMBO initialization and linear response.&lt;br /&gt;
* [[Modena 2025 : Yambopy part 1]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 A tour through GW simulation in a complex material (from the blackboard to numerical computation: convergence, algorithms, parallel usage)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get all the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ tar -xvf MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ cd hBN&lt;br /&gt;
&lt;br /&gt;
Now you can start the first tutorial:&lt;br /&gt;
&lt;br /&gt;
* [[GW tutorial Rome 2023 | GW computations on practice: how to obtain the quasi-particle band structure of a bulk material ]]&lt;br /&gt;
&lt;br /&gt;
If you have gone through the first tutorial, pass now to the second one:&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBO_TUTORIALS&lt;br /&gt;
 $ cd MoS2_HPC_tutorial&lt;br /&gt;
&lt;br /&gt;
* [[Quasi-particles of a 2D system | Quasi-particles of a 2D system ]]&lt;br /&gt;
&lt;br /&gt;
As for yambopy, the tutorial related to GW calculations is contained in the first section of Part 2&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#GW calculations| Modena 2025 : Yambopy part 2 (GW calculations)]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 Bethe-Salpeter equation (BSE)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz &lt;br /&gt;
 $ tar -xvf hBN-convergence-kpoints.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now, you may open the interactive job session with &amp;lt;code&amp;gt;salloc&amp;lt;/code&amp;gt; and proceed with the following tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[Calculating optical spectra including excitonic effects: a step-by-step guide|Perform a BSE calculation from beginning to end ]]&lt;br /&gt;
* [[How to analyse excitons - ICTP 2022 school|Analyse your results (exciton wavefunctions in real and reciprocal space, etc.) ]]&lt;br /&gt;
* [[BSE solvers overview|Solve the BSE eigenvalue problem with different numerical methods]]&lt;br /&gt;
* [[How to choose the input parameters|Choose the input parameters for a meaningful converged calculation]]&lt;br /&gt;
&lt;br /&gt;
Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:&lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS/databases_yambopy&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#Excitons| Modena 2025 : Yambopy part 2 (BSE calculations)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;17:00 - 18:30 Bethe-Salpeter equation in real time (TD-HSEX)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
The files needed for the following tutorials can be downloaded following these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Introduction_to_Real_Time_propagation_in_Yambo#Time_Dependent_Equation_for_the_Reduced_One--Body_Density--Matrix|Read the introductive section to real-time propagation for the one-body density matrix]] (the part about time-dependent Schrödinger equation will be covered on DAY 4 and you can skip it for now)&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Calculate the linear response in real time]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Calculate the BSE in real time]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, May 22 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:30 - 17:30 Nonlinear response with the time dependent berry phase&#039;&#039;&#039; Myrta Gruning (Queen&#039;s University Belfast), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the tutorials we will use first the &amp;lt;code&amp;gt;hBN-2D-RT&amp;lt;/code&amp;gt; folder (k-sampling 10x10x1) and then the &amp;lt;code&amp;gt;hBN-2D&amp;lt;/code&amp;gt; folder (k-sampling 6x6x1)&lt;br /&gt;
You may already have them in the &amp;lt;code&amp;gt;YAMBO_TUTORIALS&amp;lt;/code&amp;gt; folder&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN-2D-RT&#039;&#039;&#039; hBN-2D.tar.gz  hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
If you need to downoload again the tutorial files, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo (5.3)|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]&lt;br /&gt;
* [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 5 - Friday, 23 May ===&lt;br /&gt;
&lt;br /&gt;
== Lectures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May ===&lt;br /&gt;
&lt;br /&gt;
* D. Varsano, [Description and goal of the school].&lt;br /&gt;
* C. Franchini, [https://drive.google.com/file/d/1Z6GCjP4K1dM28ULsyYg2eckgUdYUSRph/view?usp=share_link First principles and data-driven correlated materials]&lt;br /&gt;
* F. Mohamed, [https://drive.google.com/file/d/1ITddkGTM12Gw5QxnZjAQpfZgYH0FvJL1/view?usp=share_link A tour on Density Functional Theory]&lt;br /&gt;
* E. Cannuccia, [https://drive.google.com/file/d/1mBTcPrnfoqwcA5wXE8gXQMO_qttClHAd/view?usp=share_link Electronic screening and linear response theory]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
* A. Marini, [https://drive.google.com/file/d/1HTIPHkH2sBaVDLFwwS34T-fJ9x8FhVPq/view?usp=share_link Introduction to Many-Body Perturbation Theory]&lt;br /&gt;
* C. Cardoso, Quasiparticles and the GW Approximation&lt;br /&gt;
* A. Guandalini, [https://drive.google.com/file/d/1dgcdHMfA0b7jjyrCs4r9OrG6qpiu1v39/view?usp=share_link GW in practice: algorithms and approximations]&lt;br /&gt;
* G. Sesti, [https://drive.google.com/file/d/1te_85k9jgSymr3Av86rKOu0-tA-7sGWq/view?usp=sharing  GW advanced algorithms]&lt;br /&gt;
* M. Govoni, GW without empty states and investigation of neutral excitations by embedding full configuration interaction in DFT+GW&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&lt;br /&gt;
* M. Palummo, [https://drive.google.com/file/d/1pQ491hqpETVLchL92QPy4f_jWqfMK5xf/view?usp=share_link Optical absorption and excitons via the Bethe-Salpeter Equation]&lt;br /&gt;
* D. Sangalli, Real-time simulations&lt;br /&gt;
* F. Paleari, Introduction to YamboPy (automation and post-processing)&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, 22 May ===&lt;br /&gt;
&lt;br /&gt;
* E. Luppi, An introduction to Non-linear spectroscopy&lt;br /&gt;
* M. Grüning, Non-linear spectroscopy in Yambo&lt;br /&gt;
* F. Affinito, Frontiers in High-Performance Computing&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8762</id>
		<title>Modena 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Modena_2025&amp;diff=8762"/>
		<updated>2025-05-19T13:26:49Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A general description of the goal(s) of the school can be found on the [https://www.yambo-code.eu/2025/01/17/yambo-school-modena-2025/ Yambo main website]&lt;br /&gt;
&lt;br /&gt;
== Use CINECA computational resources ==&lt;br /&gt;
Yambo tutorials will be run on the Leonardo-DCGP partition. You can find info about Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section here].&lt;br /&gt;
In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.&lt;br /&gt;
&lt;br /&gt;
=== Connect to the cluster using ssh ===&lt;br /&gt;
&lt;br /&gt;
You can access Leonardo via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt; protocol in different ways.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using username and password &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Use the following command replacing your username:&lt;br /&gt;
 ssh username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
However, in this way you have to type your password each time you want to connect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Connect using ssh key &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can setup a ssh key pair to avoid typing the password each time you want to connect to Leonardo. To do so, run the &amp;lt;code&amp;gt;ssh-keygen&amp;lt;/code&amp;gt; command to generate a private/public key pair:&lt;br /&gt;
 ssh-keygen -t rsa -b 4096 -f ~/.ssh/leonardo_rsa&lt;br /&gt;
 Generating public/private rsa key pair.&lt;br /&gt;
 Created directory &#039;/home/username/.ssh&#039;.&lt;br /&gt;
 Enter passphrase (empty for no passphrase): &lt;br /&gt;
 Enter same passphrase again: &lt;br /&gt;
 Your identification has been saved in /home/username/.ssh/leonardo_rsa&lt;br /&gt;
 Your public key has been saved in /home/username/.ssh/leonardo_rsa.pub&lt;br /&gt;
 The key fingerprint is:&lt;br /&gt;
 [...]&lt;br /&gt;
 The key&#039;s randomart image is:&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Now you need to copy the &#039;&#039;&#039;public&#039;&#039;&#039; key to Leonardo. You can do that with the following command (for this step you need to type your password):&lt;br /&gt;
 ssh-copy-id -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Be aware that when running the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command, after typing &amp;quot;yes&amp;quot; at the prompt, you might see an error message like the one shown below. Don’t worry—just follow the instructions provided in this CINECA [https://wiki.u-gov.it/confluence/display/SCAIUS/FAQ#FAQ-Ikeepreceivingtheerrormessage%22WARNING:REMOTEHOSTIDENTIFICATIONHASCHANGED!%22evenifImodifyknown_hostfile guide to resolve the issue]. Once done, run the &amp;lt;code&amp;gt;ssh-copy-id&amp;lt;/code&amp;gt; command again.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 /usr/bin/ssh-copy-id: &lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&lt;br /&gt;
 ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;
 ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Once the public key has been copied, you can connect to Leonardo without having to type the password using the &amp;lt;code&amp;gt;-i&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it&lt;br /&gt;
&lt;br /&gt;
To simplify even more, you can paste the following lines in a file named &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; located inside the &amp;lt;code&amp;gt;.ssh&amp;lt;/code&amp;gt; directory adjusting the username:&lt;br /&gt;
 Host leonardo &lt;br /&gt;
  HostName login.leonardo.cineca.it&lt;br /&gt;
  User username&lt;br /&gt;
  IdentityFile ~/.ssh/leonardo_rsa&lt;br /&gt;
&lt;br /&gt;
With the &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; file setup you can connect simply with&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
&lt;br /&gt;
=== General instructions to run tutorials ===&lt;br /&gt;
&lt;br /&gt;
Before proceeding, it is useful to know the different workspaces you have available on Leonardo, which can be accessed using environment variables. The main ones are:&lt;br /&gt;
* &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;home&amp;lt;/code&amp;gt; directory associated to your username; &lt;br /&gt;
* &amp;lt;code&amp;gt;$WORK&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;work&amp;lt;/code&amp;gt; directory associated to the account where the computational resources dedicated to this school are allocated;&lt;br /&gt;
* &amp;lt;code&amp;gt;$SCRATCH&amp;lt;/code&amp;gt;: it&#039;s the &amp;lt;code&amp;gt;scratch&amp;lt;/code&amp;gt; directory associated to your username.&lt;br /&gt;
You can find more details about storage and FileSystems [https://wiki.u-gov.it/confluence/display/SCAIUS/4%3A+Data+storage+and+FileSystems here].&lt;br /&gt;
&lt;br /&gt;
Please don&#039;t forget to &#039;&#039;&#039;run all tutorials in your scratch directory&#039;&#039;&#039;:&lt;br /&gt;
 echo $SCRATCH&lt;br /&gt;
 /leonardo_scratch/large/userexternal/username&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
&lt;br /&gt;
Computational resources on Leonardo are managed by the job scheduling system [https://slurm.schedmd.com/overview.html Slurm]. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Run a job using a batch script &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script &amp;lt;code&amp;gt;job.sh&amp;lt;/code&amp;gt;, whose generic structure is the following:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 #SBATCH --account=tra25_yambo           # Charge resources used by this job to specified account&lt;br /&gt;
 #SBATCH --time=00:10:00                 # Set a limit on the total run time of the job allocation in hh:mm:ss&lt;br /&gt;
 #SBATCH --job-name=JOB                  # Specify a name for the job allocation&lt;br /&gt;
 #SBATCH --partition= dcgp_usr_prod      # Request a specific partition for the resource allocation&lt;br /&gt;
 #SBATCH --gres=tmpfs:10g                # List of generic consumable resources&lt;br /&gt;
 #SBATCH --qos=normal                    # Quality of service &lt;br /&gt;
 #SBATCH --reservation=s_tra_yambo       # Reservation specific to this school&lt;br /&gt;
 #          &lt;br /&gt;
 #SBATCH --nodes=&amp;lt;N&amp;gt;                     # Number of nodes to be allocated for the job&lt;br /&gt;
 #SBATCH --ntasks-per-node=&amp;lt;n&amp;gt;           # Number of MPI tasks invoked per node&lt;br /&gt;
 #SBATCH --ntasks-per-socket=&amp;lt;n/2&amp;gt;       # Tasks invoked on each socket&lt;br /&gt;
 #SBATCH --cpus-per-task=&amp;lt;c&amp;gt;             # Number of OMP threads per task&lt;br /&gt;
 &lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
 &lt;br /&gt;
 mpirun -np ${SLURM_NTASKS} \&lt;br /&gt;
        yambo -F &amp;lt;input&amp;gt; -J &amp;lt;output&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section#DCGPSection-SLURMpartitions resources]. The complete list of Slurm options can be found [https://slurm.schedmd.com/sbatch.html here]. However you will find &#039;&#039;&#039;ready-to-use&#039;&#039;&#039; batch scripts in locations specified during the tutorials. &lt;br /&gt;
&lt;br /&gt;
To submit the job, use the &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 sbatch job.sh&lt;br /&gt;
 Submitted batch job 15696508&lt;br /&gt;
&lt;br /&gt;
To check the job status, use the &amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 squeue --me&lt;br /&gt;
            JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)&lt;br /&gt;
         15696508 dcgp_usr_   job.sh username  R       0:01      1 lrdn4135&lt;br /&gt;
&lt;br /&gt;
If you need to cancel your job, do:&lt;br /&gt;
 scancel &amp;lt;JOBID&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Open an interactive session &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hours:&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 srun: job 15694182 queued and waiting for resources&lt;br /&gt;
 srun: job 15694182 has been allocated resources&lt;br /&gt;
&lt;br /&gt;
We ask for 4 cpus-per-task (-c) because we can exploit OpenMP parallelization with the available resources.&lt;br /&gt;
&lt;br /&gt;
Then, you need to manually load &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; as in the batch script above:&lt;br /&gt;
 module purge&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules&lt;br /&gt;
 module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0&lt;br /&gt;
&lt;br /&gt;
Finally, set the &amp;lt;code&amp;gt;OMP_NUM_THREADS&amp;lt;/code&amp;gt; environment variable to 4 using the appropriate Slurm environment variable:&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
To close the interactive session when you have finished, log out of the compute node with the &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; command:&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Plot results with gnuplot &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the tutorials you will often need to plot the results of the calculations. In order to do so on Leonardo, &#039;&#039;&#039;open a new terminal window&#039;&#039;&#039; and connect to Leonardo enabling X11 forwarding with the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; option:&lt;br /&gt;
 ssh -X leonardo&lt;br /&gt;
&lt;br /&gt;
Please note that &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt; can be used in this way only from the login nodes:&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ cd &amp;lt;directory_with_data&amp;gt;&lt;br /&gt;
 username@&#039;&#039;&#039;login01&#039;&#039;&#039;$ gnuplot&lt;br /&gt;
 ...&lt;br /&gt;
 Terminal type is now &#039;...&#039;&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;lt;...&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; - Set up yambopy &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to run yambopy on Leonardo, you must first activate the python environment:&lt;br /&gt;
 module load profile/candidate&lt;br /&gt;
 source /leonardo_work/tra25_yambo/env_yambopy/bin/activate&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
Quick recap.&lt;br /&gt;
Before every tutorial, if you run on Leonardo, do the following steps&lt;br /&gt;
&lt;br /&gt;
 ssh leonardo&lt;br /&gt;
 cd $SCRATCH&lt;br /&gt;
 mkdir -p YAMBO_TUTORIALS &#039;&#039;&#039;#(Only if you didn&#039;t before)&#039;&#039;&#039;&lt;br /&gt;
 cd YAMBO_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
Since the compute nodes are not connected to the external network, the tarballs must be downloaded before starting the interactive session.&lt;br /&gt;
Alternatively, once the interactive session has started, it is possible to access the tarballs by copying them from the following directories:&lt;br /&gt;
&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBO_TUTORIALS&lt;br /&gt;
 /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS&lt;br /&gt;
&lt;br /&gt;
After that you can start the interactive session&lt;br /&gt;
&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
set the environment variable for openMP &lt;br /&gt;
&lt;br /&gt;
 export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&lt;br /&gt;
and load yambo or yambopy as explained above in the general instructions.&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May === &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:15 - 18:30 From the DFT ground state to the complete setup of a Many Body calculation using Yambo&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN&#039;&#039;&#039; hBN-2D.tar.gz  hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now that you have all the files, you may open the interactive job session with &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; as explained above and proceed with the tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[First steps: walk through from DFT(standalone)|First steps: Initialization and more ]]&lt;br /&gt;
* [[Next steps: RPA calculations (standalone)|Next steps: RPA calculations ]]&lt;br /&gt;
&lt;br /&gt;
At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let&#039;s create a dedicated directory, download and extract the related files.&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ mkdir -p YAMBOPY_TUTORIALS&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS&lt;br /&gt;
 $ rsync -avzP /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS/yambopy_tutorial_Modena_2025.tar.gz .&lt;br /&gt;
 $ tar --strip-components=1 -xvzf yambopy_tutorial_Modena_2025.tar.gz&lt;br /&gt;
&lt;br /&gt;
Then, follow part 1 of the tutorial, which is related to DFT band structures, YAMBO initialization and linear response.&lt;br /&gt;
* [[Modena 2025 : Yambopy part 1]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 A tour through GW simulation in a complex material (from the blackboard to numerical computation: convergence, algorithms, parallel usage)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To get all the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
 $ tar -xvf MoS2_2Dquasiparticle_tutorial.tar.gz&lt;br /&gt;
 $ cd hBN&lt;br /&gt;
&lt;br /&gt;
Now you can start the first tutorial:&lt;br /&gt;
&lt;br /&gt;
* [[GW tutorial Rome 2023 | GW computations on practice: how to obtain the quasi-particle band structure of a bulk material ]]&lt;br /&gt;
&lt;br /&gt;
If you have gone through the first tutorial, pass now to the second one:&lt;br /&gt;
 &lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBO_TUTORIALS&lt;br /&gt;
 $ cd MoS2_HPC_tutorial&lt;br /&gt;
&lt;br /&gt;
* [[Quasi-particles of a 2D system | Quasi-particles of a 2D system ]]&lt;br /&gt;
&lt;br /&gt;
As for yambopy, the tutorial related to GW calculations is contained in the first section of Part 2&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#GW calculations| Modena 2025 : Yambopy part 2 (GW calculations)]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&#039;&#039;&#039;14:00 - 16:30 Bethe-Salpeter equation (BSE)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
To get the tutorial files needed for the following tutorials, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz &lt;br /&gt;
 $ tar -xvf hBN-convergence-kpoints.tar.gz&lt;br /&gt;
 $ tar -xvf hBN.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now, you may open the interactive job session with &amp;lt;code&amp;gt;salloc&amp;lt;/code&amp;gt; and proceed with the following tutorials.&lt;br /&gt;
&lt;br /&gt;
* [[Calculating optical spectra including excitonic effects: a step-by-step guide|Perform a BSE calculation from beginning to end ]]&lt;br /&gt;
* [[How to analyse excitons - ICTP 2022 school|Analyse your results (exciton wavefunctions in real and reciprocal space, etc.) ]]&lt;br /&gt;
* [[BSE solvers overview|Solve the BSE eigenvalue problem with different numerical methods]]&lt;br /&gt;
* [[How to choose the input parameters|Choose the input parameters for a meaningful converged calculation]]&lt;br /&gt;
&lt;br /&gt;
Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:&lt;br /&gt;
 $ cd $SCRATCH&lt;br /&gt;
 $ cd YAMBOPY_TUTORIALS/databases_yambopy&lt;br /&gt;
&lt;br /&gt;
* [[Modena 2025 : Yambopy part 2#Excitons| Modena 2025 : Yambopy part 2 (BSE calculations)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;17:00 - 18:30 Bethe-Salpeter equation in real time (TD-HSEX)&#039;&#039;&#039; Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
The files needed for the following tutorials can be downloaded following these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [[Introduction_to_Real_Time_propagation_in_Yambo#Time_Dependent_Equation_for_the_Reduced_One--Body_Density--Matrix|Read the introductive section to real-time propagation for the one-body density matrix]] (the part about time-dependent Schrödinger equation will be covered on DAY 4 and you can skip it for now)&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Linear response from real time simulations (density matrix only)|Calculate the linear response in real time]]&lt;br /&gt;
* [[Real time Bethe-Salpeter Equation (density matrix only)|Calculate the BSE in real time]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, May 22 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;16:30 - 17:30 Real-time approach with the time dependent berry phase&#039;&#039;&#039; Myrta Gruning (Queen&#039;s University Belfast), Davide Sangalli (CNR-ISM, Italy)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the tutorials we will use first the &amp;lt;code&amp;gt;hBN-2D-RT&amp;lt;/code&amp;gt; folder (k-sampling 10x10x1) and then the &amp;lt;code&amp;gt;hBN-2D&amp;lt;/code&amp;gt; folder (k-sampling 6x6x1)&lt;br /&gt;
You may already have them in the &amp;lt;code&amp;gt;YAMBO_TUTORIALS&amp;lt;/code&amp;gt; folder&lt;br /&gt;
 $ ls&lt;br /&gt;
 &#039;&#039;&#039;hBN-2D&#039;&#039;&#039; &#039;&#039;&#039;hBN-2D-RT&#039;&#039;&#039; hBN-2D.tar.gz  hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
If you need to downoload again the tutorial files, follow these steps:&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz&lt;br /&gt;
 $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D.tar.gz&lt;br /&gt;
 $ tar -xvf hBN-2D-RT.tar.gz&lt;br /&gt;
&lt;br /&gt;
* [[Prerequisites for Real Time propagation with Yambo (5.3)|Perform the setup for a real-time calculation]]&lt;br /&gt;
* [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]&lt;br /&gt;
* [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
=== DAY 5 - Friday, 23 May ===&lt;br /&gt;
&lt;br /&gt;
== Lectures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAY 1 - Monday, 19 May ===&lt;br /&gt;
&lt;br /&gt;
* D. Varsano, [Description and goal of the school].&lt;br /&gt;
* C. Franchini, [https://drive.google.com/file/d/1Z6GCjP4K1dM28ULsyYg2eckgUdYUSRph/view?usp=share_link First principles and data-driven correlated materials]&lt;br /&gt;
* F. Mohamed, [https://drive.google.com/file/d/1ITddkGTM12Gw5QxnZjAQpfZgYH0FvJL1/view?usp=share_link A tour on Density Functional Theory]&lt;br /&gt;
* E. Cannuccia, [https://drive.google.com/file/d/1mBTcPrnfoqwcA5wXE8gXQMO_qttClHAd/view?usp=share_link Electronic screening and linear response theory]&lt;br /&gt;
&lt;br /&gt;
=== DAY 2 - Tuesday, 20 May ===&lt;br /&gt;
&lt;br /&gt;
* A. Marini, [https://drive.google.com/file/d/1HTIPHkH2sBaVDLFwwS34T-fJ9x8FhVPq/view?usp=share_link Introduction to Many-Body Perturbation Theory]&lt;br /&gt;
* C. Cardoso, Quasiparticles and the GW Approximation&lt;br /&gt;
* A. Guandalini, [https://drive.google.com/file/d/1dgcdHMfA0b7jjyrCs4r9OrG6qpiu1v39/view?usp=share_link GW in practice: algorithms and approximations]&lt;br /&gt;
* G. Sesti, [https://drive.google.com/file/d/1te_85k9jgSymr3Av86rKOu0-tA-7sGWq/view?usp=sharing  GW advanced algorithms]&lt;br /&gt;
* M. Govoni, GW without empty states and investigation of neutral excitations by embedding full configuration interaction in DFT+GW&lt;br /&gt;
&lt;br /&gt;
=== DAY 3 - Wednesday, 21 May ===&lt;br /&gt;
&lt;br /&gt;
* M. Palummo, [https://drive.google.com/file/d/1pQ491hqpETVLchL92QPy4f_jWqfMK5xf/view?usp=share_link Optical absorption and excitons via the Bethe-Salpeter Equation]&lt;br /&gt;
* D. Sangalli, Real-time simulations&lt;br /&gt;
* F. Paleari, Introduction to YamboPy (automation and post-processing)&lt;br /&gt;
&lt;br /&gt;
=== DAY 4 - Thursday, 22 May ===&lt;br /&gt;
&lt;br /&gt;
* E. Luppi, An introduction to Non-linear spectroscopy&lt;br /&gt;
* M. Grüning, Non-linear spectroscopy in Yambo&lt;br /&gt;
* F. Affinito, Frontiers in High-Performance Computing&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8760</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8760"/>
		<updated>2025-05-19T12:18:22Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. These are the eigenfrequencies of the system excited by the delta-kick. &lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function. As the polarization oscillates at all eigenfrequencies of the system, the real/imaginary part of the dielectric function obtained by the Fourier transform have poles/zeros at the eigenfrequencies of the system. &lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available - or you can generate it as an exercise):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation within the IPA]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l title &amp;quot;HSEX/BSE&amp;quot;, &lt;br /&gt;
 gnuplot&amp;gt; rep  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u ($1+3):2 w l title &amp;quot;IPA + 3 eV scissor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra BSE Delta.png|600px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption (with a scissor of 3 eV)]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8759</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8759"/>
		<updated>2025-05-19T12:09:54Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. &lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available - or you can generate it as an exercise):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l title &amp;quot;HSEX/BSE&amp;quot;, &lt;br /&gt;
 gnuplot&amp;gt; rep  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u ($1+3):2 w l title &amp;quot;IPA + 3 eV scissor&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra BSE Delta.png|600px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption (with a scissor of 3 eV)]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:01_TDAbsSpectra_BSE_Delta.png&amp;diff=8758</id>
		<title>File:01 TDAbsSpectra BSE Delta.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:01_TDAbsSpectra_BSE_Delta.png&amp;diff=8758"/>
		<updated>2025-05-19T12:07:31Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Uploaded own work with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2025-05-19&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Yambowikiadmin|Yambowikiadmin]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8757</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8757"/>
		<updated>2025-05-19T11:58:20Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. &lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available - or you can generate it as an exercise):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:HBN HSEX absorption.png|thumb|900px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8756</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8756"/>
		<updated>2025-05-19T11:57:07Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. &lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response (if available):&lt;br /&gt;
 gnuplot&lt;br /&gt;
 plot  &amp;quot;TD-IP_nl/o-TD-IP_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 rep &amp;quot;../CHI_IP/o-CHI_IP.eps_q1_ip&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:01 TDAbsSpectra IP.png|600px|center| Imaginary part of the dielectric function obtained from linear response and real-time simulation]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:HBN HSEX absorption.png|thumb|900px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:01_TDAbsSpectra_IP.png&amp;diff=8755</id>
		<title>File:01 TDAbsSpectra IP.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:01_TDAbsSpectra_IP.png&amp;diff=8755"/>
		<updated>2025-05-19T11:53:11Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Uploaded own work with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2025-05-19&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Yambowikiadmin|Yambowikiadmin]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8754</id>
		<title>Second-harmonic generation of 2D-hBN (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8754"/>
		<updated>2025-05-19T11:17:51Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical framework =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we compute the Second-harmonic generation (SHG) from the dynamics of the Bloch-states. The equation-of-motion of the Bloch-states is explained in the tutorial on [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]. Independently of the &#039;experiment&#039; we simulate, the part of the integration of motion stays the same. This means that any experiment, including non-linear optics, can be performed at the level of the theory listed for the computation of the dielectric function:&lt;br /&gt;
* independent (quasi)particle&lt;br /&gt;
* time-dependent Hartree (RPA level)&lt;br /&gt;
* time-dependent DFT (and DPFT)&lt;br /&gt;
* time-dependent Hartree+Screened exchange (BSE level)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
What changes when we want to calculate the SHG (or higher harmonics) is:&lt;br /&gt;
* the time-dependence of the input electric field and&lt;br /&gt;
* the post-processing of the signal  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Time dependence of the electric Field&#039;&#039;&#039;: we choose a sinusoidal electric field, thus a monochromatic laser field. This allows one to expand the polarization in the form &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; through a coefficient depending on a power of the strength of the field (with the power depending on the order of the response).&lt;br /&gt;
&lt;br /&gt;
At difference with a delta-like perturbation, a real-time simulation gives the response at the laser-field only. Then, to obtain the spectrum for the desired range of frequency, we have to perform so many simulations as the frequencies in the desired range.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Post-processing of the signal&#039;&#039;&#039;: The switch-on of the electric field corresponds to a weak delta-like kick. Thus, even if it may not be noticeable from the polarization plot, the polarization results from both the sinusoidal field and the delta-like kick. The latter excites all eigenfrequencies of the system. Though weak, the resulting signal is comparable with the second-harmonic signal. To eliminate the signal from the eigenfrequencies, we apply a dephasing (&amp;lt;math&amp;gt;\gamma_{deph}&amp;lt;/math&amp;gt;). To have a signal useful to sample the second-harmonic signal, we need to wait a time &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;  much larger than the dephasing-time &amp;lt;math&amp;gt;1/\gamma_{deph} &amp;lt;/math&amp;gt;. Note that we cannot choose a too short dephasing time (to shorten the simulation time), as this would result in a too large broadening of the spectrum. After &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;, we sample 2N+1 times in a period and use discrete Fourier transform to extract &amp;lt;math&amp;gt;{p}_n&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; n = 0,...,N&amp;lt;/math&amp;gt;, where n=2 gives the SHG. This is schematically illustrated in figure:&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;
The scheme from Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Phys. Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt; summarised the workflow for computing the SHG (or higher-harmonics) in a energy range &amp;lt;math&amp;gt;[\Omega_1,\Omega_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Scheme nl.png|350px|center|Schematic representation of real-time calculations]]&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
You should be in the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D/YAMBO/&amp;lt;/code&amp;gt;.&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). &lt;br /&gt;
Execute the commands (if running on 4 cores interactively you may need to add -nompi to the command line)&lt;br /&gt;
 yambo_nl&lt;br /&gt;
 ypp_nl -fixsym -F 00_removesym.in  &lt;br /&gt;
to create the input, to remove the symmetries which are not compatible with the field: &lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000 | 1.000000 | 0.000000 |&amp;lt;/span&amp;gt;        # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
 #KeepKGrid                     # Do not expand the k-grid&lt;br /&gt;
where we chose the field along the xy direction and we remove time-reversal symmetry.&lt;br /&gt;
&lt;br /&gt;
Then run the pre-processing job:&lt;br /&gt;
 ypp_nl -F 00_removesym.in&lt;br /&gt;
This creates the directory &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. Change directory to &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. This contains the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory with reduced symmetries, compatible with the direction of the field. Now run the setup again (&amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
  cd FixSymm&lt;br /&gt;
  yambo_nl&lt;br /&gt;
  yambo_nl -nl n -F 01_SHG_ip.in&lt;br /&gt;
to generate the input:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           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&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;0.5000000 |8.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;12&amp;lt;/span&amp;gt;                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
 0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;quot;SIN&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 | 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;
To describe the Bloch-dynamics we will use as a basis the KS-states 3-6 for the k-grid used in the non-scf DFT calculations, that is a 6x6x1 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;). We choose 12 equally spaced frequencies (&amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt;) for the applied field in the range  (&amp;lt;code&amp;gt;NLEnRange&amp;lt;/code&amp;gt;) between 0.5 and 8 eV. We choose a sinusoidal time-dependence (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) and set the field direction (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) along xy (in plane). The negative simulation time (&amp;lt;code&amp;gt;NLtime=-1.000000&amp;lt;/code&amp;gt;) means that the code will choose it based on the value of the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt;. While this is a good lower bound for the simulation time, one should check it is sufficient to get accurate results. &lt;br /&gt;
&lt;br /&gt;
Run the simulation, possibly in parallel e. g. in a interactive session on 4 cores. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[In order to get 4 cores while in an interacting node, exit your current interactive run and rerun &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; asking for the proper number of tasks:&#039;&#039;&#039;&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 4 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
&#039;&#039;&#039;Otherwise, you can submit the job with a slurm script as explained in the introductory page]&#039;&#039;&#039;&lt;br /&gt;
Note that when executing commands that don&#039;t need mpi (such as generating an input file) you may need to add -nompi to the command line &lt;br /&gt;
&lt;br /&gt;
Now execute the command:&lt;br /&gt;
  mpirun -n 4 yambo_nl -F 01_SHG_ip.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
This run will take several minutes. While it is running, you can check the progress of one specific frequency:&lt;br /&gt;
 tail -f 01_SHG_ip_files/o-01_SHG_ip.polarization_F2&lt;br /&gt;
If you want to know how many fs the simulation will last (since this was decided by the code), you can get this information in the report file:&lt;br /&gt;
 $ grep &#039;Total simulation&#039; 01_SHG_ip_files/r-01_SHG_ip_nloptics&lt;br /&gt;
 Total simulation time       :  47.81405 [fs]&lt;br /&gt;
&lt;br /&gt;
If you instead want to track the progress of the full simulation, you should check the log file(s). If you are doing a parallel run, you can type&lt;br /&gt;
 tail -f 01_SHG_ip_files/LOG/l-01_SHG_ip_nloptics_CPU_1&lt;br /&gt;
&lt;br /&gt;
Once the run is finished, check the report &amp;lt;code&amp;gt;01_SHG_ip_files/r-01_SHG_ip_nloptics&amp;lt;/code&amp;gt;. In particular, in the appended input files, you can see the default parallelization applied by the code for calculating the dipoles and run the time-propagation. For the latter, the main parallelization is on the frequencies and then on the k-points (&amp;lt;code&amp;gt;NL_ROLEs= &amp;quot;w.k&amp;quot;&amp;lt;/code&amp;gt;).   &lt;br /&gt;
&lt;br /&gt;
 | NL_CPU= &amp;quot;2.2&amp;quot;                    # [PARALLEL] CPUs for each role&lt;br /&gt;
 | NL_ROLEs= &amp;quot;w.k&amp;quot;                  # [PARALLEL] CPUs roles (w,k)&lt;br /&gt;
 | DIP_CPU= &amp;quot;2.2.1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 | DIP_ROLEs= &amp;quot;v.c.k&amp;quot;               # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
&lt;br /&gt;
Also, look at the simulation time. This is approximately 45-50 fs. &lt;br /&gt;
&lt;br /&gt;
Plot the polarization for a couple of frequencies, e.g. the first and last of the chosen range (the corresponding frequency can be read in the file, search for &amp;quot;Frequency value&amp;quot;):&lt;br /&gt;
 set ylabel &amp;quot;x-component polarization&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;time (fs)&amp;quot;&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F1&#039; u 1:2 w l lw 2 title &amp;quot;omega = 0.5 eV&amp;quot;&lt;br /&gt;
 replot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F12&#039; u 1:2 w l lw 2  title &amp;quot;omega = 7.375 eV&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:Berry_phase_polarization_of_2D_h-BN_obtained_from_the_previous_run_for_two_laser_frequencies.png|600px|center|Berry_phase_polarization_of_2D_h-BN_obtained from the run for two laser frequencies]]&lt;br /&gt;
&lt;br /&gt;
After the applied field is &#039;switched on&#039;, the polarization is oscillating at the frequency of the applied field and at the eigenfrequencies of the system as described above in the cartoon. This is visible particularly for the higher frequency. Due to the dephasing, after about 20 fs the polarization is oscillating (at least to the eye) at the frequency of the applied field. Nonlinear components are not visible since they are several orders of magnitude smaller than the first order.&lt;br /&gt;
&lt;br /&gt;
== Output post-processing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier-transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F 02_SHG_ip_pp.in -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
to generate the input file: &lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Xorder= 4&amp;lt;/span&amp;gt; # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= 0.000000       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Where we changed the &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; to 4. This variable controls the terms in the Fourier expansion of the polarization. We choose up to expand up to the fourth order. This should ensure the second order to be accurate enough. As an exercise, you can change this value (e.g. choose 2,3,5,6) and see how the result below is changing. The time-window where processing is done is chosen automatically, since values are negative. The code chooses by default the last period to carry out the analysis. &lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F 02_SHG_ip_pp.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
   &lt;br /&gt;
In  &amp;lt;code&amp;gt;01_SHG_ip_files&amp;lt;/code&amp;gt; the following files were generated &lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_1&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_2&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_3&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_4&lt;br /&gt;
 r-01_SHG_ip_nonlinear&lt;br /&gt;
&lt;br /&gt;
The output files contain respectively the first, second, third and fourth order response(corresponding to &amp;lt;code&amp;gt;Xorder=4&amp;lt;/code&amp;gt;)  at the 12 frequencies in the chosen range. &lt;br /&gt;
 &lt;br /&gt;
Inspect &amp;lt;code&amp;gt;o-01_SHG_ip.YPP-X_probe_order_2&amp;lt;/code&amp;gt;&lt;br /&gt;
#     E [eV]            X/Im[cm/stV](x)    X/Re[cm/stV](x)    X/Im[cm/stV](y)    X/Re[cm/stV](y)    X/Im[cm/stV](z)    X/Re[cm/stV](z)&lt;br /&gt;
#&lt;br /&gt;
     0.50000000        -0.63057187E-09    -0.19596550E-07    -0.36238688E-10    -0.72052719E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.1250000        -0.19604352E-08    -0.23352876E-07    -0.18347724E-09    -0.86959709E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.7500000        -0.64748829E-08    -0.36274951E-07    -0.27614124E-09    -0.17103902E-08      0.0000000          0.0000000    &lt;br /&gt;
      2.37500000       -0.241985981E-7    -0.864285561E-8    -0.160616725E-8    -0.190064969E-8      0.00000000         0.00000000   &lt;br /&gt;
 &lt;br /&gt;
The first column are the frequencies of the applied field, the second and third is the polarization along x (imaginary and real part), the fourth and fifth is the polarization along y (imaginary and real part)  &lt;br /&gt;
and the sixth and seventh is the polarization along z (imaginary and real part).&lt;br /&gt;
&lt;br /&gt;
Plot the absolute value of the SHG for the &amp;quot;xxy&amp;quot; component (that is, the applied field is in the x and y directions and one look at the polarization along x):&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP.png|600px|center|SHG_intensity_of_2D_h-BN obtained from the current run (12 frequencies) compared with a run with 112 frequencies]]&lt;br /&gt;
&lt;br /&gt;
In the figure above, the results of the current run are compared with those for a run with 112 frequencies (one can obtain these results by repeating the calculations, changing the number of frequencies in &amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt; though this take about 10 times more computational time than the run with 12). &lt;br /&gt;
&lt;br /&gt;
As an exercise, you can repeat the simulations for e,g, a time of &amp;lt;code&amp;gt;35 fs&amp;lt;/code&amp;gt; nand &amp;lt;code&amp;gt;60 fs&amp;lt;/code&amp;gt;, that is setting &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to the desired time. The comparison of the susceptibilities at different simulation times (as in the plot below) shows the importance of running long enough simulations. In too short simulations, the response signal coming from the switch-on of the electric field (delta-kick) is still of comparable intensities as the relevant second-order signal.    &lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP l.png|600px|center|SHG of 2D-hBN with IPA. Effect of different simulation time]]&lt;br /&gt;
&lt;br /&gt;
As a final note, the SHG depends on the size of the vacuum added in the supercell. Instead, one should consider the surface SHG which obtained by considering an effective thickness for the layer. This is usually chosen to be similar to the layer separation in the bulk counterpart.&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation (BSE level) =&lt;br /&gt;
&lt;br /&gt;
== Hartree+Screened exchange collisions ==&lt;br /&gt;
Similarly to the linear part, one needs to generate the Screened exchange collisions. The procedure is exactly the same.&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -X s -e -v hsex -F 03_coll_hsex.in&lt;br /&gt;
modify the input ad follows&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 collisions                       # [R] Collisions&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 1000 mHa    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % COLLBands&lt;br /&gt;
    4 |  5 |                         # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;     # [SC] SC HXC Potential&lt;br /&gt;
 HARRLvcs= 1000 mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000 mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000 mHa    # [GW] Correlation RL components&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calculate the collisions (you may want to run in parallel):&lt;br /&gt;
 yambo_nl -F 03_coll_hsex.in -J 03_coll -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Run the simulation ==&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -nl n -V qp -F 04_SHG_hsex.in&lt;br /&gt;
&lt;br /&gt;
modify the following parts of the input (by this time all the innput variables should be known from the previous exercises):&lt;br /&gt;
&lt;br /&gt;
 % NLBands&lt;br /&gt;
    4 |  5 |                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;           # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;SEX&amp;quot;             # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  0.500000 |8.000000 |         eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 12                   # [NL] Energy steps&lt;br /&gt;
&lt;br /&gt;
You can choose 4 Energy steps instead to shorten the calculations (otherwise it takes about 8 minutes on 4 cores) &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  3.000000 | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 Field1_kind= &amp;quot;SIN&amp;quot;           # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 HARRLvcs= 1000            mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
Then run the simulation using e.g. mpi and 4 cores:&lt;br /&gt;
 mpirun -n 4 yambo_nl -F 04_SHG_hsex.in -J 04_SHG_hsex,03_coll -C 04_SHG_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Postprocessing: obtain the nonlinear response ==&lt;br /&gt;
&lt;br /&gt;
Similarly to what we did for the independent particle case, we create the input:&lt;br /&gt;
 ypp_nl -nl -F 05_SHG_hsex_pp.in&lt;br /&gt;
 &lt;br /&gt;
we change &amp;lt;code&amp;gt;Xorder = 4 &amp;lt;/code&amp;gt; and then run:&lt;br /&gt;
 ypp_nl -F 05_SHG_hsex_pp.in -J 04_SHG_hsex -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
Then we plot (as before we compare with a simulation ran for 112 frequencies).&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;04_hsex_files/o-04_SHG_hsex.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG SEX.png|600px|center|SHG at the Hartree + Screened exchange from the current run with 12 frequencies (crosses) and a run with 112 frequencies (keeping the other parameters the same)]]&lt;br /&gt;
&lt;br /&gt;
We note some differences between the two simulations, this is due to the too short simulation time. Repeating the calculations with a longer time gives more accurate results. &lt;br /&gt;
In addition, note that in the interest of time, all parameters are &#039;&#039;&#039;under converged&#039;&#039;&#039;. In principle, to calculate the collisions one should use the same parameters of a converged BSE calculation. As well, to eliminate spurious interaction with the periodic images, one should use the Coulomb cut-off as it was used for this system in the [[Quasi-particles of a 2D system| tutorial on quasiparticle calculations]]. As a reference, a converged calculation for this system is in &amp;lt;ref name=&amp;quot;Gruning2014&amp;quot;&amp;gt;M. Grüning and C. Attaccalite, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.89.081102 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 081102]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= References = &lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8753</id>
		<title>Dielectric function from Bloch-states dynamics (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Dielectric_function_from_Bloch-states_dynamics_(5.3)&amp;diff=8753"/>
		<updated>2025-05-19T11:17:25Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical background =&lt;br /&gt;
&lt;br /&gt;
The dynamics of Bloch-states is found by integrating a set of Time Dependent Effective Schrödinger Equations (TD-ESEs). Effective means that an effective Hamiltonian is considered. We consider (see also below) the many-body effective Hamiltonians including electron-electron correlation at mean-field (Hartree) and at the screened-exchange level. In addition, one can also consider effective Hamiltonians based on density-functional theory. The latter choice gives time-dependent density-functional theory.&lt;br /&gt;
&lt;br /&gt;
The coupling between electrons and the external field is described by means of the [http://www.theochem.unito.it/didattica/tec-comp_sdm/note1.pdf Modern Theory of Polarization]:&lt;br /&gt;
&lt;br /&gt;
[[File:Tdse new.png|center|400px|Time-Dependent Schrödinger Equation]]&lt;br /&gt;
&lt;br /&gt;
Where  &amp;lt;math&amp;gt; | v_{i \mathbf{k}} \rangle &amp;lt;/math&amp;gt; are the time-dependent Bloch states (corresponding to the filled Bloch-states at zero-field), &amp;lt;math&amp;gt;\mathcal E(t)&amp;lt;/math&amp;gt; is the external field and the term &amp;lt;math&amp;gt; i e \partial k&amp;lt;/math&amp;gt; is the dipole operator consistent with periodic boundary condition. For more details on this last term, see Ref. &amp;lt;ref&amp;gt;I. Souza, J. Íñiguez, and D. Vanderbilt, [https://cfm.ehu.es/ivo/publications/souza_prb04.pdf PRB 69, 085106 (2004)]&amp;lt;/ref&amp;gt; and &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;h_{rt}&amp;lt;/math&amp;gt; is the Hamiltonian,&lt;br /&gt;
[[File:H mb.png|400px|center|Many-Body Hamiltonian]].&lt;br /&gt;
This contains the equilibrium Hamiltonian, that is the zero-field eigenvalues evaluated through DFT; the quasiparticle corrections, evaluated from GW or estimated from experiment, and the variation of the self-energy. The latter is a functional of the density matrix &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;, which is obtained from the Bloch states.   &lt;br /&gt;
&lt;br /&gt;
From the solution of the equation of motion for the Bloch states, the polarization is calculated by means of Berry&#039;s phase&lt;br /&gt;
&lt;br /&gt;
[[File:Berry polarization.png|center|350px|Berry&#039;s polarization]].&lt;br /&gt;
&lt;br /&gt;
One can decide the level of theory by selecting the terms to include in the Hamiltonian:&lt;br /&gt;
&lt;br /&gt;
* by including only the first term, one selects the &#039;&#039;independent-particle approximation&#039;&#039;&lt;br /&gt;
* by including the first and second terms, one selects the &#039;&#039;independent-quasiparticle approximation&#039;&#039;&lt;br /&gt;
* by including the first, second terms and the Hartree part of the self-energy, one selects the &#039;&#039;time-dependent Hartree or random-phase approximation&#039;&#039;&lt;br /&gt;
* by including all terms, one selects the &#039;&#039;time-dependent Screened-exchange or Bethe-Salpeter equation&#039;&#039; level of theory.&lt;br /&gt;
&lt;br /&gt;
The type of &amp;quot;experiment&amp;quot; to perform, or of the response one would like to extract, depend on the time-dependent field in input and the post-processing of the Berry&#039;s phase polarization.  The induced polarization is the sum of the responses of the system to all orders in the external field:&lt;br /&gt;
&amp;lt;math&amp;gt;\bf{P}(t) = \sum_{n=-\infty}^{+\infty} \bf{P}_n (t) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In the case we are interested in linear response only, we use a delta-like electric field that excites all frequencies of the system. We choose the intensity of the field &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; to be weak enough so that the response is dominated by the first order term. The response at all frequencies is obtained by taking the Fourier-transform of the polarization as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \chi(\omega) = \frac{P(\omega)}{E} &amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The response &amp;lt;math&amp;gt; \chi&amp;lt;/math&amp;gt;  is related to the dielectric function through the relation &amp;lt;math&amp;gt;\epsilon(\omega) = 1 + 4 \pi \chi(\omega) &amp;lt;/math&amp;gt;.&lt;br /&gt;
See also Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes: ==&lt;br /&gt;
* Length vs Velocity gauge: &#039;&#039;the equations of motion of Yambo are in the length gauge. Other codes choose instead to work in the velocity gauge. If you want to know more about the advantages and disadvantages of the two gauges read section 2.7 of Ref. &amp;lt;ref&amp;gt;C. Attaccalite, [https://arxiv.org/abs/1609.09639 arXiv 1609.09639 (2017)]&amp;lt;/ref&amp;gt;.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Advantages and disadvantages with respect to the density-matrix based formalism: &#039;&#039;Yambo implements two distinct formalisms for studying the real-time response, the one based on density-matrix and the one based on Boch states. Which formalism is best to use depends on what one wants to simulate. The dynamics formulation in terms of density matrix or non-equilibrium Green&#039;s functions allows a systematic treatment of correlation effects and electron-phonon coupling&amp;lt;ref name=&amp;quot;DavideEPL&amp;quot;&amp;gt;[https://arxiv.org/abs/1409.1706 D. Sangalli, and A. Marini EPL &#039;&#039;&#039;110&#039;&#039;&#039;, 47004 (2015)]&amp;lt;/ref&amp;gt;, but the price to pay is that the coupling with the external field is correct only to the linear order. This formalism is important in all those phenomena where electronic relaxation plays a major role.  On the other hand, the formulation in terms of the Bloch states treats coupling with the external field in an exact way even beyond the linear regime, and for this reason, it allows the description of phenomena coherent with the external fields and to access, for example, non-linear responses.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). Before running real time simulations in yambo you need to: &lt;br /&gt;
* 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;
* perform the steps described in [[Prerequisites for Real Time propagation with Yambo (5.3)]].&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from the lowest level of theory. Here it is assumed you are familiar with the optical spectrum of 2D h-BN at this level of theory.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
You should now be inside the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D-RT/YAMBO/FixSymm&amp;lt;/code&amp;gt;.&lt;br /&gt;
First of all, create a directory for the inputs to be run by &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;:&lt;br /&gt;
 mkdir Inputs_nl&lt;br /&gt;
&lt;br /&gt;
Then, use the command:&lt;br /&gt;
  yambo_nl -nl n -F Inputs_nl/01_td_ip.in&lt;br /&gt;
&lt;br /&gt;
to generate the input (OMP, angular and extra fields keywords are omitted for brevity):&lt;br /&gt;
 &lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&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;  |                           # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;55.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&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000             # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 |-1.000000 |      eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.000000 &amp;lt;/span&amp;gt;       eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= 18475            RL    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 18475            RL    # [XX] Exchange    RL components&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;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;
  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.010000    fs    # [RT Field1] Initial Time&lt;br /&gt;
        &lt;br /&gt;
Note that the standard input of &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; has default settings for nonlinear response (e.g. the &amp;lt;code&amp;gt;SOFTSIN&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt; that set the time-dependence &#039;kind&#039; of the field).&lt;br /&gt;
Set the field direction &amp;lt;code&amp;gt;Field1_Dir&amp;lt;/code&amp;gt; along y, the field kind to &amp;lt;code&amp;gt;DELTA&amp;lt;/code&amp;gt;, the length of the simulation &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to 55 fs, select the bands from 3 to 6 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;) and set the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt; to zero. The fields you need to change with respect to the default settings are shown above in red. &lt;br /&gt;
&lt;br /&gt;
Now run&lt;br /&gt;
  yambo_nl -F Inputs_nl/01_td_ip.in -J TD-IP_nl -C TD-IP_nl &amp;amp;&lt;br /&gt;
and then monitor the progress with&lt;br /&gt;
  tail -f TD-IP_nl/o-TD-IP_nl.polarization_F1&lt;br /&gt;
  ctrl+C&lt;br /&gt;
&lt;br /&gt;
The code produces different files (in the &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt; directory, all with the suffix &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; that contains the polarization, &amp;lt;code&amp;gt;o-TD-IP_nl.external_potential_F1&amp;lt;/code&amp;gt; the external field we used, and finally &amp;lt;code&amp;gt;r-TD-IP_nl_nloptics&amp;lt;/code&amp;gt; a report with all information about the simulation.&lt;br /&gt;
&lt;br /&gt;
Plot the third column of &amp;lt;code&amp;gt;o-TD-IP_nl.polarization_F1&amp;lt;/code&amp;gt; versus the first one (time-variable) to get the time-dependent polarization along the y-direction:&lt;br /&gt;
 gnuplot&amp;gt; p &#039;TD-IP_nl/o-TD-IP_nl.polarization_F1&#039; u 1:3 w l&lt;br /&gt;
&lt;br /&gt;
[[File:01 TDpolarization delta NL.png|center|600px|TD polarization from a delta-kick in the IPA in 2D-hBN]]&lt;br /&gt;
&lt;br /&gt;
From the plot, it is apparent that the polarization oscillates at multiple frequencies. &lt;br /&gt;
== Output postprocessing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F Inputs_nl/02_ypp_abs.in&lt;br /&gt;
&lt;br /&gt;
to generate the input file:&lt;br /&gt;
&lt;br /&gt;
 nonlinear                    # [R] NonLinear Optics Post-Processing&lt;br /&gt;
 Xorder= 1                    # Max order of the response functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
 -1.000000 |-1.000000 | fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1001&amp;lt;/span&amp;gt;                # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;10.00000&amp;lt;/span&amp;gt; | eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;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;
&lt;br /&gt;
          &lt;br /&gt;
where we set a Lorentzian smearing corresponding to 0.1 eV. Note that due to the finite time of our simulation, we need to introduce a finite smearing to Fourier transform the result.&lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/02_ypp_abs.in -J TD-IP_nl -C TD-IP_nl &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_nl.YPP-eps_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-eels_along_E&lt;br /&gt;
 o-TD-IP_nl.YPP-damped_polarization&lt;br /&gt;
inside the folder &amp;lt;code&amp;gt;TD-IP_nl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plot the dielectric constant and compare it with the linear response and the density-matrix formalism (available from the [[Real time approach to linear response]] tutorial):&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&lt;br /&gt;
 rep &amp;quot;TD-IP_nl/o-TD-IP_nl.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]]&lt;br /&gt;
&lt;br /&gt;
The differences observed with the spectra obtained from the linear-response formalisms are due to how the dipoles are evaluated. Within the linear-response formalism, dipoles are computed as &amp;lt;math&amp;gt;\frac{1}{E_{c \mathbf{k}}-E_{v \mathbf{k}}} \left\langle v \mathbf{k}\left|\mathbf{p}_{\alpha}+\mathrm i\left[V^{\mathrm{NL}}, \mathbf{r}_{\alpha}\right]\right| c \mathbf{k}\right\rangle\&amp;lt;/math&amp;gt; (which is valid in the linear response regime). The Bloch-states formalism uses instead covariant dipoles evaluated numerically on the k-mesh (valid at all orders). The differences are due to numerical errors in evaluating the covariant dipoles. These differences disappear with a denser k-mesh. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;It is a good practice to converge the dielectric function obtained from the Bloch-state dynamics with respect to the k-points using the linear-response spectrum as a reference. This gives the minimum number of k-points to be used to obtain accurate results.         &lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation =&lt;br /&gt;
&lt;br /&gt;
== Evaluating the collisions==&lt;br /&gt;
&lt;br /&gt;
[[File:Self-Energy Rho Linear Expansion.png|center|200px|Expression for the many body self-energy doing a linear expansion in terms of the density matrix]].&lt;br /&gt;
K is the functional derivative of the self--energy with respect to the density matrix and corresponds to the kernel of the Bethe--Salpeter equation. In the language of the yambo code we will refer to it with the name &amp;quot;real time collisions&amp;quot; or simply &amp;quot;collisions&amp;quot;. Choosing the HSEX approximation and using the GW energies for the quasi--particle corrections, the time propagation corresponds to a real-time version of the Bethe-Salpeter Equation&amp;lt;ref&amp;gt;[http://bcsbec.df.unicam.it/files/LaRNC11_N12%281988%29.pdf  G. Strinati, La Rivista del Nuovo Cimento &#039;&#039;&#039;11&#039;&#039;&#039; (12), 1-86 (1988)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
More details can be found in Ref. &amp;lt;ref name=&amp;quot;Attaccalite2011&amp;quot;&amp;gt;[https://arxiv.org/abs/1109.2424 C. Attaccalite, M. Grüning, and A. Marini PRB &#039;&#039;&#039;84&#039;&#039;&#039;, 245110 (2011)]&amp;lt;/ref&amp;gt;&lt;br /&gt;
(This part is common in between the &amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;yambo_rt&amp;lt;/code&amp;gt;).  &lt;br /&gt;
&lt;br /&gt;
Generate the input file to calculate the collisions use the command :&lt;br /&gt;
  yambo_nl -X s -e -v hsex -F Inputs_nl/03_coll_hsex.in&lt;br /&gt;
&lt;br /&gt;
The flag -X will tell the code to calculate the dielectric constant that is required for the screened interaction.&lt;br /&gt;
It could be even computed in an independent calculation and then loaded using the &amp;lt;code&amp;gt;-J&amp;lt;/code&amp;gt; flags&lt;br /&gt;
&lt;br /&gt;
 em1s                           # [R Xs] Static Inverse Dielectric Matrix&lt;br /&gt;
 dipoles                        # [R   ] Compute the dipoles&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;              # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                   # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000&amp;lt;/span&amp;gt; mHa      # [Xs] Response block size&lt;br /&gt;
 % DmRngeXs&lt;br /&gt;
   0.10000 |  0.10000 | eV      # [Xs] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 0.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
While this is the part of the input file specific for the evaluation of the collisions&lt;br /&gt;
 collisions                     # [R] Eval the extended Collisions&lt;br /&gt;
 % [[Variables#COLLBands|COLLBands]]&lt;br /&gt;
   &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;4 &amp;lt;/span&amp;gt;| &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 5  &amp;lt;/span&amp;gt;|                  # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;           # [SC] SC HXC Potential&lt;br /&gt;
 [[Variables#HARRLvcs|HARRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [HA] Hartree     RL components&lt;br /&gt;
 [[Variables#EXXRLvcs|EXXRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [XX] Exchange    RL components&lt;br /&gt;
 [[Variables#CORRLvcs|CORRLvcs]]= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000 &amp;lt;/span&amp;gt;mHa      # [GW] Correlation RL components&lt;br /&gt;
 &lt;br /&gt;
With this input, we calculate the HARTREE plus SEX collisions integrals. Notice that the HARTREE term in principle can be calculated on the fly, but in this way it is more efficient especially for the non-linear response. &lt;br /&gt;
Here one has to converge the cutoff for the Hartree and the Screened Exchange. Around &amp;lt;code&amp;gt;5000 mHa&amp;lt;/code&amp;gt; is a reasonable value for hBN. In this example we will use &amp;lt;code&amp;gt;1000 mHa&amp;lt;/code&amp;gt; to speed up calculations. The collisions bands &amp;lt;code&amp;gt;COLLBands&amp;lt;/code&amp;gt; have to be the same number of bands you want to use in the linear/nonlinear response.&lt;br /&gt;
Then you run&lt;br /&gt;
  yambo_nl -F Inputs_nl/03_coll_hsex.in -J COLL_HSEX -C COLL_HSEX &lt;br /&gt;
&lt;br /&gt;
The calculation may take sone time (about 1 minute in serial).&lt;br /&gt;
It produced many binary files &amp;lt;code&amp;gt;ndb.COLLISIONS_HXC_fragment_*&amp;lt;/code&amp;gt; which will be needed to perform TD-HSEX simulations.&lt;br /&gt;
&lt;br /&gt;
== Run the simulations ==&lt;br /&gt;
To generate the input for the real-time simulation you can run&lt;br /&gt;
 &lt;br /&gt;
 yambo_nl -nl n -V qp -F Inputs_nl/04_td-sex.in&lt;br /&gt;
&lt;br /&gt;
The input file is&lt;br /&gt;
&lt;br /&gt;
 nloptics                       # [R NL] Non-linear optics&lt;br /&gt;
 % NLBands&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt; 4 |  5 | &amp;lt;/span&amp;gt;                    # [NL] Bands&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;             # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;20.00000&amp;lt;/span&amp;gt;       fs      # [NL] Simulation Time&lt;br /&gt;
 NLintegrator= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;CRANKNIC&amp;lt;/span&amp;gt;&amp;quot;         # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;SEX&amp;lt;/span&amp;gt;&amp;quot;           # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
 NLLrcAlpha= 0.000000           # [NL] Long Range Correction&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  -1.000000 | -1.000000 | eV      # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 1                   # [NL] Energy steps&lt;br /&gt;
 NLDamping=  &amp;quot;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;0.10000&amp;lt;/span&amp;gt;    eV      # [NL] Damping&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 HARRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1000         mHa&amp;lt;/span&amp;gt;     # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
The next section of the input is about external quasiparticle corrections (&amp;lt;code&amp;gt;EXTQP G&amp;lt;/code&amp;gt;). There change only &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3.000000 &amp;lt;/span&amp;gt;| 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
The latter line introduces a scissor operator (a rigid shift of the conduction bands) of 3.0 eV. In principle, it is possible to perform a G&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;W&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; calculation with Yambo and use the Quasi-particle band structure instead of the rigid shift.&lt;br /&gt;
&lt;br /&gt;
The last section regards the applied field (&amp;lt;code&amp;gt;RT Field1&amp;lt;/code&amp;gt;). There change these two lines:   &lt;br /&gt;
&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_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|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
 &lt;br /&gt;
Run the calculation:&lt;br /&gt;
&lt;br /&gt;
 yambo_nl -F Inputs_nl/04_td-sex.in -J &amp;quot;TD-SEX_nl,COLL_HSEX&amp;quot; -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
== Output postprocessing: dielectric function ==&lt;br /&gt;
&lt;br /&gt;
The post-processing of the output does not depend on the level of approximation. The same steps are taken as in the independent-particle approximation.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
 ypp_nl -F Inputs_nl/ypp_abs.in -J TD-SEX_nl -C TD-SEX_nl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
 gnuplot&amp;gt; set xrange [3:10]&lt;br /&gt;
 gnuplot&amp;gt; set yrange [0:12]&lt;br /&gt;
 gnuplot&amp;gt; plot &amp;quot;TD-SEX_nl/o-TD-SEX_nl.YPP-eps_along_E&amp;quot; u 1:2 w l&lt;br /&gt;
 &lt;br /&gt;
[[File:HBN HSEX absorption.png|thumb|900px|center|In plane absorption of hBN at the TD-HSEX level compared with IP absorption]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For comparison, the linear response results at the BSE level can be obtained following the [[How to obtain an optical spectrum|BSE tutorial]]. &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Links for 2025 school ===&lt;br /&gt;
* Back to [[Modena 2025#Tutorials]]&lt;br /&gt;
* Next step [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8752</id>
		<title>Second-harmonic generation of 2D-hBN (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8752"/>
		<updated>2025-05-19T11:10:18Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical framework =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we compute the Second-harmonic generation (SHG) from the dynamics of the Bloch-states. The equation-of-motion of the Bloch-states is explained in the tutorial on [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]. Independently of the &#039;experiment&#039; we simulate, the part of the integration of motion stays the same. This means that any experiment, including non-linear optics, can be performed at the level of the theory listed for the computation of the dielectric function:&lt;br /&gt;
* independent (quasi)particle&lt;br /&gt;
* time-dependent Hartree (RPA level)&lt;br /&gt;
* time-dependent DFT (and DPFT)&lt;br /&gt;
* time-dependent Hartree+Screened exchange (BSE level)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
What changes when we want to calculate the SHG (or higher harmonics) is:&lt;br /&gt;
* the time-dependence of the input electric field and&lt;br /&gt;
* the post-processing of the signal  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Time dependence of the electric Field&#039;&#039;&#039;: we choose a sinusoidal electric field, thus a monochromatic laser field. This allows one to expand the polarization in the form &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; through a coefficient depending on a power of the strength of the field (with the power depending on the order of the response).&lt;br /&gt;
&lt;br /&gt;
At difference with a delta-like perturbation, a real-time simulation gives the response at the laser-field only. Then, to obtain the spectrum for the desired range of frequency, we have to perform so many simulations as the frequencies in the desired range.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Post-processing of the signal&#039;&#039;&#039;: The switch-on of the electric field corresponds to a weak delta-like kick. Thus, even if it may not be noticeable from the polarization plot, the polarization results from both the sinusoidal field and the delta-like kick. The latter excites all eigenfrequencies of the system. Though weak, the resulting signal is comparable with the second-harmonic signal. To eliminate the signal from the eigenfrequencies, we apply a dephasing (&amp;lt;math&amp;gt;\gamma_{deph}&amp;lt;/math&amp;gt;). To have a signal useful to sample the second-harmonic signal, we need to wait a time &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;  much larger than the dephasing-time &amp;lt;math&amp;gt;1/\gamma_{deph} &amp;lt;/math&amp;gt;. Note that we cannot choose a too short dephasing time (to shorten the simulation time), as this would result in a too large broadening of the spectrum. After &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;, we sample 2N+1 times in a period and use discrete Fourier transform to extract &amp;lt;math&amp;gt;{p}_n&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; n = 0,...,N&amp;lt;/math&amp;gt;, where n=2 gives the SHG. This is schematically illustrated in figure:&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;
The scheme from Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Phys. Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt; summarised the workflow for computing the SHG (or higher-harmonics) in a energy range &amp;lt;math&amp;gt;[\Omega_1,\Omega_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Scheme nl.png|350px|center|Schematic representation of real-time calculations]]&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
You should be in the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D/YAMBO/&amp;lt;/code&amp;gt;.&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). &lt;br /&gt;
Execute the commands (if running on 4 cores interactively you may need to add -nompi to the command line)&lt;br /&gt;
 yambo_nl&lt;br /&gt;
 ypp_nl -fixsym -F 00_removesym.in  &lt;br /&gt;
to create the input, to remove the symmetries which are not compatible with the field: &lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000 | 1.000000 | 0.000000 |&amp;lt;/span&amp;gt;        # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
 #KeepKGrid                     # Do not expand the k-grid&lt;br /&gt;
where we chose the field along the xy direction and we remove time-reversal symmetry.&lt;br /&gt;
&lt;br /&gt;
Then run the pre-processing job:&lt;br /&gt;
 ypp_nl -F 00_removesym.in&lt;br /&gt;
This creates the directory &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. Change directory to &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. This contains the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory with reduced symmetries, compatible with the direction of the field. Now run the setup again (&amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
  cd FixSymm&lt;br /&gt;
  yambo_nl&lt;br /&gt;
  yambo_nl -nl n -F 01_SHG_ip.in&lt;br /&gt;
to generate the input:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           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&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;0.5000000 |8.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;12&amp;lt;/span&amp;gt;                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
 0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;quot;SIN&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 | 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;
To describe the Bloch-dynamics we will use as a basis the KS-states 3-6 for the k-grid used in the non-scf DFT calculations, that is a 6x6x1 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;). We choose 12 equally spaced frequencies (&amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt;) for the applied field in the range  (&amp;lt;code&amp;gt;NLEnRange&amp;lt;/code&amp;gt;) between 0.5 and 8 eV. We choose a sinusoidal time-dependence (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) and set the field direction (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) along xy (in plane). The negative simulation time (&amp;lt;code&amp;gt;NLtime=-1.000000&amp;lt;/code&amp;gt;) means that the code will choose it based on the value of the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt;. While this is a good lower bound for the simulation time, one should check it is sufficient to get accurate results. &lt;br /&gt;
&lt;br /&gt;
Run the simulation, possibly in parallel e. g. in a interactive session on 4 cores. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[In order to get 4 cores while in an interacting node, exit your current interactive run and rerun &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; asking for the proper number of tasks:&#039;&#039;&#039;&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 4 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
&#039;&#039;&#039;Otherwise, you can submit the job with a slurm script as explained in the introductory page]&#039;&#039;&#039;&lt;br /&gt;
Note that when executing commands that don&#039;t need mpi (such as generating an input file) you may need to add -nompi to the command line &lt;br /&gt;
&lt;br /&gt;
Now execute the command:&lt;br /&gt;
  mpirun -n 4 yambo_nl -F 01_SHG_ip.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
This run will take several minutes. While it is running, you can check the progress of one specific frequency:&lt;br /&gt;
 tail -f 01_SHG_ip_files/o-01_SHG_ip.polarization_F2&lt;br /&gt;
If you want to know how many fs the simulation will last (since this was decided by the code), you can get this information in the report file:&lt;br /&gt;
 $ grep &#039;Total simulation&#039; 01_SHG_ip_files/r-01_SHG_ip_nloptics&lt;br /&gt;
 Total simulation time       :  47.81405 [fs]&lt;br /&gt;
&lt;br /&gt;
If you instead want to track the progress of the full simulation, you should check the log file(s). If you are doing a parallel run, you can type&lt;br /&gt;
 tail -f 01_SHG_ip_files/LOG/l-01_SHG_ip_nloptics_CPU_1&lt;br /&gt;
&lt;br /&gt;
Once the run is finished, check the report &amp;lt;code&amp;gt;01_SHG_ip_files/r-01_SHG_ip_nloptics&amp;lt;/code&amp;gt;. In particular, in the appended input files, you can see the default parallelization applied by the code for calculating the dipoles and run the time-propagation. For the latter, the main parallelization is on the frequencies and then on the k-points (&amp;lt;code&amp;gt;NL_ROLEs= &amp;quot;w.k&amp;quot;&amp;lt;/code&amp;gt;).   &lt;br /&gt;
&lt;br /&gt;
 | NL_CPU= &amp;quot;2.2&amp;quot;                    # [PARALLEL] CPUs for each role&lt;br /&gt;
 | NL_ROLEs= &amp;quot;w.k&amp;quot;                  # [PARALLEL] CPUs roles (w,k)&lt;br /&gt;
 | DIP_CPU= &amp;quot;2.2.1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 | DIP_ROLEs= &amp;quot;v.c.k&amp;quot;               # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
&lt;br /&gt;
Also, look at the simulation time. This is approximately 45-50 fs. &lt;br /&gt;
&lt;br /&gt;
Plot the polarization for a couple of frequencies, e.g. the first and last of the chosen range (the corresponding frequency can be read in the file, search for &amp;quot;Frequency value&amp;quot;):&lt;br /&gt;
 set ylabel &amp;quot;x-component polarization&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;time (fs)&amp;quot;&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F1&#039; u 1:2 w l lw 2 title &amp;quot;omega = 0.5 eV&amp;quot;&lt;br /&gt;
 replot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F12&#039; u 1:2 w l lw 2  title &amp;quot;omega = 7.375 eV&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:Berry_phase_polarization_of_2D_h-BN_obtained_from_the_previous_run_for_two_laser_frequencies.png|600px|center|Berry_phase_polarization_of_2D_h-BN_obtained from the run for two laser frequencies]]&lt;br /&gt;
&lt;br /&gt;
After the applied field is &#039;switched on&#039;, the polarization is oscillating at the frequency of the applied field and at the eigenfrequencies of the system as described above in the cartoon. This is visible particularly for the higher frequency. Due to the dephasing, after about 20 fs the polarization is oscillating (at least to the eye) at the frequency of the applied field. Nonlinear components are not visible since they are several orders of magnitude smaller than the first order.&lt;br /&gt;
&lt;br /&gt;
== Output post-processing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier-transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F 02_SHG_ip_pp.in -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
to generate the input file: &lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Xorder= 4&amp;lt;/span&amp;gt; # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= 0.000000       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Where we changed the &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; to 4. This variable controls the terms in the Fourier expansion of the polarization. We choose up to expand up to the fourth order. This should ensure the second order to be accurate enough. As an exercise, you can change this value (e.g. choose 2,3,5,6) and see how the result below is changing. The time-window where processing is done is chosen automatically, since values are negative. The code chooses by default the last period to carry out the analysis. &lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F 02_SHG_ip_pp.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
   &lt;br /&gt;
In  &amp;lt;code&amp;gt;01_SHG_ip_files&amp;lt;/code&amp;gt; the following files were generated &lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_1&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_2&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_3&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_4&lt;br /&gt;
 r-01_SHG_ip_nonlinear&lt;br /&gt;
&lt;br /&gt;
The output files contain respectively the first, second, third and fourth order response(corresponding to &amp;lt;code&amp;gt;Xorder=4&amp;lt;/code&amp;gt;)  at the 12 frequencies in the chosen range. &lt;br /&gt;
 &lt;br /&gt;
Inspect &amp;lt;code&amp;gt;o-01_SHG_ip.YPP-X_probe_order_2&amp;lt;/code&amp;gt;&lt;br /&gt;
#     E [eV]            X/Im[cm/stV](x)    X/Re[cm/stV](x)    X/Im[cm/stV](y)    X/Re[cm/stV](y)    X/Im[cm/stV](z)    X/Re[cm/stV](z)&lt;br /&gt;
#&lt;br /&gt;
     0.50000000        -0.63057187E-09    -0.19596550E-07    -0.36238688E-10    -0.72052719E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.1250000        -0.19604352E-08    -0.23352876E-07    -0.18347724E-09    -0.86959709E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.7500000        -0.64748829E-08    -0.36274951E-07    -0.27614124E-09    -0.17103902E-08      0.0000000          0.0000000    &lt;br /&gt;
      2.37500000       -0.241985981E-7    -0.864285561E-8    -0.160616725E-8    -0.190064969E-8      0.00000000         0.00000000   &lt;br /&gt;
 &lt;br /&gt;
The first column are the frequencies of the applied field, the second and third is the polarization along x (imaginary and real part), the fourth and fifth is the polarization along y (imaginary and real part)  &lt;br /&gt;
and the sixth and seventh is the polarization along z (imaginary and real part).&lt;br /&gt;
&lt;br /&gt;
Plot the absolute value of the SHG for the &amp;quot;xxy&amp;quot; component (that is, the applied field is in the x and y directions and one look at the polarization along x):&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP.png|600px|center|SHG_intensity_of_2D_h-BN obtained from the current run (12 frequencies) compared with a run with 112 frequencies]]&lt;br /&gt;
&lt;br /&gt;
In the figure above, the results of the current run are compared with those for a run with 112 frequencies (one can obtain these results by repeating the calculations, changing the number of frequencies in &amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt; though this take about 10 times more computational time than the run with 12). &lt;br /&gt;
&lt;br /&gt;
As an exercise, you can repeat the simulations for e,g, a time of &amp;lt;code&amp;gt;35 fs&amp;lt;/code&amp;gt; nand &amp;lt;code&amp;gt;60 fs&amp;lt;/code&amp;gt;, that is setting &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt; to the desired time. The comparison of the susceptibilities at different simulation times (as in the plot below) shows the importance of running long enough simulations. In too short simulations, the response signal coming from the switch-on of the electric field (delta-kick) is still of comparable intensities as the relevant second-order signal.    &lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP l.png|600px|center|SHG of 2D-hBN with IPA. Effect of different simulation time]]&lt;br /&gt;
&lt;br /&gt;
As a final note, the SHG depends on the size of the vacuum added in the supercell. Instead, one should consider the surface SHG which obtained by considering an effective thickness for the layer. This is usually chosen to be similar to the layer separation in the bulk counterpart.&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation (BSE level) =&lt;br /&gt;
&lt;br /&gt;
== Hartree+Screened exchange collisions ==&lt;br /&gt;
Similarly to the linear part, one needs to generate the Screened exchange collisions. The procedure is exactly the same.&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -X s -e -v hsex -F 03_coll_hsex.in&lt;br /&gt;
modify the input ad follows&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 collisions                       # [R] Collisions&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 1000 mHa    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % COLLBands&lt;br /&gt;
    4 |  5 |                         # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;     # [SC] SC HXC Potential&lt;br /&gt;
 HARRLvcs= 1000 mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000 mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000 mHa    # [GW] Correlation RL components&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calculate the collisions (you may want to run in parallel):&lt;br /&gt;
 yambo_nl -F 03_coll_hsex.in -J 03_coll -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Run the simulation ==&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -nl n -V qp -F 04_SHG_hsex.in&lt;br /&gt;
&lt;br /&gt;
modify the following parts of the input (by this time all the innput variables should be known from the previous exercises):&lt;br /&gt;
&lt;br /&gt;
 % NLBands&lt;br /&gt;
    4 |  5 |                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;           # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;SEX&amp;quot;             # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  0.500000 |8.000000 |         eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 12                   # [NL] Energy steps&lt;br /&gt;
&lt;br /&gt;
You can choose 4 Energy steps instead to shorten the calculations (otherwise it takes about 8 minutes on 4 cores) &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  3.000000 | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 Field1_kind= &amp;quot;SIN&amp;quot;           # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 HARRLvcs= 1000            mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
Then run the simulation using e.g. mpi and 4 cores:&lt;br /&gt;
 mpirun -n 4 yambo_nl -F 04_SHG_hsex.in -J 04_SHG_hsex,03_coll -C 04_SHG_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Postprocessing: obtain the nonlinear response ==&lt;br /&gt;
&lt;br /&gt;
Similarly to what we did for the independent particle case, we create the input:&lt;br /&gt;
 ypp_nl -nl -F 05_SHG_hsex_pp.in&lt;br /&gt;
 &lt;br /&gt;
we change &amp;lt;code&amp;gt;Xorder = 4 &amp;lt;/code&amp;gt; and then run:&lt;br /&gt;
 ypp_nl -F 05_SHG_hsex_pp.in -J 04_SHG_hsex -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
Then we plot (as before we compare with a simulation ran for 112 frequencies).&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;04_hsex_files/o-04_SHG_hsex.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG SEX.png|600px|center|SHG at the Hartree + Screened exchange from the current run with 12 frequencies (crosses) and a run with 112 frequencies (keeping the other parameters the same)]]&lt;br /&gt;
&lt;br /&gt;
We note some differences between the two simulations, this is due to the too short simulation time. Repeating the calculations with a longer time gives more accurate results. &lt;br /&gt;
In addition, note that in the interest of time, all parameters are &#039;&#039;&#039;under converged&#039;&#039;&#039;. In principle, to calculate the collisions one should use the same parameters of a converged BSE calculation. As well, to eliminate spurious interaction with the periodic images, one should use the Coulomb cut-off as it was used for this system in the [[Quasi-particles of a 2D system| tutorial on quasiparticle calculations]]. As a reference, a converged calculation for this system is in &amp;lt;ref name=&amp;quot;Gruning2014&amp;quot;&amp;gt;M. Grüning and C. Attaccalite, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.89.081102 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 081102]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= References = &lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8751</id>
		<title>Second-harmonic generation of 2D-hBN (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8751"/>
		<updated>2025-05-19T11:07:25Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical framework =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we compute the Second-harmonic generation (SHG) from the dynamics of the Bloch-states. The equation-of-motion of the Bloch-states is explained in the tutorial on [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]. Independently of the &#039;experiment&#039; we simulate, the part of the integration of motion stays the same. This means that any experiment, including non-linear optics, can be performed at the level of the theory listed for the computation of the dielectric function:&lt;br /&gt;
* independent (quasi)particle&lt;br /&gt;
* time-dependent Hartree (RPA level)&lt;br /&gt;
* time-dependent DFT (and DPFT)&lt;br /&gt;
* time-dependent Hartree+Screened exchange (BSE level)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
What changes when we want to calculate the SHG (or higher harmonics) is:&lt;br /&gt;
* the time-dependence of the input electric field and&lt;br /&gt;
* the post-processing of the signal  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Time dependence of the electric Field&#039;&#039;&#039;: we choose a sinusoidal electric field, thus a monochromatic laser field. This allows one to expand the polarization in the form &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; through a coefficient depending on a power of the strength of the field (with the power depending on the order of the response).&lt;br /&gt;
&lt;br /&gt;
At difference with a delta-like perturbation, a real-time simulation gives the response at the laser-field only. Then, to obtain the spectrum for the desired range of frequency, we have to perform so many simulations as the frequencies in the desired range.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Post-processing of the signal&#039;&#039;&#039;: The switch-on of the electric field corresponds to a weak delta-like kick. Thus, even if it may not be noticeable from the polarization plot, the polarization results from both the sinusoidal field and the delta-like kick. The latter excites all eigenfrequencies of the system. Though weak, the resulting signal is comparable with the second-harmonic signal. To eliminate the signal from the eigenfrequencies, we apply a dephasing (&amp;lt;math&amp;gt;\gamma_{deph}&amp;lt;/math&amp;gt;). To have a signal useful to sample the second-harmonic signal, we need to wait a time &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;  much larger than the dephasing-time &amp;lt;math&amp;gt;1/\gamma_{deph} &amp;lt;/math&amp;gt;. Note that we cannot choose a too short dephasing time (to shorten the simulation time), as this would result in a too large broadening of the spectrum. After &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;, we sample 2N+1 times in a period and use discrete Fourier transform to extract &amp;lt;math&amp;gt;{p}_n&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; n = 0,...,N&amp;lt;/math&amp;gt;, where n=2 gives the SHG. This is schematically illustrated in figure:&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;
The scheme from Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Phys. Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt; summarised the workflow for computing the SHG (or higher-harmonics) in a energy range &amp;lt;math&amp;gt;[\Omega_1,\Omega_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Scheme nl.png|350px|center|Schematic representation of real-time calculations]]&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
You should be in the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D/YAMBO/&amp;lt;/code&amp;gt;.&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). &lt;br /&gt;
Execute the commands (if running on 4 cores interactively you may need to add -nompi to the command line)&lt;br /&gt;
 yambo_nl&lt;br /&gt;
 ypp_nl -fixsym -F 00_removesym.in  &lt;br /&gt;
to create the input, to remove the symmetries which are not compatible with the field: &lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000 | 1.000000 | 0.000000 |&amp;lt;/span&amp;gt;        # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
 #KeepKGrid                     # Do not expand the k-grid&lt;br /&gt;
where we chose the field along the xy direction and we remove time-reversal symmetry.&lt;br /&gt;
&lt;br /&gt;
Then run the pre-processing job:&lt;br /&gt;
 ypp_nl -F 00_removesym.in&lt;br /&gt;
This creates the directory &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. Change directory to &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. This contains the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory with reduced symmetries, compatible with the direction of the field. Now run the setup again (&amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
  cd FixSymm&lt;br /&gt;
  yambo_nl&lt;br /&gt;
  yambo_nl -nl n -F 01_SHG_ip.in&lt;br /&gt;
to generate the input:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           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&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;0.5000000 |8.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;12&amp;lt;/span&amp;gt;                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
 0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;quot;SIN&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 | 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;
To describe the Bloch-dynamics we will use as a basis the KS-states 3-6 for the k-grid used in the non-scf DFT calculations, that is a 6x6x1 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;). We choose 12 equally spaced frequencies (&amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt;) for the applied field in the range  (&amp;lt;code&amp;gt;NLEnRange&amp;lt;/code&amp;gt;) between 0.5 and 8 eV. We choose a sinusoidal time-dependence (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) and set the field direction (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) along xy (in plane). The negative simulation time (&amp;lt;code&amp;gt;NLtime=-1.000000&amp;lt;/code&amp;gt;) means that the code will choose it based on the value of the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt;. While this is a good lower bound for the simulation time, one should check it is sufficient to get accurate results. &lt;br /&gt;
&lt;br /&gt;
Run the simulation, possibly in parallel e. g. in a interactive session on 4 cores. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[In order to get 4 cores while in an interacting node, exit your current interactive run and rerun &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; asking for the proper number of tasks:&#039;&#039;&#039;&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 4 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
&#039;&#039;&#039;Otherwise, you can submit the job with a slurm script as explained in the introductory page]&#039;&#039;&#039;&lt;br /&gt;
Note that when executing commands that don&#039;t need mpi (such as generating an input file) you may need to add -nompi to the command line &lt;br /&gt;
&lt;br /&gt;
Now execute the command:&lt;br /&gt;
  mpirun -n 4 yambo_nl -F 01_SHG_ip.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
This run will take several minutes. While it is running, you can check the progress of one specific frequency:&lt;br /&gt;
 tail -f 01_SHG_ip_files/o-01_SHG_ip.polarization_F2&lt;br /&gt;
If you want to know how many fs the simulation will last (since this was decided by the code), you can get this information in the report file:&lt;br /&gt;
 $ grep &#039;Total simulation&#039; 01_SHG_ip_files/r-01_SHG_ip_nloptics&lt;br /&gt;
 Total simulation time       :  47.81405 [fs]&lt;br /&gt;
&lt;br /&gt;
If you instead want to track the progress of the full simulation, you should check the log file(s). If you are doing a parallel run, you can type&lt;br /&gt;
 tail -f 01_SHG_ip_files/LOG/l-01_SHG_ip_nloptics_CPU_1&lt;br /&gt;
&lt;br /&gt;
Once the run is finished, check the report &amp;lt;code&amp;gt;01_SHG_ip_files/r-01_SHG_ip_nloptics&amp;lt;/code&amp;gt;. In particular, in the appended input files, you can see the default parallelization applied by the code for calculating the dipoles and run the time-propagation. For the latter, the main parallelization is on the frequencies and then on the k-points (&amp;lt;code&amp;gt;NL_ROLEs= &amp;quot;w.k&amp;quot;&amp;lt;/code&amp;gt;).   &lt;br /&gt;
&lt;br /&gt;
 | NL_CPU= &amp;quot;2.2&amp;quot;                    # [PARALLEL] CPUs for each role&lt;br /&gt;
 | NL_ROLEs= &amp;quot;w.k&amp;quot;                  # [PARALLEL] CPUs roles (w,k)&lt;br /&gt;
 | DIP_CPU= &amp;quot;2.2.1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 | DIP_ROLEs= &amp;quot;v.c.k&amp;quot;               # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
&lt;br /&gt;
Also, look at the simulation time. This is approximately 45-50 fs. &lt;br /&gt;
&lt;br /&gt;
Plot the polarization for a couple of frequencies, e.g. the first and last of the chosen range (the corresponding frequency can be read in the file, search for &amp;quot;Frequency value&amp;quot;):&lt;br /&gt;
 set ylabel &amp;quot;x-component polarization&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;time (fs)&amp;quot;&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F1&#039; u 1:2 w l lw 2 title &amp;quot;omega = 0.5 eV&amp;quot;&lt;br /&gt;
 replot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F12&#039; u 1:2 w l lw 2  title &amp;quot;omega = 7.375 eV&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:Berry_phase_polarization_of_2D_h-BN_obtained_from_the_previous_run_for_two_laser_frequencies.png|Berry_phase_polarization_of_2D_h-BN_obtained from the run for two laser frequencies]]&lt;br /&gt;
&lt;br /&gt;
After the applied field is &#039;switched on&#039;, the polarization is oscillating at the frequency of the applied field and at the eigenfrequencies of the system as described above in the cartoon. This is visible particularly for the higher frequency. Due to the dephasing, after about 20 fs the polarization is oscillating (at least to the eye) at the frequency of the applied field. Nonlinear components are not visible since they are several orders of magnitude smaller than the first order.&lt;br /&gt;
&lt;br /&gt;
== Output post-processing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier-transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F 02_SHG_ip_pp.in -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
to generate the input file: &lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Xorder= 4&amp;lt;/span&amp;gt; # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= 0.000000       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Where we changed the &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; to 4. This variable controls the terms in the Fourier expansion of the polarization. We choose up to expand up to the fourth order. This should ensure the second order to be accurate enough. As an exercise, you can change this value (e.g. choose 2,3,5,6) and see how the result below is changing. The time-window where processing is done is chosen automatically, since values are negative. The code chooses by default the last period to carry out the analysis. &lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F 02_SHG_ip_pp.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
   &lt;br /&gt;
In  &amp;lt;code&amp;gt;01_SHG_ip_files&amp;lt;/code&amp;gt; the following files were generated &lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_1&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_2&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_3&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_4&lt;br /&gt;
 r-01_SHG_ip_nonlinear&lt;br /&gt;
&lt;br /&gt;
The output files contain respectively the first, second, third and fourth order response(corresponding to &amp;lt;code&amp;gt;Xorder=4&amp;lt;/code&amp;gt;)  at the 12 frequencies in the chosen range. &lt;br /&gt;
 &lt;br /&gt;
Inspect &amp;lt;code&amp;gt;o-01_SHG_ip.YPP-X_probe_order_2&amp;lt;/code&amp;gt;&lt;br /&gt;
#     E [eV]            X/Im[cm/stV](x)    X/Re[cm/stV](x)    X/Im[cm/stV](y)    X/Re[cm/stV](y)    X/Im[cm/stV](z)    X/Re[cm/stV](z)&lt;br /&gt;
#&lt;br /&gt;
     0.50000000        -0.63057187E-09    -0.19596550E-07    -0.36238688E-10    -0.72052719E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.1250000        -0.19604352E-08    -0.23352876E-07    -0.18347724E-09    -0.86959709E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.7500000        -0.64748829E-08    -0.36274951E-07    -0.27614124E-09    -0.17103902E-08      0.0000000          0.0000000    &lt;br /&gt;
      2.37500000       -0.241985981E-7    -0.864285561E-8    -0.160616725E-8    -0.190064969E-8      0.00000000         0.00000000   &lt;br /&gt;
 &lt;br /&gt;
The first column are the frequencies of the applied field, the second and third is the polarization along x (imaginary and real part), the fourth and fifth is the polarization along y (imaginary and real part)  &lt;br /&gt;
and the sixth and seventh is the polarization along z (imaginary and real part).&lt;br /&gt;
&lt;br /&gt;
Plot the absolute value of the SHG for the &amp;quot;xxy&amp;quot; component (that is, the applied field is in the x and y directions and one look at the polarization along x):&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP.png|600px|center|SHG_intensity_of_2D_h-BN obtained from the current run (12 frequencies) compared with a run with 112 frequencies]]&lt;br /&gt;
&lt;br /&gt;
In the figure above, the results of the current run are compared with those for a run with 112 frequencies (one can obtain these results by repeating the calculations, changing the number of frequencies in &amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt; though this take about 10 times more computational time than the run with 12). One can notice some differences between the two runs. &lt;br /&gt;
&lt;br /&gt;
As an exercise, you can repeat the simulation for e,g, a time of &amp;lt;code&amp;gt;35 fs&amp;lt;/code&amp;gt; nand &amp;lt;code&amp;gt;60 fs&amp;lt;/code&amp;gt;, that is setting &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt;. The comparison of the susceptibilities at different simulation times (as in the plot below) shows the importance of running long enough simulations. In too short simulations, the response signal coming from the switch-on of the electric field (delta-kick) is still of comparable intensities as the relevant second-order signal.    &lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP l.png|600px|center|SHG of 2D-hBN with IPA. Effect of different simulation time]]&lt;br /&gt;
&lt;br /&gt;
As a final note, the SHG depends on the size of the vacuum added in the supercell. Instead, one should consider the surface SHG which obtained by considering an effective thickness for the layer. This is usually chosen to be similar to the layer separation in the bulk counterpart.&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation (BSE level) =&lt;br /&gt;
&lt;br /&gt;
== Hartree+Screened exchange collisions ==&lt;br /&gt;
Similarly to the linear part, one needs to generate the Screened exchange collisions. The procedure is exactly the same.&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -X s -e -v hsex -F 03_coll_hsex.in&lt;br /&gt;
modify the input ad follows&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 collisions                       # [R] Collisions&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 1000 mHa    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % COLLBands&lt;br /&gt;
    4 |  5 |                         # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;     # [SC] SC HXC Potential&lt;br /&gt;
 HARRLvcs= 1000 mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000 mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000 mHa    # [GW] Correlation RL components&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calculate the collisions (you may want to run in parallel):&lt;br /&gt;
 yambo_nl -F 03_coll_hsex.in -J 03_coll -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Run the simulation ==&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -nl n -V qp -F 04_SHG_hsex.in&lt;br /&gt;
&lt;br /&gt;
modify the following parts of the input (by this time all the innput variables should be known from the previous exercises):&lt;br /&gt;
&lt;br /&gt;
 % NLBands&lt;br /&gt;
    4 |  5 |                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;           # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;SEX&amp;quot;             # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  0.500000 |8.000000 |         eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 12                   # [NL] Energy steps&lt;br /&gt;
&lt;br /&gt;
You can choose 4 Energy steps instead to shorten the calculations (otherwise it takes about 8 minutes on 4 cores) &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  3.000000 | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 Field1_kind= &amp;quot;SIN&amp;quot;           # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 HARRLvcs= 1000            mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
Then run the simulation using e.g. mpi and 4 cores:&lt;br /&gt;
 mpirun -n 4 yambo_nl -F 04_SHG_hsex.in -J 04_SHG_hsex,03_coll -C 04_SHG_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Postprocessing: obtain the nonlinear response ==&lt;br /&gt;
&lt;br /&gt;
Similarly to what we did for the independent particle case, we create the input:&lt;br /&gt;
 ypp_nl -nl -F 05_SHG_hsex_pp.in&lt;br /&gt;
 &lt;br /&gt;
we change &amp;lt;code&amp;gt;Xorder = 4 &amp;lt;/code&amp;gt; and then run:&lt;br /&gt;
 ypp_nl -F 05_SHG_hsex_pp.in -J 04_SHG_hsex -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
Then we plot (as before we compare with a simulation ran for 112 frequencies).&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;04_hsex_files/o-04_SHG_hsex.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG SEX.png|600px|center|SHG at the Hartree + Screened exchange from the current run with 12 frequencies (crosses) and a run with 112 frequencies (keeping the other parameters the same)]]&lt;br /&gt;
&lt;br /&gt;
We note differences between the two simulations. This is due to the too short simulation time. Repeating the calculations with a longer time gives more accurate results. &lt;br /&gt;
In addition, note that in the interest of time, all parameters are &#039;&#039;&#039;under converged&#039;&#039;&#039;. In principle, to calculate the collisions one should use the same parameters of a converged BSE calculation. As well, to eliminate spurious interaction with the periodic images, one should use the Coulomb cut-off as it was used for this system in the [[Quasi-particles of a 2D system| tutorial on quasiparticle calculations]]. As a reference, a converged calculation for this system is in &amp;lt;ref name=&amp;quot;Gruning2014&amp;quot;&amp;gt;M. Grüning and C. Attaccalite, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.89.081102 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 081102]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= References = &lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8750</id>
		<title>Second-harmonic generation of 2D-hBN (5.3)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Second-harmonic_generation_of_2D-hBN_(5.3)&amp;diff=8750"/>
		<updated>2025-05-19T11:06:10Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Step 0: Theoretical framework =&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we compute the Second-harmonic generation (SHG) from the dynamics of the Bloch-states. The equation-of-motion of the Bloch-states is explained in the tutorial on [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]. Independently of the &#039;experiment&#039; we simulate, the part of the integration of motion stays the same. This means that any experiment, including non-linear optics, can be performed at the level of the theory listed for the computation of the dielectric function:&lt;br /&gt;
* independent (quasi)particle&lt;br /&gt;
* time-dependent Hartree (RPA level)&lt;br /&gt;
* time-dependent DFT (and DPFT)&lt;br /&gt;
* time-dependent Hartree+Screened exchange (BSE level)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
What changes when we want to calculate the SHG (or higher harmonics) is:&lt;br /&gt;
* the time-dependence of the input electric field and&lt;br /&gt;
* the post-processing of the signal  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Time dependence of the electric Field&#039;&#039;&#039;: we choose a sinusoidal electric field, thus a monochromatic laser field. This allows one to expand the polarization in the form &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; through a coefficient depending on a power of the strength of the field (with the power depending on the order of the response).&lt;br /&gt;
&lt;br /&gt;
At difference with a delta-like perturbation, a real-time simulation gives the response at the laser-field only. Then, to obtain the spectrum for the desired range of frequency, we have to perform so many simulations as the frequencies in the desired range.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Post-processing of the signal&#039;&#039;&#039;: The switch-on of the electric field corresponds to a weak delta-like kick. Thus, even if it may not be noticeable from the polarization plot, the polarization results from both the sinusoidal field and the delta-like kick. The latter excites all eigenfrequencies of the system. Though weak, the resulting signal is comparable with the second-harmonic signal. To eliminate the signal from the eigenfrequencies, we apply a dephasing (&amp;lt;math&amp;gt;\gamma_{deph}&amp;lt;/math&amp;gt;). To have a signal useful to sample the second-harmonic signal, we need to wait a time &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;  much larger than the dephasing-time &amp;lt;math&amp;gt;1/\gamma_{deph} &amp;lt;/math&amp;gt;. Note that we cannot choose a too short dephasing time (to shorten the simulation time), as this would result in a too large broadening of the spectrum. After &amp;lt;math&amp;gt;\bar t&amp;lt;/math&amp;gt;, we sample 2N+1 times in a period and use discrete Fourier transform to extract &amp;lt;math&amp;gt;{p}_n&amp;lt;/math&amp;gt; for &amp;lt;math&amp;gt; n = 0,...,N&amp;lt;/math&amp;gt;, where n=2 gives the SHG. This is schematically illustrated in figure:&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;
The scheme from Ref. &amp;lt;ref name=&amp;quot;Attaccalite2013&amp;quot;&amp;gt;C. Attaccalite and M. Gruning [https://arxiv.org/abs/1309.4012v2 Phys. Rev. B, &#039;&#039;&#039;88&#039;&#039;&#039;, 235113 (2013)]&amp;lt;/ref&amp;gt; summarised the workflow for computing the SHG (or higher-harmonics) in a energy range &amp;lt;math&amp;gt;[\Omega_1,\Omega_2]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:Scheme nl.png|350px|center|Schematic representation of real-time calculations]]&lt;br /&gt;
&lt;br /&gt;
= Step 1: Prerequisites =&lt;br /&gt;
You should be in the folder &amp;lt;code&amp;gt;YAMBO_TUTORIALS/hBN-2D/YAMBO/&amp;lt;/code&amp;gt;.&lt;br /&gt;
In this example, we will consider a single layer of hexagonal boron nitride (hBN). &lt;br /&gt;
Execute the commands (if running on 4 cores interactively you may need to add -nompi to the command line)&lt;br /&gt;
 yambo_nl&lt;br /&gt;
 ypp_nl -fixsym -F 00_removesym.in  &lt;br /&gt;
to create the input, to remove the symmetries which are not compatible with the field: &lt;br /&gt;
 fixsyms                          # [R] Remove symmetries not consistent with an external perturbation&lt;br /&gt;
 % Efield1&lt;br /&gt;
  &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;1.000000 | 1.000000 | 0.000000 |&amp;lt;/span&amp;gt;        # First external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % Efield2&lt;br /&gt;
  0.000000 | 0.000000 | 0.000000 |        # Additional external Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 BField= 0.000000           T     # [MAG] Magnetic field modulus&lt;br /&gt;
 Bpsi= 0.000000             deg   # [MAG] Magnetic field psi angle [degree]&lt;br /&gt;
 Btheta= 0.000000           deg   # [MAG] Magnetic field theta angle [degree]&lt;br /&gt;
 #RmAllSymm                     # Remove all symmetries&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;RmTimeRev&amp;lt;/span&amp;gt;                     # Remove Time Reversal&lt;br /&gt;
 #RmSpaceInv                    # Remove Spatial Inversion&lt;br /&gt;
 #KeepKGrid                     # Do not expand the k-grid&lt;br /&gt;
where we chose the field along the xy direction and we remove time-reversal symmetry.&lt;br /&gt;
&lt;br /&gt;
Then run the pre-processing job:&lt;br /&gt;
 ypp_nl -F 00_removesym.in&lt;br /&gt;
This creates the directory &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. Change directory to &amp;lt;code&amp;gt;FixSymm&amp;lt;/code&amp;gt;. This contains the &amp;lt;code&amp;gt;SAVE&amp;lt;/code&amp;gt; directory with reduced symmetries, compatible with the direction of the field. Now run the setup again (&amp;lt;code&amp;gt;yambo_nl&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
= Step 2: Independent-particle approximation =&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
  cd FixSymm&lt;br /&gt;
  yambo_nl&lt;br /&gt;
  yambo_nl -nl n -F 01_SHG_ip.in&lt;br /&gt;
to generate the input:&lt;br /&gt;
&lt;br /&gt;
 nloptics                         # [R] Non-linear spectroscopy&lt;br /&gt;
 % NLBands&lt;br /&gt;
    &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;3 |  6 |&amp;lt;/span&amp;gt;                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
 NLverbosity= &amp;quot;high&amp;quot;              # [NL] Verbosity level (low | high)&lt;br /&gt;
 NLtime=-1.000000           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&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;0.5000000 |8.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;12&amp;lt;/span&amp;gt;                     # [NL] Energy steps&lt;br /&gt;
 NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)&lt;br /&gt;
 RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative Yambo sets it equal to Phase_LifeTime in NL)&lt;br /&gt;
 #EvalCurrent                   # [NL] Evaluate the current&lt;br /&gt;
 #FrPolPerdic                   # [DIP] Force periodicity of polarization respect to the external field&lt;br /&gt;
 % Field1_Freq&lt;br /&gt;
 0.100000 | 0.100000 |         eV    # [RT Field1] Frequency&lt;br /&gt;
 %&lt;br /&gt;
 Field1_NFreqs= 1                 # [RT Field1] Frequency&lt;br /&gt;
 Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity&lt;br /&gt;
 Field1_Width= 0.000000     fs    # [RT Field1] Width&lt;br /&gt;
 Field1_kind= &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;quot;SIN&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 | 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;
To describe the Bloch-dynamics we will use as a basis the KS-states 3-6 for the k-grid used in the non-scf DFT calculations, that is a 6x6x1 (&amp;lt;code&amp;gt;NLBands&amp;lt;/code&amp;gt;). We choose 12 equally spaced frequencies (&amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt;) for the applied field in the range  (&amp;lt;code&amp;gt;NLEnRange&amp;lt;/code&amp;gt;) between 0.5 and 8 eV. We choose a sinusoidal time-dependence (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) and set the field direction (&amp;lt;code&amp;gt;Field1_kind&amp;lt;/code&amp;gt;) along xy (in plane). The negative simulation time (&amp;lt;code&amp;gt;NLtime=-1.000000&amp;lt;/code&amp;gt;) means that the code will choose it based on the value of the &amp;lt;code&amp;gt;NLDamping&amp;lt;/code&amp;gt;. While this is a good lower bound for the simulation time, one should check it is sufficient to get accurate results. &lt;br /&gt;
&lt;br /&gt;
Run the simulation, possibly in parallel e. g. in a interactive session on 4 cores. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[In order to get 4 cores while in an interacting node, exit your current interactive run and rerun &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; asking for the proper number of tasks:&#039;&#039;&#039;&lt;br /&gt;
 srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 4 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash&lt;br /&gt;
&#039;&#039;&#039;Otherwise, you can submit the job with a slurm script as explained in the introductory page]&#039;&#039;&#039;&lt;br /&gt;
Note that when executing commands that don&#039;t need mpi (such as generating an input file) you may need to add -nompi to the command line &lt;br /&gt;
&lt;br /&gt;
Now execute the command:&lt;br /&gt;
  mpirun -n 4 yambo_nl -F 01_SHG_ip.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
This run will take several minutes. While it is running, you can check the progress of one specific frequency:&lt;br /&gt;
 tail -f 01_SHG_ip_files/o-01_SHG_ip.polarization_F2&lt;br /&gt;
If you want to know how many fs the simulation will last (since this was decided by the code), you can get this information in the report file:&lt;br /&gt;
 $ grep &#039;Total simulation&#039; 01_SHG_ip_files/r-01_SHG_ip_nloptics&lt;br /&gt;
 Total simulation time       :  47.81405 [fs]&lt;br /&gt;
&lt;br /&gt;
If you instead want to track the progress of the full simulation, you should check the log file(s). If you are doing a parallel run, you can type&lt;br /&gt;
 tail -f 01_SHG_ip_files/LOG/l-01_SHG_ip_nloptics_CPU_1&lt;br /&gt;
&lt;br /&gt;
Once the run is finished, check the report &amp;lt;code&amp;gt;01_SHG_ip_files/r-01_SHG_ip_nloptics&amp;lt;/code&amp;gt;. In particular, in the appended input files, you can see the default parallelization applied by the code for calculating the dipoles and run the time-propagation. For the latter, the main parallelization is on the frequencies and then on the k-points (&amp;lt;code&amp;gt;NL_ROLEs= &amp;quot;w.k&amp;quot;&amp;lt;/code&amp;gt;).   &lt;br /&gt;
&lt;br /&gt;
 | NL_CPU= &amp;quot;2.2&amp;quot;                    # [PARALLEL] CPUs for each role&lt;br /&gt;
 | NL_ROLEs= &amp;quot;w.k&amp;quot;                  # [PARALLEL] CPUs roles (w,k)&lt;br /&gt;
 | DIP_CPU= &amp;quot;2.2.1&amp;quot;                 # [PARALLEL] CPUs for each role&lt;br /&gt;
 | DIP_ROLEs= &amp;quot;v.c.k&amp;quot;               # [PARALLEL] CPUs roles (k,c,v)&lt;br /&gt;
&lt;br /&gt;
Also, look at the simulation time. This is approximately 45-50 fs. &lt;br /&gt;
&lt;br /&gt;
Plot the polarization for a couple of frequencies, e.g. the first and last of the chosen range (the corresponding frequency can be read in the file, search for &amp;quot;Frequency value&amp;quot;):&lt;br /&gt;
 set ylabel &amp;quot;x-component polarization&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;time (fs)&amp;quot;&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F1&#039; u 1:2 w l lw 2 title &amp;quot;omega = 0.5 eV&amp;quot;&lt;br /&gt;
 replot &#039;01_SHG_ip_files/o-01_SHG_ip.polarization_F12&#039; u 1:2 w l lw 2  title &amp;quot;omega = 7.375 eV&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:Berry_phase_polarization_of_2D_h-BN_obtained_from_the_previous_run_for_two_laser_frequencies.png|Berry_phase_polarization_of_2D_h-BN_obtained from the run for two laser frequencies]]&lt;br /&gt;
&lt;br /&gt;
After the applied field is &#039;switched on&#039;, the polarization is oscillating at the frequency of the applied field and at the eigenfrequencies of the system as described above in the cartoon. This is visible particularly for the higher frequency. Due to the dephasing, after about 20 fs the polarization is oscillating (at least to the eye) at the frequency of the applied field. Nonlinear components are not visible since they are several orders of magnitude smaller than the first order.&lt;br /&gt;
&lt;br /&gt;
== Output post-processing: the dielectric function ==&lt;br /&gt;
&lt;br /&gt;
Once we obtained the polarization, we Fourier-transform the polarization to obtain the dielectric function.&lt;br /&gt;
&lt;br /&gt;
Use the command:&lt;br /&gt;
&lt;br /&gt;
  ypp_nl -nl -F 02_SHG_ip_pp.in -C 01_SHG_ip_files&lt;br /&gt;
&lt;br /&gt;
to generate the input file: &lt;br /&gt;
&lt;br /&gt;
 nonlinear                        # [R] Non-linear response analysis&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Xorder= 4&amp;lt;/span&amp;gt; # Max order of the response/exc functions&lt;br /&gt;
 % TimeRange&lt;br /&gt;
  -1.000000 |-1.000000 |         fs    # Time-window where processing is done&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsRt= 200                    # Total Energy steps&lt;br /&gt;
 % EnRngeRt&lt;br /&gt;
   0.00000 | 20.00000 |         eV    # Energy range&lt;br /&gt;
 %&lt;br /&gt;
 DampMode= &amp;quot;NONE&amp;quot;                 # Damping type ( NONE | LORENTZIAN | GAUSSIAN )&lt;br /&gt;
 DampFactor= 0.000000       eV    # Damping parameter&lt;br /&gt;
 PumpPATH= &amp;quot;none&amp;quot;                 # Path of the simulation with the Pump only&lt;br /&gt;
&lt;br /&gt;
Where we changed the &amp;lt;code&amp;gt;Xorder&amp;lt;/code&amp;gt; to 4. This variable controls the terms in the Fourier expansion of the polarization. We choose up to expand up to the fourth order. This should ensure the second order to be accurate enough. As an exercise, you can change this value (e.g. choose 2,3,5,6) and see how the result below is changing. The time-window where processing is done is chosen automatically, since values are negative. The code chooses by default the last period to carry out the analysis. &lt;br /&gt;
&lt;br /&gt;
To run the post-processing, use the command:&lt;br /&gt;
 ypp_nl -F 02_SHG_ip_pp.in -J 01_SHG_ip -C 01_SHG_ip_files&lt;br /&gt;
   &lt;br /&gt;
In  &amp;lt;code&amp;gt;01_SHG_ip_files&amp;lt;/code&amp;gt; the following files were generated &lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_1&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_2&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_3&lt;br /&gt;
 o-01_SHG_ip.YPP-X_probe_order_4&lt;br /&gt;
 r-01_SHG_ip_nonlinear&lt;br /&gt;
&lt;br /&gt;
The output files contain respectively the first, second, third and fourth order response(corresponding to &amp;lt;code&amp;gt;Xorder=4&amp;lt;/code&amp;gt;)  at the 12 frequencies in the chosen range. &lt;br /&gt;
 &lt;br /&gt;
Inspect &amp;lt;code&amp;gt;o-01_SHG_ip.YPP-X_probe_order_2&amp;lt;/code&amp;gt;&lt;br /&gt;
#     E [eV]            X/Im[cm/stV](x)    X/Re[cm/stV](x)    X/Im[cm/stV](y)    X/Re[cm/stV](y)    X/Im[cm/stV](z)    X/Re[cm/stV](z)&lt;br /&gt;
#&lt;br /&gt;
     0.50000000        -0.63057187E-09    -0.19596550E-07    -0.36238688E-10    -0.72052719E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.1250000        -0.19604352E-08    -0.23352876E-07    -0.18347724E-09    -0.86959709E-09      0.0000000          0.0000000    &lt;br /&gt;
      1.7500000        -0.64748829E-08    -0.36274951E-07    -0.27614124E-09    -0.17103902E-08      0.0000000          0.0000000    &lt;br /&gt;
      2.37500000       -0.241985981E-7    -0.864285561E-8    -0.160616725E-8    -0.190064969E-8      0.00000000         0.00000000   &lt;br /&gt;
 &lt;br /&gt;
The first column are the frequencies of the applied field, the second and third is the polarization along x (imaginary and real part), the fourth and fifth is the polarization along y (imaginary and real part)  &lt;br /&gt;
and the sixth and seventh is the polarization along z (imaginary and real part).&lt;br /&gt;
&lt;br /&gt;
Plot the absolute value of the SHG for the &amp;quot;xxy&amp;quot; component (that is, the applied field is in the x and y directions and one look at the polarization along x):&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;01_SHG_ip_files/o-01_SHG_ip.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP.png|600px|center|SHG_intensity_of_2D_h-BN obtained from the current run (12 frequencies) compared with a run with 112 frequencies]]&lt;br /&gt;
&lt;br /&gt;
In the figure above, the results of the current run are compared with those for a run with 112 frequencies (one can obtain these results by repeating the calculations, changing the number of frequencies in &amp;lt;code&amp;gt;NLEnSteps&amp;lt;/code&amp;gt; though this take about 10 times more computational time than the run with 12). One can notice some differences between the two runs. &lt;br /&gt;
&lt;br /&gt;
As an exercise, you can repeat the simulation for e,g, a time of &amp;lt;code&amp;gt;35 fs&amp;lt;/code&amp;gt; nand &amp;lt;code&amp;gt;60 fs&amp;lt;/code&amp;gt;, that is setting &amp;lt;code&amp;gt;NLtime&amp;lt;/code&amp;gt;. The comparison of the susceptibilities at different simulation times (as in the plot below) shows the importance of running long enough simulations. In too short simulations, the response signal coming from the switch-on of the electric field (delta-kick) is still of comparable intensities as the relevant second-order signal.    &lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG IP l.png|600px|center|SHG of 2D-hBN with IPA. Effect of different simulation time]]&lt;br /&gt;
&lt;br /&gt;
As a final note, the SHG depends on the size of the vacuum added in the supercell. Instead, one should consider the surface SHG which obtained by considering an effective thickness for the layer. This is usually chosen to be similar to the layer separation in the bulk counterpart.&lt;br /&gt;
&lt;br /&gt;
= Step 3: Hartree+Screened exchange approximation (BSE level) =&lt;br /&gt;
&lt;br /&gt;
== Hartree+Screened exchange collisions ==&lt;br /&gt;
Similarly to the linear part, one needs to generate the Screened exchange collisions. The procedure is exactly the same.&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -X s -e -v hsex -F 03_coll_hsex.in&lt;br /&gt;
modify the input ad follows&lt;br /&gt;
 em1s                             # [R][Xs] Statically Screened Interaction&lt;br /&gt;
 collisions                       # [R] Collisions&lt;br /&gt;
 dipoles                          # [R] Oscillator strenghts (or dipoles)&lt;br /&gt;
 Chimod= &amp;quot;HARTREE&amp;quot;                # [X] IP/Hartree/ALDA/LRC/PF/BSfxc&lt;br /&gt;
 % BndsRnXs&lt;br /&gt;
    1 |  20 |                         # [Xs] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXs= 1000 mHa    # [Xs] Response block size&lt;br /&gt;
 % LongDrXs&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [Xs] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % COLLBands&lt;br /&gt;
    4 |  5 |                         # [COLL] Bands for the collisions&lt;br /&gt;
 %&lt;br /&gt;
 HXC_Potential= &amp;quot;SEX+HARTREE&amp;quot;     # [SC] SC HXC Potential&lt;br /&gt;
 HARRLvcs= 1000 mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000 mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000 mHa    # [GW] Correlation RL components&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calculate the collisions (you may want to run in parallel):&lt;br /&gt;
 yambo_nl -F 03_coll_hsex.in -J 03_coll -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Run the simulation ==&lt;br /&gt;
&lt;br /&gt;
Create the input:&lt;br /&gt;
 yambo_nl -nl n -V qp -F 04_SHG_hsex.in&lt;br /&gt;
&lt;br /&gt;
modify the following parts of the input (by this time all the innput variables should be known from the previous exercises):&lt;br /&gt;
&lt;br /&gt;
 % NLBands&lt;br /&gt;
    4 |  5 |                         # [NL] Bands range&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 NLintegrator= &amp;quot;CRANKNIC&amp;quot;           # [NL] Integrator (&amp;quot;EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC&amp;quot;)&lt;br /&gt;
 NLCorrelation= &amp;quot;SEX&amp;quot;             # [NL] Correlation (&amp;quot;IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 % NLEnRange&lt;br /&gt;
  0.500000 |8.000000 |         eV    # [NL] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 NLEnSteps= 12                   # [NL] Energy steps&lt;br /&gt;
&lt;br /&gt;
You can choose 4 Energy steps instead to shorten the calculations (otherwise it takes about 8 minutes on 4 cores) &lt;br /&gt;
&lt;br /&gt;
 % GfnQP_E&lt;br /&gt;
  3.000000 | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim&lt;br /&gt;
 %&lt;br /&gt;
&lt;br /&gt;
 Field1_kind= &amp;quot;SIN&amp;quot;           # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)&lt;br /&gt;
&lt;br /&gt;
 % Field1_Dir&lt;br /&gt;
  1.000000 | 1.000000 | 0.000000 |        # [RT Field1] Versor&lt;br /&gt;
 %&lt;br /&gt;
 HARRLvcs= 1000            mHa    # [HA] Hartree     RL components&lt;br /&gt;
 EXXRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
 CORRLvcs= 1000            mHa    # [XX] Exchange    RL components&lt;br /&gt;
&lt;br /&gt;
Then run the simulation using e.g. mpi and 4 cores:&lt;br /&gt;
 mpirun -n 4 yambo_nl -F 04_SHG_hsex.in -J 04_SHG_hsex,03_coll -C 04_SHG_hsex_files&lt;br /&gt;
&lt;br /&gt;
== Postprocessing: obtain the nonlinear response ==&lt;br /&gt;
&lt;br /&gt;
Similarly to what we did for the independent particle case, we create the input:&lt;br /&gt;
 ypp_nl -nl -F 05_SHG_hsex_pp.in&lt;br /&gt;
 &lt;br /&gt;
we change &amp;lt;code&amp;gt;Xorder = 4 &amp;lt;/code&amp;gt; and then run:&lt;br /&gt;
 ypp_nl -F 05_SHG_hsex_pp.in -J 04_SHG_hsex -C 04_hsex_files&lt;br /&gt;
&lt;br /&gt;
Then we plot (as before we compare with a simulation ran for 112 frequencies).&lt;br /&gt;
&lt;br /&gt;
Plot the results:&lt;br /&gt;
&lt;br /&gt;
 set ylabel &amp;quot;{/Symbol=26 \174}{/Symbol=26 c}_{xyx}^{(2)}{/Symbol=26 \174} (pm/V)&amp;quot; offset -0.7&lt;br /&gt;
 set xlabel &amp;quot;Energy (eV)&amp;quot;&lt;br /&gt;
 pmVm1toCGS=2.38721e-09&lt;br /&gt;
 plot &#039;04_hsex_files/o-04_SHG_hsex.YPP-X_probe_order_2&#039; u 1:(sqrt($2**2+$3**2)/pmVm1toCGS) w p title &amp;quot;calc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[File:02 SHG SEX.png|600px|center|SHG at the Hartree + Screened exchange from the current run with 12 frequencies (crosses) and a run with 112 frequencies (keeping the other parameters the same)]]&lt;br /&gt;
&lt;br /&gt;
Also in this case, we note differences between the two simulations. As discussed for the independent particle approximation, this is due to the too short simulation time. Repeating the calculations with a longer time gives more accurate results. &lt;br /&gt;
In addition, note that in the interest of time, all parameters are &#039;&#039;&#039;under converged&#039;&#039;&#039;. In principle, to calculate the collisions one should use the same parameters of a converged BSE calculation. As well, to eliminate spurious interaction with the periodic images, one should use the Coulomb cut-off as it was used for this system in the [[Quasi-particles of a 2D system| tutorial on quasiparticle calculations]]. As a reference, a converged calculation for this system is in &amp;lt;ref name=&amp;quot;Gruning2014&amp;quot;&amp;gt;M. Grüning and C. Attaccalite, [https://journals.aps.org/prb/abstract/10.1103/PhysRevB.89.081102 Phys. Rev. B &#039;&#039;&#039;89&#039;&#039;&#039;, 081102]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= References = &lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:02_SHG_SEX.png&amp;diff=8749</id>
		<title>File:02 SHG SEX.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:02_SHG_SEX.png&amp;diff=8749"/>
		<updated>2025-05-19T11:04:24Z</updated>

		<summary type="html">&lt;p&gt;Yambowikiadmin: Uploaded own work with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2025-05-19&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Yambowikiadmin|Yambowikiadmin]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Yambowikiadmin</name></author>
	</entry>
</feed>