Hello Adel,

Thank you again for responding to me. I am new to this Python world and I don’t 
have much experience on the subject. However, discovering and learning Kwant 
and Tkwant has been very interesting. I reproduced the example given in 
reference [1] 
https://mail.python.org/archives/list/kwant-discuss@python.org/thread/2VB4IKZSCBZZNZJOWS3QFSP2AT6FCYVL/.
 But I still have some doubts about the Green functions in Kwant. Based on the 
code below:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
import kwant
from types import SimpleNamespace
from copy import copy
import tinyarray
import numpy as np
import csv
import ipywidgets
from scipy import sparse
from matplotlib import pyplot
from scipy.optimize import minimize

sigma_x = tinyarray.array([[0, 1], [1, 0]])
sigma_y = tinyarray.array([[0, -1j], [1j, 0]])
sigma_z = tinyarray.array([[1, 0], [0, -1]])
sigma_0 = tinyarray.array([[1, 0], [0, 1]])

tau_x = tinyarray.array([[0, 1], [1, 0]])
tau_y = tinyarray.array([[0, -1j], [1j, 0]])
tau_z = tinyarray.array([[1, 0], [0, -1]])
tau_0 = tinyarray.array([[1, 0], [0, 1]])

def make_system_ex3(L=10):
    lat = kwant.lattice.chain(norbs=2)
    syst = kwant.Builder()

#### Define the scattering region. ####
    def onsite_sc(site,t,mu,delta):
        return (2.*t-mu )*tau_z + delta*tau_x

    def onsite_N(site,t,mu,V_N):
        return (2.*t-mu + V_N)*tau_z

    syst[(lat(x) for x in range(1, L))] = onsite_sc

#### Superconducting onsite hamiltonian ####
    syst[lat(L)] = onsite_N  #normal onsite hamiltonian

    syst[(lat(x) for x in range(L+1,2*L+1))] = onsite_sc #superconducting 
onsite hamiltonian

    def hop(site1,site2,t,phi): 
        return -t*np.matmul(np.exp(1j*phi*tau_z),tau_z)

    syst[(lat(L-1), lat(L))] = hop
    for i in range(1,L-1):
        syst[(lat(i), lat(i+1))] = -t*tau_z
    for i in range(L,2*L):
        syst[(lat(i), lat(i+1))] = -t*tau_z

#### Define the leads ####
    sym_left = kwant.TranslationalSymmetry([-1])
    lead0 = kwant.Builder(sym_left)
    lead0[(lat(0))] = (2.*t-mu)*tau_z + delta*tau_x
    lead0[lat.neighbors()] = -t*tau_z

    sym_right = kwant.TranslationalSymmetry([1])
    lead1 = kwant.Builder(sym_right)
    lead1[(lat(2*L+1))] =  (2.*t-mu)*tau_z + delta*tau_x
    lead1[lat.neighbors()] = -t*tau_z

##### Attach the leads and return the system ####
    syst.attach_lead(lead0)
    syst.attach_lead(lead1)

    return syst, lat

mu=1
t=1.0
delta=0.5
V_N=1
phi=0
L=10

par = dict(t=t,mu=mu,delta=delta,phi=phi,V_N=V_N)

syst, lat = make_system_ex3(L=10)

def mount_vlead(sys, vlead_interface, norb):
    dim = norb*len(vlead_interface)
    print(dim)
    zero_array = np.zeros((dim, dim), dtype=float)
    def selfenergy_func(energy, args=()):
        return zero_array

    vlead = kwant.builder.SelfEnergyLead(selfenergy_func, vlead_interface,())
    sys.leads.append(vlead)

lead2 = mount_vlead(syst,[lat(L-1)], 2)
lead3 = mount_vlead(syst,[lat(L)], 2)

syst =syst.finalized()

G12=kwant.greens_function(syst, energy=-1.8*1j, in_leads=[2],out_leads=[3],\
                           check_hermiticity=False,params=par).data
G21=kwant.greens_function(syst, energy=-1.8*1j, in_leads=[3],out_leads=[2],\
                           check_hermiticity=False,params=par).data
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
I have some questions about the code above:

1. The fictitious lead has a self-energy equal to zero. However, the system 
defined in 'syst' has "real leads" attached. So, when we write 
'kwant.greens_function(syst, energy=-1.8*1j, in_leads=[2],out_leads=[3], 
check_hermiticity=False,params=par).data' will the contribution of the attached 
leads be taken into account?

2. If not, how can we take into account the leads attached in 'syst'?

3. Is the function 'kwant.greens_function(syst, energy=-1.8*1j, 
in_leads=[2],out_leads=[3], check_hermiticity=False,params=par).data' the 
retarded Green's function?

4. How can I obtain the correlation function (Lesser Green's function)?

5. Is the 'energy' parameter always a complex number?

Best,
Gabriel

Reply via email to