Hi Joe,

Thanks for your help! Your advice was what I needed to get my code working. I had a feeling what I needed was somewhere in the documentation- I was just looking in the wrong places.

I've included an ipython notebook for anyone who might want to check it out (hopefully it works): http://nbviewer.ipython.org/github/samlagasse/LaGasse_QT/blob/master/QHE_currentdensity.ipynb

I haven't yet implemented any Fermi-Dirac functions so this is only for a very idealized case... The code is pretty messy but it might help anyone who runs into similar problems to mine. I modified one of the examples posted in the Kwant paper for it. I think it is pretty interesting to compare the probability density and current density maps- I expected them to give the same information but in my testing, it goes case by case. In this example its pretty similar (I just think it looks really cool), but in another I did looking a focusing effects in graphene, you really need the current density map.

It also shows my way of plotting log-scale colormaps of data from Kwant. It probably exists, but I didn't see a native way of doing it with the existing codes.

I'm hoping to add some more examples to this notebook over time- this is just kind of a first draft of the code- it doesn't have many comments. I'm also not convinced it doesn't have mistakes yet.

Thanks again!

Sam

From: Joseph Weston <joseph.weston08@gmail.com>
Sent: Wednesday, July 29, 2015 1:42 AM
To: LaGasse, Samuel
Cc: kwant-discuss@kwant-project.org
Subject: Re: [Kwant] Nearest neighbor Hamiltonian elements (Current density maps)

Hi,

Kwant finalized systems have a graph which can be efficiently queried to get the
"neighbours" of a site (neighbours here means that they are joined by a hopping)
you can do:

...
lat = kwant.lattice.honeycomb()
sys = make_system(lat)
fsys = sys.finalized()

i = fsys.sites.index(lat(5, 6))
# get sequence of integers -- sites connected to i by a hopping
all_the_neighbors = fsys.graph.out_neighbors(i)

depending on what you want to do afterwards you can map the integers in
"all_the_neighbors"  back to bona-fide sites using "fsys.sites", which you

There is documentation on the graph (http://kwant-project.org/doc/1.0/reference/generated/kwant.graph.CGraph#kwant.graph.CGraph)
but this is kind of advanced kwant usage and there's no explicit examples in the tutorial.

Hope that helps,

Joe

P.S.
I'm actually looking to implement better support for manipulating quantities which are defined over
sites/hoppings, and am talking with Christoph about having this in kwant 2.0.

On 28 July 2015 at 21:50, LaGasse, Samuel wrote:

Hi All,

I am currently trying to implement the advice given by Joseph in https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00075.html​ to write a code which generates the current density going into each site in my graphene system.

My issue is with returning the nearest neighbor hopping elements in graphene. In the example Joseph posted for a square lattice, there is an obvious coordinate for the nearest neighbor sites. It seems to me that in graphene (or any honeycomb lattice), this is not so obvious.

I have been looking for a function built into Kwant that would give me what I need, but haven't had much luck. I've figured out lots of ways (for example, using sys_leads_sites on my finalized system) to generate the number assigned to each site and the corresponding position, but not a good way to determine which are nearest neighbors. I'm guessing the answer is very simple using some of the machinery built into Kwant, I'm just not seeing it.

Does anyone have any tips they would be willing to give me? I am not looking for a complete current density code, just a nudge in the right direction. ​

Thanks very much!

Sam