Dear Sir,
I am a PhD student of Hong Kong University of Science and Technology. I
want to use KWANT to caculate Hall resistance of a Hall bar structure.We
can get the conductance between 6 electrodes, but how to get hall
resistance? Can you give me some help? Thank you very much.
Best Regards,
Zhang Bing

Dear All,
I was consulting the example of the current in a *closed system* and I am a
little bit confused:
The figure showing the current flowing inside a circle [1] is obtained for
a magnetic field B=0 !
But we know that for B=0, the Hamiltonian is a real symmetric matrix and
thus diagonalized by a real orthogonal matrix, so the eigenvectors are real
(any phase is just artificial.)
By using the formula giving the current we should find zero !
moreover we can ask why we have a current flowing clockwise and not
anticlockwise (I remind that B=0) !
When we put B=0.05, we obtain the figures below for the current and the
wave function.
the wave function has circular symmetry but not the current. Moreover, x
and y play exactly the same role so the current should be the same on x and
on y (independently from the used gauge)
Am I missing something ?
Thank you in advance.
Adel
[1] https://kwant-project.org/doc/1/tutorial/spectrum

Dear Kwant developer,
Thank you for your effort in developing Kwant.
I have a question about the definition of the direction of momentum in the smatrix.lead_info. Assume a lead lies along the y direction with primitive vector (0,1). The symmetry operation of a lead is (0,1) if the lead goes towards the positive direction and is (0,-1) if the lead goes towards the negative direction. For the momenta contained in smatrix.lead_info for these two leads , do they use the same coordinate system? Positive momenta mean the direction (0,1), negative momenta mean the direction (0,-1). For velocity, in smatrix.lead_info, it has nothing to do with the coordinate system. Positive means outgoing, negative means incoming in the lead.
Thank you
KS Chan
Disclaimer: This email (including any attachments) is for the use of the intended recipient only and may contain confidential information and/or copyright material. If you are not the intended recipient, please notify the sender immediately and delete this email and all copies from your system. Any unauthorized use, disclosure, reproduction, copying, distribution, or other form of unauthorized dissemination of the contents is expressly prohibited.

Dear all,
In the section "Computing local quantities: densities and currents", the
function field_direction(pos,r0,delta) is defined with the condition:
if r==0: m_i=[0,0,1]
This should be m_i =[0,0,-1]
This explains why we get some strange pattern in the present figures on the
online documentation. With this minor correction, the result will be better
and more physical.
Adel

