Dear Gabriel,

I went back to your original message. You want a system with a di-atomic
chain and leads with a monoatomic lattice.
You can achieve that with one unique monoatomic lattice for the whole
system and put a staggered potential in the middle. This will make your
life easier.
Check the code below

I hope this helps,
Adel


##############################################
lat=kwant.lattice.square()
sys=kwant.Builder()

L=10
t=1
def pot(site,v1,v2):
    x,_=site.pos
    if x%2==0: return v1
    else: return v2
sys[(lat(x,0) for x in range(L))]=pot
sys[lat.neighbors()]=-t
sym=kwant.TranslationalSymmetry((-1,0))
lead=kwant.Builder(sym)

lead[lat(0,0)]=0
lead[lat.neighbors()]=-t
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
kwant.plot(sys)

sysf=sys.finalized()

sm=kwant.smatrix(sysf,energy=-1.8,params=dict(v1=0.1,v2=-0.1))
T=sm.transmission(0,1)




On Mon, Jul 10, 2023 at 7:25 PM Gabriel Garcia <gqgarci...@gmail.com> wrote:

> 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?
>


-- 
Abbout Adel

Reply via email to