Hi Henry,

The builder is internally a dictionary, and hence on recent versions
of Python it stores sites in the order in which they were added. The
finalized system, on the other hand, stores the sites in lexicographic
ordering [1]. To get the neighbors of a site in a finalized system you
should use its graph attribute, so the method
syst.graph.in_neighbors(site_number) [2]. The graph works with
integer-indexed sites, to convert to the corresponding site objects,
use syst.sites and syst.id_by_site.

Cheers,
Anton

[1]: 
https://kwant-project.org/doc/1/pre/whatsnew/1.3#consistent-ordering-of-sites-in-finalized-builders
[2]: 
https://kwant-project.org/doc/1/reference/generated/kwant.graph.CGraph#kwant.graph.CGraph.in_neighbors

On Thu, 12 Aug 2021 at 11:12, Henry Axt <henry....@gmail.com> wrote:
>
> I am attempting to approximate the first derivate over the system's 
> wavefunction values, yet it seems there is no neighbors() function to call 
> after finalization of the system.
> What would be the method to attain a list of neighboring sites after 
> finalizaion? Is the ordering of the sites preserved before and after 
> finalization?

Reply via email to