Hi,
I am interested in calculating the wavefunction at sites inside the scattering
region in systems with one or more leads. My goal is to calculate spin currents
between sites, which requires to find expressions on the form
\psi^{\dagger}(x,y) \vect{\sigma} \psi(x+1,y) and so on. As far as I understand
one can use kwant.solvers.default.wave_function() and specify lead number, mode
and a position (by inserting the site index) to get out a wave function (a
complex number). My questions are then:
- What is the wave function at a site when there are several leads and
propagating modes at a given energy ? Is it a sum of all contributions from all
leads and all propagating modes ?
- Can one get out the spin components of the wavefunction (not just a single
number) ? (Maybe this is related to what modes we put in)
I use the dev version of kwant 1.3 where it is possible to specify a
conservation_law in the lead.
I included a simple example below of a two-dimensional NFN-system where I try
to get out the wavefunction at the site (1,2).
Best,
Sverre Gulbrandsen
import kwant
from matplotlib import pyplot
import tinyarray
# Define 2x2-matrices to span spin space:
sigma_0 = tinyarray.array([[1, 0], [0, 1]])
sigma_z = tinyarray.array([[1, 0], [0, -1]])
def make_system(a=1, t=1.0, W=10, L=30):
lat = kwant.lattice.square(a, norbs=2)
sys = kwant.Builder()
sys[(lat(x, y) for x in range(L) for y in range(W))] = 4 * t * sigma_0 +
0.2 * t * sigma_z
sys[lat.neighbors()] = -t * sigma_0
lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)),
conservation_law=-sigma_z)
lead[(lat(0, j) for j in range(W))] = 4 * t * sigma_0
lead[lat.neighbors()] = -t * sigma_0
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
return sys
def print_wave_function_at_site(sys, energy, position_vector):
site_index = [sys.sites[i].pos for i in
range(len(sys.sites))].index(position_vector)
wf_at_site = kwant.solvers.default.wave_function(sys,
energy)(0)[0][site_index]
print(wf_at_site)
def main():
sys = make_system()
kwant.plot(sys)
sys = sys.finalized()
print_wave_function_at_site(sys, energy=1, position_vector=(1, 2))
if __name__ == '__main__':
main()