Hi. I tried to add leads on the rectangular honeycomb scattering region. I was 
able to add two leads (the first one is from the left from 0 < y < 10, and the 
second one is from the right 0 < y < 4). But when I tried add another lead on 
the right from 7 < y < 10, it gives an error: 
ValueError: No sites close to (1, 1) are inside the desired shape.


Here is the code for the setup:

import matplotlib.pyplot
import kwant

lat = kwant.lattice.honeycomb()
sys = kwant.Builder()

def rectangle(pos):
x, y = pos
return 0 < x < 20 and 0 < y < 10

sys[lat.shape(rectangle, (1, 1))] = 0 #next nearest 
sys[lat.neighbors()] = -1 #nearest

sym = kwant.TranslationalSymmetry((-1, 0)) #from the left
sym.add_site_family(lat.sublattices[0], other_vectors=[(-1, 2)])
sym.add_site_family(lat.sublattices[1], other_vectors=[(-1, 2)])

lead = kwant.Builder(sym)

def lead1_shape(pos):
x, y = pos
return 0 < y < 10

lead[lat.shape(lead1_shape, (1,1))] = 0
lead[lat.neighbors()] = -1

sym2 = kwant.TranslationalSymmetry((1, 0)) #to the right, botttom
sym2.add_site_family(lat.sublattices[0], other_vectors=[(-1, 2)])
sym2.add_site_family(lat.sublattices[1], other_vectors=[(-1, 2)])

def lead2_shape(pos):
x, y = pos
return 0 < y < 4 # bottom

lead2 = kwant.Builder(sym2)
lead2[lat.shape(lead2_shape, (1,1))] = 0
lead2[lat.neighbors()] = -1

sym3 = kwant.TranslationalSymmetry(lat.vec((1, 0))) #to the right, top
sym3.add_site_family(lat.sublattices[0], other_vectors=[(-1, 2)])
sym3.add_site_family(lat.sublattices[1], other_vectors=[(-1, 2)])

def lead3_shape(pos): #tried to add this lead and gives an error
x, y = pos
return 7 < y < 10 # top

lead3 = kwant.Builder(sym3)
lead3[lat.shape(lead3_shape, (1,1))] = 0
lead3[lat.neighbors()] = -1

sys.attach_lead(lead)
sys.attach_lead(lead2)
sys.attach_lead(lead3)

kwant.plot(sys);

Thanks,

James

Reply via email to