How to choose the input parameters: Difference between revisions

From The Yambo Project
Jump to navigation Jump to search
 
(39 intermediate revisions by 5 users not shown)
Line 1: Line 1:
In the [[Calculating optical spectra including excitonic effects: a step-by-step guide|previous tutorial]], you have been guided step-by-step through the calculations of the optical spectrum of bulk hBN by solving the Bethe-Salpeter equation. The values for the relevant input parameters have then been given to you.
In a [[Calculating optical spectra including excitonic effects: a step-by-step guide|previous tutorial]], you have been guided step-by-step through the calculations of the optical spectrum of bulk ''h-BN'' by solving the Bethe-Salpeter equation. The values for the relevant input parameters have then been given to you.


In this tutorial you will learn how to choose those parameters. These parameters are related either to the truncation of infinite sums or to the approximations of infinitesimal with small, but finite quantities. A wrong choice of these parameters can lead to inaccurate or even physically wrong results. One then needs to run a series of calculations by changing the parameters till the results are '''converged''' , meaning they are changing by a negligible amount. This is a tedious still essential part of the calculations.
In this tutorial you will learn how to choose these parameters which are related either to the truncation of infinite sums or to the approximations of infinitesimal with small, but finite quantities. A wrong choice of these parameters can lead to inaccurate or even physically wrong results. One needs to run a series of calculations by changing the parameters until the results are ''converged'', meaning they are changing by what you consider a negligible amount. This is a tedious yet essential part of determining the optical properties of a system.


