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

Hello,
I’m interested in using kwant to look at transport beyond the effective mass approximation. To that end, I’ve entered a Hamiltonian that reproduces silicon’s band structure [specifically, the k.p Hamiltonian from M. Cardona and F. H. Pollak, Phys. Rev. 142, 530 (1966)] into a 1D kwant lattice.
When I plot the bands in the leads using kwant.plotter.bands, at first it looks nothing like Si’s band structure (see lead_bands.pdf, attached). However, when zoomed in to an appropriate k range for Si, Si’s band structure is there as expected (see lead_bands_zoom.pdf, attached). To be more specific, this is Si’s band structure in the (100) direction, which is what I was aiming for.
However, this is still useless for transport because kwant calculates transmission as a function of energy for all k values – including k values that are meaningless for Si and need to be excluded from the calculation.
So, I think that my question boils down to: is there a reasonably simple way to restrict the range of k values that kwant considers? If not, can you think of another way to hack a full band structure into kwant?
Thanks.
-Leon
PS. Just to preempt some non-helpful answers: I am not interested in replies along the lines of “You couldn’t possibly need to include the full band structure. Just use an effective mass.” I have good reasons to want to include the full band structure.

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 all, I want to know the voltage at each site of my device. I have set the terminal voltage and segmented that total voltage in my choice. But, I cannot get the output. Please help me in giving a way out.My code is appended herewith.Regards.K.K.Ghoshkk_ghosh(a)rediffmail.com

Dear all,
I am trying to write the current density in a file. In order to write the
current in an external file, I have to know the coordinates associated with
the current as well. In Kwant < 1.3, I used *sys**.site(i).pos* to know the
position of a given tag *i*. In the current version, this is not available
anymore. How can I do this now? That is, given *current = J(psi)* (As in
the example on the website), how can I know the position associated with *i*
in *current[i]*?
Best Regards,
Luan

Dear All,
I have a Hamaltonian (BHZ hamiltonian) and i'm trying to introduce a
magnetic field. I believe I have to use the Peierls phase, however i'm not
sure how to implement this after I have finalized the BHZ hamiltonian. Any
assistance is appreciated. I will paste the code i have to generate my
hamiltonian. You can find more information about the BHZ hamiltonian here:
arxiv:0801.0901 <https://arxiv.org/abs/0801.0901>
"""
import kwant
import numpy as np
import scipy.linalg as la
import scipy.sparse.linalg as sla
import sympy
import matplotlib.pyplot as plt
from ipywidgets import interact
Gamma_so = [[0, 0, 0, -1],
[0, 0, +1, 0],
[0, +1, 0, 0],
[-1, 0, 0, 0]]
hamiltonian = """
+ M * kron(sigma_0, sigma_z)
- B * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z)
- D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0)
+ A * k_x * kron(sigma_z, sigma_x)
- A * k_y * kron(sigma_0, sigma_y)
+ Delta * Gamma_so
"""
params_bhz=dict(A=364.5, B=-686, D=-512, M=-10, Delta=1.6)
hamiltonian = kwant.continuum.sympify(hamiltonian,
locals=dict(Gamma_so=Gamma_so))
hamiltonian
grid_spacing = 5
template = kwant.continuum.discretize(hamiltonian,
grid_spacing=grid_spacing)
syst = kwant.wraparound.wraparound(template)
syst = syst.finalized()
"""
Best,
Alex

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 Sir,
In the new version of Kwant, it is possible to calculate the up and down
spin conductance. In order to calculate the different components of the
spin conductance (G_x,G_y,G_z), Greens function can be used as shown in
the following mail-archive
link:https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00483.…
If I want to calculate the quantities like G_x^up or G_x^down, is it
possible to calculate these with Greens function like the smatrix.
Another question I want to ask (forgive me if it is out of the context).
We can calculate the zero temperature charge shot-noise using the
kwant.physics.two_terminal_shotnoise. Is there any option to calculate the
spin shot-noise?
With Regards,
Sudin Ganguly

