Dear Joseph Weston Thank you very much for your quick response. Of course, I can post you my cod example. It is in the following:
import kwant import matplotlib.pyplot as plt import math d=1.42; a1=d*math.sqrt(3); t=-0.033; latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,-d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder() #................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return -4.75*a1<x<4.75*a1 and -8*d<y<8*d syst[latt.shape(rectangle, (1,1))]=0 def delet(pos): x, y = pos z=x**2+y**2 return z<(1*a1)**2 del syst[latt.shape(delet, (1,1))] #nearest neighbors............................................................. syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t sym = kwant.TranslationalSymmetry(latt.vec((-4,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)]) lead = kwant.Builder(sym) def lead_shape(pos): x, y = pos return -8*d<y<8*d lead[latt.shape(lead_shape, (1,1))] = 0 def delet_lead(pos): x, y = pos z=x**2+y**2 return z<(1*a1)**2 del lead[latt.shape(delet_lead, (1,1))] lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t syst.attach_lead(lead,add_cells=3) syst.attach_lead(lead.reversed(),add_cells=3) ax=kwant.plot(syst); Best wishes, Nafise Sorry for double email. The first email was not as reply. Best, Nafise On Tue, Oct 8, 2019 at 3:08 PM Nafise Nouri <nafise.n...@gmail.com> wrote: > Hi, > Of course. > I sent it to you and also to the mailing list, > > Best regards, > Nafise > > On Tue, Oct 8, 2019 at 11:31 AM Joseph Weston <joseph.westo...@gmail.com> > wrote: > >> Hi, >> >> Can you post this as a reply to your query in the mailing list? I >> accidentally replied directly to you when I should have CC'd the mailing >> list also. >> >> Thanks, >> >> Joe >> On 10/6/19 7:43 AM, Nafise Nouri wrote: >> >> Dear Joseph Weston >> Thank you very much for your quick response. >> Of course, I can post you my cod example. It is in the following: >> >> import kwant >> import matplotlib.pyplot as plt >> import math >> >> d=1.42; >> a1=d*math.sqrt(3); >> t=-0.033; >> >> latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], >> [(a1/2,-d/2),(a1/2,d/2)]) >> a,b = latt.sublattices >> syst= kwant.Builder() >> >> >> #................................................................................... >> def rectangle(pos): >> x, y = pos >> z=x**2+y**2 >> return -4.75*a1<x<4.75*a1 and -8*d<y<8*d >> >> syst[latt.shape(rectangle, (1,1))]=0 >> >> def delet(pos): >> x, y = pos >> z=x**2+y**2 >> return z<(1*a1)**2 >> >> del syst[latt.shape(delet, (1,1))] >> >> >> #nearest >> neighbors............................................................. >> syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t >> syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t >> syst[[kwant.builder.HoppingKind((-1,1),a,b)]] =t >> >> >> sym = kwant.TranslationalSymmetry(latt.vec((-4,0))) >> >> sym.add_site_family(latt.sublattices[0], other_vectors=[(-1, 2)]) >> sym.add_site_family(latt.sublattices[1], other_vectors=[(-1, 2)]) >> lead = kwant.Builder(sym) >> >> >> def lead_shape(pos): >> x, y = pos >> return -8*d<y<8*d >> >> lead[latt.shape(lead_shape, (1,1))] = 0 >> >> def delet_lead(pos): >> x, y = pos >> z=x**2+y**2 >> return z<(1*a1)**2 >> >> del lead[latt.shape(delet_lead, (1,1))] >> >> lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t >> lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t >> lead[[kwant.builder.HoppingKind((-1,1),a,b)]] =t >> >> syst.attach_lead(lead,add_cells=3) >> syst.attach_lead(lead.reversed(),add_cells=3) >> >> ax=kwant.plot(syst); >> >> Best wishes, >> Nafise >> >> On Sat, Oct 5, 2019 at 12:57 PM Joseph Weston <joseph.westo...@gmail.com> >> wrote: >> >>> Hi Nafise >>> >>> >>> I need to make a periodic lattice with hole. In fact I should make holes on >>> the scattering region and also on the leads. Although I can make this kind >>> of lattice by kwant, I have problem about the distances between holes. I >>> want to make a periodic holes on the nanoribbon but the distance between >>> holes in the scattering region is different from the distance between holes >>> in the other regions. Would you please let me know How Can I make a same >>> distance between holes? Should I work on the translational symmetry in the >>> leads? >>> >>> >>> Because the leads need to be translationally invariant if you want a >>> very large distance between defects then your unit cell in the leads needs >>> to be correspondingly large. >>> >>> If you post a code example of what your problem is specifically we may >>> be able to help more. >>> >>> >>> Happy Kwanting, >>> >>> Joe >>> >>> >>> P.S. sorry for the double reply; I forgot to send to the mailing list >>> also >>> >>>