Xising Michael Creutz creutz@bnl.gov (Extension by block spin transformations: Andreas Honecker a.honecker@tu-bs.de - description see end of file) 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 several simple 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 grey 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 program source is freely distributable. The latest version is kept on our WWW server at "http://thy.phy.bnl.gov/www/xtoys/xtoys.html" along with some related programs. COMPILING: The program should run on anything supporting Xwindows. If you find an exception, please let me know. To compile, try the xtoys Makefile. Otherwise, "cc -O -o xising -L/usr/X11R6/lib xising.c -lm -lX11" usually works. On Sun workstations the X stuff is in an unconventional place; try "cc -O -I/usr/openwin/include -L/usr/openwin/lib newxising.c -lm -lX11". Replacing "cc" with "gcc" may also help. If either of these doesn't work try using the makefile found at the above web site. If you still have problems, possibly the X11 includes are not being found. Then you need to compile with a -I option to where them 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 to run it. WHAT THE SCREEN SHOWS: The 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 "run free," "heat," and "cool," are for adjusting the temperature. Normal running is with the energy/temperature conserved, but to heat or cool the system toggle the appropriate button. In a canonical mode (see below) the temperature can also be adjusted by clicking on the thermometer. 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 a "local" updating scheme. This can be toggled into a variation of the "cluster" algorithm of R.H. Swendsen and J.-S. Wang, Phys. Rev. Letters 58, 86 (1987), where a large block of spins is grown and then flipped in unison. At the bottom of the display is a button that switches between a canonical and a microcanonical updating. The latter case is 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. In this mode the temperature is not fixed, but calculated from the average demon energy. Note the thermal fluctuations on the thermometer when in a microcanonical mode. The microcanonical version of the cluster algorithm is discussed in Phys. Rev. Letters 69, 1002 (1992). The program attains its speed by updating spins one word at a time using multispin coding and bit manipulation. The canonical modes are obtained by allowing the demons to be occasionally refreshed by visiting a heat bath. When in one of these, a mouse click near the thermometer will adjust the temperature to the value pointed at by the cursor. Clicking elsewhere in the main window when the system is paused with any algorithm does a single step. The remaining buttons, "quit" and "pause" should be self explanatory, as should the "speed" slider. The lattice dimensions can be adjusted by resizing the window. 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 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 forces 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 spin up and down. To illustrate the power of the cluster approach, 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. ADDITION MAY 2001: "block" button added by Andreas Honecker WHAT IT DOES: The block button performs a block spin transformation on the state of the system. Each block of 3x3 spins is replaced by a single spin. If 5 or more spins in a block are black, the blocked spin becomes a black one and otherwise a white one. I use 3x3 blocks, since 3*3=9 is odd and thus allows for a unique mapping to a single spin (e.g. for 2x2 blocks, i.e. 4 spins, I wouldn't know what to do with configurations where an equal number of spins are black and white). In order to keep the size of the system unchanged and still obtain a valid configuration after the block spin transformation, the blocked state is copied 9 times into the state of the system. WHAT TO DO WITH IT: The purpose of this button is to illustrate Kadanoff's block spin renormalization group ideas. I have implemented it in Michael Creutz' Ising simulation since it can run in microcanonical mode which is particularly useful for the purpose of illustrating (block spin) renormalization group transformations. Equilibrate the system as usual, then make sure that you are in "microcanonical" mode. First hit "pause", then "block" (once is usually sufficient) and watch how the "spin" field shrinks. Hit again on "pause" and watch the thermometer (as well as the value of beta) change after a little while ! The advantage of the microcanonical simulation is that it will associate a new temperature to the block spin state (instead of equilibrating it back at the original temperature as in canonical mode). Next, switch back to canonical mode and adjust the temperature to somewhat above (or below) T_c (the same effect can be obtained by carefully heating or cooling in microcanonical mode). Then apply the block spin transformations (in microcanonical mode !) as described before. Where does the temperature move if you are above (or below) T_c ? What happens if you repeat the blocking procedure ? Note: You can also hit the "block" button while the simulation is running, but then you won't be able to inspect the "spins" window after the transformation since it will quickly be modified by the simulation. You should learn that if you are above T_c, block spin transformations increase T (decrease beta) and below T_c, they decrease T (increase beta). This is in fact precisely what is expected: The block spin transformations reduce the scale of fluctuations and thus move away from the critical temperature. In other words: The critical point of the 2D Ising model is a repulsive fixed point under (block spin) renormalization group transformations. Remarks: 1. Very close to the critical point, the direction in which you move (or whether you move at all) will be random - after all, there are random numbers involved in everything (including estimating the temperature). 2. If you start from a non-equilibrium state (e.g. a state with several domains below T_c), block spin transformations may not quite do what we claimed before. Do you understand why ?