Difference between revisions of "ALPS 2 Tutorials:DWA-01 Revisiting MC05"

From ALPS
Jump to: navigation, search
(Preparing and running the simulation from the command line)
(Preparing and running the simulation from the command line)
Line 37: Line 37:
 
  parameter2xml parm1a
 
  parameter2xml parm1a
 
  dwa --Tmin 5 --write-xml parm1a.in.xml
 
  dwa --Tmin 5 --write-xml parm1a.in.xml
 +
 +
=== Preparing and running the simulation using Python ===
 +
 +
To set up and run the simulation in Python we use the script  [http://alps.comp-phys.org/static/tutorials2.1.0/dwa-01-bosons/tutorial1a.py tutorial1a.py]. The first parts of this script imports the required modules and then prepares the input files as a list of Python dictionaries:
 +
 +
import pyalps
 +
 +
parms = []
 +
for t in [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1]:
 +
    parms.append(
 +
        {
 +
          'LATTICE'        : "square lattice",
 +
          'MODEL'          : "boson Hubbard",
 +
          'T'              : 0.1,
 +
          'L'              : 4 ,
 +
          't'              : t ,
 +
          'mu'            : 0.5,
 +
          'U'              : 1.0 ,
 +
          'Nmax'          : 2 ,
 +
          'THERMALIZATION' : 100000,
 +
          'SWEEPS'        : 5000000,
 +
          'SKIP'          : 5000
 +
        }
 +
    )
 +
 +
 +
To run this, launch your python interpreter using the convenience scripts <tt>alpspython</tt> or <tt>vispython</tt>.
 +
 +
We next convert this into a job file in XML format and run the worm simulation:
 +
 +
input_file = pyalps.writeInputFiles('parm5a',parms)
 +
res = pyalps.runApplication('worm',input_file,Tmin=5)
 +
 +
We now have the same output files as in the command line version.

Revision as of 13:27, 13 September 2013

Quantum phase transitions in the Bose-Hubbard model

As an example of the dwa QMC code we will study a quantum phase transition in the Bose-Hubbard mode.

Superfluid density in the Bose Hubbard model

Preparing and running the simulation from the command line

The parameter file parm1a sets up Monte Carlo simulations of the quantum Bose Hubbard model on a square lattice with 4x4 sites for a couple of hopping parameters (t=0.01, 0.02, ..., 0.1) using the dwa code.

 LATTICE="square lattice";
 L=4;
 
 MODEL="boson Hubbard";
 Nmax = 2;
 U    = 1.0;
 mu   = 0.5;
 
 T    = 0.1;
 
 SWEEPS=5000000;
 THERMALIZATION=100000;
 SKIP=5000;
 
 { t=0.01; }
 { t=0.02; }
 { t=0.03; }
 { t=0.04; }
 { t=0.05; }
 { t=0.06; }
 { t=0.07; }
 { t=0.08; }
 { t=0.09; }
 { t=0.1;  }

Using the standard sequence of commands you can run the simulation using the quantum dwa code

parameter2xml parm1a
dwa --Tmin 5 --write-xml parm1a.in.xml

Preparing and running the simulation using Python

To set up and run the simulation in Python we use the script tutorial1a.py. The first parts of this script imports the required modules and then prepares the input files as a list of Python dictionaries:

import pyalps

parms = []
for t in [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1]:
   parms.append(
       { 
         'LATTICE'        : "square lattice", 
         'MODEL'          : "boson Hubbard",
         'T'              : 0.1,
         'L'              : 4 ,
         't'              : t ,
         'mu'             : 0.5,
         'U'              : 1.0 ,
         'Nmax'           : 2 ,
         'THERMALIZATION' : 100000,
         'SWEEPS'         : 5000000,
         'SKIP'           : 5000
       }
   )


To run this, launch your python interpreter using the convenience scripts alpspython or vispython.

We next convert this into a job file in XML format and run the worm simulation:

input_file = pyalps.writeInputFiles('parm5a',parms)
res = pyalps.runApplication('worm',input_file,Tmin=5)

We now have the same output files as in the command line version.