Dear Sudin, Please post the code giving the error or explain better your concern.
Could you just do it by defining an on site function? def Onsite(site): x,y=site.pos() i,_=site.tag if y=y0: return Values[i] else: return V0 sys[(........)]=Onsite I hope this helps, Adel On Wed, Apr 15, 2020 at 3:45 PM SUDIN GANGULY <sudingang...@gmail.com> wrote: > Dear Sir, > > I want to assign a particular sequence of site values on a particular line > (a number of lines) of a zigzag graphene nanoribbon. For example, the > bottom zigzag line. > > let's say, from the left to right there are 10 sites and I want to put the > onsite values as [1,2,3,...]. > > I was able to get the information about the sites that are in the bottom > line and have assigned the site values accordingly. But the problem is that > each time I finalize the system, I get different onsite values along the > bottom line. Is there any way to resolve this? Or maybe this approach is > not the right way to do that. > > A part of my code is given below > ======================== > def make_system(W, L, no_of_line): > > ## scattering region ## > sys = kwant.Builder() > sys[lat.shape(cross(W,L), (0,0))] = 0 > sys[lat.neighbors(1)] = -1. > #######INFO of the line######### > line=[] > for site in sys.expand(lat.shape(cross(W,L), (0, 0))): > #print (site.pos[0],site.pos[1]) > line.append(site.pos[1]) > > line=set(line) > line=list(line) > line=sort(line) > > > i=1 > for site in sys.expand(lat.shape(cross(W,L), (0, 0))): > for j in range(0,no_of_line+1,2): > line_no=j > if (site.pos[1]==line[line_no] or site.pos[1]==line[line_no+1]): > sys[site]=i > i=i+1 > ######################## > > With Regards, > Sudin > -- Abbout Adel