I am a bit surprised that for my system with 16 sites and 9 hoppings
between the unit cells
I get lead.modes(E, args =[...] )
returning stabilized modes which are 9 vectors of length 9 . I
understand that my hopping is degenerate
and what I hoped to get from calling
lead.modes(E, args =[...] )
is evanescent mode vectors of length 16 with corresponding complex
momenta and some extra vectors spanning the non-propagating subspace.
Could you clarify how to get what I want, please.
I'm trying to reproduce the data from PRB 74, 205307 (2006) with Kwant. I'm
having trouble extracting data from the spin up and spin down lattices.
This is how I do it:
Define two square lattices with names "up" and "down". Here's the code for
the local energies:
lat_up = kwant.lattice.square(1, name="up")
lat_dw = kwant.lattice.square(1, name="dw")
sys[(lat_up(x, y) for x in range(Nx) for y in range(Ny))] = 4*t
sys[(lat_dw(x, y+delta) for x in range(Nx) for y in range(Ny))] = 4*t
I'm using this "delta" so that the kwant.plot(sys) show then separately.
Define separate leads for the spin up and down lattices. So I can
investigate the injection of each kind of spin.
To reproduce Fig.1, panels (b) and (c), of the paper above I run
This gives me the spin up and down projections of the wave-function
injected via lead 0 (up lead). But the spin up projection is on one
lattice, while the spin down is on the other lattice.
When I plot using kwant's map plot (command below), I do see exactly
Fig.1(b) and (c), one in each lattice.
But I don't know how to extract from rho0 (or from kwant's wave-function
command) the data from a given lattice.
When I try to implement a spin-orbit Hamiltonian using matrices instead of
separate lattices, it is easy to split the spin up and down data using
something like ldos[0::2] and ldos[1::2], since the up and down data
alternate in the array. But with matrices I have no control over the spin
up or down injection. So it seems that I do have to use separate lattices.
So, with separate lattices... how do I extract the data from each lattice
to separate arrays?
Thanks in advance,
Dear Kwant users,
I am looking to port Kwant 1.0.4 to Python 3 ahead of the development
Kwant 2.0, which will begin soon. Kwant 2.0 will be fully Python 3 from the
start, and so it will be useful to have the existing Kwant 1.x as Python
serve as a base for Kwant 2.0. In addition, any users who want to use
straight away (a requested feature in the survey) would be able to do so
having to wait for Kwant 2.0.
I would like to start a discussion about which version of Python 3 Kwant
support. Below I will outline the the status of support for Python 3 on
platforms, as well as my proposal.
The status of Python 3
Python 3 is the preferred  version of the Python programming language for
applications in current development. The current stable version of
Python 3 is
version 3.4, and was released in March 2014. Windows and Mac OS X
this version have been available since release , in addition the Anaconda
distribution has been shipping installers for Python 3.4 since version
popular Linux distributions the Python 3 package is already version 3.4 by
default, even in releases more than a year old[3-6]. The notable
Debian old-stable (Wheezy) which still has Python 3.2.
I propose that Kwant 1.x (and subsequently Kwant 2.x) depend on Python
as opposed to 3.2 or some even older version. For Windows and OS X the
standard download proposed on python.org is version 3.4, so any users on
platforms will just have to choose the default. For users who are still on
Debian old-stable (e.g. users who don't control their computing
the admins have not yet updated to stable) this would mean that they
the Python 3 version of Kwant or Kwant 2. I think this is a reasonable
The Python 3 release of Kwant 1.x will not add any new features or bug
so users on old-stable will not be inconvenienced; they will just have to
keep using the Python 2 version of Kwant 1.x. The development of Kwant 2.0
will in any case take some time, which will give any users on old-stable the
chance to upgrade to current stable. In any case old-stable becomes
in less than a year.
Anyone with a strong preference either way is encouraged to reply to
: For ubuntu, since 14.04
: For Debian, on current stable (Jessie)
: For OpenSuse since 13.2, for Fedora since 21
Upon experimenting with Joe’s python3 version of kwant on OS X I found that mumps has a well maintained homebrew formula of its own in the homebrew/science tap: https://github.com/Homebrew/homebrew-science/blob/master/mumps.rb
I think it might be useful to simplify the kwant installation on OS X.
Also the tinyarray and kwant version are outdated on https://github.com/michaelwimmer/homebrew-kwant
Updating tinyarray via pip doesn’t work:
bnijholt:~> pip install tinyarray -U
Installing collected packages: tinyarray
Found existing installation: tinyarray 1.0.2
DEPRECATION: Uninstalling a distutils installed project (tinyarray) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Successfully uninstalled tinyarray-1.0.2
Rolling back uninstall of tinyarray
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 299, in run
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 646, in install
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 813, in install
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1008, in move_wheel_files
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 317, in clobber
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/tinyarray.so'
Changing the kwant tarball to the 1.0.4 file on the brew formula also doesn’t work (https://github.com/basnijholt/homebrew-kwant/blob/master/kwant.rb):
bnijholt:~> brew install kwant
==> Installing kwant from basnijholt/homebrew-kwant
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Building with an alternative Fortran compiler
This is unsupported.
Warning: No Fortran optimization information was provided. You may want to consider
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
`brew install` if your compiler is compatible with GCC.
If you like the default optimization level of your compiler, ignore this
==> Downloading pypi.python.org/packages/source/k/kwant/kwant-1.0.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/kwant-1.0.4.tar.gz
patching file build.conf
==> python setup.py install --prefix=/usr/local/Cellar/kwant/1.0.4
Build configuration was:
User-configured LAPACK and BLAS
error: command 'clang' failed with exit status 1
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
I am currently trying to implement the advice given by Joseph in https://email@example.com/msg00075.html? to write a code which generates the current density going into each site in my graphene system.
My issue is with returning the nearest neighbor hopping elements in graphene. In the example Joseph posted for a square lattice, there is an obvious coordinate for the nearest neighbor sites. It seems to me that in graphene (or any honeycomb lattice), this is not so obvious.
I have been looking for a function built into Kwant that would give me what I need, but haven't had much luck. I've figured out lots of ways (for example, using sys_leads_sites on my finalized system) to generate the number assigned to each site and the corresponding position, but not a good way to determine which are nearest neighbors. I'm guessing the answer is very simple using some of the machinery built into Kwant, I'm just not seeing it.
Does anyone have any tips they would be willing to give me? I am not looking for a complete current density code, just a nudge in the right direction. ?
Thanks very much!