Hello everyone 

I want to attach a lead on top of lattice but it doesn't work.
Please check the following code and tell me the error code in the lead
construction section 

Thank you 

import kwant
from matplotlib import pyplot 

lat = kwant.lattice.general([(0, 0.5, 0.5), (0.5, 0, 0.5), (0.5, 0.5,
0)],
[(0, 0, 0), (0.25, 0.25, 0.25)], name=['a1', 'a2'])
a1, a2 = lat.sublattices 

def make_cuboid(a=15, b=15, c=15):
def cuboid_shape(pos):
x, y, z = pos
return 0 <= x < a and 0 <= y < b and 0 <= z < c

syst = kwant.Builder()
syst[a1.shape(cuboid_shape, (0, 0, 0))] = 1 ## the same on-site foar a1
and b1
syst[a2.shape(cuboid_shape, (0, 0, 0))] = 1
syst[lat.neighbors()] = 1

sym_lead = kwant.TranslationalSymmetry((-1,0))
top_lead = kwant.Builder(sym_lead)

top_lead[(lat(0,0,j) for j in range(c))] = 1
top_lead[lat.neighbors()]=-1

syst.attach_lead(top_lead)

return syst 

def main():

syst = make_cuboid() 

kwant.plot(syst)

syst = syst.finalized()

syst = make_cuboid(a=1.1, b=1.1, c=1.1)

def family_colors(site):
return 'r' if site.family == a1 else 'g' 

kwant.plot(syst, site_size=0.18, site_lw=0.01, hop_lw=0.05,
site_color=family_colors)

### Conventional unit cell "FCC"
#pyplot.show()
if __name__ == '__main__':
main()

Reply via email to