Computing matrix elements in BSE Kernel
Moderators: Davide Sangalli, andrea.ferretti, myrta gruning, andrea marini, Daniele Varsano, Conor Hogan, Nicola Spallanzani

 Posts: 31
 Joined: Wed Jul 20, 2022 9:36 am
Computing matrix elements in BSE Kernel
Dear developers,
I am having some questions regarding the Coulomb and Exchange matrix elements in the BSE Kernel.
First of all, why is it allowed to remove the G=0 element from the Gsum in the Exchange Kernel?
Second, in the Coulomb part of the BSE Kernel you have matrix elements of the form that translate to:
<ck exp(i{q+G}*r) c'k'> = delta_q,kk' sum_{G_ck} C*_ck(G_ck) C_c'k'(G_ck  G),
where the C's denote the planewave coefficients and G_ck the Millerindices.
In case of G=0 and for k .neq. k' we find different values for the same matrix element depending on the kgrid sampling used in QE. I put c to the lowest conduction band and k=(0, 0, 0) and k' = (1/3, 1/3, 0) in crystal coordinates for all kgrid samplings (see attached figure). We used SOC, a 2Dslab of MoS2 and k, k' are from within the IBZ.
I would have imagined, that the values should either be identical or at least look smooth when plotted against the kspace sampling. Is this behaviour expected? Or do you compute the matrix elements in a different way?
Best,
Franz Fischer
I am having some questions regarding the Coulomb and Exchange matrix elements in the BSE Kernel.
First of all, why is it allowed to remove the G=0 element from the Gsum in the Exchange Kernel?
Second, in the Coulomb part of the BSE Kernel you have matrix elements of the form that translate to:
<ck exp(i{q+G}*r) c'k'> = delta_q,kk' sum_{G_ck} C*_ck(G_ck) C_c'k'(G_ck  G),
where the C's denote the planewave coefficients and G_ck the Millerindices.
In case of G=0 and for k .neq. k' we find different values for the same matrix element depending on the kgrid sampling used in QE. I put c to the lowest conduction band and k=(0, 0, 0) and k' = (1/3, 1/3, 0) in crystal coordinates for all kgrid samplings (see attached figure). We used SOC, a 2Dslab of MoS2 and k, k' are from within the IBZ.
I would have imagined, that the values should either be identical or at least look smooth when plotted against the kspace sampling. Is this behaviour expected? Or do you compute the matrix elements in a different way?
Best,
Franz Fischer
You do not have the required permissions to view the files attached to this post.
Franz Fischer
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
 Davide Sangalli
 Posts: 570
 Joined: Tue May 29, 2012 4:49 pm
 Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
 Contact:
