Dear mutc1r2595,
The dimension of the self energy in kwant is the number of sites of the
system connected to all the leads (left and right) whereas the dimension of
the Hamiltonian H is the total number of sites in the scattering region.
If you want to separate the self energy to left and right and use it the
way you described, you can do as follows:
###########################
import numpy as np
def make_system():
#create your system here
pass
return sys
sys=make_system()
syst=sys.finalized()
H=syst.hamiltonian_submatrix()
Left_self_energy=np.zeros_like(H)
Right_self_energy=np.zeros_like(H)
for i0, i in enumerate(syst.lead_interfaces[0]):
for j0, j in enumerate(syst.lead_interfaces[0]):
Left_self_energy[i,j]=syst.leads[0].selfenergy(energy=0.3)[i0,j0]
for i0, i in enumerate(syst.lead_interfaces[1]):
for j0, j in enumerate(syst.lead_interfaces[1]):
Right_self_energy[i,j]=syst.leads[1].selfenergy(energy=0.3)[i0,j0]
I hope this helps,
Adel
On Sun, Jul 5, 2020 at 3:20 PM
Dear Kwant developers,
I am trying to calculate the retarded Green's function for a simple 2D square lattice with two leads. Rather than using the following: G = kwant.greens_function(sys, energy) Gr10=G.submatrix(1,0)
I need to calculate Green's function by Gr = (EI-H-Sigma_L-Sigma_R)^-1. But apparently I coudn't properly construct it in Kwant: Gr2=Np.linalg.inv(energy*Np.identity(W)-H-Sigma_Lr-Sigma_Rr) H = sys.hamiltonian_submatrix()
The problem is dimensions of self energy matrices are WxW, where W is the width sites. However the Hamiltonian matrix I get above has the dimensions of NxN, where N is the number of sites in the scattering region.
Do I use the wrong Hamiltonian? How should I implement Gr = (EI-H-Sigma_L-Sigma_R)^-1 correctly in Kwant?
Thanks for your time, Ran
-- Abbout Adel