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 Sir,
I was trying to plot 2D LDOS map for a 3D system. I am using kwant.plotter.map and kwant.plotter.plot for plotting density and LDOS.
But there is an error message showing " Only 2D system can be plotted in this way". The following part is included where I am getting this error. Thanks in advance.
def density(sys, energy, lead_nr, params=params):
wf = kwant.wave_function(sys, energy, params=params)
return (abs(wf(lead_nr))**2).sum(axis=0)
d = density(sys,0.5, 0, params=params)
print (d)
kwant.plotter.map(sys, d, cmap='gist_heat_r', colorbar=True)#, site_lw=0)
ldos = kwant.ldos(sys, energy=0.5, params=params)
print (ldos)
kwant.plotter.plot(sys, ldos, num_lead_cells=2)
Regards,
priyanka

Dear Sir,
I am a beginner user of kwant i want to make a ring shaped structure of
bi2se3 .it is rhombohedral having lattice constants a = 4.138, c = 28.64.
Internal coordinates u = 0.399 for Bi sites v= 0.206 for Se sites.
The basic unit cell of Bi2Se3 is called Quituple layer which contains 5
atoms, one Se atom at (0,0,0), Bi atoms at internal
coordinates(+_u,+_,u+_u) and Se atoms at (+-v,+-v,+-v)
The Bravis lattice vectors are
a1 = (-a/2,-a/2*sqrt(3),c/3)
a2 = (a/2,-a/2*sqrt(3),c/3)
a3=(0,-a/sqrt(3), c/3)
for bi2Se3 i wrote the following program..Please tell whether it is correct
or not and please tell how to form a ring structure of bi2se3
from math import pi, sqrt, tanh
import kwant
# For computing eigenvalues
import scipy.sparse.linalg as sla
# For plotting
from matplotlib import pyplot
# Define bismuth selenide lattice
a= 4.138
c= 28.64
u= 0.399
v= 0.206
bismuthselenide =
kwant.lattice.general([(-4.138/2,-4.138/2*sqrt(3),28.64/3),(4.138/2,-4.138/2*sqrt(3),28.64/3),(0,-4.138/sqrt(3),28.64/3)],
[(0, 0, 0),(0.399, 0.399, 0.399),(0.206, 0.206, 0.206)])
a, b, c = bismuthselenide.sublattices

