Dear Luca,

With the parameter salt (which can be a number or a string), you will be sure that each time you call your system (or hamiltonian) with the same parameter salt, you will have the same configuration: this means that the potential is random from one site to another, but the overall configuration does not change when you call your system many times. If you use the usual random function from numpy, you will have a different random configuration each time you call your system.

I hope this helps,
Adel

On Mon, Feb 3, 2020 at 12:00 AM Luca Lepori <llepori81@gmail.com> wrote:
Dear Joe,

thank you very much for your fast and compelling reply.

Exploiting your advice, that means writing

-----------------------------------------------------------------------------------------------

def onsite(site, salt):

    return uniform(repr(site))


def kitaev(L ,t, mu, Delta, W, salt) :

    syst = kwant.Builder()
    lat = kwant.lattice.chain(norbs=2)

    syst[lat(0)] = -(1/2)*(mu + W*(2*onsite(lat(0), salt) - 1))*pauli3

    for i in range(1,L):

        syst[lat(i)] = -(1/2)*(mu + W*(2*onsite(lat(i), salt) - 1))*pauli3


        syst[lat(i), lat(i - 1)] = -(t/2)*pauli3 + 1j*(Delta/2)*pauli2


    return syst

-----------------------------------------------------------------------------------------------

the code actually works, in the sense that no errors occur in the output
of the calling string

-----------------------------------------------------------------------------------------------

t = 1
Delta = 1
L = 50
W = 1
salt = 1

mub  = 3
systb = kitaev(L,t,mub,Delta,W,salt)
systb = systb.finalized()
hamatb = systb.hamiltonian_submatrix(sparse = False)
evalsb, evecsb = la.eigh(hamatb)

-----------------------------------------------------------------------------------------------

However, I still do not get the role of the parameter "salt" (here
above I defined it conventionally
salt = 1): how do I have to set it ?

In the previous discussion page

https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg01497.html

you claim that

 "the 'salt' parameter does not have any physical meaning; it's like
the 'seed' that you typically specify to a random number generator."

Then does it mean that the physical numbers must not to change with
the set value for salt ?

Last question:  the string

mub  = 3
systb = kitaev(L,t,mub,Delta,W,salt)
systb = systb.finalized()
hamatb = systb.hamiltonian_submatrix(sparse = False)
evalsb, evecsb = la.eigh(hamatb)

creates the Kitaev code with just one specific configuration for
the random onsite offset, right ?

Thank you very much again and best

L.


--
Abbout Adel