Attaching lead to a system

Hi all, I have made a one dimensional system with 3 sub-lattices. However, in order to attach leads I have to make a lead and manually attach it to sublattice A. But, apparently this code below is not working. Any suggestion will be help full.
def make_system(nlattice):
lat = kwant.lattice.Polyatomic([(1, 0), (0, 1)], [(0, 0), (1/3.0, 0), (2/3.0, 0)]) sub_a, sub_b, sub_c = lat.sublattices
# central scattering region syst = kwant.Builder() syst[(sub_a(x,0) for x in range(nlattice))] = 4 syst[(sub_b(x,0) for x in range(nlattice))] = 4 syst[(sub_c(x,0) for x in range(nlattice))] = 4 syst[lat.neighbors()] = -1
# add leads lat_lead = kwant.lattice.square() sym_lead1 = kwant.TranslationalSymmetry((-1, 0))
lead1 = kwant.Builder(sym_lead1) lead1[lat_lead(-1, 0)] = 4 lead1[lat_lead.neighbors()] = -1
syst[lat_lead(-1,0)] = 4 syst[lat_lead(-1,0), sub_a(0,0)] = -1 syst.attach_lead(lead1) syst.attach_lead(lead1.reversed())
kwant.plot(lead1) return syst
fsyst = make_system(nlattice=10).finalized() kwant.plot(sys, fig_size=[10,8], site_size=0.2)
Shashank Kumar

Shashank Kumar wrote:
I have made a one dimensional system with 3 sub-lattices. However, in order to attach leads I have to make a lead and manually attach it to sublattice A. But, apparently this code below is not working. Any suggestion will be help full.
I am able to run your code with the following changes:
• Add “import kwant” in the beginning.
• Replace “sys” by “fsyst” in the last line.
Please explain your problem in more detail if you still need help.
Cheers Christoph
participants (2)
-
Christoph Groth
-
Shashank Kumar