
Bob Silsbee and I made up this program last year, and Jörg Dräger sped it up by implementing a table lookup which saves a bunch of exponentials.
The program is in ~sethna/teaching/SolidState/Ising, and is called Ising. Choose parameters with the sliders or by typing in the boxes. Click the ``send'' button to start the simulation. You should copy all the files from my directory into your directory: Ising calls a bunch of shell scripts to do the graphics.
The checkerboard display gives the arrangement of spins after each sweep if the number of sweeps is less than MAX_SWEEP_DISPLAY = 50; otherwise it shows the spin arrangement after the sweeps are completed. The printed output gives averages of < |M| > , < (M- < M > )^2 >, < E > and < (E- < E > )^2 >, averaged over the sweeps in that run. M as a function of time is also plotted in the graph.
After a run, the program can be restarted to continue from where it left off, either at the old (H, T) values or new ones if you change them. Note that, as is typical with computers, everything is numbers and we've lost all the units. The convention chosen for this simulation is to measure T and H in units of J. That is, T = 3 means kT/J = 3, and H is defined such that the energies for the +1 and -1 values of S are -J H and +J H respectively. The idea is to think of the simulation as an experiment in which you are going to learn what you can about this model system, and check out some simple analytical models for its behavior.
cd ~sethna/teaching/StatPhys/ps3 IsingThe slider package outputs new parameters to the program whenever you hit the send button. You can either move the sliders or type parameters directly into the windows.
mkdir ps3 cd ps3 cp ~sethna/teaching/StatPhys/ps3/* .For the later parts of this problem set, you'll be making changes to the program. I'll bet, except for the most sophisticated of you, the main difficulties the first time won't be in figuring out what changes to make: it'll be in the mechanics of making the changes and recompiling the program. You'll need to know how to use an editor (vi or jove or emacs or ...). When the changes are made, presuming you haven't changed the name of the program, you can type
make Isingand it should compile. Alternatively, you can type
cc -O -o newname newname.c ran3.o -lm
Being compulsive, I ran many sweeps per temperature (near Tc, up to 4000 sweeps, after first equilibrating for 800). Far from Tc, you need many fewer sweeps.
You can use xmgr to plot the resulting data.
xmgr -nxy data_filewill plot all the curves in datafile.
You can either edit this file to look at one curve at a time, or you can use xmgr to blow up the right regions. Make sure you can tell which curve is which!
Edit / Transformations / Evaluate Expression / x = abs(x-Tc) View / Graphs / Set graph type / Log-log
Jim Sethna, sethna@lassp.cornell.edu
Statistical Mechanics: Entropy, Order Parameters, and Complexity,
now available at
Oxford University Press
(USA,
Europe).