Starting from:

$25

FYS4150 - Project 4 Computational Physics I  - Solved

Studies of phase transitions in magnetic systems 
Introduction 
The aim of this project is to study a widely popular model to simulate phase transitions, the so-called Ising model in two dimensions. At a given critical temperature, this model exhbits a phase transition from a magnetic phase (a system with a finite magnetic moment) to a phase with zero magnetization. This is a so-called binary system where the objects at each lattice site can only take two values. These could be 00 and 11 or other values. Here we will use spins pointing up or down as the model for our system. But we could replace the spins with blue and green balls for example. The Ising model has been extremely popular, with applications spanning from studies of phase transitions to simulations in statistics. In one and two dimensions its has analytical solutions to several expectation values and it gives a qualitatively good underatanding of several types of phase transitions. 

In its simplest form the energy of the Ising model is expressed as, without an externally applied magnetic field, 

E=−J∑<kl>NskslE=−J∑<kl>Nsksl

with sk=±1sk=±1. The quantity NN represents the total number of spins and JJ is a coupling constant expressing the strength of the interaction between neighboring spins. The symbol <kl><kl> indicates that we sum over nearest neighbors only. We will assume that we have a ferromagnetic ordering, viz J>0J>0. We will use periodic boundary conditions and the Metropolis algorithm only. The material on the Ising model can be found in chapter 13 of the lecture notes. The Metropolis algorithm is discussed in chapter 12. 

For this project you can hand in collaborative reports and programs. This project (together with projects 3 and 5) counts 1/3 of the final mark. 

Project 4a): A simple 2×22×2 lattice, analytical expressions 
Assume we have only two spins in each dimension, that is L=2L=2. Find the analytical expression for the partition function and the corresponding expectations values for the energy EE, the mean absolute value of the magnetic moment |M||M| (we will refer to this as the mean magnetization), the specific heat CVCV and the susceptibility χχ as functions of TT using periodic boundary conditions. These results will serve as benchmark calculations for our next steps. 

Project 4b) Setting up boundary conditions and Boltzmann distribution 
Convince yourself about the correctness of Equations (13.6) and (13.7) of the lecture notes. Show that only five possible values of the energy differences ΔEΔE are possible for the two-dimensional Ising model. Figure out how to encode efficiently the energy differences in the Boltzmann distribution. See the discussions in section 13.5 of the lecture notes. Why don't you need to calculate exp−ΔEβexp⁡−ΔEβ each time you update the energy? 

Discuss also how to encode periodic boundary conditions. Here you could start with simple if tests. Discuss thereafter possibly more efficient ways of coding the periodic boundary conditions. 

Project 4c): Writing a code for the Ising model 
Write now a code for the Ising model which computes the mean energy EE, mean magnetization |M||M|, the specific heat CVCV and the susceptibility χχ as functions of TT using periodic boundary conditions for L=2L=2 in the xx and yy directions. Compare your results with the expressions from a) for a temperature T=1.0T=1.0 (in units of kT/JkT/J). 

How many Monte Carlo cycles do you need in order to achieve a good agreeement? 

Project 4d): When is the most likely state reached? 
We choose now a square lattice with L=20L=20 spins in the xx and yy directions. 

In the previous exercise we did not study carefully how many Monte Carlo cycles were needed in order to reach the most likely state. Here we want to perform a study of the time (here it corresponds to the number of Monte Carlo sweeps of the lattice) one needs before one reaches an equilibrium situation and can start computing various expectations values. Our first attempt is a rough and plain graphical one, where we plot various expectations values as functions of the number of Monte Carlo cycles. 

Choose first a temperature of T=1.0T=1.0 (in units of kT/JkT/J) and study the mean energy and magnetisation (absolute value) as functions of the number of Monte Carlo cycles. Let the number of Monte Carlo cycles (sweeps per lattice) represent time. Use both an ordered (all spins pointing in one direction) and a random spin orientation as starting configuration. How many Monte Carlo cycles do you need before you reach an equilibrium situation? Repeat this analysis for T=2.4T=2.4. Can you, based on these values estimate an equilibration time? Make also a plot of the total number of accepted configurations as function of the total number of Monte Carlo cycles. How does the number of accepted configurations behave as function of temperature TT? 

Project 4e): Analyzing the probability distribution 
Compute thereafter the probability P(E)P(E) for the previous system with L=20L=20 and the same temperatures, that is at T=1.0T=1.0 and T=2.4T=2.4. You compute this probability by simply counting the number of times a given energy appears in your computation. Start the computation after the steady state situation has been reached. Compare your results with the computed variance in energy σ2EσE2 and discuss the behavior you observe. 

