Dear Kamal,
pos is an attribute of lat; if we try something like
print lat(1,2).pos
we should get [1.0,2.0] as an answer. So an atom with index (1,2) lives at
the "real-space coordinates" (1,2). (this seems trivial, but it gets
different when you do the same for a lattice other than a square one).
If we play a bit with your onsite function:
print onsite(lat(1,1),-1)
print onsite(lat(15,1),-1)
we see the output 0 and -1, and is precisely what we want. Next step is
defining a wire, say 40 atoms long and 10 wide, and assign the on site
energies on all the atoms using the function "onsite". The way to do it in
kwant is by:
sys[(lat(x, y) for x in range(40) for y in range(10))] = onsite
which assigns the function "onsite" to all on site energies at sites
0<=x<40 and 0<=y<10. At this point, nothing happened much. If we ask python
to
print sys[lat(1,1)]
it will tell us something like "
Dear all, Please help me in correcting the following program which I tried to mimic a portion of the program on transmission through a quantum well. I tried the following:
import kwant import cmath
lat=kwant.lattice.square(1) sys=kwant.Builder()
def potential(site,pot): (x,y)=site.pos if 10 < x< 20: return pot else: return 0 def onsite(site,pot=0): return potential(site,pot)
print potential(12,0)
Error shown : (x,y)=site.pos; there is no attribute in int (x,y)= site.pos It is strange that in the original program of the quantum well, I also could not explain why that program run successfully! because there also no such "pos" attribute is defined anywhere.
Please bear with my misunderstanding and rectify me with brief tutorial.
K.K.Ghosh mail: kk_ghosh@rediffmail.com
https://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/sign... Get your own *FREE* website, *FREE* domain & *FREE* mobile app with Company email. *Know More >* http://track.rediff.com/click?url=___http://businessemail.rediff.com?sc_cid=sign-1-10-13___&cmp=host&lnk=sign-1-10-13&nsrv1=host