Hello (again),
Everything is in the title.
I want to implement random (and complex) next nearest neighbors hopping in a Haldane infinite wire.
Without the random part, 'kwant.plotter.bands()' correctly plot the band structure of my system.
However, when I add a random contribution on the modulus of the NNN hopping term, I get an error from 'kwant.plotter.bands()' :
'The cell Hamiltonian is not Hermitian'
Which is strange because I red everywhere that the hermicity constraint is always fullfilled using Kwant.
The function for random NNN hopping works perfectly fine for a finite system.
So, is this comming from the inter-cell hopping terms ? If so, how to correct it ?
Kwant does not consider the hopping terms of both ends of the cell as being equal ? It should be because u_k(r) = u_k(r+R) is like periodic boundary conditions for u_k.
I add my script at the end so you can see for yourself (the NNN hopping randomness parameter is 'rand_nnn').
Best regards,
Alexandre BERNARD
----------------- my script ----------------------
from types import SimpleNamespace
import matplotlib
import math
from matplotlib import pyplot
from mpl_toolkits import mplot3d
import numpy as np
import random
import kwant
def random_uni(param):
return param*(random.random() - 0.5)*2 # returns a random number between +param and -param
def onsite(site, p):
# Here we affect a potential whose sign depends on which sublattice the atom lives in (breaking sublattice symmetry)
if site.family == A: # sublattice A
return p.m + random_uni(p.rand_os)
else: # sublattice B
return -p.m + random_uni(p.rand_os)
def nn_hopping(site1, site2, params):
return params.t_1 + random_uni(params.rand_nn)
def nnn_hopping(site1, site2, params):
return (math.cos(params.phi) + 1j*math.sin(params.phi)) * (params.t_2 + random_uni(params.rand_nnn))
def ribbon_shape_armchair(pos):
return (-1 <= pos[0] < w)
def hopping_color(site1, site2):
if site1.family == A and site2.family == A:
return 'b'
elif site1.family == B and site2.family == B:
return 'r'
else:
return '0.5'
def site_color(site):
if site.family == A:
return 'b'
else:
return 'r'
np.random.seed(271828) # Fixing the RNG seed for reproducibility (or not, because of how Kwant works)
# Graphene lattice "pointing up", with two sublattices
graphene = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # Here are the vectors of the Bravais lattice
[[0, 0], [0, 1/np.sqrt(3)]]) # Here are the positions of the atoms in the unit cell
A, B = graphene.sublattices
w = 29 # width of the ribbon
p = SimpleNamespace(t_1=1.0, t_2=0.1, m=0.0, phi=np.pi/2, rand_os=0., rand_nn=0., rand_nnn=0.1)
# Creation of the list of (oriented) bonds that will have the complex hopping term
nnn_hoppings_A = (((-1, 0), A, A), ((0, 1), A, A), ((1, -1), A, A)) # Bonds within the A sublattice
nnn_hoppings_B = (((1, 0), B, B), ((0, -1), B, B), ((-1, 1), B, B)) # Bonds within the B sublattice
nnn_hoppings = nnn_hoppings_A + nnn_hoppings_B
haldane_armchair = kwant.Builder(kwant.TranslationalSymmetry((0, 1*np.sqrt(3))))
haldane_armchair[graphene.shape(ribbon_shape_armchair, (0, 0))] = onsite
haldane_armchair[graphene.neighbors(1)] = nn_hopping
haldane_armchair[[kwant.builder.HoppingKind(*hopping) for hopping in nnn_hoppings]] = nnn_hopping
kwant.plot(haldane_armchair, site_color=site_color, hop_color=hopping_color, fig_size=(6, 9));
kwant.plotter.bands(haldane_armchair.finalized(), args=[p], fig_size=(12, 8));

Dear Sir,
I want to model a bi2se3 nanowire in kwant to investigate the
transport properties.
Please help me in this regard.
Regards,
Shyam Lochan Bora
Dept. of Physics.
Dibrugarh University
Assam, India

Hi Girish,
Currently the recommended way to install kwant on macOS is with conda.
See the instructions on https://kwant-project.org/install#
Best, Bas
> On 15 May 2018, at 09:20, Girish Sharma <girishs(a)g.clemson.edu> wrote:
>
> Dear All,
>
> I am trying to install Kwant on my Mac High Sierra 10.13.4. I am facing the following error after brew tap homebrew/science command:
>
> brew tap homebrew/science
> Updating Homebrew...
> ==> Auto-updated Homebrew!
> Updated 1 tap (homebrew/core).
> ==> Updated Formulae
> aptly gtksourceview@4 nano rocksdb
> armadillo jhiccup node-build solr
> dash kubernetes-helm osquery spigot
> dscanner libu2f-host pam-u2f spring-roo
> fabric maxwell postgrest
> fn mercurial pound
> grpc mpc proguard
>
> Error: homebrew/science was deprecated. This tap is now empty as all its formulae were migrated.
>
> Could any one of you please help me with this.
>
> Thank you.
>
> Best regards,
> Girish

Dear All,
I am trying to install Kwant on my Mac High Sierra 10.13.4. I am facing the
following error after brew tap homebrew/science command:
brew tap homebrew/science
Updating Homebrew...
==> *Auto-updated Homebrew!*
Updated 1 tap (homebrew/core).
==> *Updated Formulae*
aptly gtksourceview@4 nano rocksdb
armadillo jhiccup node-build solr
dash kubernetes-helm osquery spigot
dscanner libu2f-host pam-u2f spring-roo
fabric maxwell postgrest
fn mercurial pound
grpc mpc proguard
*Error: homebrew/science was deprecated. This tap is now empty as all its
formulae were migrated.*
Could any one of you please help me with this.
Thank you.
Best regards,
Girish

