## Computing matrix elements in BSE Kernel

Various technical topics such as parallelism and efficiency, netCDF problems, the Yambo code structure itself, are posted here.
Franz Fischer
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 G-sum 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,k-k' sum_{G_ck} C*_ck(G_ck) C_c'k'(G_ck - G),

where the C's denote the plane-wave coefficients and G_ck the Miller-indices.
In case of G=0 and for k .neq. k' we find different values for the same matrix element depending on the k-grid 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 k-grid samplings (see attached figure). We used SOC, a 2D-slab 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 k-space 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 / IMPRS-UFAST 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,

First of all, why is it allowed to remove the G=0 element from the G-sum in the Exchange Kernel?
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).
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.
I would have imagined, that the values should either be identical or at least look smooth when plotted against the k-space sampling. Is this behaviour expected? Or do you compute the matrix elements in a different way?
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 sub-spaces, 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 sub-spaces, I'd expect the plot to give a constant value.

Best,
D.
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Franz Fischer
Posts: 31
Joined: Wed Jul 20, 2022 9:36 am

### Re: Computing matrix elements in BSE Kernel

Dear Davide,

thanks for your answer.
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 sub-spaces, otherwise you are looking to random projections
For k' = (1/3, 1/3, 0), c was set to be fixed at the highest valence band (non-degenerate). For k = (0, 0, 0) we used the two degenerate top-most valence bands, i.e. c_1 = VBM-1 and c_2 = VBM and computed sqrt(|<c_1 k| c k'>|^2 + |<c_2 k| c k'>|^2).
Using your wave functions, i.e. the p2y converted QE wave functions (ns.wf_fragments_*) we see that the value remains constant for different k-grid 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 G-basis (i.e. G-VECTORS 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 / IMPRS-UFAST 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 k-centered spheres in the files ns.wf_fragment*

However, WF_load
a) loads the WFs in memory on the k-centered spheres if called with space="C".
b) loads the WFs in memory moving from the k-centered 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
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Franz Fischer
Posts: 31
Joined: Wed Jul 20, 2022 9:36 am

### Re: Computing matrix elements in BSE Kernel

Hi Davide,
p2y doesn't anything special.
It just changes the format of the files.
The WFs are still written in k-centered spheres in the files ns.wf_fragment*
this helped a lot and the error was due to some false order reading of the QE WFs on my side.

Another small question:
The BSE Kernel in your cheatsheet is written as [2 Vbar - W]. Is this the formulation of the non-SOC case and the factor of 2 is removed in the SOC case?

Thanks a lot.

Best,
Franz
Franz Fischer
PhD student / IMPRS-UFAST 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

The BSE Kernel in your cheatsheet is written as [2 Vbar - W]. Is this the formulation of the non-SOC case and the factor of 2 is removed in the SOC case?
Yeah, the factor 2 is only for the case without SOC and without spin-polarization.

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 cheat-sheet.

Best,
D.
Last edited by Davide Sangalli on Wed Mar 29, 2023 9:20 am, edited 1 time in total.
Reason: Fixed typo in spin-occ
Davide Sangalli, PhD
CNR-ISM, Division of Ultrafast Processes in Materials (FLASHit) and MaX Centre
https://sites.google.com/view/davidesangalli
http://www.max-centre.eu/

Franz Fischer
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
Franz Fischer
PhD student / IMPRS-UFAST fellow
Institute of Physical Chemistry
University of Hamburg