Dear kwant users and developers,
I am trying to calculate the up and down conductance in the following
system, separately, to calculate spin polarization.
I followed some of the steps suggested in the mailing list before
(wavefuncation or current operator).
I know for this system I should get the same conductance for up and down
spins.
I first calculate the total conductance
But then
1- The wave function approach does not give the the up/down conductance
similar to total.
2- the current-operator approach gives the error
'kwant.graph.core.EdgeDoesNotExistError'.
I have attached the code in the following. If one runs the code
it plot the system with leads correctly
the first conductance plot is what one expects (if trans:)
then the second plot is incorrect (if strans1:) and then gives the error
(if strans:).
I appreciate any help
Patrik
-----------------------------------------------------------------
from mpl_toolkits.mplot3d import Axes3D
from scipy.spatial import *
from matplotlib import rcParams
from numpy import *
from numpy.linalg import *
import pickle
import sys
import os
import string
import heapq
import kwant
import tinyarray
from matplotlib import pyplot
chiral=True
if chiral:
p = pi/5 #phi
t = 0.66 #theta
a = 0.34
x = 1.4
e1 = 0
e2 = 0.3
t2=0.1
t1=-x*t2
t0 = 2
lam=-0.08
t_so1 = 0.01 #spin-orbit coupling param
t_so2 = x*t_so1 #spin-orbit coupling param
tl=tr=0.3
N = 30
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]])
no=2 #number of orbitals
def sigma_v1(ap): # pauli metrix along the vertical axis
value=sigma_z*cos(t)+sin(t)*(sigma_x*sin(ap)-sigma_y*cos(ap))
return value
def sigma_v2(ap): # pauli metrix along the vertical axis
value=sigma_z*cos(t)-sin(t)*(sigma_x*sin(ap)-sigma_y*cos(ap))
return value
def family_color(sites):
return 'black' #if site.family == sites
def hopping_lw(site1, site2):
return 0.08
class Amorphous(kwant.builder.SiteFamily):
def __init__(self, coords):
self.coords = coords
super(Amorphous, self).__init__("amorphous", "",no)
def normalize_tag(self, tag):
try:
tag = int(tag[0])
except:
raise KeyError
if 0 <= tag < len(coords):
return tag
else:
raise KeyError
def pos(self, tag):
return self.coords[tag]
coords=[(0.0000000000, 0.0000000000, 0.0000000000), (-0.1336881039,
0.4114496766, 0.3400000000), (-0.4836881039, 0.6657395614, 0.6800000000),
(-0.9163118961, 0.6657395614, 1.0200000000), (-1.2663118961, 0.4114496766,
1.3600000000), (-1.4000000000, 0.0000000000, 1.7000000000), (-1.2663118961,
-0.4114496766, 2.0400000000), (-0.9163118961, -0.6657395614, 2.3800000000),
(-0.4836881039, -0.6657395614, 2.7200000000), (-0.1336881039,
-0.4114496766, 3.0600000000), (0.0000000000, -0.0000000000, 3.4000000000),
(-0.1336881039, 0.4114496766, 3.7400000000), (-0.4836881039, 0.6657395614,
4.0800000000), (-0.9163118961, 0.6657395614, 4.4200000000), (-1.2663118961,
0.4114496766, 4.7600000000), (-1.4000000000, 0.0000000000, 5.1000000000),
(-1.2663118961, -0.4114496766, 5.4400000000), (-0.9163118961,
-0.6657395614, 5.7800000000), (-0.4836881039, -0.6657395614, 6.1200000000),
(-0.1336881039, -0.4114496766, 6.4600000000), (0.0000000000, -0.0000000000,
6.8000000000), (-0.1336881039, 0.4114496766, 7.1400000000), (-0.4836881039,
0.6657395614, 7.4800000000), (-0.9163118961, 0.6657395614, 7.8200000000),
(-1.2663118961, 0.4114496766, 8.1600000000), (-1.4000000000, 0.0000000000,
8.5000000000), (-1.2663118961, -0.4114496766, 8.8400000000),
(-0.9163118961, -0.6657395614, 9.1800000000), (-0.4836881039,
-0.6657395614, 9.5200000000), (-0.1336881039, -0.4114496766, 9.8600000000),
(-1.4000000000, 0.0000000000, 0.0000000000), (-1.2663118961, -0.4114496766,
0.3400000000), (-0.9163118961, -0.6657395614, 0.6800000000),
(-0.4836881039, -0.6657395614, 1.0200000000), (-0.1336881039,
-0.4114496766, 1.3600000000), (0.0000000000, -0.0000000000, 1.7000000000),
(-0.1336881039, 0.4114496766, 2.0400000000), (-0.4836881039, 0.6657395614,
2.3800000000), (-0.9163118961, 0.6657395614, 2.7200000000), (-1.2663118961,
0.4114496766, 3.0600000000), (-1.4000000000, 0.0000000000, 3.4000000000),
(-1.2663118961, -0.4114496766, 3.7400000000), (-0.9163118961,
-0.6657395614, 4.0800000000), (-0.4836881039, -0.6657395614, 4.4200000000),
(-0.1336881039, -0.4114496766, 4.7600000000), (0.0000000000, -0.0000000000,
5.1000000000), (-0.1336881039, 0.4114496766, 5.4400000000), (-0.4836881039,
0.6657395614, 5.7800000000), (-0.9163118961, 0.6657395614, 6.1200000000),
(-1.2663118961, 0.4114496766, 6.4600000000), (-1.4000000000, 0.0000000000,
6.8000000000), (-1.2663118961, -0.4114496766, 7.1400000000),
(-0.9163118961, -0.6657395614, 7.4800000000), (-0.4836881039,
-0.6657395614, 7.8200000000), (-0.1336881039, -0.4114496766, 8.1600000000),
(0.0000000000, -0.0000000000, 8.5000000000), (-0.1336881039, 0.4114496766,
8.8400000000), (-0.4836881039, 0.6657395614, 9.1800000000), (-0.9163118961,
0.6657395614, 9.5200000000), (-1.2663118961, 0.4114496766, 9.8600000000)]
amorphous_lat = Amorphous(coords)
syst = kwant.Builder()
#adding the onsite and hopping to the system
for i in range(N):
syst[amorphous_lat(i)] = e1*sigma_0
syst[amorphous_lat(N+i)] = e2*sigma_0
syst[amorphous_lat(i), amorphous_lat(N+i)] = lam*sigma_0
if i > 0:
syst[amorphous_lat(i), amorphous_lat(i-1)] = t1*sigma_0 +
1j*t_so1*(sigma_v1(i*p)+sigma_v1((i-1)*p))
syst[amorphous_lat(N+i),amorphous_lat(N+i-1)] = t2*sigma_0 +
1j*t_so2*(sigma_v2(i*p)+sigma_v2((i-1)*p))
# If we want to attach to vertical 1D chains to the system
# we first add a site of the down lead to the scattering region
lat=kwant.lattice.cubic(a, norbs=no)
syst[lat(0, 0, -1)] = e1*sigma_0
syst[amorphous_lat(0), lat(0, 0, -1)] = tl*sigma_0
# We make a regular down lead and attach it to the system
dn_lead = kwant.Builder(kwant.TranslationalSymmetry((0, 0, -a)))
dn_lead[lat(0, 0, -2)] = e1*sigma_0
dn_lead[lat.neighbors()] = t0*sigma_0
syst.attach_lead(dn_lead)
prim_vecs=tinyarray.array([(a,0.,0.),(0.,a,0.),(0.,0.,a)])
offset=tinyarray.array((-1.2663118961, 0.4114496766,0.0))
lat2=kwant.lattice.Monatomic(prim_vecs, offset, norbs=no)
syst[lat2(0, 0, N)] = e1*sigma_0
syst[amorphous_lat(2*N-1), lat2(0, 0, N)] = tr*sigma_0
up_lead = kwant.Builder(kwant.TranslationalSymmetry((0, 0, a)))
up_lead[lat2(0, 0, N+1)] = e1*sigma_0
up_lead[lat2.neighbors()] = t0*sigma_0
syst.attach_lead(up_lead)
system=kwant.plot(syst, site_lw=0.1, site_color=family_color,
hop_lw=hopping_lw)
trans=True
if trans:
syst = syst.finalized()
energies = []
data = []
for ie in range(-320,520):
energy = ie * 0.001
smatrix = kwant.smatrix(syst, energy=energy)
energies.append(energy)
data.append(0.5*smatrix.transmission(1, 0))
fig = pyplot.figure(figsize=(6,2))
pyplot.plot(energies, data)
pyplot.xlim([-0.32,0.52])
pyplot.ylim([-0.03,1.25])
pyplot.xlabel("energy [eV]")
pyplot.ylabel("conductance [e^2/h]")
pyplot.show()
strans1=True
if strans1:
#syst = syst.finalized()
energies = []
data = []
def oscle(ene, lead_nr):
wfs=kwant.wave_function(syst, ene,
check_hermiticity=True)(lead_nr)
spin_current_z = 0
for psi in wfs:
psi_start = psi[0 : 2]
psi_end = psi[2 * 61: 2 * 61 + 2]
#spin_current_z += -2 *
imag(psi_end.conjugate().dot(sigma_z).dot(psi_start))
spin_current_z +=
abs(imag(psi_end.conjugate().dot(sigma_z).dot(psi_start)))
return spin_current_z
for ie in range(-320,520):
energy = ie * 0.001
energies.append(energy)
data.append(oscle(ene=energy, lead_nr=1))
fig = pyplot.figure(figsize=(6,2))
pyplot.plot(energies, data)
pyplot.show()
strans=True
if strans:
#syst = syst.finalized()
J_spin = kwant.operator.Current(syst, sigma_z,
where=[(amorphous_lat(0), amorphous_lat(N-2))], sum=True)
all_wfs = kwant.wave_function(syst, energy=0.25)(1)
spin_current_list = sum(J_spin(wf) for wf in all_wfs)
print(spin_current_list)