Hello,
I encountered an issue when dealing with a semi-infinite ribbon: when defining a 1D translationnal invariance, I end up with a unit cell with unwanted and unexpected additionnal degrees of freedom.
The unit cell have additionnal segments of atoms (depending on the translationnal invariance vector). This additionnal segment is not visible with a "kwant.plot()" but appears in the Hilbert space dimensionnality.
It then create unexpected states close to zero energy which are not visible on the band structure but are visible in the DOS.
I copy the script at the end of the message, if you want to have a look. This is a Haldane model ribbon with armchair edges.
I tried to change the translationnal invariance vector but I didn't manage to get around it.
Do you have a solution ? Should I use wraparound ?
My end goal is to have a large enough system with a kind of periodic boundary condition in one direction, but still preserving a plotable dispersion relation, so I though that using 1D translationnal invariance with a big unit cell was a good idea.
Thank you in advance,
Alexandre BERNARD
---------------------------------------------------- the script ---------------------------------------------------------------
from types import SimpleNamespace
import matplotlib
import math
from matplotlib import pyplot
from mpl_toolkits import mplot3d
import numpy as np
import scipy.linalg as la
import random
import kwant
def random_uni(param):
return param*(random.random() - 0.5)*2 # returns a random number between +param and -param
def onsite(site, p):
# Here we affect a potential whose sign depends on which sublattice the atom lives in (breaking sublattice symmetry)
if site.family == A: # sublattice A
return p.m + random_uni(p.rand_os)
else: # sublattice B
return -p.m + random_uni(p.rand_os)
def nn_hopping(site1, site2, params):
return params.t_1
def nnn_hopping(site1, site2, params):
return (math.cos(params.phi) + 1j*math.sin(params.phi)) * (params.t_2)
def ribbon_shape_armchair(pos):
return (-1 <= pos[0] < w)
def hopping_color(site1, site2):
if site1.family == A and site2.family == A:
return 'b'
elif site1.family == B and site2.family == B:
return 'r'
else:
return '0.5'
def site_color(site):
if site.family == A:
return 'b'
else:
return 'r'
np.random.seed(271828) # Fixing the RNG seed for reproducibility
# Graphene lattice "pointing up", with two sublattices
graphene = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # Here are the vectors of the Bravais lattice
[[0, 0], [0, 1/np.sqrt(3)]]) # Here are the positions of the atoms in the unit cell
A, B = graphene.sublattices
w = 5 # width of the ribbon
p = SimpleNamespace(t_1=1.0, t_2=0.1, m=0.0, phi=np.pi/2, rand_os=0.)
# Creation of the list of (oriented) bonds that will have the complex hopping term
nnn_hoppings_A = (((-1, 0), A, A), ((0, 1), A, A), ((1, -1), A, A)) # Bonds within the A sublattice
nnn_hoppings_B = (((1, 0), B, B), ((0, -1), B, B), ((-1, 1), B, B)) # Bonds within the B sublattice
nnn_hoppings = nnn_hoppings_A + nnn_hoppings_B
haldane_armchair = kwant.Builder(kwant.TranslationalSymmetry((0, 1*np.sqrt(3))))
haldane_armchair[graphene.shape(ribbon_shape_armchair, (0, 0))] = onsite
haldane_armchair[graphene.neighbors(1)] = nn_hopping
haldane_armchair[[kwant.builder.HoppingKind(*hopping) for hopping in nnn_hoppings]] = nnn_hopping
kwant.plot(haldane_armchair, site_color=site_color, hop_color=hopping_color, fig_size=(6, 9));
haldane_f2 = haldane_armchair.finalized()
ham = haldane_f2.hamiltonian_submatrix(args = [p])
eigenVal, eigenVec = la.eigh(ham)
nb_eVal = len(eigenVal[:])
print("Number of eigenvalues (i.e. unit cell DOF): ", nb_eVal)
pyplot.hist(eigenVal[:], 300)
pyplot.show()
pyplot.hist(eigenVal[:], 100, cumulative=True)
pyplot.show()
kwant.plotter.bands(haldane_armchair.finalized(), args=[SimpleNamespace(t_1=p.t_1, t_2=p.t_2, m=p.m, phi=p.phi, rand_os=p.rand_os)], fig_size=(12, 8));
E_F = 0.0
for j in range(nb_eVal):
if eigenVal[j] > E_F:
break
print("eigenVal[", j, "] = ", eigenVal[j])
pyplot.figure(figsize=(w,w/2))
for i, s in enumerate(haldane_f2.sites):
x,y=s.pos
prob = abs(eigenVec[i,j])**2
pyplot.scatter(x,y,c=prob,vmin=0,vmax=5e-3,s=60)
pyplot.show()

