Difference between revisions of "Calculating optical spectra including excitonic effects: a step-by-step guide"

From The Yambo Project
Jump to navigation Jump to search
 
(44 intermediate revisions by 6 users not shown)
Line 1: Line 1:
WORK IN PROGRESS - by Myrta Grüning
This tutorial guides you through the workflow of a calculation of the optical spectrum of a given material by solving the Bethe-Salpeter equation.
Specifically, we will use [[Bulk material: h-BN|bulk h-BN]] as an example.


This tutorial guides you through the workflow of a calculation of the optical spectrum of a given material by solving the Bethe-Salpeter equation.
[[File:HBN-bulk-3x3-annotated.png|x200px|center|Atomic structure of bulk hBN]]
Specifically we will use [[Bulk material: h-BN|bulk h-BN]] as an example.
 
Before starting, you need to obtain the tarballs for hBN. See instructions on the [[Tutorials|main tutorials page]].


Start by downloading the databases into a dedicated directory. ADD DOWNLOAD!!!
The target quantity in a Bethe-Salpeter calculation is the macroscopic dielectric matrix &epsilon;<sub>M</sub>. The following quantities/steps are needed to obtain &epsilon;<sub>M</sub>:
 
Note that if you have run all previous tutorials you may have already the SAVE directory with all needed databases. You can use those, but we recommend you to download and use the provided folder instead for the sake of consistency.   


The calculation of an optical spectrum consists of the following stages:
[[File:Scheme1b.png|500px|center|BSE calculation scheme]]


The optical absorption spectrum corresponds to Im&epsilon;<sub>M</sub>(&omega;). Following this scheme we go through the flow of a calculation:
__TOC__
__TOC__


<!-- - Calculating the effective two-particle Hamiltonian (which implies calculating the matrix elements of the Bethe-Salpeter kernel)
===Step 1: Static screening===
Use the ''SAVE'' folders that are already provided and type:
$ cd YAMBO_TUTORIALS/hBN/YAMBO
 
Follow the '''[[Static screening]]''' module and then '''return to this tutorial '''
 
===Step 2: Bethe-Salpeter kernel===
Follow the module on '''[[Bethe-Salpeter kernel]]''' and '''return to this tutorial'''


- Diagonalizing the effective two-particle Hamiltonian and calculate the spectra from the eigenvectors and eigenvalues-->
===Step 3: Diagonalisation of the excitonic Hamiltonian ===
This is the step in which you obtain the spectra. Mathematically this implies solving a large eigenvalue problem. In this tutorial, we diagonalise the whole Bethe-Salpeter matrix, but there are other numerical approaches available in Yambo. The difference between these approaches and when they should be used is the object of [[BSE solvers overview|one of the next tutorials]].


