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.