Hello Kwant community,
I write since I am trying to simulate a Kitaev chain with disorder,
here distributed uniformly in the range [1,-1],
and I am experiencing troubles to implement the disorder itself.
In the absence of disorder,
the function that defines the tight-binding (open) Hamiltonian can be written
e.g. as follows:
def kitaev(L ,t, mu, Delta) :
syst = kwant.Builder()
lat = kwant.lattice.chain(norbs=2)
syst[lat(0)] = - (mu/2)*pauli3
for i in range(1,L):
syst[lat(i)] = -(mu/2)*pauli3
syst[lat(i), lat(i - 1)] = -(t/2)*pauli3 + 1j*(Delta/2)*pauli2
return syst
where the Pauli matrices have been previously defined, t is the hopping,
mu is the chemical potential, and Delta is the gap.
Now, I want to add disorder, proportional to W and uniformly
distributed in [-1,1]. The tutorial online for Kwant states that the
function kwant.digest.uniform(input, salt='') creates a random offset
in the interval [0,1]. Therefore I thought that the Hamiltonian could
be changed e.g. as follows:
def kitaev(L ,t, mu, Delta, W) :
syst = kwant.Builder()
lat = kwant.lattice.chain(norbs=2)
syst[lat(0)] = -(1/2)*(mu + W*(2*onsite - 1))*pauli3
for i in range(1,L):
syst[lat(i)] = -(1/2)*(mu + W*(2*onsite - 1))*pauli3
syst[lat(i), lat(i - 1)] = -(t/2)*pauli3 + 1j*(Delta/2)*pauli2
return syst
after that the onsite function has been defined as
def onsite(site, phi, salt):
return uniform(repr(site), salt)
(I am still trying to follow the tutorial).
However, when trying to calculate eigenvalues and eigenvectors,
via the code
L = 50
W = 0
mub = 3
systb = kitaev(L ,1, mub, 1, W)
systb = systb.finalized()
hamatb = systb.hamiltonian_submatrix(sparse = False)
evalsb, evecsb = la.eigh(hamatb)
I encountered the problem
-----------------------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-12a574eefcd0> in <module>
3
4 mub = 3
----> 5 systb = kitaev(L ,1, mub, 1, W)
6 systb = systb.finalized()
7 hamatb = systb.hamiltonian_submatrix(sparse = False)
<ipython-input-9-661d5ddb539a> in kitaev(L, t, mu, Delta, W)
4 lat = kwant.lattice.chain(norbs=2)
5
----> 6 syst[lat(0)] = -(1/2)*(mu + W*(2*onsite - 1))*pauli3
7
8 for i in range(1,L):
TypeError: unsupported operand type(s) for *: 'int' and 'function'
—————————————————————————————------
that instead does no occur in the absence of disorder (then when the
first definition above for the Kitaev chain is assumed).
Probably I did not understand properly how to use the
function uniform(repr(site), salt).
Can you help me ?
Thank you very much in advance and best regards
L. L.