Hi Adel, Thanks for answering me. I already read the FAQ, but unfortunately it's not working for me. I tried to replicate your example above with different lattice parameters, where the primitive vector is (2,0) and the atoms are located at (0,0) and (1,0). So that, from matplotlib import pyplot as plt from matplotlib import backends import kwant t = 10 # em eV (hopping parameter) L = 5
lat = kwant.lattice.general([(2,0),(0,1)],[(0,0),(1,0)], norbs=1) a, b = lat.sublattices syst = kwant.Builder() # Scattering region for i in range(L): syst[a(i, 0)] = 0 syst[b(i, 0)] = 0 syst[kwant.builder.HoppingKind((0, 0), a, b)] = -t syst[kwant.builder.HoppingKind((1, 0), a, b)] = -t kwant.plot(syst) plt.show() # Anexando as leads lat_lead1 = kwant.lattice.general([(1,0),(0,1)],[(0,0)], norbs=1).sublattices[0] sym_lead1 = kwant.TranslationalSymmetry((-1, 0)) syst[lat_lead1(-1,0)] = 0 syst[lat_lead1(-1,0),a(0,0)] = -t syst[lat_lead1(10,0)] = 0 syst[lat_lead1(10,0),b(9,0)] = -t lead1 = kwant.Builder(sym_lead1) lead1[lat_lead1(0,0)] = 0 lead1[lat_lead1.neighbors()] = -t syst.attach_lead(lead1) syst.attach_lead(lead1.reversed()) kwant.plot(syst) plt.show() --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-17-d6f28d521172> in <module> 8 9 syst[lat_lead1(10,0)] = 0 ---> 10 syst[lat_lead1(10,0),b(9,0)] = -t 11 12 lead1 = kwant.Builder(sym_lead1) ~\anaconda3\lib\site-packages\kwant\builder.py in __setitem__(self, key, value) 1160 func = (self._set_site if isinstance(sh, Site) 1161 else self._set_hopping) -> 1162 func(sh, value) 1163 1164 def _del_site(self, site): ~\anaconda3\lib\site-packages\kwant\builder.py in _set_hopping(self, hopping, value) 1136 # of identical sites. 1137 a2 = a = self.H[a][0] -> 1138 b2 = b = self.H[b][0] 1139 else: 1140 b2, a2 = sym.to_fd(b, a) KeyError: Site(kwant.lattice.Monatomic([[2.0, 0.0], [0.0, 1.0]], [1.0, 0.0], '1', 1), array([9, 0])) --------------------------------------------------------------------------------------------------------------------------------------- Every time I change the lattice parameters, the code gives me an error. The erro is exactly in hopping with leads. Can someone can explain to me what i did wrong?