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 am using Kwant to study a system with both spins and electron and hole,
so the hopping matrix is 4X4. Now I want to know how to separate the spins,
electron and hole. I study this through the "2.6. Superconductors: orbital
degrees of freedom, conservation laws and symmetries"
smatrix = kwant.smatrix(syst, energy)
data.append(smatrix.submatrix((0, 0), (0, 0)).shape[0]
-smatrix.transmission((0, 0), (0, 0)) +smatrix.transmission((0, 1), (0, 0)))
I do not find more information about this for kwant.
For my system, if I have 3 leads, and the hopping and onsite energy is set
in this order:
(e↑,0,0,0)- spin up electron,first row of the 4X4matrix
(0,e↓,0,0)- spin down electron,second row of the 4X4matrix
(0,0, h↑ ,0)- spin up hole,third row of the 4X4matrix
(0,0, 0, h ↓ )- spin down hole,fourth row of the 4X4matrix
I want to obtain the transmissions from 0 →2.
smatrix = kwant.smatrix(syst, energy)
The transmission from h↑ to e↑ is: smatrix.transmission((2, 1), (0, 2))
The transmission from h ↓ to e↑ is: smatrix.transmission((2, 1), (0, 3))
Is my understanding correct?
Thanks very much in advance!
Hosein Khani

Hello :)
I'm trying to calculate the Berry curvature. Is there a way to get access to the eigenvectors of H (k) for different k values just diagonalizing the following hamiltonian H_k?
-----------Code-------------------------------------------------------------------------------
wrapped = kwant.wraparound.wraparound(sys).finalized()
def ham(sys,k_x,k_y=None, **params):
k= momentum_to_lattice(sys, [k_x] if k_y is None else [k_x,k_y])
p=dict(zip(sys._momentum_names,k),**params)
return sys.hamiltonian_submatrix(params=p,sparse=False)
H_k= ham(wrapped,kx,ky)
------------------------------------------------------------------------------------------------------
Thanks for your time and help!
Nayra

Dear All,
I am trying to plot the density on top of the plot of the current. I use for that "ax" to combine the two plots. I kind of noticed that the two plots do not have the same size (although the system is the same!)
I know that when "ax" is not None, "figsize" is disabled.
Is there a way to fix the size of the two plots to be the same such that they can be combined?
Regards,
Adel

Hello,
I am modeling a graphene lattice that is rectangular in shape.
graphene = kwant.lattice.general([(1, 0), (sin_30, os_30)],
[(0, 0), (0, 1 / sqrt(3))])
When you attach the leads (with symmetry parallel to the rectangle edges), extra lattice sites get added. I want to avoid this and my thinking is that you define a seperate lattice for the leads, such that it is a unit cell translatable like a square lattice, which in this case would be something like:
lattice_lead = kwant.lattice.general([(1, 0), (0, 2*cos_30)],
[(0, 0), (0, l(1 / sqrt(3))),(0.5,((1/sqrt(3))+(tan_30*0.5))),(0.5,((2/sqrt(3))+(tan_30*0.5)))])
My question is firstly, is this the way to go about it? And secondly, how does this interplay with the sublattices and thier hoppings?

Hello,
I have set up a system in which I want to define hoppings in a lead between sites that originate from two sublattices: LatticeA has sublatices a and b, LatticeB has sublattices c and d. Currently, I believe I am achieving this via:
for site in lead2.sites():
(x,y) = site.pos
if str(site.family) == "<Monatomic lattice e0>":
lead2[c(x,y),a(x,y)] = Delta
if str(site.family) == "<Monatomic lattice e1>":
lead2[d(x,y),b(x,y)] = Delta
and thereby connecting sublattices c and a, and d and b.
Is this accurate? Can this be done with HoppingKind? And is there a way for me to list all the hoppings created to check if this was successful?