Re: Computing matrix elements in BSE Kernel
Dear Franz,
Accordingly you can have either L=Lo + Lo (v+K) L or Lbar=Lo + Lo (vbar+K) Lbar.
Simplifying a lot. The two, i.e. L and Lbar, differ because in L the longitudinal poles are shifted from the transverse ones (in 2D only at finite momentum q).
For absorption, where one is interested in the transverse poles only, Lbar can be used to directly obtain the dielectric function.
First of all, when you change the sampling, do you just change it in the nscf run with QE or also in the scf one?
Second, I'd check that c and c' do not belong to degenerate subspaces, otherwise you are looking to random projections,
If you are running nscf calculations on top of the same density, and c and c' do not belong to degenerate subspaces, I'd expect the plot to give a constant value.
Best,
D.
Because the G=0 term is non analytical. There are many papers / documents about the difference between "v" (which includes the G=0 term) and "vbar" (which doesn't).First of all, why is it allowed to remove the G=0 element from the Gsum in the Exchange Kernel?
Accordingly you can have either L=Lo + Lo (v+K) L or Lbar=Lo + Lo (vbar+K) Lbar.
Simplifying a lot. The two, i.e. L and Lbar, differ because in L the longitudinal poles are shifted from the transverse ones (in 2D only at finite momentum q).
For absorption, where one is interested in the transverse poles only, Lbar can be used to directly obtain the dielectric function.
Not 100% clear what you are plotting here, i.e. k=(0, 0, 0) and k' = (1/3, 1/3, 0), but what are c and c'I would have imagined, that the values should either be identical or at least look smooth when plotted against the kspace sampling. Is this behaviour expected? Or do you compute the matrix elements in a different way?
First of all, when you change the sampling, do you just change it in the nscf run with QE or also in the scf one?
Second, I'd check that c and c' do not belong to degenerate subspaces, otherwise you are looking to random projections,
If you are running nscf calculations on top of the same density, and c and c' do not belong to degenerate subspaces, I'd expect the plot to give a constant value.
Best,
D.
Davide Sangalli, PhD
CNRISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.maxcentre.eu/
CNRISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.maxcentre.eu/

 Posts: 31
 Joined: Wed Jul 20, 2022 9:36 am
Re: Computing matrix elements in BSE Kernel
Dear Davide,
thanks for your answer.
Using your wave functions, i.e. the p2y converted QE wave functions (ns.wf_fragments_*) we see that the value remains constant for different kgrid as expected. We did the exact same computation for the wave function output by QE directly and don't get a constant value, see the attached figure.
My question is what procedure do the wave functions go through when converted into the yambo ns.wf_fragments_* files besides being put in a common Gbasis (i.e. GVECTORS in ns.db1)?
Thanks a lot for your help.
Best,
Franz
thanks for your answer.
For k' = (1/3, 1/3, 0), c was set to be fixed at the highest valence band (nondegenerate). For k = (0, 0, 0) we used the two degenerate topmost valence bands, i.e. c_1 = VBM1 and c_2 = VBM and computed sqrt(<c_1 k c k'>^2 + <c_2 k c k'>^2).Not 100% clear what you are plotting here, i.e. k=(0, 0, 0) and k' = (1/3, 1/3, 0), but what are c and c'
First of all, when you change the sampling, do you just change it in the nscf run with QE or also in the scf one?
Second, I'd check that c and c' do not belong to degenerate subspaces, otherwise you are looking to random projections
Using your wave functions, i.e. the p2y converted QE wave functions (ns.wf_fragments_*) we see that the value remains constant for different kgrid as expected. We did the exact same computation for the wave function output by QE directly and don't get a constant value, see the attached figure.
My question is what procedure do the wave functions go through when converted into the yambo ns.wf_fragments_* files besides being put in a common Gbasis (i.e. GVECTORS in ns.db1)?
Thanks a lot for your help.
Best,
Franz
You do not have the required permissions to view the files attached to this post.
Franz Fischer
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
 Davide Sangalli
 Posts: 570
 Joined: Tue May 29, 2012 4:49 pm
 Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
 Contact:
Re: Computing matrix elements in BSE Kernel
p2y doesn't anything special.
It just changes the format of the files.
The WFs are still written in kcentered spheres in the files ns.wf_fragment*
However, WF_load
a) loads the WFs in memory on the kcentered spheres if called with space="C".
b) loads the WFs in memory moving from the kcentered spheres to a single gamma centered sphere if called with space="G".
c) does a Fourier transform into real space if called with space="R" (default).
Best,
D.
It just changes the format of the files.
The WFs are still written in kcentered spheres in the files ns.wf_fragment*
However, WF_load
a) loads the WFs in memory on the kcentered spheres if called with space="C".
b) loads the WFs in memory moving from the kcentered spheres to a single gamma centered sphere if called with space="G".
c) does a Fourier transform into real space if called with space="R" (default).
Best,
D.
Davide Sangalli, PhD
CNRISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.maxcentre.eu/
CNRISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.maxcentre.eu/

 Posts: 31
 Joined: Wed Jul 20, 2022 9:36 am
Re: Computing matrix elements in BSE Kernel
Hi Davide,
Another small question:
The BSE Kernel in your cheatsheet is written as [2 Vbar  W]. Is this the formulation of the nonSOC case and the factor of 2 is removed in the SOC case?
Thanks a lot.
Best,
Franz
this helped a lot and the error was due to some false order reading of the QE WFs on my side.p2y doesn't anything special.
It just changes the format of the files.
The WFs are still written in kcentered spheres in the files ns.wf_fragment*
Another small question:
The BSE Kernel in your cheatsheet is written as [2 Vbar  W]. Is this the formulation of the nonSOC case and the factor of 2 is removed in the SOC case?
Thanks a lot.
Best,
Franz
Franz Fischer
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
 Davide Sangalli
 Posts: 570
 Joined: Tue May 29, 2012 4:49 pm
 Location: Via Salaria Km 29.3, CP 10, 00016, Monterotondo Stazione, Italy
 Contact:
Re: Computing matrix elements in BSE Kernel
Yeah, the factor 2 is only for the case without SOC and without spinpolarization.The BSE Kernel in your cheatsheet is written as [2 Vbar  W]. Is this the formulation of the nonSOC case and the factor of 2 is removed in the SOC case?
In the code there is a spin_occ factor.
 spin_occ=2 for n_spin=1
 spin_occ=1 for n_spin>1 (spin_polarized systems or SOC)
I will fix the cheatsheet.
Best,
D.
Last edited by Davide Sangalli on Wed Mar 29, 2023 9:20 am, edited 1 time in total.
Reason: Fixed typo in spinocc
Reason: Fixed typo in spinocc
Davide Sangalli, PhD
CNRISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.maxcentre.eu/
CNRISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.maxcentre.eu/

 Posts: 31
 Joined: Wed Jul 20, 2022 9:36 am
Re: Computing matrix elements in BSE Kernel
Thanks! That resolved all of my questions.
Best,
Franz
Best,
Franz
Franz Fischer
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg
PhD student / IMPRSUFAST fellow
Institute of Physical Chemistry
University of Hamburg