I triend changing it, but that does not solve the problem.
From: Anton Akhmerov [mailto:anton.akhmerov+kd@
Sent: 24. januar 2017 12:36
Could the difference originate from you using a lattice constant of 2 instead of 1?
On Tue, Jan 24, 2017, 10:41 Camilla Espedal <firstname.lastname@example.org> wrote:
Thanks again for all your help. I will try to do it the linux way. Just one more thing regarding this. I wrote a script in the old Kwant to find the total conductance and compare it to the one in your notebook. While the two plots are qualitatively similar, they are not the same. Am I missing something, or am I calculating different things?
# Tutorial 2.3.1. Matrix structure of on-site and hopping elements
# Physics background
# Gaps in quantum wires with spin-orbit coupling and Zeeman splititng,
# as theoretically predicted in
# and (supposedly) experimentally oberved in
# Kwant features highlighted
# - Numpy matrices as values in Builder
# For plotting
import matplotlib.pyplot as plt
# For matrix support
import numpy as np
# define Pauli-matrices for convenience
sigma_0 = tinyarray.array([[1, 0], [0, 1]])
sigma_x = tinyarray.array([[0, 1], [1, 0]])
sigma_y = tinyarray.array([[0, 1j], [-1j, 0]])
sigma_z = tinyarray.array([[1, 0], [0, -1]])
def make_system(a=2, t=1.0, alpha=0.1, e_z=0.05, W=10, L=10):
# Start with an empty tight-binding system and a single square lattice.
# `a` is the lattice constant (by default set to 1 for simplicity).
lat = kwant.lattice.square(a)
sys = kwant.Builder()
#### Define the scattering region. ####
sys[(lat(x, y) for x in range(L) for y in range(W))] = \
4 * t * sigma_0 + e_z * sigma_z
# hoppings in x-direction
(1, 0), lat, lat)] = \
-t * sigma_0 - 1j * alpha * sigma_y
# hoppings in y-directions
(0, 1), lat, lat)] = \
-t * sigma_0 + 1j * alpha * sigma_x
#### Define the left lead. ####
lead = kwant.Builder(kwant.
lead[(lat(0, j) for j in range(W))] = 4 * t * sigma_0
# hoppings in x-direction
lead[lat.neighbors()] = \
-t * sigma_0
#### Attach the leads and return the finalized system. ####
def plot_conductance(sys, energies):
# Compute conductance
data = 
for energy in energies:
smatrix = kwant.smatrix(sys, energy)
sys = make_system()
# Check that the system looks as intended.
# Finalize the system.
sys = sys.finalized()
energies = np.linspace(0, 1, 200)
smatrices = [kwant.smatrix(sys, energy) for energy in energies]
fig = plt.figure(figsize=(13, 8))
ax = fig.add_subplot(1, 1, 1)
ax.plot(energies, [smatrix.transmission(1,0) for smatrix in smatrices], label='total')
ax.set_ylabel('$G [e^2/h]$', fontsize='xx-large')
# Call the main function if the script gets executed (as opposed to imported).
# See <http://docs.python.org/
if __name__ == '__main__':
From: email@example.com [mailto:anton.akhmerov@gmail.
com] On Behalf Of Anton Akhmerov
Sent: 17. januar 2017 10:48
To: Camilla Espedal <firstname.lastname@example.org>
Subject: Re: [Kwant] Regarding smatrix and spin
It seems that you are trying to install Kwant on windows. This is a very hard task, and I fear none of the Kwant developers has enough knowledge of it right now (our Windows packages are built by Christoph Gohlke, see  for the build environment description). However if you are using windows 10, I suggest to try to install Kwant using the windows subsystem for linux. That way the standard Ubuntu build procedure should work for you.
On Mon, Jan 16, 2017 at 9:45 AM, Camilla Espedal <email@example.com> wrote:
> Thanks a lot. I tried to install the cons_laws_combined, but I get the following error message:
> "LINK: fatal error LNK1181: cannot open input file 'lapack.lib'"
> Is there some package or installation I am missing?
> Best regards,
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:anton.akhmerov@gmail.
> Behalf Of Anton Akhmerov
> Sent: 8. januar 2017 16:35
> To: Tómas Örn Rosdahl <email@example.com>
> Cc: Camilla Espedal <firstname.lastname@example.org>;
> Subject: Re: [Kwant] Regarding smatrix and spin
> Hi Camilla, everyone,
> I've slightly modified Tómas's example to a case where the spins do get coupled, check it out:
> I've also provided more detailed installation instructions in the notebook.
> On Sun, Jan 8, 2017 at 2:45 PM, Tómas Örn Rosdahl <email@example.com> wrote:
>> Dear Camilla,
>> For a Hamiltonian with degeneracies due to a conservation law, the
>> scattering states will in general not have a definite value of the
>> conservation law. In your case, Kwant returns scattering states that
>> are arbitrary linear combinations of spin up and down, so it is not
>> possible to label the amplitudes in the scattering matrix by spin.
>> However, in Kwant 1.3 a feature will be added that allows for the
>> construction of scattering states with definite values of a
>> conservation law. See here for an explanation of the basic idea behind the algorithm.
>> We're currently working on implementing this feature in Kwant itself.
>> The good news is that we're practically done - here is a link to a
>> git repo with a functioning implementation. After you clone the repo,
>> check out the branch cons_laws_combined, which contains a version of
>> Kwant with conservation laws implemented. This notebook contains a
>> simple example to illustrate how to work with conservation laws and the scattering matrix.
>> I invite you and anyone else who is interested to give it a try. We'd
>> appreciate any feedback!
>> In your case specifically, there would be two projectors in the new
>> implementation - P0 which projects out the spin up block, and P1 that
>> projects out the spin down block. If they are specified in this
>> order, then the spin up and down blocks in the Hamiltonian have block
>> 0 and 1, respectively. In the new implementation, it is possible to
>> ask for subblocks of the scattering matrix relating not only any two
>> leads, but also any two conservation law blocks in any leads. To get
>> the reflection amplitude of an incident spin up electron from lead 0
>> into an outgoing spin down electron in lead 0, you could simply do
>> smat.submatrix((0, 1), (0, 0)). Here, the arguments are tuples of indices (lead index, block index).
>> Best regards,
>> On Fri, Jan 6, 2017 at 3:46 PM, Camilla Espedal
>>> Hi again,
>>> This question is basically the same as this:
>>> I want to calculate some things using the scattering matrix. I
>>> started out with a very simple system, most basic two-terminal
>>> system. For some energy there is one propagating mode. I now add
>>> matrix structure to the mix (just multiply by s_0 everywhere) and
>>> there are now 2 propagating modes (which makes sense).
>>> Now, if I look at the reflection coefficients for lead 0 by using
>>> submatrix(0,0), it is now a 2x2 matrix after I introduced the
>>> matrices. How are the elements ordered? Is it
>>> [[r_upup, r_updown],[r_downup, r_downdown]]
>>> I know that I could make two lattices, but since I do not plan to
>>> use the other functions such as transmission. I just want the smatrix.
>>> Hope you can help me, and thanks in advance.
>>> Best regards,