sword in the stone   Hayne of Tintagel
Mac OS X  /  Programming  /  IsingCocoa

IsingCocoa


This application provides an interface for running simulations of the Ising model of magnetically interacting spins on a 2-dimensional lattice. It is intended as a demonstration of the possibilities for interactive exploration of scientific models - the computing power available in modern machines is sufficient to perform sophisticated calculations on the fly as the parameters are changed. The original version of this program was written for X11 using the UIM/X user-interface development tool while I was an employee at Visual Edge Software in 1991.

The Ising model is a model for a ferromagnetic material. Imagine a two-dimensional array of spins, each one of which can be either "up" or "down" and is free to flip between these two states. Suppose that it is energetically favourable for the spins to be aligned - ie. each spin prefers to be pointing in the same direction as its neigbours.

At high temperature, there is so much energy around that the spins don't much mind the extra energy-cost of being mis-aligned, but as the temperature drops, the energy-cost becomes more and more important. Thus at high temperature, the spins tend to a random configuration with little correlation between the orientation of neighbouring spins, but at low temperature, the spins tend to align themselves with their neighbours, resulting in domains where all the spins are "up" and domains where all the spins are "down".

In the simulation, we start out with a random configuration of spins and then let them evolve according to their own dynamics. Each spin is represented by one pixel on the screen, with the "up" spins shown as white and the "down" spins shown as black. In order to avoid problems with the boundaries of the lattice, we consider the left edge to be joined onto the right edge, and the top edge to be joined onto the bottom edge.

The sliders in the Ising window allow you to vary the temperature and ambient magnetic field while the simulation is in progress. The temperature is shown in units of the spin-spin interaction energy. Statistics on the update rates for the calculation ("model") and display ("view") are available in a drawer that can be opened via the View menu. (The update rates are shown in both frames per second (fps) and millions of spin updates per second (Msps)).

download the IsingCocoa executable (Requires OS X, version 10.3 or higher)

download the IsingCocoa project files (licensed under the GPL)
(Requires the Apple Developer Tools - I used XCode version 2.0)

Technical Points of Interest