Follow the module on '''[[Bethe-Salpeter solver: diagonalization]]''' then '''return to this tutorial'''
===Step 4: Include previous quasiparticle (GW) results ===
In Step 3, we included the quasiparticle corrections to the Kohn-sham energies as a scissor operator. An alternative is to use the results from a previous run of Yambo.
Follow the module on '''[[Bethe-Salpeter on top of quasiparticle energies]]''' and '''return to this tutorial'''
==Links==
* Back to [[Rome 2023#Tutorials]]
* [[Modules|Back to technical modules menu]]
* [[Tutorials|Back to tutorials menu]]
<!--
= Calculating the effective two-particle Hamiltonian =   
= Calculating the effective two-particle Hamiltonian =   


Line 40: Line 62:
   1 | 40 |                 
   1 | 40 |                 
  %
  %
   [[Variables#NGsBlkXs|NGsBlkXs]]= 2 Ry
   [[Variables#NGsBlkXs|NGsBlkXs]]= 4 Ry


The first variable gives how many bands are included in the sum to calculate the static response function. The second is a cutoff for the dimension of the static dielectric matrix.
The first variable gives how many bands are included in the sum to calculate the static response function. The second is a cutoff for the dimension of the static dielectric matrix.
Line 53: Line 75:


Run the calculation by invoking yambo:
Run the calculation by invoking yambo:
  $ yambo -J 3D_BSE -F 01_3D_BSE_screening.in
  $ yambo -F 01_3D_BSE_screening.in -J 3D_BSE


In the log (l_em1s) of the calculation you can see that after calculating the dipole matrix elements, for each q vector yambo calculates the IP response function and by inversion the RPA response function  
In the log (l_em1s) of the calculation you can see that after calculating the dipole matrix elements, for each q vector yambo calculates the IP response function and by inversion the RPA response function  
Line 88: Line 110:


  [[Variables#BSENGexx|BSENGexx]] = 30 Ry
  [[Variables#BSENGexx|BSENGexx]] = 30 Ry
  [[Variables#BSENGBlk|BSENGBlk]] = 2 Ry
  [[Variables#BSENGBlk|BSENGBlk]] = 4 Ry
  % [[Variables#BSEBands|BSEBands]]
  % [[Variables#BSEBands|BSEBands]]
   6 | 10 |       
   6 | 10 |       
Line 112: Line 134:


Run the calculation by invoking yambo in the command line:
Run the calculation by invoking yambo in the command line:
  $ yambo -J 3D_BSE -F 02_3D_BSE_kernel.in
  $ yambo -F 02_3D_BSE_kernel.in -J 3D_BSE
In the log (either in standard output or in l_optics_bse_bsk), after various setup/loading, the kernel is calculated:   
In the log (either in standard output or in l_optics_bse_bsk), after various setup/loading, the kernel is calculated:   
   
   
Line 140: Line 162:
(1) diagonalize the full Hamiltonian (diagonalization solver)  
(1) diagonalize the full Hamiltonian (diagonalization solver)  


(2) use the subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm| Lanczos algorithm] and by-pass diagonalization with the Haydock approach<ref>R. Haydock, in
(2) use the subspace iterative [https://en.wikipedia.org/wiki/Lanczos_algorithm | Lanczos algorithm] and by-pass diagonalization with the Haydock approach<ref>R. Haydock, in
  ''Solid State Phys.'', '''35''' 215 (1980)
  ''Solid State Phys.'', '''35''' 215 (1980)
  edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press</ref> (Lanczos-Haydock solver)
  edited by H. Ehrenfest, F. Seitz, and D. Turnbull, Academic Press</ref> (Lanczos-Haydock solver)
Line 173: Line 195:


Run yambo:  
Run yambo:  
  $ yambo -J 3D_BSE -F 03_3D_BSE_diago_solver.in  
  $ yambo -F 03_3D_BSE_diago_solver.in -J 3D_BSE 
In the log (either in standard output or in l-3d_BSE_optics_bse_bsk_bss), after various setup/loading, the BSE is diagonalized using the linked linear algebra libraries:  
In the log (either in standard output or in l-3d_BSE_optics_bse_bsk_bss), after various setup/loading, the BSE is diagonalized using the linked linear algebra libraries:  
  <01s> [06] BSE solver(s)
  <01s> [06] BSE solver(s)
Line 224: Line 246:
To use the Lanczos-Haydock solver invoke yambo with "-y h" option in the command line:
To use the Lanczos-Haydock solver invoke yambo with "-y h" option in the command line:


  $ yambo -y h
  $ yambo -y h -F 03_3D_BSE_haydock_solver.in
Beside the same input parameters defined for the diagonalization solver, the parameter
Beside the same input parameters defined for the diagonalization solver, the parameter
  [[Variables#BSHayTrs|BSHayTrs]]= -0.02000           
  [[Variables#BSHayTrs|BSHayTrs]]= -0.02000           
Line 230: Line 252:
The minus sign indicates that the average difference over the specified energy range is considered (i.e. that means that cancellations of error may occur) as opposed to the maximum absolute difference over the specified energy range (plus sign). For the moment we leave this variable unchanged. This parameter ultimately determines the terms are included in the continued fraction here above. Later we explore how this variable influences the final result.   
The minus sign indicates that the average difference over the specified energy range is considered (i.e. that means that cancellations of error may occur) as opposed to the maximum absolute difference over the specified energy range (plus sign). For the moment we leave this variable unchanged. This parameter ultimately determines the terms are included in the continued fraction here above. Later we explore how this variable influences the final result.   


Invoke yambo to run the calculation.
Invoke yambo to run the calculation:
 
$ yambo -F 03_3D_BSE_haydock_solver.in -J "3D_BSE-low,3D_BSE" 
This outputs the following log:
...
  <01s> [06] BSE solver(s)
  <01s> [06] BSE solver(s)
  <01s> [06.01] Haydock solver
  <01s> [06.01] Haydock solver
  <01s> [Haydock] Iteration 1
  <01s> [Haydock] Iteration 1
  <03s> [Haydock] Iteration 27 Accuracy :  0.01956| -0.02000
  <03s> [Haydock] Iteration 21 Accuracy :  0.01647| -0.02000
The Lanczos-Haydock iterative procedure converged to the desired accuracy in 27 iterations.
...
The Lanczos-Haydock iterative procedure converged to the desired accuracy in 21 iterations.


This runs only produces human readable files. That means that if you changes the input parameters (such as the broadening or the energy range) the Lanczos-Haydock procedure has to be repeated.  
This runs only produces human readable files. That means that if you changes the input parameters (such as the broadening or the energy range) the Lanczos-Haydock procedure has to be repeated.  
Line 262: Line 287:
which enforces a stricter condition on the convergence of the iterative process (see above)
which enforces a stricter condition on the convergence of the iterative process (see above)


Running yambo, outputs the following log  
Running yambo:
$ yambo -F 03_3D_BSE_haydock_solver.in -J "3D_BSE-high,3D_BSE" 
outputs the following log  
...
  <01s> [06] BSE solver(s)
  <01s> [06] BSE solver(s)
  <01s> [06.01] Haydock solver
  <01s> [06.01] Haydock solver
  <01s> [Haydock] Iteration 1
  <01s> [Haydock] Iteration 1
  <06s> [Haydock] Iteration 47 Accuracy : 0.01965|  0.02000
  <06s> [Haydock] Iteration 45 Accuracy :   0.0098|  0.02000
Now 47 iterations, rather than 27, were needed to reach the desired accuracy.
...
Now 45 iterations, rather than 21, were needed to reach the desired accuracy.
By plotting these results:
By plotting these results:
  $ gnuplot
  $ gnuplot
Line 277: Line 306:


==Reading the QP corrections from a previous ''GW'' calculation==
==Reading the QP corrections from a previous ''GW'' calculation==
In the above calculation we have used a simple scissor operator to correct the Kohn-Sam DFT energies. In this part we see how we can instead take the corrections from a previous Yambo Gw calculation.
We create and edit the input. This time instead of proceeding in three steps as before, we create one input performing all three steps:
$yambo -o b -k sex -y d -V qp -F Ins/05_3D_QP_BSE.in
We set all parameters as in the previous calculation, except for the part regarding the QP correction:
  [[Variables#KfnQPdb|KfnQPdb]]= "E < 3D_QP_BSE/ndb.QP"              # [EXTQP BSK BSS] Database
  [[Variables#KfnQP_N|KfnQP_N]]= 1                  # [EXTQP BSK BSS] Interpolation neighbours
  % [[Variables#KfnQP_E|KfnQP_E]]
  0.000000 | 1.000000 | 1.000000 |        # [EXTQP BSK BSS] E parameters  (c/v) eV|adim|adim
%
Instead of setting the values for the scissor, we give the path to a database (3D_QP_BSE/ndb.QP) which contains the QP corrections. This has been created by running a GW calculation as in the [[How to obtain the quasi-particle band structure of a bulk material: h-BN |GW tutorial]].
Run Yambo:
$ yambo -F Ins/05_3D_QP_BSE.in -J "3D_QP_BSE,3D_BSE"
This produces the following log in the standard output. Note Section 4 (regarding external QP corrections to the kernel):
<01s> [04.01] External QP corrections (K)
<01s> [QP@K] E<3D_QP_BSE/ndb.QP[ PPA XG:39 Xb:1  40 Scb:1  40]
<01s> [QP] Kpts covered exactly  [o/o]: 100.0000
This tells you that the file was found, read correctly and that the '''k''' points found in the file matched the ones you are using for the current calculation (otherwise interpolation would be needed).
It is crucial to check that the file has been read, since if not Yambo gives a warning but continues the calculation (with no QP corrections at all!).
As in the previous calculation the final results of the calculation are the files with the spectral functions. Let's compare the results for the optical absorption spectrum with those obtained previously with a simple scissor:
$ gnuplot
...
plot 'o-3D_QP_BSE.eps_q1_diago_bse' u 1:2 w l t 'Explicit QP', 'o-3D_BSE.eps_q1_diago_bse' u 1:2 w l t 'Scissor'
[[File:03 bse diago qp.png|none|600px]]
It is clear that this makes a difference in the peak distribution and intensity. Note that beside a simple shift you can renormalise as well the bandwidth of the valence and conduction bands in KfnQP_E (respectively the third and second value). You can try as an exercise to set up a new calculation using e.g. 1.440000 | 1.200000 | 0.900000 | for KfnQP_E.


=References =
=References =
<references />
<references />
-->

Latest revision as of 14:08, 19 May 2023

This tutorial guides you through the workflow of a calculation of the optical spectrum of a given material by solving the Bethe-Salpeter equation. Specifically, we will use bulk h-BN as an example.

Atomic structure of bulk hBN

Before starting, you need to obtain the tarballs for hBN. See instructions on the main tutorials page.

The target quantity in a Bethe-Salpeter calculation is the macroscopic dielectric matrix εM. The following quantities/steps are needed to obtain εM:

BSE calculation scheme

The optical absorption spectrum corresponds to ImεM(ω). Following this scheme we go through the flow of a calculation:

Step 1: Static screening

Use the SAVE folders that are already provided and type:

$ cd YAMBO_TUTORIALS/hBN/YAMBO

Follow the Static screening module and then return to this tutorial

Step 2: Bethe-Salpeter kernel

Follow the module on Bethe-Salpeter kernel and return to this tutorial

Step 3: Diagonalisation of the excitonic Hamiltonian

This is the step in which you obtain the spectra. Mathematically this implies solving a large eigenvalue problem. In this tutorial, we diagonalise the whole Bethe-Salpeter matrix, but there are other numerical approaches available in Yambo. The difference between these approaches and when they should be used is the object of one of the next tutorials.

Follow the module on Bethe-Salpeter solver: diagonalization then return to this tutorial

Step 4: Include previous quasiparticle (GW) results

In Step 3, we included the quasiparticle corrections to the Kohn-sham energies as a scissor operator. An alternative is to use the results from a previous run of Yambo.

Follow the module on Bethe-Salpeter on top of quasiparticle energies and return to this tutorial

Links