Dear all,
I am learning Kwant through tutorial. My toy model is a two-terminal
quantum wire system based on the square lattice. I want to plot the spatial
local dos for both the scattering region and leads. However, it does not
work for leads part. The following is the code that presents my problem. I
am wondering whether it is possible to solve this problem with Kwant.
Thanks a lot for any help.
Kind regards,
kuangyia
=============================================================
#!/usr/bin/env python3
import kwant
import numpy as np
import matplotlib.pyplot as plt
def make_system(a=1, t=1.0, W=20, L=50, L_well=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 and its potential profiel. ####
def potential(site, pot):
(x, y) = site.pos
if (L - L_well) / 2 < x < (L + L_well) / 2:
return pot
else:
return 0
def onsite(site, pot=0):
return 4 * t + potential(site, pot)
sys[(lat(x, y) for x in range(L) for y in range(W))] = onsite
sys[lat.neighbors()] = -t
#### Define and attach the leads. ####
lead = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
lead[(lat(0, j) for j in range(W))] = 4 * t
lead[lat.neighbors()] = -t
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
return sys
def main():
sys = make_system()
# Check that the system looks as intended.
kwant.plot(sys)
# Finalize the system.
sys = sys.finalized()
# Calculate ldos at a given energy
well_depth = 0.55
ldos = kwant.ldos(sys, energy=0.25, args=[-well_depth])
kwant.plotter.map(sys, ldos, num_lead_cells=10)
if __name__ == '__main__':
main()

Hello everyone!
I want to solve a quantum transport question about the quantum spin Hall
bar. The Hamiltonian of my system is
The tight-binding model can be written as follow ( is the lattice constant):
Onsite item: ; Hopping-x item: ; Hopping-y item:
The matrix:
My Question:
(1) The first one is that I am not sure whether the tight-binding model
presented above is right for the case of , such as , especially for the
hopping -x and -y item.
(2) In order to calculate the density distribution of electron and the
conductance, the code presented below cannot exactly match the results in
the paper
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.83.081402]. For
example the density of states calculated by Kwant near the edge is much
thick compared with the paper results. The conductance also cannot give the
same result, such as the conductance is 1.1e^2/h for my result but 2.0e^2/h
for the paper at Fermi energy 10meV.
My kwant code is
import math
import numpy
from numpy import *
from matplotlib import pyplot
import kwant
import tinyarray
sigma_0 = tinyarray.array([[1, 0, 0, 0], [0, 1, 0 ,0], [0, 0, 1, 0], [0, 0,
0, 1]])
sigma_1 = tinyarray.array([[0, -1, 0, 0], [-1, 0, 0 ,0], [0, 0, 0, 1], [0,
0, 1, 0]])
sigma_2 = tinyarray.array([[1, 0, 0, 0], [0, -1, 0 ,0], [0, 0, 1, 0], [0, 0,
0, -1]])
sigma_3 = tinyarray.array([[0, -1, 0, 0], [1, 0, 0 ,0], [0, 0, 0, -1], [0,
0, 1, 0]])
def make_system(W_QPC):
L1=70
W1=60
L2=70
W=150
A=364.5
B=-686
C=0
D=-512
M=-10
a=2
b=1
def central_region(pos):
x, y = pos
return -(L1 +W1 + L2)/2 < x < (L1 +W1 + L2)/2 and \
abs(y) < (x <= L1-(L1 +W1 + L2)/2) * abs(0.25 * (2 * W-W_QPC) *
(math.sin((x+(L1 +W1 + L2)/2)*math.pi/L1 - math.pi/2) + 1)-W) + (x >
L1-(L1 +W1 + L2)/2 and x <= (L1+W1-(L1 +W1 + L2)/2)) * W_QPC/2 + (x > (L1 +
W1-(L1 +W1 + L2)/2) and x < (L1+W1+L2-(L1 +W1 + L2)/2)) * abs(0.25 * (2 *
W-W_QPC) * (math.sin((x-W1/2)*math.pi/L1 + math.pi/2) + 1)-W)
lat = kwant.lattice.square(a)
sys = kwant.Builder()
sys[lat.shape(central_region, (0, 0))] = (C-4*D/a**2)*sigma_0 +
(M-4*B/a**2)*sigma_2
sys[kwant.builder.HoppingKind((b, 0), lat, lat)] = D * sigma_0/a**2+B *
sigma_2/a**2+1j * A * sigma_1/a
sys[kwant.builder.HoppingKind((0, b), lat, lat)] = D * sigma_0/a**2+B *
sigma_2/a**2+ A * sigma_3/a
sym = kwant.TranslationalSymmetry((-a, 0))
lead = kwant.Builder(sym)
lead[(lat(0, y) for y in range(-int(W/2) + 1, int(W/2)))] =
(C-4*D/a**2)*sigma_0 + (M-4*B/a**2)*sigma_2
lead[kwant.builder.HoppingKind((b, 0), lat, lat)] = D * sigma_0/a**2+B *
sigma_2/a**2+1j * A * sigma_1/a
lead[kwant.builder.HoppingKind((0, b), lat, lat)] = D * sigma_0/a**2+B *
sigma_2/a**2+ A * sigma_3/a
sys.attach_lead(lead)
sys.attach_lead(lead.reversed())
return sys.finalized()
def density(sys, energy):
psi = kwant.wave_function(sys, energy)
for i in range(2):
psi_5 = abs(psi(0)[i]**2)#.sum(axis=0)
#psi_5 = abs(psi(0)[5]**2)
#numpy.savetxt("psi_n.txt",psi_n);
A1, A2 = psi_5[::4], psi_5[1::4]#, psi_n[2::4], psi_n[3::4]
D = A1+A2
numpy.savetxt("D_now.txt",D);
kwant.plotter.map(sys, D)
def plot_conductance(WW_QPC, energy):
# Compute conductance
data = []
for w_QPC in WW_QPC:
sys = make_system(W_QPC=w_QPC)
#sys = sys.finalized()
smatrix = kwant.smatrix(sys, energy)
data.append(smatrix.transmission(1, 0))
numpy.savetxt("WW_QPC.txt",WW_QPC)
numpy.savetxt("data.txt",data)
pyplot.figure()
pyplot.plot(WW_QPC, data)
pyplot.xlabel("W_QPC [nm]")
pyplot.ylabel("conductance [e^2/h]")
pyplot.show()
sys = make_system(W_QPC=50)
kwant.plot(sys)
d = density(sys, energy=10)
plot_conductance(WW_QPC = [50*i+50 for i in range(4)], energy = 10)
#numpy.savetxt("D.txt",d);
#kwant.plotter.map(sys, d)