Hi Matthias,

Thanks, that's very helpful.

Could you please mention if the 'CONSERVED_QUANTUMNUMBERS=N' and 'N_total = xx' options are ignored by the SSE and Worm algorithms of ALPS? (If so, perhaps things will be different in a newer ALPS version? I'm using 2.1.) I can't seem to run a fixed particle-number simulation using either of these algorithms (final output density not equalling desired density), but can in the ED or Lanczos codes.

Thanks,
Vipin

On 03/12/2014 03:13 PM, Matthias Troyer wrote:
Hi Vipin,

This is expected behaviour. If you write

          'mu'             : 5.0*2*(random()-0.5),

then Python evaluates the expression, which means that mu just evaluates to a number. To pass in the function random() in  non-evaluated way you need to pass the expression as a string:

          'mu'             : '5.0*2*(random()-0.5)',

Matthias


On 12 Mar 2014, at 06:26, vvarma@ictp.it wrote:

Dear ALPS users,

I am trying to run a very simple worm simulation with disorder (site-dependent 'mu') for the Bose-Hubbard model using a Python script. If I simply translate a working parameter file (obtained from the ALPS website) into the below Python code, 'random()' is unrecognized (which is not so for the parameter file where the simulation goes through).

But if I include 'import random' at the beginning of the Python script then the simulation does go through but a different model gets simulated (i.e. a random 'mu' but equal for all sites).

I was wondering, should not the below Python script translated directly from a similar working parameter file run as is for the desired model?

<SNIP>
import pyalps
import matplotlib.pyplot as plt
import pyalps.plot

#prepare the input parameters
parms = []
for DISORDERSEED in [34275, 49802, 82529]:
    parms.append(
        {
          'LATTICE'        : "inhomogeneous square lattice periodic",
          'MODEL'          : "boson Hubbard",
          'T'              : 0.1,
          'L'              : 4 ,
          't'              : 1.0 ,
          'DISORDERSEED'   : DISORDERSEED,
          'mu'             : 5.0*2*(random()-0.5),
          'U'              : 1.0 ,
          'NONLOCAL'       : 0 ,
          'Nmax'           : 2 ,
          'THERMALIZATION' : 100,
          'SWEEPS'         : 5000
        }
    )
<SNIP>

Thanks,
Vipin