Difference between revisions of "ALPS 2 Tutorials:MC-01 Equilibration"

Jump to: navigation, search
(Using command line)
(Using command line)
Line 51: Line 51:
  gnuplot <<@@
  gnuplot <<@@
set output "parm1a.task1.out.density.timeseries.ps"
  set datafile separator ','
  set datafile separator ','
  plot "parm1a.task1.out.density.timeseries.csv"
  plot "parm1a.task1.out.density.timeseries.csv"

Revision as of 14:42, 28 August 2013


Rule of thumb: All Monte Carlo simulations have to be equilibrated before taking measurements.

Example: Quantum Monte Carlo (directed worm algorithm) simulations

As an example, we consider a Quantum Monte Carlo simulation implemented in the directed worm algorithm for boson Hubbard model in square lattice geometry of size 202.

Using command line

The parameter file parm1a:

LATTICE="square lattice"
MODEL="boson Hubbard"





We first convert the input parameters to XML and then run the application dwa:

parameter2xml parm1a
dwa parm1a.in.xml

Detailed information regarding the Density measurements, for example, can be extracted from:

h5dump -g /simulation/results/Density parm1a.task1.out.h5

or its (binned) timeseries from:

h5dump -g /simulation/results/Density/timeseries parm1a.task1.out.h5

We can extract the timeseries data into a CSV file:

h5dump -d /simulation/results/Density/timeseries/data -w 1 -y -o parm1a.task1.out.density.timeseries.csv parm1a.task1.out.h5

and plot it using your favourite graphical plotter, say xmgrace:

xmgrace parm1a.task1.out.density.timeseries.csv

or, say gnuplot:

gnuplot <<@@
set datafile separator ','
plot "parm1a.task1.out.density.timeseries.csv"

Using Python

The following describes what is going on within the script file tutorial1a.py.

The headers:

import pyalps

Set up a python list of parameters (python) dictionaries:

parms = [{
  'LATTICE'         : "square lattice",          
  'MODEL'           : "boson Hubbard",
  'L'               : 20,
  'Nmax'            : 20,
  't'               : 1.,
  'U'               : 16.,
  'mu'              : 32.,
  'T'               : 1.,
  'THERMALIZATION'  : 10000,
  'SWEEPS'          : 100000,
  'SKIP'            : 400

Write into XML input file:

input_file = pyalps.writeInputFiles('parm1a',parms)

and run the application dwa:

pyalps.runApplication('dwa', input_file, Tmin=10, writexml=True)