Tutorial II: Classical Monte Carlo Simulations
Tutorial II: Classical Monte Carlo Simulations
The parameter file classical1/parm1a sets up
Monte Carlo simulations of the classical Ising model on finite square
lattices (L=2, 4, ..., 48) at the critical temperature TC=2.269186
using local updates.
LATTICE="square lattice" LATTICE_LIBRARY="../lattices.xml" T=2.269186 J=1 THERMALIZATION=10000 SWEEPS=50000 UPDATE="local" MODEL="Ising" {L=2;} {L=4;} {L=8;} {L=16;} {L=32;} {L=48;}
|
In order to run the simulation you first need to
convert this
parameter file into a job file in XML format by typing
This will generate 6 task files and a job
description file parm1a.in.xml which
you can open with an XML browser (such as netscape 7.0 but not 7.1 or 7.2) to check the
status of your
simulation once you started it.
The simulation can be started on a single processor by
spinmc -Tmin 10 parm1a.in.xml
|
or on multiple processors (in our example 8) using
MPI by
mpirun -np 8 spinmc_mpi -Tmin 10 parm1a.in.xml
|
(In the following examples we will refer to the
single processor commands only.)
By setting the argument -Tmin 10 the scheduler initially
checks every 10 seconds if the simulation is finished (the time is then
dynamically adapted by the scheduler).
You can restart a simulation which has been halted
(e.g. due to pressing Ctrl-C or reaching the CPU time limit) by
starting the simulation with the XML output file, e.g.
spinmc -Tmin 10 parm1a.out.xml
|
The results of each simulation task will be stored
in an XML output
file (parm1a.task[1-5].out.xml) which you can open from the job
description file parm1a.out.xml using your XML browser or
alternatively by converting the output to a text file using either of
the following commands:
netscape $PWD/parm1a.out.xml
convert2text parm1a.out.xml
|
The results of a single task stored for example in parm1a.task1.out.xml
can be displayed by using either of the following commands:
netscape $PWD/parm1a.task1.out.xml
convert2text parm1a.task1.out.xml
|
To obtain more detailed information on the
simulation runs (e.g. to check the convergence of errors) you can
convert the run files of the tasks (parm1a.task[1-6].out.run1)
into XML files by typing
conver2xml parm1a.task*.out.run1
|
which will generate the XML output files parm1a.task[1-6].out.run1.xml
which you can open using your XML browser or alternatively convert to
text using either of the following commands:
netscape $PWD/parm1a.task1.out.run1.xml
convert2text parm1a.task1.out.run1.xml
|
Repeat this for all six tasks and observe that for
large lattices the errors no longer convergeby
studying the the binning analysis in the files
parm1a.task[1-6].out.run1.xml
The parameter file classical1/parm1b sets up
Monte Carlo simulations of the classical Ising model on finite square
lattices (L=2, 4, ..., 48) at the critical temperature TC=2.269186
using cluster updates.
LATTICE="square lattice" LATTICE_LIBRARY="../lattices.xml" T=2.269186 J=1 THERMALIZATION=1000 SWEEPS=100000 UPDATE="cluster" MODEL="Ising" {L=2;} {L=4;} {L=8;} {L=16;} {L=32;} {L=48;}
|
To run the simulations please follow the same
procedure as in the case
of simulations using local updates, and check if now the errors
converge.
parameter2xml parm1b
spinmc -Tmin 10 parm1b.in.xml
|
The parameter file classical2/parm2a sets up
Monte Carlo simulations of the classical Heisenberg model on a one-dimensional
chain with 60 sites for a couple of temperatures (T=0.05, 0.1, ...,
1.5) using cluster updates.
LATTICE="chain lattice" LATTICE_LIBRARY="../lattices.xml" L=60 J=-1 THERMALIZATION=15000 SWEEPS=500000 UPDATE="cluster" MODEL="Heisenberg" {T=0.05;} {T=0.1;} {T=0.2;} {T=0.3;} {T=0.4;} {T=0.5;} {T=0.6;} {T=0.7;} {T=0.8;} {T=0.9;} {T=1.0;} {T=1.25;} {T=1.5;}
|
You can run the simulation by using the following
standard sequence of commands
parameter2xml parm2a
spinmc -Tmin 10 parm2a.in.xml
|
To extract the calculated results for the
susceptibilty from the XML output files
you can use the extracttext tool to generate a plot of the
susceptibility
versus temperature. The extraxttext tool expects the plot
specification as an
XML input file. For this specific case (susceptibility versus energy)
you may use the
example file plot.xml
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="http://xml.comp-phys.org/2003/4/plot2html.xsl"?>
<plot name="Susceptibility versus temperature for one-dimesnional Heisenberg models"> <!-- general plot description --> <legend show="true"/> <xaxis label="Temperature" type="PARAMETER" name="T"/> <yaxis label="Susceptibility" type="SCALAR_AVERAGE"/>
<!-- set descriptions --> <set label="One-dimensional chain"/>
</plot>
|
The plot will be generated by typing
extracttext plot.xml parm2a.task*.out.xml
|
If you have installed xmgrace you can directly create a nice plot by typing:
extractxmgr plot.xml parm2a.task*.out.xml > plot2a.xmgr
xmgrace plot2a.xmgr
|
The parameter file classical2/parm2a sets up
Monte Carlo simulations of the classical Heisenberg model on a one-dimensional
ladder with 60 sites for a couple of temperatures (T=0.05, 0.1,
..., 1.5) using cluster updates.
LATTICE="ladder" LATTICE_LIBRARY="../lattices.xml" L=60 J=-1 THERMALIZATION=15000 SWEEPS=500000 UPDATE="cluster" MODEL="Heisenberg" {T=0.05;} {T=0.1;} {T=0.2;} {T=0.3;} {T=0.4;} {T=0.5;} {T=0.6;} {T=0.7;} {T=0.9;} {T=1.0;} {T=1.25;} {T=1.5;}
|
You may now run the simulation for this model by
typing the sequence
parameter2xml parm2b
spinmc -Tmin 10 parm2b.in.xml
extracttext plot.xml parm2b.task*.out.xml
|
Now use your favorite plotting program to make a graph of the susceptibility as a function of
temperature.
If you have installed xmgrace you can directly create a nice plot by typing:
extractxmgr plot.xml parm2b.task*.out.xml > plot2b.xmgr
xmgrace plot2b.xmgr
|
(c) 2003-2004 by Simon Trebst, Fabien Alet, Matthias Troyer and Synge Todo