Dear all
I am having a problem defining a system which matches leads I want.
'''I start by defining a rectangular graphene lattice of size 0<=xhttps://mailman-mail5.webfaction.com/pipermail/kwant-discuss/2014-October/00....
and Anton had givern the answer:"We should use add_site_family"
I use "add_site_family",but it didn't work.
*In summary,I don't know how to use "add_site_family" exactly in
kwant.Then I can't create armchair nonaribbon and four leads*
*or six leads hall bar (The up and down leads are wrong.Left and right
leads are right according to my code.The central scattering*
* region is rectangle).Can you explain "add_site_family" in detail or *
*give me a six leads hall bar code to compare with my code .I have spent a
lot of time but I can't solve it.*
This is my code
from math import pi, sqrt, tanh
import kwant
# For computing eigenvalues
import scipy.sparse.linalg as sla
# For plotting
from matplotlib import pyplot
#Paramter
LeftLength=0.5 #width of scattering region
RightLength=5
UpWidth=0
DownWidth=2*4+1#length of scattering region
UnitCell=int((DownWidth-1)/2)+1 #unit cell
# Define the graphene lattice
sin_30, cos_30 = (1 / 2, sqrt(3) / 2)
graphene = kwant.lattice.general([(1, 0), (sin_30, cos_30)],
[(0, 0), (0, 1 / sqrt(3))])
a,b=graphene.sublattices
#graphene2 = graphene = kwant.lattice.general([(sqrt(3)/2, 1/2), (0, 1)],
#[(0, 0), (1 / (2*sqrt(3)),1/2)])
def make_system(LeftLength,RightLength,UpWidth,DownWidth):
#### Define the scattering region. ####
# circular scattering region
def circle(pos):
x, y = pos
return (-LeftLength <= x <= RightLength and
(-(sqrt(3)/2*DownWidth+1/2/sqrt(3))<=y<=sqrt(3)/2*UpWidth))
syst = kwant.Builder()
# w: width and pot: potential maximum of the p-n junction
def potential(pos):
#def potential(pos):
(x, y) = pos
return 0
syst[graphene.shape(circle, (0, 0))] = potential
# specify the hoppings of the graphene lattice in the
# format expected by builder.HoppingKind
hoppings = (((0, 0), a, b), ((0, 1), a, b), ((-1, 1), a, b))
syst[[kwant.builder.HoppingKind(*hopping) for hopping in hoppings]] = -1
# Lead left and right
sym0 = kwant.TranslationalSymmetry(graphene.vec((-1, 0)))
sym0.add_site_family(graphene.sublattices[0], other_vectors=[(1, -2)])
sym0.add_site_family(graphene.sublattices[1], other_vectors=[(1, -2)])
def lead0_shape(pos):
x, y = pos
return (-(sqrt(3)/2*DownWidth+1/2/sqrt(3))<=y<=sqrt(3)/2*UpWidth)
lead0= kwant.Builder(sym0)
lead0[graphene.shape(lead0_shape, (0, 0))] = 0
lead0[[kwant.builder.HoppingKind(*hopping) for hopping in hoppings]] = -1
#Lead up and down
sym1 = kwant.TranslationalSymmetry(graphene.vec((-1, 2)))
#sym1.add_site_family(graphene.sublattices[0], other_vectors=[(1,1)])
#sym1.add_site_family(graphene.sublattices[1], other_vectors=[(1,1)])
def lead1_shape(pos):
x, y = pos
return (-1http://docs.python.org/library/__main__.html.
if __name__ == '__main__':
main()
Thanks in advance.
Bill Yang