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

# 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

know about already, or you can calculate currents etc.

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 <SLaGasse@sunypoly.edu> 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