Subject: Re: CCL:codes for Ising model

From: Dongchul Lim <[email-masked]>
Date: Wed, 26 Oct 94 21:31:01 EDT

Frank Ling writes:
> Dear Netters,
> 
> I am working on the finite 2 dimensional Ising networks, having just 
> calculated the partition function for a 3X3 net by enumerating all 
> 512 configurations, I realized that there must exist general codes 
> that do what I did for the 3X3 network, i.e., enumerating all confi-
> gurations of one site binding, two, three site cooperative binding, 
> and so on (or one spin up, two spins up, ...).  There are genreally 
> speaking 2^N such configurations and for N small workstations are well 
> capable of exhausting all possible configurations and thus obtain the 
> partition function.  I will appreciate it very much if someone would 
> kindly privide me with the code or coding information, and I will 
> summerise.
> 
> Frank
> 

I haven't seen a 3D model, but a X-windows program for a simple 2D
model is available from freehep.scri.fsu.edu [144.174.128.21]
in the directory /freehep/lattice_field_theory/xising.

----------------------------------------------------------------------
                       XIsing
 
                    Michael Creutz   
               [email-masked] 
                     March 1994

WHAT IT IS:

This is an Xwindow program to illustrate a Monte Carlo simulation of
a simple statistical mechanical system.  The Ising model demonstrates
ferromagnetism, displaying a second order phase transition from a
disordered state at high temperature to an ordered state when cool.
The program allows dynamical observation of this system under two 
simple microcanonical Monte Carlo algorithms.

The system is a two dimensional array of spins, each of which is 
represented by a bit in a bit map displayed on the screen.  Black and
white represent the two possible states of a given spin.  The energy
of the system is entirely determined by nearest neighbor pairs.
If two neighbors are the same, then the energy has one value, and
if they differ, it is higher by two units.

The source is freely distributable.  It is available for 
anonymous FTP at freehep.scri.fsu.edu [144.174.128.21]
in the directory /freehep/lattice_field_theory/xising

COMPILING:

The program should run on anything supporting Xwindows.  If you
find an exception, please let me know.  To compile, 
"cc -O xising.c -lm -lX11" should work.  If not, possibly 
the X11 includes are not being found.  Then you need to compile 
with a -I option to where they are and possibly change the -lX11 
to help the linker.   Remember, as with any Xwindow program, 
you need to have "xhost" and "DISPLAY" set up properly.

WHAT THE SCREEN SHOWS:

The Xwindow display shows the spins in the image labeled "spins."
This is above another bit map labeled "changes," representing the 
spins being changed under the current algorithm.  The display
has a thermometer to indicate the temperature and various buttons 
for controlling the updating.  The inverse temperature, beta, is 
displayed above the thermometer.  The critical value for beta is 
exactly known to be 0.5*log(1+sqrt(2))=.44068.... The critical 
temperature is marked on the thermometer.

One set of three buttons, labeled "conserve E," "heat," and "cool,"
are for adjusting the temperature.  Normal running is with the
energy conserved, but to heat or cool the system press the 
appropriate button.  

Another set of buttons controls the boundary conditions.  The choices 
include "periodic," wherein the spin neighbors at an edge are those 
on the opposite edge, and "antiperiodic," which is similar but with the
the wrapped neighbors inverted.  The other two boundary choices 
are constant white or black.  The latter two are not permitted when 
the cluster algorithm, discussed below, is in operation.

The algorithm button toggles between two alternatives.  The program
starts with the "local" case as described in some detail in my paper  
Phys. Rev. Letters 50, 1411 (1983).  A set of "demons" circulates 
around the lattice trying to flip spins.  Each carries a two bit sack of 
energy ranging from 0 to 16 units in steps of 4.  Any energy change 
associated with a spin flip is compensated by a change in this sack.  
If the demon's sack cannot accommodate the change, the flip is rejected.  
The behavior under this algorithm is quite close to that of a conventional 
Metropolis et al. simulation.  The program attains its speed by updating
spins one word at a time using multispin coding and bit manipulation.

The alternative algorithm operates by constructing a large "cluster" 
of spins and flipping them in unison.  This is based on the approach
of  R.H. Swendsen and J.-S. Wang, Phys. Rev. Letters 58, 86 (1987),
as adapted to a single cluster by U. Wolfe, Phys. Rev. Letters 62, 
361 (1989).  The particular implementation here is a microcanonical 
variation I discussed in Phys. Rev. Letters 69, 1002 (1992).

The remaining buttons, "quit," and the "pause" "run" toggle are 
self explanatory.  Finally, a mouse click elsewhere in the main window
toggles on and off a short "about" message.

SOME EXPERIMENTS:

After starting the program, press the heat button and observe how
the domains get small and the acceptance, as shown in the "changes"
display, gets large.  Then press the cool button until the temperature,
as displayed in the thermometer, is a couple of tic marks below the
critical value.  Watch the domains grow as the system magnetizes.
Note how the acceptance is largest at the domain boundaries.

In many cases a single domain will grow to dominate the system.
If, however, bands of different phases wrap around the lattice
in either a horizontal or vertical direction, then the system
can have a hard time deciding which phase will dominate and it
can remain metastable  for a long time.  

Switching the boundary conditions to antiperiodic will force the 
system to have at least one domain wall.  Switching between black 
and white edges allows one to create large included domains which 
gradually shrink away.

Returning the system to near the critical temperature, switch to
the cluster algorithm.  In this case a few iterations quickly give
independent configurations.  Heat the system and observe how
the typical cluster size becomes quite small.  Cooling the system
below the critical temperature gives single clusters covering most
of the system, which then flashes between dominantly black and 
dominantly white.  

To illustrate the power of the cluster algorithm, use the local 
algorithm to heat the system to a high temperature and then rapidly 
quench it to somewhat below the critical value.  Before the local 
approach has had time to have the smaller domains dissolve in the 
dominant one, change to the cluster approach.  Note how quickly
the cluster sweeps anneal out the included domains.

----------------------------------------------------------------------

---

From: [email-masked] (James A Given)
Date: Thu, 27 Oct 94 11:31:52 -0400

You better connect the spins on each edge to spins on the
opposite edge (i.e. use toroidal boundary conditions) or
the results probably will be misleading.

---

From: [email-masked] (Marty Gallagher)
Date: Thu, 27 Oct 94 15:28:55 -0700

Hello,

        I read your post on CCL.  Can you recommend any good review
articles on Ising networks?

                                Thanks,

                                 Marty

=========================================================================
Martin J. Gallagher             phone:  (617) 432-1729
Dept. of Neurobiology           fax:    (617) 734-7557
Harvard Medical School          E-mail: [email-masked]
220 Longwood Ave                http://ionchannel.med.harvard.edu/~marty
Boston, MA  02115

-- When I feed the poor, they call me saint. When I ask why the poors do
   not have food, they call me communist - Archbishop Camaran
===========================================================================