Note that all the following operations can be automated. A useful python-based interface to yambo, [http://yambopy.readthedocs.io/en/devel/tutorial.html yambopy], can be used for this purpose. It is worth however to go at least once through the pain of a 'by-hand' convergence study so to better understand the automated process.
Note that all the operations described below can be automated. A flexible python-based interface to yambo, [[First steps in Yambopy|yambopy]], can be used for this purpose. It is worth however to go at least once through the pain of a 'by-hand' convergence study so to better understand the automated process.


Coming back to the scheme to calculate the macroscopic dielectric matrix within Bethe-Salpeter (BS), here the list of the parameters that have to be determined by convergence studies:
==Before starting==
 
Have completed (or be familiar with the content of) the following tutorials:
* [[First steps: a walk through from DFT to optical properties]]
* [[Calculating optical spectra including excitonic effects: a step-by-step guide]]
 
==Background==
 
Coming back to the scheme to calculate the macroscopic dielectric matrix within Bethe-Salpeter (BS), the list of the parameters that have to be determined by convergence studies are:


[[File:Scheme2.png|500px|center|convergence parameters]]
[[File:Scheme2.png|500px|center|convergence parameters]]


First the parameters for the screening have to be determined, then the parameters for the BS kernel. Finally the convergence with respect to the choice of the k-mesh needs to performed.  
This provides as well a scheme for a full convergence study:
* first the parameters for the screening have to be determined,  
* then the parameters for the BS kernel, and
* finally the convergence with respect to the choice of the k-mesh needs to performed.  


==Convergence of the static screening==
==Convergence of the static screening==
Line 15: Line 26:
[[File:Yambo-CH5.png|none|x30px|Yambo tutorial image]]
[[File:Yambo-CH5.png|none|x30px|Yambo tutorial image]]
where ''&chi;<sub>GG'</sub>'' is given by
where ''&chi;<sub>GG'</sub>'' is given by
[[File:Yambo-CH7.png|none|x50px|Yambo tutorial image]]
[[File:Dyson_rpa.png|none|x50px|Yambo tutorial image]]


* <code>[[Variables#NGsBlkXs|NGsBlkXs]]</code> : The dimension of the microscopic inverse matrix, related to [[Local fields]]
* <code>[[Variables#NGsBlkXs|NGsBlkXs]]</code> : The dimension of the microscopic inverse matrix, related to [[Local fields]]
Line 23: Line 34:
* <code>[[Variables#FFTGvecs|FFTGvecs]]</code>
* <code>[[Variables#FFTGvecs|FFTGvecs]]</code>
since generally, fewer G-vectors are needed than what are needed in DFT calculations. This can be critical for large calculations, or for supercells with a lot of vacuum.
since generally, fewer G-vectors are needed than what are needed in DFT calculations. This can be critical for large calculations, or for supercells with a lot of vacuum.
Note that this parameter appear only when the input is generated specifying the verbosity level <code>-V RL</code>
Remember that the latter parameter appears only when the input is generated specifying the verbosity level <code>-V RL</code>
 
The convergence for the static screening then is similar to the convergence of other response functions and the plasmon pole in [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW calculations]] and won't be covered here. Note in fact that you can re-use the database obtained (and converged) from a previous plasmon pole calculation as long as the same k-points are used.


The convergence for the static screening then is similar to the convergence of other response functions and for the plasmon-pole in [[How to obtain the quasi-particle band structure of a bulk material: h-BN|GW calculations]] and won't be covered here. Note in fact that you can re-use the database obtained (and converged) from a previous screening calculation as long as the same k-points are used.


==Convergence of the macroscopic dielectric function==
==Convergence of the macroscopic dielectric function==
Line 37: Line 47:
* the k-point mesh of the DFT calculations defines the '''k'''   
* the k-point mesh of the DFT calculations defines the '''k'''   


Basically we need a large enough basis of transitions (pair of quasiparticle states) to correctly describe the excitons in the energy region of interest.
Basically we need a large enough basis of transitions (pair of quasiparticle states) to correctly describe the excitons (in the energy region of interest).


Furthermore, in the kernel part
Furthermore, in the kernel components


[[File:BSE1_Eq3.png|none|x100px]]
[[File:BSE1_Eq3.png|none|x100px]]


summations over '''G''' vectors appear:
the summations over '''G''' vectors appear. These corresponds to two parameters:


* <code>[[Variables#BSENGblk|BSENGblk]]</code>: defines the screened interaction block size (double sum in ''W'').
* <code>[[Variables#BSENGblk|BSENGblk]]</code>: defines the screened interaction block size (double sum in ''W''), related to the electron-hole attraction.
* <code>[[Variables#BSENGexx|BSENGexx]]</code>: defines the components of Hartree potential (the sum in ''V'').
* <code>[[Variables#BSENGexx|BSENGexx]]</code>: defines the components of Hartree potential (the sum in ''V''), related to local fields.


In the following we will see how the spectrum depends on these parameters.
In the following we will see how the spectrum depends on these parameters.


===Prepare the common databases===
===Prepare the common databases===
Enter the <code>6x6x2</code> directory and run the initialization.  
 
Enter the <code>hBN</code> directory (containing a 6x6x2 k-grid SAVE) and run the initialization if you didn't do it before.  
 
> cd YAMBO_TUTORIALS/hBN/YAMBO
 
For all the calculations in this sessions you can fix the screening parameters, and thus calculate the screening once for all.
For all the calculations in this sessions you can fix the screening parameters, and thus calculate the screening once for all.
Following the scheme we learned in previous tutorial:
Following the scheme we learned in previous tutorial:


- Create the input for calculating the screening:
* Create the input for calculating the screening:


  $ yambo -F 02_screening.in -b
  > yambo -F 02_screening.in -X s


- Modify the input as follows
* Modify the input as follows


  NGsBlkXs = 4 Ry
  NGsBlkXs = 4 Ry
Line 69: Line 83:
  %
  %


- Run the calculation for the screening
* Run the calculation for the screening


  $ yambo -F 02_screening.in  
  > yambo -F 02_screening.in  


As we do not specify a particular prefix, the screening databases  <code>ndb.dip_iR_and_P, ndb.em1s</code> are saved in the <code>SAVE</code> folder and visible to all the subsequent jobs you will launch is this directory.
As we do not specify a particular prefix, the screening databases  <code>ndb.dip_iR_and_P, ndb.em1s</code> are saved in the <code>SAVE</code> folder and visible to all the subsequent jobs you will launch is this directory.


===Convergence with the cut-off for reciprocal lattice vectors sums===  
===Convergence with the cut-off for reciprocal lattice vectors sums===  
Create the input for calculating the macroscopic dielectric function:
As next step, create the input for calculating the macroscopic dielectric function:
  $ yambo -F 03_bse.in -o b -k sex -y d -V qp
  > yambo -F 03_bse.in -o b -k sex -y d -V qp
Which combines the BS kernel + BS solver (diagonalization) runlevels
Which combines the BS kernel + BS solver (diagonalization) runlevels
- Modify the input as follows
* Modify the input as follows
  [[Variables#BSENGexx|BSENGexx]] = 30 Ry
  [[Variables#BSENGexx|BSENGexx]] = 30 Ry
  [[Variables#BSENGBlk|BSENGBlk]] = 4 Ry
  [[Variables#BSENGBlk|BSENGBlk]] = 4 Ry
Line 88: Line 102:
   2.00000 | 8.00000 | eV     
   2.00000 | 8.00000 | eV     
  %
  %
  [[Variables#BEnSteps|BEnSteps]]= 200      
  [[Variables#BEnSteps|BEnSteps]]= 100      
  % [[Variables#BDmRange|BDmRange]]
  % [[Variables#BDmRange|BDmRange]]
   0.10000 |  0.10000 | eV     
   0.10000 |  0.10000 | eV     
Line 98: Line 112:
   1.440000 | 1.000000 | 1.000000 |
   1.440000 | 1.000000 | 1.000000 |
  %
  %
[[Variables#BSHayTrs|BSHayTrs]]= 0.02000
* Launch the calculation:
Launch the calculation:
  > yambo -F 03_bse.in -J 3D_4Ry_GBlk
  $ yambo -F 03_bse.in -J 3D_4Ry_GBlk
This produces the file with the optical spectrum <code>o-3D_4Ry_GBlk.eps_q1_diago_bse</code>.
This produces the file with the optical spectrum <code>o-3D_4Ry_GBlk.eps_q1_diago_bse</code>.


Open the <code>03_bse.in</code> in an editor and changes:
* Open the <code>03_bse.in</code> in an editor and changes:
  [[Variables#BSENGBlk|BSENGBlk]] = '''3 Ry'''
  [[Variables#BSENGBlk|BSENGBlk]] = '''3 Ry'''
while leaving the rest untouched.
while leaving the rest untouched.
Launch the calculation:
* Launch the calculation:
  $ yambo -F 03_bse.in -J 3D_3Ry_GBlk
  > yambo -F 03_bse.in -J 3D_3Ry_GBlk
This produces the file with the optical spectrum <code>o-3D_3Ry_GBlk.eps_q1_diago_bse</code>.  
This produces the file with the optical spectrum <code>o-3D_3Ry_GBlk.eps_q1_diago_bse</code>.  
<code>BSENGBlk= '''2 Ry'''</code>
Repeat this operation for <code>BSENGBlk= '''2 Ry'''</code> and <code>BSENGBlk= '''1 Ry'''</code>. Remember to change the prefix correspondingly so that you can later on identify the job, e.g. <code>-J 
3D_3Ry_GBlk</code> for <code>BSENGBlk= '''2 Ry'''</code>. etc.


Finally plot the obtained optical spectra:
* Repeat this operation for <code>BSENGBlk= '''2 Ry'''</code> and <code>BSENGBlk= '''1 Ry'''</code>. Remember to change the prefix correspondingly so that you can later on identify the job, e.g. <code>-J 3D_2Ry_GBlk</code> for <code>BSENGBlk='''2 Ry'''</code> etc.
  $ gnuplot
 
* Finally plot the obtained optical spectra:
  > gnuplot
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '4 Ry','o-3D_3Ry_GBlk.eps_q1_diago_bse' w l t '3 Ry',  'o-3D_2Ry_GBlk.eps_q1_diago_bse' w l t '2 Ry', 'o-3D_1Ry_GBlk.eps_q1_diago_bse' w l t '1 Ry'
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '4 Ry','o-3D_3Ry_GBlk.eps_q1_diago_bse' w l t '3 Ry',  'o-3D_2Ry_GBlk.eps_q1_diago_bse' w l t '2 Ry', 'o-3D_1Ry_GBlk.eps_q1_diago_bse' w l t '1 Ry'


[[File:03 bse conv GBlk.png|500px|center|convergence with Gblk ]]
[[File:03 bse conv GBlk.png|500px|center|convergence with Gblk ]]


This shows that <code>BSENGBlk= '''2 Ry'''</code> gives already a results close to convergence and we can confidently lower <code>BSENGBlk</code> to 2,3 Ry.  
This shows that <code>BSENGBlk= '''2 Ry'''</code> gives already a results close to convergence and we can confidently lower <code>BSENGBlk</code> to 2 or 3 Ry.  


Repeat now the same procedure with <code>BSENGexx</code>. Change the value to 10 Ry and 20 Ry. Remember to change the prefix correspondingly so that you can later on identify the job, e.g. <code>-J  
* Repeat now the same procedure with <code>BSENGexx</code>. Change the value to 10 Ry and 20 Ry. Remember to change the prefix correspondingly so that you can later on identify the job, e.g. <code>-J 3D_10Ry_Gexx</code> for <code>BSENGexx= '''10 Ry'''</code> etc., and remember to keep the value of <code>BSENGBlk</code> the same throughout these calculations.
3D_10Ry_Gexx</code> for <code>BSENGexx= '''10 Ry'''</code>. etc.


Finally plot the obtained optical spectra:
* Finally plot the obtained optical spectra:
  $ gnuplot
  > gnuplot
   plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '30 Ry' ls 1,'o-3D_20Ry_Gexx.eps_q1_diago_bse' w l t '20 Ry',  'o-3D_10Ry_Gexx.eps_q1_diago_bse' w l t '10 Ry'
   plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '30 Ry' ls 1,'o-3D_20Ry_Gexx.eps_q1_diago_bse' w l t '20 Ry',  'o-3D_10Ry_Gexx.eps_q1_diago_bse' w l t '10 Ry'


Line 133: Line 144:


===Convergence with the BS bands===  
===Convergence with the BS bands===  
You can then repeat the procedure above keeping fixed all parameters except
You can now repeat the procedure above keeping fixed all parameters to their original values except for
  % BSEBands
  % BSEBands
  6 | 10 |       
  6 | 10 |       
  %
  %
Typically only the bands close to the Fermi energies contributes to the spectrum. If the energy separation between two bands is much larger than the spectral energy range, you can assume the corresponding transitions are not contributing to the spectra.  
Typically only the bands which are close to the Fermi energies contributes to the spectrum. If the energy separation between two bands is much larger than the spectral energy range, you can assume the corresponding transitions are not contributing to the spectra.  
Repeat then the calculation for the optical spectrum using the following band ranges: ''7-10'', ''8-10'', ''6-9'', ''7-9'' and ''8-9''. When launching the job remember to identify your job with a recognizable name, e.g. <code>-J 3D_7-9_BND</code>.   
 
* Repeat then the calculation for the optical spectrum using the following band ranges:  
''7-10'', ''8-10'', ''6-9'', ''7-9'' and ''8-9''.  
 
When launching the job remember to identify your job with a recognizable name, e.g. <code>-J 3D_7-9_BND</code> for the ''7-9'' range.   


Plot then the optical spectra obtained from the different runs:
* Plot the optical spectra obtained from the different runs:
  $ gnuplot
  > gnuplot
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_7-10_BND.eps_q1_diago_bse' w l t '7-10 Bands', 'o-3D_8-10_BND.eps_q1_diago_bse' w l t '8-10 Bands'
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_7-10_BND.eps_q1_diago_bse' w l t '7-10 Bands', 'o-3D_8-10_BND.eps_q1_diago_bse' w l t '8-10 Bands'
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_6-9_BND.eps_q1_diago_bse' w l t '6-9 Bands', 'o-3D_7-9_BND.eps_q1_diago_bse' w l t '7-9 Bands', 'o-3D_8-9_BND.eps_q1_diago_bse' w l t '8-9 Bands'
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_6-9_BND.eps_q1_diago_bse' w l t '6-9 Bands', 'o-3D_7-9_BND.eps_q1_diago_bse' w l t '7-9 Bands', 'o-3D_8-9_BND.eps_q1_diago_bse' w l t '8-9 Bands'


[[File:03 bse conv Bnds.png|500px|left|convergence with Bnds]] [[File:03 bse conv Bnds2.png|500px|center|convergence with Bnds]]
[[File:03 band convergence 1.png|500px|left|Band convergence]] [[File:03 band convergence2.png|500px|center|Band convergence 2]]


From the plots we see we need to include valence bands from at least 6-7 (those bands are degenerate at several high symmetry points of the Brillouin zone) and band 10.
The plots show that we need to include valence bands from at least 6-7 (those bands are degenerate at several high symmetry points of the Brillouin zone) and conduction at least up to band 10.
To see if this is sufficient you can try to include more bands.
To see if this is sufficient you can try to include more bands.
For example you can prepare and run calculations with the following bands ranges:   ''1-12'', ''4-12'', ''4-14'' and plot the results  
 
  $ gnuplot
For example you can prepare and run calculations with the following bands ranges: ''1-12'', ''4-12'', ''4-14'' and plot the results:
  > gnuplot
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_4-12_BND.eps_q1_diago_bse' w l t '4-12 Bands', 'o-3D_4-14_BND.eps_q1_diago_bse' w l t '4-14 Bands', 'o-3D_1-12_BND.eps_q1_diago_bse' w l t '1-12 Bands' ls 4
  plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_4-12_BND.eps_q1_diago_bse' w l t '4-12 Bands', 'o-3D_4-14_BND.eps_q1_diago_bse' w l t '4-14 Bands', 'o-3D_1-12_BND.eps_q1_diago_bse' w l t '1-12 Bands' ls 4


[[File:03 bse conv Bnds1.png|500px|center|convergence with Bnds]]
[[File:03 bse conv Bnds1.png|500px|center|convergence with Bnds]]


Which is showing that the spectrum changes only marginally when adding those bands.
The plot is showing that the spectrum changes only marginally when adding those bands.


==Convergence with the k-point mesh==
==Convergence with the k-point mesh==
For this part you need the SAVE databases for different meshes which are contained in the corresponding folders:
As final step you need to study the dependence on the '''k''' mesh. This parameter cannot be changed in yambo. For each '''k''' mesh you need to run a separate non-self consistent DFT calculation (on top of a converged self-consistent one) and generate the corresponding SAVE folders. Be careful to change '''only''' the '''k''' mesh.
For this exercise the SAVE databases for different meshes were generated beforehand in the [http://www.yambo-code.org/educational/tutorials/files/hBN-convergence-kpoints.tar.gz hBN-convergence-kpoints.tar.gz] tarball and are contained in the corresponding folders:
> pwd
YAMBO_TUTORIALS/hBN-convergence-kpoints/YAMBO
> ls
  9x9x3 12x12x4 15x15x5 18x18x6
  9x9x3 12x12x4 15x15x5 18x18x6


Following the scheme we learned in previous tutorial:  
By now you should be familiar with the process:


- Enter the 9x9x3 directory  
* Enter the 9x9x3 directory  
- Run the initialization  
* Run the initialization  
- Create the input for calculating the screening:
* Create the input for calculating the screening:
   $ yambo -F 02_screening.in -J 3D_993 -b
   > yambo -F 02_screening.in -J 3D_993 -X s
- Modify the input as follows
* Modify the input as follows
  [[Variables#NGsBlkXs|NGsBlkXs]] = 4 Ry
  [[Variables#NGsBlkXs|NGsBlkXs]] = 4 Ry
  %[[Variables#BndsRnXs|BndsRnXs]]
  %[[Variables#BndsRnXs|BndsRnXs]]
Line 175: Line 196:
  1.000 | 1.000 | 1.000|
  1.000 | 1.000 | 1.000|
  %
  %
- Run the calculation for the screening
* Run the calculation for the screening
  $ yambo -F 02_screening.in -J 3D_993
  > yambo -F 02_screening.in -J 3D_993
- Create the input for calculating the macroscopic dielectric function:
* Create the input for calculating the macroscopic dielectric function:
  $ yambo -F 03_bse.in -J 3D_993 -o b -k sex -y h -V qp
  > yambo -F 03_bse.in -J 3D_993 -o b -k sex -y h -V qp
Which combines the BS kernel + BS solver (Lanczos-Haydock) runlevels
Which combines the BS kernel + BS solver (Lanczos-Haydock) runlevels
- Modify the input as follows
* Modify the input as follows
  [[Variables#BSENGexx|BSENGexx]] = 30 Ry
  [[Variables#BSENGexx|BSENGexx]] = 30 Ry
  [[Variables#BSENGBlk|BSENGBlk]] = 4 Ry
  [[Variables#BSENGBlk|BSENGBlk]] = 4 Ry
Line 200: Line 221:
  %
  %
  [[Variables#BSHayTrs|BSHayTrs]]= 0.02000
  [[Variables#BSHayTrs|BSHayTrs]]= 0.02000
- Launch the calculation:
* Launch the calculation:
  $ yambo -F 03_bse.in -J 3D_993
  > yambo -F 03_bse.in -J 3D_993
-Repeat the procedure for the <code>12x12x4</code> (it will take few minutes) with the difference you will use a different prefix: <code>-J 3D_12124</code>.
* Repeat the procedure for the <code>12x12x4</code> (it will take few minutes) with the difference you will use a different prefix: <code>-J 3D_12124</code>.


The convergence on the k-point is the most expensive part. Note that for the two larger meshes the calculations of both the screening and kernel take 10 to 30 minutes each.  
The convergence on the k-point is certainly the most tedious and expensive part. Note that for the two larger meshes the calculations of both the screening and kernel take about 10 to 30 minutes each.  
If short of time/resources postpone these calculations. If you have the time and computational resources repeat the above procedure for <code>15x15x5</code> and <code>18x18x6</code>.
If short of time/resources postpone these calculations. If you have the time and computational resources repeat the above procedure for <code>15x15x5</code> and <code>18x18x6</code>.
Note that the BS kernel starts becoming very (too) large and you need to fragment it '''to speed up the IO'''. Then '''after''' generating and modifying the input the input invoke yambo again as:
 
  $ yambo -F 03_bse.in -J 3D_15155 -o b -k sex -y h -V io
Note that for those meshes the BS kernel database is becoming very/too large and you need to fragment it. To do that '''after''' you generated and modified the input invoke yambo again as:
  > yambo -F 03_bse.in -J 3D_15155 -o b -k sex -y h '''-V io'''
and modify the variable  
and modify the variable  
   [[Variables#DBsFRAGpm|DBsFRAGpm]]= "+BS"
   [[Variables#DBsFRAGpm|DBsFRAGpm]]= "+BS"
After that launch the calculation   
Then launch the calculation   
  $ yambo -F 03_bse.in -J 3D_15155
  > yambo -F 03_bse.in -J 3D_15155


If you correctly followed the above procedure you have a file of the optical absorption spectrum for each mesh, e.g. <code>o-3D_993.eps_q1_haydock_bse</code>.
If you correctly followed the above procedure you should have a file with the optical absorption spectrum for each mesh, e.g. <code>o-3D_993.eps_q1_haydock_bse</code>.
To see at the effect of k-points plot those files with <code>gnuplot</code>:
To see the effect of k-points plot those files with <code>gnuplot</code> (remember to include the 6x6x2 calculation which should still be inside <code>hBN/YAMBO</code>, if the parameters don't match you simply rerun it here by creating a <code>6x6x2</code> directory and copying the SAVE there):
  $ gnuplot
  > gnuplot
  > plot '18x18x6/o-3D_18186.eps_q1_haydock_bse' w l t '18x18x6, '15x15x5/o-3D_15155.eps_q1_haydock_bse' w l t '15x15x5', . . .
  plot '18x18x6/o-3D_18186.eps_q1_haydock_bse' w l t '18x18x6, '15x15x5/o-3D_15155.eps_q1_haydock_bse' w l t '15x15x5','12x12x4/o-3D_12124.eps_q1_haydock_bse' w l t '12x12x4,  
  . . . '12x12x4/o-3D_12124.eps_q1_haydock_bse' w l t '12x12x4, '9x9x3/o-3D_993.eps_q1_haydock_bse' w l t '9x9x3', '6x6x2/o-3D_662.eps_q1_haydock_bse' w l t '6x6x2'
'9x9x3/o-3D_993.eps_q1_haydock_bse' w l t '9x9x3', '6x6x2/o-3D_662.eps_q1_haydock_bse' w l t '6x6x2'


[[File:03 bse conv k.png|500px|center|convergence with k points]]
[[File:03 bse conv k.png|500px|center|convergence with k points]]


From this plot you can notice that:  
From this plot you can notice that:
* results with the 6x6x2 mesh are clearly non converged: the first peak is too red shifted, the peak at 6 eV too sharp and intense and there is an 'extra' peak at 7 eV
* results with the 6x6x2 mesh are clearly not converged: the first peak is too red shifted, the peak at 6 eV too sharp and intense and there is an 'extra' peak at 7 eV.
* both the position and shape of the first peak are practically converged with the 9x9x3 mesh
* both the position and shape of the first peak are practically converged with the 9x9x3 mesh.
* conversely the second peak is still not fully converged with the 18x18x6
* conversely the second peak is still not fully converged with the 18x18x6.
The difference behavior in the convergence of the two features depends on the localization of the exciton. The sharp first peak suggests a quite localized exciton. The shape of the second peak a much more delocalized exciton. A finer '''k''' mesh, corresponds in direct space, to considering a larger amount of unit cells. Then when the excitation is delocalized over a large number of unit cells a very fine '''k''' mesh is needed.  
The different behavior in the convergence of the two features depends on the localization of the exciton. The sharp first peak suggests a localized exciton. The shape of the second peak a much more delocalized exciton. A finer '''k''' mesh, corresponds in direct space, to considering a larger amount of unit cells. Then when the excitation is delocalized over a large number of unit cells a very fine '''k''' mesh is needed.  
A too small '''k''' mesh then induces an artificial localization of the excitons which then correspond to artefacts in the spectrum. A nice, instructive discussion on wrong deductions from unconverged '''k''' mesh calculations can be found in the Appendix of Molina-Sanchez et al. (2013).<ref>Alejandro Molina-Sánchez, Davide Sangalli, Kerstin Hummer, Andrea Marini, and Ludger Wirtz
Typically a too coarse '''k''' mesh induces an artificial localization of the excitons which then correspond to artefacts in the spectrum (similar to what is observed for the 6x6x9). A nice, instructive discussion on wrong deductions from unconverged '''k''' mesh calculations can be found in the Appendix of Molina-Sanchez et al. (2013).<ref>Alejandro Molina-Sánchez, Davide Sangalli, Kerstin Hummer, Andrea Marini, and Ludger Wirtz Phys. Rev. B 88, 045412 (2013)</ref>
Phys. Rev. B 88, 045412 (2013)</ref>
 
==Summary==
 
To sum-up the results from this tutorial you have found that for the system under study:
* <code>BSENGBlk= '''3 Ry'''</code>
* <code>BSENGexx= '''10 Ry'''</code>
* <code>BSEBands '''from 6 to 10'''</code>
* To converge the position and shape of the first exciton peak a 12x12x4 mesh is sufficient. For the second exciton peak a mesh larger than 18x18x6 would be needed (indeed Wirtz and co-workers found a k-mesh 24x24x10 was needed.<ref>Ludger Wirtz, Andrea Marini, Myrta Gruning, Angel Rubio in arXiv:cond-mat/0508421 [cond-mat.mtrl-sci]</ref>)
 
==Links==
* Go to [[Calculating optical spectra including excitonic effects: a step-by-step guide]] module
* Back to [[Rome 2023#Tutorials]]
* Back to [[BSE hBN Yambo Virtual 2021 version|BSE tutorial sections]]
* Back to [[ICTP 2022]]
* Back to [[CECAM VIRTUAL 2021]]
* [[Modules|Back to technical modules menu]]
* [[Tutorials|Back to tutorials menu]]


==References==
==References==

Latest revision as of 14:37, 21 May 2023

In a previous tutorial, you have been guided step-by-step through the calculations of the optical spectrum of bulk h-BN by solving the Bethe-Salpeter equation. The values for the relevant input parameters have then been given to you.

In this tutorial you will learn how to choose these parameters which are related either to the truncation of infinite sums or to the approximations of infinitesimal with small, but finite quantities. A wrong choice of these parameters can lead to inaccurate or even physically wrong results. One needs to run a series of calculations by changing the parameters until the results are converged, meaning they are changing by what you consider a negligible amount. This is a tedious yet essential part of determining the optical properties of a system.

Note that all the operations described below can be automated. A flexible python-based interface to yambo, yambopy, can be used for this purpose. It is worth however to go at least once through the pain of a 'by-hand' convergence study so to better understand the automated process.

Before starting

Have completed (or be familiar with the content of) the following tutorials:

Background

Coming back to the scheme to calculate the macroscopic dielectric matrix within Bethe-Salpeter (BS), the list of the parameters that have to be determined by convergence studies are:

convergence parameters

This provides as well a scheme for a full convergence study:

  • first the parameters for the screening have to be determined,
  • then the parameters for the BS kernel, and
  • finally the convergence with respect to the choice of the k-mesh needs to performed.

Convergence of the static screening

The parameters that need to be converged can be understood by looking at the equations:

Yambo tutorial image

where χGG' is given by

Yambo tutorial image
  • NGsBlkXs : The dimension of the microscopic inverse matrix, related to Local fields
  • BndsRnXs : The sum on bands in the independent particle χ0GG'

Furthermore as shown in this tutorial one can reduce the value of

since generally, fewer G-vectors are needed than what are needed in DFT calculations. This can be critical for large calculations, or for supercells with a lot of vacuum. Remember that the latter parameter appears only when the input is generated specifying the verbosity level -V RL

The convergence for the static screening then is similar to the convergence of other response functions and for the plasmon-pole in GW calculations and won't be covered here. Note in fact that you can re-use the database obtained (and converged) from a previous screening calculation as long as the same k-points are used.

Convergence of the macroscopic dielectric function

In the expression for the macroscopic dielectric function

BSE1-Eq4.png

depends on the summation over the pair of quasiparticle states vck.

  • BSEBands : defines the vc pairs.
  • the k-point mesh of the DFT calculations defines the k

Basically we need a large enough basis of transitions (pair of quasiparticle states) to correctly describe the excitons (in the energy region of interest).

Furthermore, in the kernel components

BSE1 Eq3.png

the summations over G vectors appear. These corresponds to two parameters:

  • BSENGblk: defines the screened interaction block size (double sum in W), related to the electron-hole attraction.
  • BSENGexx: defines the components of Hartree potential (the sum in V), related to local fields.

In the following we will see how the spectrum depends on these parameters.

Prepare the common databases

Enter the hBN directory (containing a 6x6x2 k-grid SAVE) and run the initialization if you didn't do it before.

> cd YAMBO_TUTORIALS/hBN/YAMBO

For all the calculations in this sessions you can fix the screening parameters, and thus calculate the screening once for all. Following the scheme we learned in previous tutorial:

  • Create the input for calculating the screening:
> yambo -F 02_screening.in -X s
  • Modify the input as follows
NGsBlkXs = 4 Ry
%BndsRnXs
 1 | 40 |
%
%LongDrXS
 1.000 | 1.000 | 1.000|
%
  • Run the calculation for the screening
> yambo -F 02_screening.in 

As we do not specify a particular prefix, the screening databases ndb.dip_iR_and_P, ndb.em1s are saved in the SAVE folder and visible to all the subsequent jobs you will launch is this directory.

Convergence with the cut-off for reciprocal lattice vectors sums

As next step, create the input for calculating the macroscopic dielectric function:

> yambo -F 03_bse.in -o b -k sex -y d -V qp

Which combines the BS kernel + BS solver (diagonalization) runlevels

  • Modify the input as follows
BSENGexx = 30 Ry
BSENGBlk = 4 Ry
% BSEBands
 6 | 10 |       
%
% BEnRange
  2.00000 | 8.00000 | eV    
%
BEnSteps= 100      
% BDmRange
  0.10000 |  0.10000 | eV    
%
% BLongDir
 1.000000 | 1.000000 | 0.000000 | 
%
% KfnQP_E 
 1.440000 | 1.000000 | 1.000000 |
%
  • Launch the calculation:
> yambo -F 03_bse.in -J 3D_4Ry_GBlk

This produces the file with the optical spectrum o-3D_4Ry_GBlk.eps_q1_diago_bse.

  • Open the 03_bse.in in an editor and changes:
BSENGBlk = 3 Ry

while leaving the rest untouched.

  • Launch the calculation:
> yambo -F 03_bse.in -J 3D_3Ry_GBlk

This produces the file with the optical spectrum o-3D_3Ry_GBlk.eps_q1_diago_bse.

  • Repeat this operation for BSENGBlk= 2 Ry and BSENGBlk= 1 Ry. Remember to change the prefix correspondingly so that you can later on identify the job, e.g. -J 3D_2Ry_GBlk for BSENGBlk=2 Ry etc.
  • Finally plot the obtained optical spectra:
> gnuplot
plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '4 Ry','o-3D_3Ry_GBlk.eps_q1_diago_bse' w l t '3 Ry',  'o-3D_2Ry_GBlk.eps_q1_diago_bse' w l t '2 Ry', 'o-3D_1Ry_GBlk.eps_q1_diago_bse' w l t '1 Ry'
convergence with Gblk

This shows that BSENGBlk= 2 Ry gives already a results close to convergence and we can confidently lower BSENGBlk to 2 or 3 Ry.

  • Repeat now the same procedure with BSENGexx. Change the value to 10 Ry and 20 Ry. Remember to change the prefix correspondingly so that you can later on identify the job, e.g. -J 3D_10Ry_Gexx for BSENGexx= 10 Ry etc., and remember to keep the value of BSENGBlk the same throughout these calculations.
  • Finally plot the obtained optical spectra:
> gnuplot
 plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '30 Ry' ls 1,'o-3D_20Ry_Gexx.eps_q1_diago_bse' w l t '20 Ry',  'o-3D_10Ry_Gexx.eps_q1_diago_bse' w l t '10 Ry'
convergence with Gexx

The plot shows that already with BSENGexx= 10 Ry the spectrum is converged and the cut-off can be lowered to this value.

Convergence with the BS bands

You can now repeat the procedure above keeping fixed all parameters to their original values except for

% BSEBands
6 | 10 |       
%

Typically only the bands which are close to the Fermi energies contributes to the spectrum. If the energy separation between two bands is much larger than the spectral energy range, you can assume the corresponding transitions are not contributing to the spectra.

  • Repeat then the calculation for the optical spectrum using the following band ranges:
7-10, 8-10, 6-9, 7-9 and 8-9. 

When launching the job remember to identify your job with a recognizable name, e.g. -J 3D_7-9_BND for the 7-9 range.

  • Plot the optical spectra obtained from the different runs:
> gnuplot
plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_7-10_BND.eps_q1_diago_bse' w l t '7-10 Bands', 'o-3D_8-10_BND.eps_q1_diago_bse' w l t '8-10 Bands'
plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_6-9_BND.eps_q1_diago_bse' w l t '6-9 Bands', 'o-3D_7-9_BND.eps_q1_diago_bse' w l t '7-9 Bands', 'o-3D_8-9_BND.eps_q1_diago_bse' w l t '8-9 Bands'
Band convergence
Band convergence 2

The plots show that we need to include valence bands from at least 6-7 (those bands are degenerate at several high symmetry points of the Brillouin zone) and conduction at least up to band 10. To see if this is sufficient you can try to include more bands.

For example you can prepare and run calculations with the following bands ranges: 1-12, 4-12, 4-14 and plot the results:

> gnuplot
plot  'o-3D_4Ry_GBlk.eps_q1_diago_bse' w l t '6-10 Bands','o-3D_4-12_BND.eps_q1_diago_bse' w l t '4-12 Bands', 'o-3D_4-14_BND.eps_q1_diago_bse' w l t '4-14 Bands', 'o-3D_1-12_BND.eps_q1_diago_bse' w l t '1-12 Bands' ls 4
convergence with Bnds

The plot is showing that the spectrum changes only marginally when adding those bands.

Convergence with the k-point mesh

As final step you need to study the dependence on the k mesh. This parameter cannot be changed in yambo. For each k mesh you need to run a separate non-self consistent DFT calculation (on top of a converged self-consistent one) and generate the corresponding SAVE folders. Be careful to change only the k mesh.

For this exercise the SAVE databases for different meshes were generated beforehand in the hBN-convergence-kpoints.tar.gz tarball and are contained in the corresponding folders:

> pwd
YAMBO_TUTORIALS/hBN-convergence-kpoints/YAMBO
> ls
9x9x3 12x12x4 15x15x5 18x18x6

By now you should be familiar with the process:

  • Enter the 9x9x3 directory
  • Run the initialization
  • Create the input for calculating the screening:
 > yambo -F 02_screening.in -J 3D_993 -X s
  • Modify the input as follows
NGsBlkXs = 4 Ry
%BndsRnXs
1 | 40 |
%
%LongDrXS
1.000 | 1.000 | 1.000|
%
  • Run the calculation for the screening
> yambo -F 02_screening.in -J 3D_993
  • Create the input for calculating the macroscopic dielectric function:
> yambo -F 03_bse.in -J 3D_993 -o b -k sex -y h -V qp

Which combines the BS kernel + BS solver (Lanczos-Haydock) runlevels

  • Modify the input as follows
BSENGexx = 30 Ry
BSENGBlk = 4 Ry
% BSEBands
 6 | 10 |       
%
% BEnRange
  2.00000 | 8.00000 | eV    
%
BEnSteps= 200      
% BDmRange
  0.10000 |  0.10000 | eV    
%
% BLongDir
 1.000000 | 1.000000 | 0.000000 | 
%
% KfnQP_E 
 1.440000 | 1.000000 | 1.000000 |
%
BSHayTrs= 0.02000
  • Launch the calculation:
> yambo -F 03_bse.in -J 3D_993
  • Repeat the procedure for the 12x12x4 (it will take few minutes) with the difference you will use a different prefix: -J 3D_12124.

The convergence on the k-point is certainly the most tedious and expensive part. Note that for the two larger meshes the calculations of both the screening and kernel take about 10 to 30 minutes each. If short of time/resources postpone these calculations. If you have the time and computational resources repeat the above procedure for 15x15x5 and 18x18x6.

Note that for those meshes the BS kernel database is becoming very/too large and you need to fragment it. To do that after you generated and modified the input invoke yambo again as:

> yambo -F 03_bse.in -J 3D_15155 -o b -k sex -y h -V io

and modify the variable

 DBsFRAGpm= "+BS"

Then launch the calculation

> yambo -F 03_bse.in -J 3D_15155

If you correctly followed the above procedure you should have a file with the optical absorption spectrum for each mesh, e.g. o-3D_993.eps_q1_haydock_bse. To see the effect of k-points plot those files with gnuplot (remember to include the 6x6x2 calculation which should still be inside hBN/YAMBO, if the parameters don't match you simply rerun it here by creating a 6x6x2 directory and copying the SAVE there):

> gnuplot
plot '18x18x6/o-3D_18186.eps_q1_haydock_bse' w l t '18x18x6, '15x15x5/o-3D_15155.eps_q1_haydock_bse' w l t '15x15x5','12x12x4/o-3D_12124.eps_q1_haydock_bse' w l t '12x12x4, 
'9x9x3/o-3D_993.eps_q1_haydock_bse' w l t '9x9x3', '6x6x2/o-3D_662.eps_q1_haydock_bse' w l t '6x6x2'
convergence with k points

From this plot you can notice that:

  • results with the 6x6x2 mesh are clearly not converged: the first peak is too red shifted, the peak at 6 eV too sharp and intense and there is an 'extra' peak at 7 eV.
  • both the position and shape of the first peak are practically converged with the 9x9x3 mesh.
  • conversely the second peak is still not fully converged with the 18x18x6.

The different behavior in the convergence of the two features depends on the localization of the exciton. The sharp first peak suggests a localized exciton. The shape of the second peak a much more delocalized exciton. A finer k mesh, corresponds in direct space, to considering a larger amount of unit cells. Then when the excitation is delocalized over a large number of unit cells a very fine k mesh is needed. Typically a too coarse k mesh induces an artificial localization of the excitons which then correspond to artefacts in the spectrum (similar to what is observed for the 6x6x9). A nice, instructive discussion on wrong deductions from unconverged k mesh calculations can be found in the Appendix of Molina-Sanchez et al. (2013).[1]

Summary

To sum-up the results from this tutorial you have found that for the system under study:

  • BSENGBlk= 3 Ry
  • BSENGexx= 10 Ry
  • BSEBands from 6 to 10
  • To converge the position and shape of the first exciton peak a 12x12x4 mesh is sufficient. For the second exciton peak a mesh larger than 18x18x6 would be needed (indeed Wirtz and co-workers found a k-mesh 24x24x10 was needed.[2])

Links

References

  1. Alejandro Molina-Sánchez, Davide Sangalli, Kerstin Hummer, Andrea Marini, and Ludger Wirtz Phys. Rev. B 88, 045412 (2013)
  2. Ludger Wirtz, Andrea Marini, Myrta Gruning, Angel Rubio in arXiv:cond-mat/0508421 [cond-mat.mtrl-sci]