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 "<function onsite at 0x7ff91e80f050>". In order to actually get all the on site energies and hoppings assigned, is to finalize the system with sys.finalized. kwant will then figure out what all the on site energies and all the hoppings are supposed to be by passing all the lat(x,y)s to the onsite function.


On Tue, Sep 29, 2015 at 9:28 AM, kamal ghosh <> wrote:
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

import kwant
import cmath


def potential(site,pot):
if 10 < x< 20:
return pot
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.


Get your own FREE website, FREE domain & FREE mobile app with Company email.  
Know More >