Dear Kwant developer,
I solved my problem in installation. I forgot to install packages which are required by matplotlib.
After installing them, the problem is solved.
KS Chan
Disclaimer: This email (including any attachments) is for the use of the intended recipient only and may contain confidential information and/or copyright material. If you are not the intended recipient, please notify the sender immediately and delete this email and all copies from your system. Any unauthorized use, disclosure, reproduction, copying, distribution, or other form of unauthorized dissemination of the contents is expressly prohibited.

Dear Kwant developer,
I am trying to install kwant 1.3 on window 10. The installation went smoothly without warning. I encounter problems when I try to run the ab ring example with the following error messages. There was no warning about the installation of matplotlib during the installation. I ran pip list and can see matplotlib.
KS Chan
Warning (from warnings module):
File "C:\Users\KSCHAN\AppData\Local\Programs\Python\Python36\lib\site-packages\kwant\plotter.py", line 49
"functions will work.", RuntimeWarning)
RuntimeWarning: matplotlib is not available, only iterator-providing functions will work.
Traceback (most recent call last):
File "C:\Users\KSCHAN\Desktop\ab_ring.py", line 21, in <module>
from matplotlib import pyplot
File "C:\Users\KSCHAN\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\__init__.py", line 124, in <module>
from matplotlib.rcsetup import (defaultParams,
File "C:\Users\KSCHAN\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\rcsetup.py", line 32, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "C:\Users\KSCHAN\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\fontconfig_pattern.py", line 25, in <module>
from pyparsing import Literal, ZeroOrMore, \
ModuleNotFoundError: No module named 'pyparsing'
Disclaimer: This email (including any attachments) is for the use of the intended recipient only and may contain confidential information and/or copyright material. If you are not the intended recipient, please notify the sender immediately and delete this email and all copies from your system. Any unauthorized use, disclosure, reproduction, copying, distribution, or other form of unauthorized dissemination of the contents is expressly prohibited.

Dear all,
on ordering of propagating modes. In the documentation
https://kwant-project.org/doc/1/reference/generated/kwant.physics.Propagati…
it says:
"modes with negative velocity are ordered from larger to lower momenta"
Shouldn't it be:
"modes with negative velocity are ordered from lower to larger momenta"?
As is mentioned in FAQ (in section "How does Kwant order the propagating modes of a lead?")
https://test.kwant-project.org/doc/doc-faq/tutorial/FAQ
namely:
"Negative velocity modes are ordered by increasing momentum"
Best,
Tibor