Dear Bariş,
I don’t know why kwant doesn’t attach the lead as you want. However, it works quite fine if you attach it transversally.
You may try the program bellow, in case this is helpful.
I just added the transversal lead to your code.
Regards,
Ousmane
##############################################
import kwant
import matplotlib.pyplot as plt
def make_system(a, W, L):
def shape(pos):
(x, y) = pos
return (-L <= x <= 0 and -L <= y <= L)
def onsite(site, par):
return 4 * par.t - par.mu
def hopx(site1, site2, par):
return -par.t
def hopy(site1, site2, par):
return -par.t
lat = kwant.lattice.square(a, norbs=1)
syst = kwant.Builder()
syst[lat.shape(shape, (0, 0))] = onsite
syst[kwant.builder.HoppingKind((1, 0), lat, lat)] = hopx
syst[kwant.builder.HoppingKind((0, 1), lat, lat)] = hopy
# (b = 2, c = 1) works, (b = 1, c = 1) does not work
b = 2
c = 1
lead = kwant.Builder(kwant.TranslationalSymmetry((b*a, c*a))) #,
#time_reversal=1)
lead2 = kwant.Builder(kwant.TranslationalSymmetry((a, a)))
def lead_shape(pos):
(x, y) = pos
return -L/2<= y <=L/2
#return -2*L<= x <=-L
def lead_shape2(pos):
(x, y) = pos
#return -L/2<= y <=L/2
return -2*L<= x <=-L
def lead_hopx(site1, site2, par):
return -par.t
def lead_onsite(site, par):
return 4 * par.t - par.mu
lead[lat.shape(lead_shape, (0, 0))] = lead_onsite
lead2[lat.shape(lead_shape2, (-L, 0))] = lead_onsite
lead[kwant.builder.HoppingKind((1, 0), lat, lat)] = lead_hopx
lead[kwant.builder.HoppingKind((0, 1), lat, lat)] = hopy
lead2[kwant.builder.HoppingKind((1, 0), lat, lat)] = " "
lead2[kwant.builder.HoppingKind((0, 1), lat, lat)] = " "
syst.attach_lead(lead)
syst.attach_lead(lead2)
syst = syst.finalized()
return syst
lat = kwant.lattice.honeycomb()
sym = kwant.TranslationalSymmetry(lat.a.vec((-2, 1)))
lead = kwant.Builder(sym)
lead[lat.wire((0, -5), 5)] = 0
lead[lat.neighbors()] = 1
a = 5
number_of_sites = 20
L=number_of_sites*a
number_of_sites2 = 50
L2=number_of_sites2*a
syst = make_system(a=a, W=L2, L=L)
kwant.plot(syst)
##############################################