Bethe-Salpeter solver: Lanczos-Haydock: Difference between revisions
No edit summary |
m (Fixed references) |
||
(13 intermediate revisions by 4 users not shown) | |||
Line 8: | Line 8: | ||
You can avoid the full matrix [[Bethe-Salpeter solver: diagonalization|diagonalization]] (which rapidly become expensive as it scales as N<sup>3</sup>) by using the Lanczos-Haydock solver. While for small matrices the full diagonalization and the Lanczos-Haydock solver have similar computational cost, for matrices of the size 10000 by 10000 and larger, the Lanczos-Haydock solver is remarkably faster. The drawback is that excitonic functions cannot be calculated. | You can avoid the full matrix [[Bethe-Salpeter solver: diagonalization|diagonalization]] (which rapidly become expensive as it scales as N<sup>3</sup>) by using the Lanczos-Haydock solver. While for small matrices the full diagonalization and the Lanczos-Haydock solver have similar computational cost, for matrices of the size 10000 by 10000 and larger, the Lanczos-Haydock solver is remarkably faster. The drawback is that excitonic functions cannot be calculated. | ||
Within the Lanczos-Haydock approach the macroscopic dielectric function is rewritten as a continued fraction<ref> | Within the Lanczos-Haydock approach the macroscopic dielectric function is rewritten as a continued fraction<ref name="Benedict1999"/>. | ||
[[file:BSE1-Eq5.png|none|x100px]] | [[file:BSE1-Eq5.png|none|x100px]] | ||
where ''a'' 's and ''b'' 's result from the [https://en.wikipedia.org/wiki/Lanczos_algorithm#Lanczos_method| Lanczos iterative algorithm]. | where ''a'' 's and ''b'' 's result from the [https://en.wikipedia.org/wiki/Lanczos_algorithm#Lanczos_method| Lanczos iterative algorithm]. In Yambo the approach is coded both for the Hermitian case (BSE neglecting coupling) and for the pseud-hermitian case (BSE with coupling)<ref name="Gruning2011"/>. | ||
==Prerequisites== | ==Prerequisites== | ||
[[File:Yambo-handbook-v4.1.2-p-16.png|thumb|Cheatsheet on Haydock|150px]] | |||
* You must first complete the [[Static screening]] and [[Bethe-Salpeter kernel]] modules | * You must first complete the [[Static screening]] and [[Bethe-Salpeter kernel]] modules in the [[Calculating optical spectra including excitonic effects: a step-by-step guide|step-by-step guide]] | ||
* Optionally, in order to compare results with the diagonalization solver, you may first complete the [[Bethe-Salpeter solver: diagonalization]] module. | |||
'''You will need''': | '''You will need''': | ||
Line 23: | Line 24: | ||
* The <code>yambo</code> executable | * The <code>yambo</code> executable | ||
* <code>gnuplot</code> for plotting spectra | * <code>gnuplot</code> for plotting spectra | ||
==Choice of input parameters== | ==Choice of input parameters== | ||
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 | $ yambo -F 03_3D_BSE_haydock_solver.in -y h -V qp -J 3D_BSE | ||
The input is open in the editor. The input variable to be changed are | |||
% [[Variables#BEnRange|BEnRange]] | |||
2.00000 | 8.00000 | eV | |||
% | |||
[[Variables#BEnSteps|BEnSteps]]= 200 | |||
% [[Variables#BDmRange|BDmRange]] | |||
0.10000 | 0.10000 | eV | |||
% | |||
% [[Variables#BLongDir|BLongDir]] | |||
1.000000 | 1.000000 | 0.000000 | | |||
% | |||
% [[Variables#KfnQP_E|KfnQP_E]] | |||
1.440000 | 1.000000 | 1.000000 | | |||
% | |||
as for the diagonalization solver and the additional parameter | |||
[[Variables#BSHayTrs|BSHayTrs]]= -0.02000 | [[Variables#BSHayTrs|BSHayTrs]]= -0.02000 | ||
defines the threshold accuracy for the Lanczos-Haydock iterative process: the calculation stops when the difference between two consecutive calculated spectra is smaller than the absolute value of the threshold. | defines the threshold accuracy for the Lanczos-Haydock iterative process: the calculation stops when the difference between two consecutive calculated spectra is smaller than the absolute value of the threshold. | ||
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. | ||
==Bethe-Salpeter solver runlevel== | ==Bethe-Salpeter solver runlevel== | ||
Invoke yambo to run the calculation: | Invoke yambo to run the calculation: | ||
Line 39: | Line 53: | ||
This outputs the following log: | This outputs the following log: | ||
... | ... | ||
< | <---> [03] BSE solver(s) @q1 | ||
< | <---> [03.01] Haydock Solver for abs @q1, scheme hermitian | ||
< | <---> [Haydock] Iteration 1 | ||
< | <---> [Haydock] Iteration 30 Accuracy 0.010712|-0.020000 | ||
... | ... | ||
The Lanczos-Haydock iterative procedure converged to the desired accuracy in | The Lanczos-Haydock iterative procedure converged to the desired accuracy in 30 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. | ||
Among the human readable files, o-3D_BSE-low.eps_q1_haydock_bse contains the real and imaginary part of the macroscopic dielectric function: | Among the human readable files, o-3D_BSE-low.eps_q1_haydock_bse contains the real and imaginary part of the macroscopic dielectric function: | ||
$ less o-3D_BSE-low.eps_q1_haydock_bse | $ less o-3D_BSE-low.eps_q1_haydock_bse | ||
... | ... | ||
# | # | ||
# | # E/ev[1] EPS-Im[2] EPS-Re[3] EPSo-Im[4] EPSo-Re[5] EPS`-Im[6] EPS`-Re[7] | ||
# | # | ||
2.00000000 0.596701317E-1 3.11588907 0.300982650E-1 2.50442362 0.596701317E-1 3.11588907 | |||
2.03015089 0.607327521E-1 3.13400769 0.304788072E-1 2.51354647 0.607327521E-1 3.13400769 | |||
... | ... | ||
This file has a slightly different data structure with respect to the diagonalization solver: | This file has a slightly different data structure with respect to the diagonalization solver: | ||
Line 62: | Line 77: | ||
$gnuplot | $gnuplot | ||
... | ... | ||
plot 'o-3D_BSE.eps_q1_diago_bse' u 1:2 w l t 'Diagonalization', 'o-3D_BSE-low.eps_q1_haydock_bse' u 1:2 w l t 'Haydock ( | plot 'o-3D_BSE.eps_q1_diago_bse' u 1:2 w l t 'Diagonalization', 'o-3D_BSE-low.eps_q1_haydock_bse' u 1:2 w l t 'Haydock (30 its)', 'o-3D_BSE-low.eps_q1_haydock_bse' u 1:6 w l t 'Haydock (29 its)' | ||
[[file:03_bse_haydock.png|none|600px]] | [[file:03_bse_haydock.png|none|600px]] | ||
Except for the peak at higher energy, the results on this scale are identical to those obtained via the diagonalization solver. By comparing the results for the Lanczos-Haydock solver at | Except for the peak at higher energy, the results on this scale are identical to those obtained via the diagonalization solver. By comparing the results for the Lanczos-Haydock solver at 30 and 29 iterations, it is clear that the difference with the diagonalization results can be eliminated by lowering the threshold for the iterative process. | ||
==Convergence of the iterative procedure== | ==Convergence of the iterative procedure== | ||
Line 75: | Line 90: | ||
outputs the following log | outputs the following log | ||
... | ... | ||
< | <---> [03] BSE solver(s) @q1 | ||
< | <---> [03.01] Haydock Solver for abs @q1, scheme hermitian | ||
< | <---> [Haydock] Iteration 1 | ||
< | <---> [Haydock] Iteration 43 Accuracy 0.002787| 0.020000 | ||
... | ... | ||
Now | Now 43 iterations, rather than 30, were needed to reach the desired accuracy. | ||
By plotting these results: | By plotting these results: | ||
$ gnuplot | $ gnuplot | ||
Line 93: | Line 108: | ||
==Links== | ==Links== | ||
* Previous module: [[Bethe-Salpeter kernel]] | |||
* Alternative Bethe-Salpeter equation solver: [[Bethe-Salpeter solver: diagonalization | diagonalization]] | |||
* Alternative Bethe-Salpeter equation solver: [[Bethe-Salpeter solver: SLEPC|SLEPC]] | |||
* Back to [[Calculating optical spectra including excitonic effects: a step-by-step guide]] tutorial | |||
* [[Tutorials|Back to tutorials menu]] | |||
* [[Modules|Back to technical modules menu]] | |||
==References== | ==References== | ||
<references> | |||
<ref name="Benedict1999">L. X. Benedict, and E. L. Shirley, Phys. Rev. B '''59''', 5441 (1999)</ref> | |||
<ref name="Gruning2011">M. Gruning, A. Marini, and X. Gonze, [https://doi.org/10.1016/j.commatsci.2011.02.021 Comp. Mat. Science '''50''' 2148-2156 (2011)]</ref> | |||
</references> |
Latest revision as of 09:09, 12 September 2023
In this module you learn how to obtain the optical absorption spectrum of bulk BN within the Bethe-Salpeter equation (BSE)framework for a previously calculated Bethe-Salpeter (BS) kernel. You will learn how to by-pass the diagonalization of the full two-particle Hamiltonian by using the subspace-iterative Lanczos-Haydock solver.
Background
The macroscopic dielectric function (from which the absorption and EEL spectra can be computed) is obtained from the eigenvalues Eλ (excitonic energies) and eigenvectors Aλcvk (exciton composition in terms of electron-hole pairs) of the two-particle Hamiltonian:
You can avoid the full matrix diagonalization (which rapidly become expensive as it scales as N3) by using the Lanczos-Haydock solver. While for small matrices the full diagonalization and the Lanczos-Haydock solver have similar computational cost, for matrices of the size 10000 by 10000 and larger, the Lanczos-Haydock solver is remarkably faster. The drawback is that excitonic functions cannot be calculated. Within the Lanczos-Haydock approach the macroscopic dielectric function is rewritten as a continued fraction[1].
where a 's and b 's result from the Lanczos iterative algorithm. In Yambo the approach is coded both for the Hermitian case (BSE neglecting coupling) and for the pseud-hermitian case (BSE with coupling)[2].
Prerequisites
- You must first complete the Static screening and Bethe-Salpeter kernel modules in the step-by-step guide
- Optionally, in order to compare results with the diagonalization solver, you may first complete the Bethe-Salpeter solver: diagonalization module.
You will need:
- The
SAVE
databases for 3D hBN - The
3D_BSE
directory containing the databases from the Static screening and Bethe-Salpeter kernel modules - The
yambo
executable gnuplot
for plotting spectra
Choice of input parameters
To use the Lanczos-Haydock solver invoke yambo with "-y h" option in the command line:
$ yambo -F 03_3D_BSE_haydock_solver.in -y h -V qp -J 3D_BSE
The input is open in the editor. The input variable to be changed are
% 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 | %
as for the diagonalization solver and the additional parameter
BSHayTrs= -0.02000
defines the threshold accuracy for the Lanczos-Haydock iterative process: the calculation stops when the difference between two consecutive calculated spectra is smaller than the absolute value of the threshold. 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.
Bethe-Salpeter solver runlevel
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:
... <---> [03] BSE solver(s) @q1 <---> [03.01] Haydock Solver for abs @q1, scheme hermitian <---> [Haydock] Iteration 1 <---> [Haydock] Iteration 30 Accuracy 0.010712|-0.020000 ...
The Lanczos-Haydock iterative procedure converged to the desired accuracy in 30 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. Among the human readable files, o-3D_BSE-low.eps_q1_haydock_bse contains the real and imaginary part of the macroscopic dielectric function:
$ less o-3D_BSE-low.eps_q1_haydock_bse
... # # E/ev[1] EPS-Im[2] EPS-Re[3] EPSo-Im[4] EPSo-Re[5] EPS`-Im[6] EPS`-Re[7] # 2.00000000 0.596701317E-1 3.11588907 0.300982650E-1 2.50442362 0.596701317E-1 3.11588907 2.03015089 0.607327521E-1 3.13400769 0.304788072E-1 2.51354647 0.607327521E-1 3.13400769 ...
This file has a slightly different data structure with respect to the diagonalization solver:
Energy in eV | Imaginary part BSE | Real part BSE |Imaginary part IPA | Real part IPA |Imaginary part BSE (it-1) | Real part BSE (it-1)|
We can plot the second and sixth columns and compare with the result from diagonalization:
$gnuplot ... plot 'o-3D_BSE.eps_q1_diago_bse' u 1:2 w l t 'Diagonalization', 'o-3D_BSE-low.eps_q1_haydock_bse' u 1:2 w l t 'Haydock (30 its)', 'o-3D_BSE-low.eps_q1_haydock_bse' u 1:6 w l t 'Haydock (29 its)'
Except for the peak at higher energy, the results on this scale are identical to those obtained via the diagonalization solver. By comparing the results for the Lanczos-Haydock solver at 30 and 29 iterations, it is clear that the difference with the diagonalization results can be eliminated by lowering the threshold for the iterative process.
Convergence of the iterative procedure
Repeat now the calculation by changing the input variable:
BSHayTrs= 0.02000
which enforces a stricter condition on the convergence of the iterative process (see above)
Running yambo:
$ yambo -F 03_3D_BSE_haydock_solver.in -J "3D_BSE-high,3D_BSE"
outputs the following log
... <---> [03] BSE solver(s) @q1 <---> [03.01] Haydock Solver for abs @q1, scheme hermitian <---> [Haydock] Iteration 1 <---> [Haydock] Iteration 43 Accuracy 0.002787| 0.020000 ...
Now 43 iterations, rather than 30, were needed to reach the desired accuracy. By plotting these results:
$ gnuplot plot 'o-3D_BSE.eps_q1_diago_bse' u 1:2 w l ls 1 t 'Diagonalization', 'o-3D_BSE-high.eps_q1_haydock_bse' u 1:2 w l ls 2 t 'Haydock (high)', 'o-3D_BSE-low.eps_q1_haydock_bse' u 1:2 w l ls 3 t 'Haydock (low)'
Which shows that the Lanczos-Haydock solver with the stricter convergence criterion and the diagonalization solver are identical on this scale.
Summary
From this tutorial you've learned:
- How to compute the optical spectrum by using the Lanczos-Haydock solver within the Bethe-Salpeter equation framework
- How to improve the calculated optical spectrum by using a stricter convergence criterion for the iterative Lanczos-Haydock solver
Links
- Previous module: Bethe-Salpeter kernel
- Alternative Bethe-Salpeter equation solver: diagonalization
- Alternative Bethe-Salpeter equation solver: SLEPC
- Back to Calculating optical spectra including excitonic effects: a step-by-step guide tutorial
- Back to tutorials menu
- Back to technical modules menu
References
- ↑ L. X. Benedict, and E. L. Shirley, Phys. Rev. B 59, 5441 (1999)
- ↑ M. Gruning, A. Marini, and X. Gonze, Comp. Mat. Science 50 2148-2156 (2011)