Assignment 3 

 

We explore the physics of the Ising Model in two dimensions via Monte Carlo simulation, using Kawasaki dynamics and the Metropolis algorithm. 

 

Write a simulation of a 2-d Ising model on a square lattice, using these steps:

 

1. Define the temperature k_B T=1, exchange coefficient J=1, and up-spin density xup=0.3.

 

2. Define the system size n=60, and  number of time steps is nsteps=50,000. 

 

3. Define a matrix s(i,j) of size n by n. Set the spins s(i,j) randomly to +1 with probability xup, otherwise s(ij)=-1.

 

—> Save a picture of the system in this random initial state.

 

4. Set up a loop on isteps=1 to nsteps. This represents a complete Monte Carlo step (one attempted spin flip per particle.)

 

5. Set up a loop on itry= 1 to n*n.

 

6. Pick an i,j spin at random from the whole system, then pick one of its four nearest neighbors (north, south, east, west) at random, remembering to use periodic boundary conditions. Let the neighbor spin be inab, jnab. If i,j, and inab,jnab  have opposite spins, let’s calculate the probability of flipping them both. (That’s a spin exchange.)

 

7. Calculate Eold = the energy of the two spins  and all their neighbors in their present configuration,

using periodic boundary conditions.

 

8. Calculate Enew=the energy of the spins if they were flipped.

 

9. Use the Metropolis algorithm to accept or reject the change. (I'll let you work that out from class notes.)

 

10. Next itry.

  

11.Every 10000 isteps, save a picture of the system showing the “up” spins only. Let me know if you need help with graphics tools.

 

12. Next istep.

 

Note: If your computer’s cpu can’t run that large a system for that long in a reasonable amount of time, you may reduce the system size and perform fewer Monte Carlo steps if necessary. 

 

Please turn in your code  and pictures of your system at time= 0, 10000, 20000, 30000, 40000, and 50000 steps. These should show nucleation and growth of clusters.

 

Note: In our next assignment, we will further analyze our data to measure how the average cluster size grows.