Hello,
I'm confused by some problem when doing time-dependent spin related transport calculations by tkwant. Let me briefly introduce what the main problem is. I'm now considering a 1D chain model with some magnetic spin moment on some of the sites. By applying a voltage to one lead, I want to know how the spin accumulate near the other lead. My problem is that in my code the calculated spin density and charge density near the second lead are always same which I believe should not be true because this means that only one spin channel is always occupied and the other is always empty! My code is as follows:
import tkwant
import kwant
from matplotlib import pyplot as plt
from math import pi, sqrt, cos, sin
from cmath import atan
import numpy as np
############ spin matrix #############
s0=np.array([[1,0],[0,1]])
sx=np.array([[0,1],[1,0]])
sy=np.array([[0,-1j],[1j,0]])
sz=np.array([[1,0],[0,-1]])
length=10
l_M=1
M=0.2
t=1
times=range(200)
lat = kwant.lattice.general([(5,0,0),(0,5,0),(0,0,1)],
[(2.5,2.5,0)],norbs=2)
def scattering_region(pos):
x,y,z=pos
return abs(x-2.5)<=1 and abs(y-2.5)<=1 and z>=0 and z<=length-1
def mag_region0(pos):
x,y,z=pos
return abs(x-2.5)<=1 and abs(y-2.5)<=1 and z<=-1 and z>=-l_M
def mag_region1(pos):
x,y,z=pos
return abs(x-2.5)<=1 and abs(y-2.5)<=1 and z>=length and z<=length+l_M-1
syst=kwant.Builder()
syst[lat.shape(scattering_region, (2.5, 2.5, 0))]=0*s0
syst[lat.shape(mag_region0, (2.5, 2.5, -1))]=M*sz
syst[lat.shape(mag_region1, (2.5, 2.5, length))]=M*sz
for i in range (length+2*l_M-1):
syst[lat.sublattices[0](0,0,i-l_M),lat.sublattices[0](0,0,i-l_M+1)]=t*s0
def lead_region(pos):
x,y,z=pos
return abs(x-2.5)<=1 and abs(y-2.5)<=1
lead=kwant.Builder(kwant.TranslationalSymmetry(lat.vec((0,0,-1))),conservation_law=-sz)
lead[lat.shape(lead_region, (2.5,2.5,0))]=0*s0
lead[lat.neighbors()]=t*s0
def phi(time):
Vb, tau= 0.6, 20
if time > tau:
return Vb*time - Vb*tau/2
return Vb*time*time/2/tau
syst.attach_lead(lead)
syst.attach_lead(lead.reversed())
kwant.plot(syst,site_size=0.2,site_lw=0.01,hop_lw=0.05)
tkwant.leads.add_voltage(syst,0,phi)
syst=syst.finalized()
def current_cut(site_to, site_from):
return site_from.pos[2]<=length-1 and site_to.pos[2]>length-1
def density_cut(site):
return site.pos[2]>=length and site.pos[2]<=length+l_M-1
current_operator=kwant.operator.Current(syst,where=current_cut)
charge_density_operator=kwant.operator.Density(syst,s0,where=density_cut)
spin_density_operator=kwant.operator.Density(syst,sz,where=density_cut)
occupy=tkwant.manybody.lead_occupation(chemical_potential=-0.5)
print('make up of state ...')
state=tkwant.manybody.State(syst,tmax=max(times),occupations=occupy,refine=False,combine=True)
Currents=[]
Charge=[]
Spin=[]
for time in times:
print('%.4f percent ...' % (100*times.index(time)/len(times)))
state.evolve(time)
current=state.evaluate(current_operator)
charge=state.evaluate(charge_density_operator)
spin=state.evaluate(spin_density_operator)
Currents.append(current)
Charge.append(charge)
Spin.append(spin)
np.savetxt('Times_linear_chain.txt',times)
np.savetxt('Current_linear_chain.txt',Currents)
np.savetxt('Charge_density_linear_chain.txt',Charge)
np.savetxt('Spin_density_linear_chain.txt',Spin)
plt.figure()
plt.plot(times,Currents)
plt.xlabel('time $t$')
plt.ylabel('Current $I$')
plt.show()
plt.figure()
plt.subplot(211)
plt.plot(times,Charge)
plt.xlabel('time $t$')
plt.ylabel('Charge density')
plt.subplot(212)
plt.plot(times,Spin)
plt.xlabel('time $t$')
plt.ylabel('Spin density')
plt.show()
Does anyone know where the problem is?
-Yizhou LIU