Thanks a lot Joseph. As you found my system has four degrees of freedom per site and I know (by reading previous emails) they are located sequentially in wavefunction array. I wanted to know how to filter them to access specific sites. Thanks again for your help, but I have another question about what you wrote. What is index in mentioned function "in_sheet"? Would you please explain how I can implement it in my code or a simple system?
Thanks for your time and consideration.
On Wed, Jul 29, 2015 at 8:06 PM, Joseph Weston email@example.com wrote:
The finalized system has a `sites` attribute which is a sequence of sites ordered in the same way as in the wavefunction. You should know that in the wavefunction the values on degrees of freedom which belong to the same site are stored sequentially.
I see you have 4 degrees of freedom per site in your model, therefore you can do something like the following:
import numpy as np import kwant sys = make_system() fsys = sys.finalized() wavefunction = .... ... # get sites in "sheet" def in_sheet(index, site): return site.pos == 0 # site in x-z plane sheet_idx_sites = filter(in_sheet, enumerate(fsys.sites)) n = len(sheet_sites) # prepare storage projected_wavefunction = np.empty((n, 4), dtype=np.complex) # get wavefunction projection for i, (idx, site) in enumerate(sheet_idx_sites): projected_wavefunction[i] = wavefunction[idx*4: (idx+1)*4]
Similar questions have been asked several times on the mailing list, although never explicitly with >1 orbital per site.
Hope that helps,
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.