Sunday, 23 November 2008

Scientists are possibly a little obsessive

I'm feeling pretty smug tonight because I finally managed to implement a new way of simulating the Ising model that I'd been thinking about off and on for years. At the same time I'm also feeling a bit sad that I've stayed up until 3am on a Saturday night doing it. I think it's the element of obsessive scientist that comes out occasionally where you have a tea/coffee fueled binge until you've solved the problem - it's probably not limited to scientists.

The reason I wanted to do this will become clear soon (as in I'll post on it). I wanted to simulate a lattice with as many sites as possible so that I can do some visualisation of renormalisation group ideas (again more on this soon). Instead of storing each site inside a byte of memory I store 8 sites in each byte and then use a bit of binary operating to get the bit I need. This means each site now only takes one bit of memory.

That was the easy bit. The hard bit was simulating this setup around the critical point. Critical points in statistical mechanics are incredibly interesting but real buggers to simulate. Fortunately there have been some very clever people who have worked out how to do this. I've not done anything that clever, but I have worked out how to implement a Wolff cluster algorithm using ~ N/4 bytes of memory which I think is good going.

I will post on this again when I've managed to run the programme on our fancy new computer (it's got 8GB of RAM) and have a nice picture to show. I will also explain what the Ising model is and what a critical point is...


  1. This comment has been removed by the author.

  2. I know that feeling all too well, cannot sleep until done, argh!

    I remember RLJ telling me about a similar trick that PM used to calculate persistence functions in massive FA model systems. Although an easy (relatively) solution for the dynamics is to only keep track of the "excitations" you still need a lattice for other calculations.

    You may want to check this out:

  3. The hard bit was storing the cluster. They can get as big as 80% of the system and each element of the array is a 64 bit number (it has to be able to address all the sites). I got around it by effectively adding and removing from the stack as I went. The maximum size seems to be of ~sqrt(N).

    Metropolis wasn't an option as it's too slow at the critical point.

  4. Oh, and any ideas on how to draw a 10^5 by 10^5 lattice are welcome. It would be one hell of a bmp file...