ALPS 2 Tutorials:DWA-02 Density Profile

Revision as of 15:26, 16 September 2013 by Tamama (talk | contribs) (Preparing and running the simulation from Python)

Jump to: navigation, search

Density profile

As a second example of the dwa QMC code, we will study the density profile of an optical lattice in an harmonic trap which resembles the experiment

Mimicking the experiment

Preparing and running the simulation from the command line

The parameter file parm2a sets up Monte Carlo simulation of a 1003 optical lattice trap that mimicks the Bloch experiment:

LATTICE="inhomogeneous simple cubic lattice"

MODEL='boson Hubbard"

mu="4.05 - (0.0073752*(x-(L-1)/2.)*(x-(L-1)/2.) + 0.0036849*(y-(L-1)/2.)*(y-(L-1)/2.) + 0.0039068155*(z-(L-1)/2.)*(z-(L-1)/2.))"
MEASURE[Local Density]=1

{ T=1. }

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

parameter2xml parm2a

Preparing and running the simulation from Python

To set up and run the simulation in Python we use the script 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 = [
    'LATTICE' : 'inhomogeneous simple cubic lattice' ,
    'L'       : 100 ,

    'MODEL'   : 'boson Hubbard' ,
    'Nmax'    : 20 ,

    't'  : 1. ,
    'U'  : 8.11 ,
    'mu' : '4.05 - (0.0073752*(x-(L-1)/2.)*(x-(L-1)/2.) + 0.0036849*(y-(L-1)/2.)*(y-(L-1)/2.) + 0.0039068155*(z-(L-1)/2.)*(z-(L-1)/2.))' ,

    'T'  : 1. ,

    'THERMALIZATION' : 2000 ,
    'SWEEPS'         : 200000 ,
    'SKIP'           : 100 , 

    'MEASURE[Local Density]': 1

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

input_file = pyalps.writeInputFiles('parm2a', parms)
res = pyalps.runApplication('dwa', input_file)

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