Dear All, How to retrieve the actual grid position from a given site index? For example, how to get local_dos at (i,j) space position from 1d Numpy array, on a simple rectangular grid? I assume that it has something to do with pos method, but an simple example will be appreciated. Thanks in advance, Jerzy
On 30/06/14 08:55, Jerzy Wrobel wrote:
Dear All, How to retrieve the actual grid position from a given site index? For example, how to get local_dos at (i,j) space position from 1d Numpy array, on a simple rectangular grid? I assume that it has something to do with pos method, but an simple example will be appreciated. Thanks in advance, Jerzy
Hi,
The ordering of the elements of the output from `local_dos` (as well as `wave_function`) is the same as the ordering of the sites in your finalized system. You can say
ldos_dict = {tuple(site.tag): ldos for site, ldos in zip(fsys.sites, ldos_array)}
where `fsys` is your finalized system and `ldos` is the numpy array returned by `local_dos`. You can then get the value for site `(i,j)` by saying
ldos_dict[i, j]
Note that this will only work in the case where you have 1 orbital per site (i.e. scalar values for your onsite matrix elements).
Hope that helps,
Joe
Dear Jerzy,
"Jerzy Wrobel" wrobel@ifpan.edu.pl writes:
how to get local_dos at (i,j) space position from 1d Numpy array, on a simple rectangular grid?
The order of sites in a finalized system is random, as there is no useful order in the general case. It’s straightforward to lookup the site object given a site index in a finalized builder: sys.sites[123] gives the Site object of site nr. 123. sys.sites is simply a sequence of all the sites in the system in the order in which they appear in the finalized system.
If you need efficient lookup in the opposite direction, the best way is to create a lookupdictionary. See Joseph’s reply for an example of how to do that.
Christoph
participants (3)

christoph.groth＠cea.fr

Jerzy Wrobel

Joseph Weston