Dear all, I would like to ask about the wave function of the propagating modes because I don't know how should i write it into the file. I do that using the code smatrix = kwant.smatrix(sys, energy) mode= smatrix.lead_info and now mode[1].wave_functions[i][0] gives as the wave function of the propagating mode corresponding to the 0 orbital in lead 1. I would like to write this wave function into the file but a don't know how is the correspondence between position "i" and the real position in the lead. It is important for me because I need to know how is the average spin of each propagating mode. Thank you in advance Best Regards Pawel
Hi, Finalized builders have an attribute called `sites` which is a sequence of `kwant.lattice.Site`s contained within the system. This sequence is ordered in the same way as the wavefunction elements. You could, for example, create a "dictionary" (mapping) between sites and wavefunction elements like so:: lead = 1 # whatever mode = 0 # whatever smatrix = kwant.smatrix(sys, energy) mode = smatrix.lead_info sites = fsys.leads[lead].sites psi = mode[lead].wave_functions[:, mode] psi = dict(zip(sites, psi)) and then access the wavefunction elements like:: psi[lat(4, 5)] I see in your case that you mention that your are studying a system with spin. Note that the above example will work if you have implemented the spin degree of freedom using two different lattices, like in the kwant `lattice`_ example. In such a case you may access the different spin components by indexing `psi` using the different spin lattices:: spin_up_component = psi[spin_up_lattice(4, 5)] spin_down_component = psi[spin_down_lattice(4, 5)] If you have implemented the spin by assigning 2x2 matrices to the onsite elements (like in the kwant `orbital`_ example), then the following will work:: lead = 1 # whatever mode = 0 # whatever sites = fsys.leads[lead].sites psi = mode[lead].wave_functions[:, mode] psi_up = dict(zip(sites, psi[::2])) # even elements of psi (up) psi_down = dict(zip(sites, psi[1::2])) # odd elements of psi (down) and access:: spin_up_component = psi_up[lat(4, 5)] spin_down_component = psi_down[lat(4, 5)] Regards, Joe P.S. The `sites` attribute is not actually documented anywhere, as it's not part of the official interface to finalized builders. .. _lattice: http://kwant-project.org/doc/1.0/tutorial/tutorial5#lattice-description-usin... .. _orbital: http://kwant-project.org/doc/1.0/tutorial/tutorial5#orbital-description-usin...
participants (2)
-
Joseph Weston
-
Pawel Wojcik