Hello everyone,
Is there currently way to visualize the current through a 2D cut for a
3D system that does not involve messing with the kwant code?
I have a 3D system and would like to see the differences in the
current when I switch some specific hoppings on and off.
Regards,
--
Dr. Eleni Chatzikyriakou
Computational Physics lab
Aristotle University of Thessaloniki
elchatz(a)auth.gr - tel:+30 2310 998109

Hi,
Please use the option "Reply All".
Also how do you start the "ipython notebook", how did you install it.
Best,
Rafal
--
Rafał Skolasiński
GitHub: https://github.com/RafalSkolasinski
Kwant GitLab: https://gitlab.kwant-project.org/r-j-skolasinski
On 3 May 2018 at 12:54, shyam lochan bora <shyamlochan04(a)gmail.com> wrote:
> Dear sir ,
> I am running ubuntu 16.4.
> In windows 10 ,kwant is installed and i am running it from notepad++
> In Ubuntu i am trying to use it from ipython notebook..
> Thank you sir. I will provide you the error message.
>
>
>
> Regards
> Shyam Lochan Bora
>
>
> On Thu, May 3, 2018 at 4:16 PM, Rafal Skolasinski <
> r.j.skolasinski(a)gmail.com> wrote:
>
>> Hi,
>>
>> Which version of Ubuntu do you run and how did you install Jupyter
>> Notebook?
>> Could you provide a full error message that you see in the notebook?
>>
>> I cannot help you with Windows 10, maybe someone else have experience
>> with it?
>>
>> Best,
>> Rafal
>>
>>
>>
>>
>>
>>
>> --
>> Rafał Skolasiński
>>
>> GitHub: https://github.com/RafalSkolasinski
>> Kwant GitLab: https://gitlab.kwant-project.org/r-j-skolasinski
>>
>> On 3 May 2018 at 12:35, shyam lochan bora <shyamlochan04(a)gmail.com>
>> wrote:
>>
>>> Dear Sir,
>>> Yesterday i was able to install kwant on my windows 10 succesfully but
>>> in Ubuntu 16.4
>>> I am not able to install it.
>>> I was trying to install it by giving the following commands
>>> "sudo apt-add-repository -s ppa:kwant-project/ppa
>>> sudo apt- get update
>>> sudo apt-get install python3-kwant python-kwant-doc"
>>> everything was good but when i tried to import kwant from my ipython
>>> notebook error occurs.
>>> Could you please provide me the detailed instructions and requirements
>>> to install kwant in ubuntu and could you please tell how to install jupiter
>>> notebook in windows 10.
>>>
>>> Thanking you.
>>>
>>> Regards
>>> Shyam Lochan Bora.
>>>
>>>
>>> On Wed, May 2, 2018 at 7:44 PM, Rafal Skolasinski <
>>> r.j.skolasinski(a)gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Could you provide more detailed description of the problem on Ubuntu?
>>>>
>>>> Best,
>>>> Rafal
>>>>
>>>> On Wed, 2 May 2018, 16:11 shyam lochan bora, <shyamlochan04(a)gmail.com>
>>>> wrote:
>>>>
>>>>> dear sir,
>>>>> I am unable to install kwant on windows and ubuntu after following
>>>>> the instructions.
>>>>> please help me in this regard.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thank you
>>>>>
>>>>>
>>>>> Regards
>>>>> Shyam Lochan Bora
>>>>> Research Scholar
>>>>> Dibrugarh University
>>>>> Assam, India
>>>>>
>>>>
>>>
>>
>