I am fairly new to kwant, but what I have seen so far is really impressive!
Currently, I am trying to obtain the dual transverse wave functions and mode
velocities for graphene leads. In other words, I would like to achieve the
diagonalization of the coupling matrix Gamma (=2Im Sigma^R) in terms of the
wave-function and velocities. Any pointers on how to do this in a convenient way
would be highly appreciated.
Many thanks & best regards,
> ... the spin is still
> defined, and the two degrees of freedom correspond to local spin
>polarizations up or down...
Exactly, therefore I have prepared the following function
which, I think, plots averages <S_x>, <S_y> and <S_z> at each site:
def plot_Si(sys, energy, n_lead):
# Compute wave function
psi = kwant.wave_function(sys, energy)
psi_n = psi(n_lead).sum(axis=0)
# Calculate <Si> per site
Nsites = psi_n.shape / 2
sx = zeros((Nsites,))
sy = zeros((Nsites,))
sz = zeros((Nsites,))
psi_i = array([[0.0], [0.0]])
for i in xrange(Nsites):
psi_i = array([[psi_n[i * 2]], [psi_n[i * 2 + 1]]])
sx[i] = abs(dot(psi_i.conj().T, dot(sigma_x, psi_i)))[0, 0]
sy[i] = abs(dot(psi_i.conj().T, dot(sigma_y, psi_i)))[0, 0]
sz[i] = abs(dot(psi_i.conj().T, dot(sigma_z, psi_i)))[0, 0]
kwant.plotter.map(sys, sx, num_lead_cells=5)
kwant.plotter.map(sys, sy, num_lead_cells=5)
kwant.plotter.map(sys, sz, num_lead_cells=5)
It seems that it works for a 2-terminal quantum wire (like the one defined
in spin_orbit.py). For example with just one transmitted mode and
\alpha=0.5, ez = 0.0, a nice "snapshot" of the spin precession is obtained
(run the attached spin_orbit_jw1.py script).
However, there must be something wrong with this function, since for
3-terminal T-shaped device (like the one defined in spin_orbit_T_jw1.py)
the <S_i> patterns, without spin-orbit interaction (\alpha=0.), are
asymmetrical. This is strange, since the device is symmetric along lead
axis, from which the wave function is emanated. There is no such a problem
for 2-terminal wire, in that case each <S_i> looks much like ldos for
Any hint what is wrong will be appreciated. I suspect the mysterious psi_n
= psi(n_lead).sum(axis=0) command, since psi(n_lead) consist of two
rows of length 2Nsites, even for just one (spin degenerate) mode.
What is stored in each row?
P.S. I use python27 under win8.
It appears that the version number of the kwant package on the cheese-shop
is incorrect. On `https://pypi.python.org/pypi/kwant/` the version is
correctly stated as `1.0.0`, and the tar archive is version `1.0.0` as
required, however when installing via `pip` the version is quoted as `0.1.6`.
- set up python virtualenv `venv`
- activate virtualenv
- installed all dependencies via `pip` (cython, numpy, scipy, tinyarray)
- installed kwant via `pip`
- launch python shell:
<<< import kwant
<<< print kwant.__file__
<<< print kwant.version.version
The API for this package seems to be commensurate with that for version
`1.0.0`, so I believe that this is just a case of `kwant/_static_version.py`
having not been regenerated correctly when kwant was packaged and published
on the cheese-shop.
This is no a major issue, but may be confusing for people who have downloaded
kwant via `pip` especially if they then seek help and quote the version as
P.S. the non-standard Python shell prompts `<<<` were used because Gmane
accuses me of top-posting if I use `>>>`