Dear Luca,

That is an easy task: Just put a different parameter in your function.

1) Put the  "salt" as a parameter in your onsite function and not in make_system
def Onsite(site, salt="1"):
……
……

2) when you do your calculation, use params:
params={"disorder"="1", B=2, Phi=4}
for i in range(100):
params["disorder"]=str(i)
wave=kwant.wave_function(syst, params=params)
#then calculate whatever you want for this configuration

I hope this helps

On Mon, Feb 3, 2020 at 11:23 PM Luca Lepori <llepori81@gmail.com> wrote:
Dear Adel and Joe,

If I understand correctly, then I am not sure
how to simulate the physics of disorder.

Indeed, that task requires to create various
(in principle infinite in number) configurations,
measure some physical quantity on each of them, and then
to take the average of all these measurements on the created configurations.

How can I create the different configurations ?
Starting e.g. from the piece of code

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

t = 1
Delta = 1
L = 50
W = 1
(salta = ?)

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

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

is it sufficient to add a For cycle on the value of salt ?
Say, from 1 to Nmax, where Nmax is the number of configurations
that I want to consider ?

Thank you very much again

L.

Il giorno lun 3 feb 2020 alle ore 11:48 Abbout Adel
>
> 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,
>
> 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.
>
>
>
> --