Studies of phase transitions 
Near TCTC we can characterize the behavior of many physical quantities by a power law behavior. As an example, for the Ising class of models, the mean magnetization is given by 

⟨M(T)⟩∼(T−TC)β,⟨M(T)⟩∼(T−TC)β,

where β=1/8β=1/8 is a so-called critical exponent. A similar relation applies to the heat capacity 

CV(T)∼|TC−T|α,CV(T)∼|TC−T|α,

and the susceptibility 

χ(T)∼|TC−T|γ,(1)(1)χ(T)∼|TC−T|γ,

with α=0α=0 and γ=7/4γ=7/4. Another important quantity is the correlation length, which is expected to be of the order of the lattice spacing for T>>TCT>>TC. Because the spins become more and more correlated as TT approaches TCTC, the correlation length increases as we get closer to the critical temperature. The divergent behavior of ξξ near TCTC is 

ξ(T)∼|TC−T|−ν.(2)(2)ξ(T)∼|TC−T|−ν.

A second-order phase transition is characterized by a correlation length which spans the whole system. Since we are always limited to a finite lattice, ξξ will be proportional with the size of the lattice. Through so-called finite size scaling relations it is possible to relate the behavior at finite lattices with the results for an infinitely large lattice. The critical temperature scales then as 

TC(L)−TC(L=∞)=aL−1/ν,(3)(3)TC(L)−TC(L=∞)=aL−1/ν,

with aa a constant and νν defined in Eq. (2)(2). We set T=TCT=TC and obtain a mean magnetisation 

⟨M(T)⟩∼(T−TC)β→L−β/ν,(4)(4)⟨M(T)⟩∼(T−TC)β→L−β/ν,

a heat capacity 

CV(T)∼|TC−T|−γ→Lα/ν,(5)(5)CV(T)∼|TC−T|−γ→Lα/ν,

and susceptibility 

χ(T)∼|TC−T|−α→Lγ/ν.(6)(6)χ(T)∼|TC−T|−α→Lγ/ν.

Project 4f): Numerical studies of phase transitions 
We wish to study the behavior of the Ising model in two dimensions close to the critical temperature as a function of the lattice size L×LL×L. Calculate the expectation values for ⟨E⟩⟨E⟩ and ⟨|M|⟩⟨|M|⟩, the specific heat CVCV and the susceptibility χχ as functions of TT for L=40L=40, L=60L=60, L=80L=80 and L=100L=100 for T∈[2.0,2.3]T∈[2.0,2.3] with a step in temperature ΔT=0.05ΔT=0.05 or smaller. You may find it convenient to narrow the domain for TT. 

Plot ⟨E⟩⟨E⟩, ⟨|M|⟩⟨|M|⟩, CVCV and χχ as functions of TT. Can you see an indication of a phase transition? Use the absolute value ⟨|M|⟩⟨|M|⟩ when you evaluate χχ. For these production runs you should parallelize the code using MPI (recommended). Alternatively OpenMP can be used. Use optimization flags when compiling. Perform a timing analysis of some selected runs in order to see that you get an optimal speedup when parallelizing your code. 

Project 4g): Extracting the critical temperature 
Use Eq. (3)(3) and the exact result ν=1ν=1 in order to estimate TCTC in the thermodynamic limit L→∞L→∞ using your simulations with L=40L=40, L=60L=60, L=80L=80 and L=100L=100 The exact result for the critical temperature (after Lars Onsager) is kTC/J=2/ln(1+2–√)≈2.269kTC/J=2/ln(1+2)≈2.269 with ν=1ν=1. 

Background literature 
If you wish to read more about the Ising model and statistical physics here are three suggestions. 

M. Plischke and B. Bergersen, Equilibrium Statistical Physics, World Scientific, see chapters 5 and 6.
D. P. Landau and K. Binder, A Guide to Monte Carlo Simulations in Statistical Physics, Cambridge, see chapters 2,3 and 4.
M. E. J. Newman and T. Barkema, Monte Carlo Methods in Statistical Physics, Oxford, see chapters 3 and 4.
Introduction to numerical projects 
Here follows a brief recipe and recommendation on how to write a report for each project. 

Give a short description of the nature of the problem and the eventual numerical methods you have used.
Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself.
Include the source code of your program. Comment your program properly.
If possible, try to find analytic solutions, or known limits in order to test your program when developing the code.
Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes.
Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc.
Try to give an interpretation of you results in your answers to the problems.
Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts you've made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it.
Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you don't properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning.
Format for electronic delivery of report and programs 
The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report: 


More products