Difference between revisions of "Third Harmonic Generation (THG)"

From The Yambo Project
Jump to navigation Jump to search
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Third Harmonic Generation in bulk Silicon'''
==Third Harmonic Generation in bulk Silicon==


In this tutorial we will calculate third harmonic generation (THG) in bulk Silicon.  
In this tutorial we will calculate third harmonic generation (THG) in bulk Silicon.  
[[File:Thg silicon.jpg|center| 150px]]
[[File:Thg silicon.jpg|center| 150px]]


<br>Calculation of third harmonic generation proceeds in similar way to the SHG calculations. <br>DFT input can be found here ([http://www.attaccalite.com/lumen/tutorials/silicon_dft.tgz abinit] or [http://www.attaccalite.com/lumen/tutorials/silicon_qe.tgz |quantum espresso]). <br> We import the wave-functions as explained in the [[Real time approach to non-linear response]], then perform the setup using only 1000 plane waves. <br>
<br>Calculation of third harmonic generation proceeds in similar way to the SHG calculations. <br>DFT input can be found here ([http://www.attaccalite.com/lumen/tutorials/silicon_dft.tgz abinit] or [http://www.attaccalite.com/lumen/tutorials/silicon_qe.tgz QuantumEspresso]). <br> We import the wave-functions as explained in the [[Real time approach to non-linear response]], then perform the setup using only 1000 plane waves. <br>
 
==Removing symmetries==
We are interested in the <math> \chi^{(3)}_{1111} </math> therefore we consider an external field in direction [1, 0, 0] (equivalent to [x,0,0]).<br />
We are interested in the <math> \chi^{(3)}_{1111} </math> therefore we consider an external field in direction [1, 0, 0] (equivalent to [x,0,0]).<br />
We remove all the symmetries not compatible with the external field plus the time-reversal symmetry by doing <code>ypp -y</code>:<br />
We remove all the symmetries not compatible with the external field plus the time-reversal symmetry by doing <code>ypp_nl (or ypp) -y</code>:<br />
<br>
<br>
  fixsyms                      # [R] Reduce Symmetries
  fixsyms                      # [R] Reduce Symmetries
Line 18: Line 20:
  <span style="color:red>RmTimeRev</span>                  # Remove Time Reversal
  <span style="color:red>RmTimeRev</span>                  # Remove Time Reversal


==Real-time simulations==
Then you go in the FixSymm folder, run again the setup (as explained in the [[Linear response using Dynamical Berry Phase]]) and then generate the input file with the command <code>yambo_nl -u n -V qp -F input.in</code>:<br />
Then you go in the FixSymm folder, run again the setup (as explained in the [[Linear response using Dynamical Berry Phase]]) and then generate the input file with the command <code>yambo_nl -u n -V qp -F input.in</code>:<br />


Line 36: Line 39:
  %Field1_Dir
  %Field1_Dir
   <span style="color:red>1.000000 </span>| 0.000000 | 0.000000 |        # [RT Field1] Versor
   <span style="color:red>1.000000 </span>| 0.000000 | 0.000000 |        # [RT Field1] Versor
  Field1_kind= "SOFTSIN"        # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)
  Field1_kind= "<span style="color:red>SOFTSIN</span>"        # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)
  Field1_Int= <span style="color:red>0.1000E+8 </span>        kWLm2 # [NL ExtF] Intensity
  Field1_Int= <span style="color:red>0.1000E+8 </span>        kWLm2 # [NL ExtF] Intensity
   % GfnQP_E
   % GfnQP_E
   <span style="color:red>0.600000</span> | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim
   <span style="color:red>0.600000</span> | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim
   %
   %
We calculate the <math>\chi^{(3)}_{1111} \)</math> only on 6 frequencies, but calculations can be extended to larger frequency range. We introduce a scissor operator of 0.6 eV in such a way to reproduce the gap of bulk silicon. Notice that we increased the field intensity in such a way to improve the ratio between non-linear response and numerical noise.<br />
We calculate the <math>\chi^{(3)}_{1111}</math> only on 6 frequencies, but calculations can be extended to larger frequency range. <br>We introduce a scissor operator of 0.6 eV in such a way to reproduce the gap of bulk silicon. Notice that we increased the field intensity in such a way to improve the ratio between non-linear response and numerical noise.<br />
Now that you have created the file <code>input.in</code> you can run the non-linear optics calculation with the command:<br />
Now that you have created the file <code>input.in</code> you can run the non-linear optics calculation with the command:<br />
<br />
<br />
Line 47: Line 50:
<pre>yambo_nl -F input.in</pre>
<pre>yambo_nl -F input.in</pre>
<br />
<br />
when the simulation will end, it will have produced the files <code>SAVE/ndb.Nonlinear</code>.<br />
when the simulation will end, it will have produced the file <code>SAVE/ndb.Nonlinear</code> with all information on the simulation and the files <code>SAVE/ndb.Nonlinear_fragment_x</code> with the polarization and current for each laser frequency.<br />
Results can be analized in the same way of the SHG, using the command <code>ypp -u</code>:<br />
 
==Analysis of the results==
Results can be analyzed in the same way of the SHG, using the command <code>ypp_nl -u</code>:<br />
<br />
<br />


<pre>nonlinear                    # [R] NonLinear Optics Post-Processing
nonlinear                    # [R] NonLinear Optics Post-Processing
Xorder=  5                   # Max order of the response functions
Xorder=  <span style="color:red>5 </span>                # Max order of the response functions
% TimeRange
% TimeRange
40 | -1.00000 | fs    # Time-window where processing is done
  <span style="color:red>40.000000 </span>| -1.00000 | fs    # Time-window where processing is done
%
%
ETStpsRt= 200                # Total Energy steps
ETStpsRt= 200                # Total Energy steps
% EnRngeRt
% EnRngeRt
0.00000 | 10.00000 | eV    # Energy range
  0.00000 | 10.00000 | eV    # Energy range
%
%
DampMode= &quot;NONE&quot;            # Damping type ( NONE | LORENTZIAN | GAUSSIAN )
DampMode= &quot;NONE&quot;            # Damping type ( NONE | LORENTZIAN | GAUSSIAN )
DampFactor=  0.10000  eV    # Damping parameter</pre>
DampFactor=  0.10000  eV    # Damping parameter
<br />
 
This time we increase the dephasing time to 40 fs in such a way to have a clean third-harminic response.<br />
This time we increase the de-phasing time to 40 fs in such a way to have a clean third-harmonic response.<br />
Hereafter we report the result with the 8x8x8 k-points sampling and the converged result with the 24x24x24 k-points sampling:
Hereafter we report the result with the 8x8x8 k-points sampling and the converged result with the 24x24x24 k-points sampling:
[[File:images/Si_THG_results.png]]
[[File:Si THG results.png|center| 600px]]
Plot data can be downloaded [[tutorials/Si_thg_results.tgz|here]].
Plot data can be downloaded [http://www.attaccalite.com/lumen/tutorials/Si_thg_results.tgz here].
 
==Analysis of the results with YamboPy==
'''This part works only with Yambo 5.3 or the last version available on Github:''' [https://github.com/yambo-code/yambo https://github.com/yambo-code/yambo]
<br>
<br>
 
The previous analysis can be performed using <code>YamboPy</code>, see these other tutorials for more details ([[Real time approach to non-linear response#Analysis of the results using YamboPy]])
From the folder of the calculations in python you use the script:
 
from yambopy import *
from yambopy.plot  import *
from yambopy.units import fs2aut
 
NLDB=YamboNLDB()
pol =NLDB.Polarization[0]
time=NLDB.IO_TIME_points
Harmonic_Analysis(NLDB,X_order=5,T_range=[40.0*fs2aut,-1.0])
 
it will produce files with the non-linear response ''o.YamboPY-X_probe_order_x'' equivalent to the ones produced by <code>ypp_nl</code>.
 
==How to choose the external field direction for the different X<sup>3</sup>==
In the X<sup>3</sup><sub>abcd</sub> response you have four field directions. The three components ''b'',''c'' and ''d'' are determined by the external field and the four ''a''
is the direction where you measure the response.<br>
 
The external field in Yambo is set using the variable
%Field1_Dir
  1.000000 | 0.000000 | 0.000000 |       # [NL ExtF] Versor .
%
 
For example if you set in Yambo field direction as:
 
1.0 | 0.0 | 0.0 | ---> you calculate all components X<sup>3</sup><sub>*xxx</sub>
0.0 | 1.0 | 0.0 | ---> you calculate all components X<sup>2</sup><sub>*yyy</sub>
0.0 | 0.0 | 1.0 | ---> you calculate all components X<sup>2</sup><sub>*zzz</sub>
 
the * correspond to the different direction in the response file <code>o.YPP-X_probe_order_3</code>.
In the <code>o.YPP-X_probe_order_3</code> you have seven columns:
 
The first column is the energy [[omega]],
the 2nd and 3rd columns are the imaginary and real part of X<sup>3</sup><sub>x***</sub>
the 4th and 5th columns are the imaginary and real part of X<sup>3</sup><sub>y***</sub>
the 6th and 7th columns are the imaginary and real part of X<sup>3</sup><sub>z***</sub>
 
where the *** are the direction of the incoming field, see above.
 
Instead for an external field in Yambo in the direction
%Field1_Dir
  1.000000 | 1.000000 | 1.000000 |        # [NL ExtF] Versor .
%
 
you can get in output in the <code>o.YPP-X_probe_order_3</code> file the components:
 
the 2nd and 3rd columns are the imaginary and real part of X<sup>3</sup><sub>xxyz</sub>
the 4th and 5th columns are the imaginary and real part of X<sup>3</sup><sub>yxyz</sub>
the 6th and 7th columns are the imaginary and real part of X<sup>3</sup><sub>zxyz</sub>
 
 
 
Other terms of the X<sup>3</sup> tensor can be obtained combining the different columns of the  <code>o.YPP-X_probe_order_3</code> file and using external fields along linear combination of the Cartesian axes.  


</div>
'''Nota bene:''' if you change the direction of the external field you have to remove the corresponding symmetries as explained in the tutorial
on [[Prerequisites for Real Time propagation with Yambo#Reduce symmetries real-time linear response tutorial]].

Revision as of 13:14, 18 January 2024

Third Harmonic Generation in bulk Silicon

In this tutorial we will calculate third harmonic generation (THG) in bulk Silicon.

Thg silicon.jpg


Calculation of third harmonic generation proceeds in similar way to the SHG calculations.
DFT input can be found here (abinit or QuantumEspresso).
We import the wave-functions as explained in the Real time approach to non-linear response, then perform the setup using only 1000 plane waves.

Removing symmetries

We are interested in the [math]\displaystyle{ \chi^{(3)}_{1111} }[/math] therefore we consider an external field in direction [1, 0, 0] (equivalent to [x,0,0]).
We remove all the symmetries not compatible with the external field plus the time-reversal symmetry by doing ypp_nl (or ypp) -y:

fixsyms                      # [R] Reduce Symmetries
% Efield1
 1.00     | 0.00     | 0.00     |        # First external Electric Field
%
% Efield2
 0.00     | 0.00     | 0.00     |        # Additional external Electric Field
%
#RmAllSymm                   # Remove all symmetries
RmTimeRev                   # Remove Time Reversal

Real-time simulations

Then you go in the FixSymm folder, run again the setup (as explained in the Linear response using Dynamical Berry Phase) and then generate the input file with the command yambo_nl -u n -V qp -F input.in:

nloptics                      # [R NL] Non-linear optics
% NLBands
  1 | 7 |                   # [NL] Bands
%
NLstep=   0.0100       fs    # [NL] Real Time step length
NLtime=-1.000000       fs    # [NL] Simulation Time
NLintegrator= "CRANKNIC"     # [NL] Integrator ("EULEREXP/RK4/RK2EXP/HEUN/INVINT/CRANKNIC")
NLCorrelation= "IPA"         # [NL] Correlation ("IPA/HARTREE/TDDFT/LRC/JGM/HF/SEX")
NLLrcAlpha= 0.000000         # [NL] Long Range Correction
% NLEnRange
 0.200000 | 2.000000 |  eV    # [NL] Energy range
%
NLEnSteps=  6               # [NL] Energy steps
NLDamping= 0.200000    eV    # [NL] Damping
%Field1_Dir
  1.000000 | 0.000000 | 0.000000 |        # [RT Field1] Versor
Field1_kind= "SOFTSIN"         # [NL ExtF] Kind(SIN|SOFTSIN|RES|ANTIRES|GAUSS|DELTA|QSSIN)
Field1_Int= 0.1000E+8         kWLm2 # [NL ExtF] Intensity
 % GfnQP_E
 0.600000 | 1.000000 | 1.000000 |        # [EXTQP G] E parameters  (c/v) eV|adim|adim
 %

We calculate the [math]\displaystyle{ \chi^{(3)}_{1111} }[/math] only on 6 frequencies, but calculations can be extended to larger frequency range.
We introduce a scissor operator of 0.6 eV in such a way to reproduce the gap of bulk silicon. Notice that we increased the field intensity in such a way to improve the ratio between non-linear response and numerical noise.
Now that you have created the file input.in you can run the non-linear optics calculation with the command:

yambo_nl -F input.in


when the simulation will end, it will have produced the file SAVE/ndb.Nonlinear with all information on the simulation and the files SAVE/ndb.Nonlinear_fragment_x with the polarization and current for each laser frequency.

Analysis of the results

Results can be analyzed in the same way of the SHG, using the command ypp_nl -u:

nonlinear                    # [R] NonLinear Optics Post-Processing
Xorder=  5                   # Max order of the response functions
% TimeRange
 40.000000 | -1.00000 | fs    # Time-window where processing is done
%
ETStpsRt= 200                # Total Energy steps
% EnRngeRt
 0.00000 | 10.00000 | eV    # Energy range
%
DampMode= "NONE"             # Damping type ( NONE | LORENTZIAN | GAUSSIAN )
DampFactor=  0.10000   eV    # Damping parameter

This time we increase the de-phasing time to 40 fs in such a way to have a clean third-harmonic response.
Hereafter we report the result with the 8x8x8 k-points sampling and the converged result with the 24x24x24 k-points sampling:

Si THG results.png

Plot data can be downloaded here.

Analysis of the results with YamboPy

This part works only with Yambo 5.3 or the last version available on Github: https://github.com/yambo-code/yambo

The previous analysis can be performed using YamboPy, see these other tutorials for more details (Real time approach to non-linear response#Analysis of the results using YamboPy) From the folder of the calculations in python you use the script:

from yambopy import *
from yambopy.plot  import *
from yambopy.units import fs2aut 
 
NLDB=YamboNLDB()

pol =NLDB.Polarization[0]
time=NLDB.IO_TIME_points

Harmonic_Analysis(NLDB,X_order=5,T_range=[40.0*fs2aut,-1.0])

it will produce files with the non-linear response o.YamboPY-X_probe_order_x equivalent to the ones produced by ypp_nl.

How to choose the external field direction for the different X3

In the X3abcd response you have four field directions. The three components b,c and d are determined by the external field and the four a is the direction where you measure the response.

The external field in Yambo is set using the variable

%Field1_Dir 
 1.000000 | 0.000000 | 0.000000 |        # [NL ExtF] Versor .
%

For example if you set in Yambo field direction as:

1.0 | 0.0 | 0.0 | ---> you calculate all components X3*xxx
0.0 | 1.0 | 0.0 | ---> you calculate all components X2*yyy
0.0 | 0.0 | 1.0 | ---> you calculate all components X2*zzz

the * correspond to the different direction in the response file o.YPP-X_probe_order_3. In the o.YPP-X_probe_order_3 you have seven columns:

The first column is the energy omega,
the 2nd and 3rd columns are the imaginary and real part of X3x***
the 4th and 5th columns are the imaginary and real part of X3y***
the 6th and 7th columns are the imaginary and real part of X3z***

where the *** are the direction of the incoming field, see above.

Instead for an external field in Yambo in the direction

%Field1_Dir 
 1.000000 | 1.000000 | 1.000000 |        # [NL ExtF] Versor .
%

you can get in output in the o.YPP-X_probe_order_3 file the components:

the 2nd and 3rd columns are the imaginary and real part of X3xxyz
the 4th and 5th columns are the imaginary and real part of X3yxyz
the 6th and 7th columns are the imaginary and real part of X3zxyz


Other terms of the X3 tensor can be obtained combining the different columns of the o.YPP-X_probe_order_3 file and using external fields along linear combination of the Cartesian axes.

Nota bene: if you change the direction of the external field you have to remove the corresponding symmetries as explained in the tutorial on Prerequisites for Real Time propagation with Yambo#Reduce symmetries real-time linear response tutorial.