Physics 367x

Introduction

Learning goals

The goals of Physics 366x build on those of physics 365x. We aim to teach you to use computational methods to solve real-world physics problems. At the same time, we aim to help improve and solidify the material you are learning in the paradigms. At the same time, you should learn:

Physics:
  1. Ising model of a ferromagnet
  2. Boltzmann ratio
  3. Microcanonical and canonical ensembles
  4. Phase transitions
Numerical methods:
  1. Monte Carlo method
  2. Metropolis algorithm (if we have time)
  3. Solving for eigenvalues with a canned routine
Programming in python:
  1. Use of matrices
  2. Lists (to handle large numbers of coupled harmonic oscillators)

Ising model

The Ising model is a simplified model that is often used to for ferromagnets. An Ising model consists of spins in a regular arrangement, each of which has a few neighboring spins. The system is defined by a set of values S_i which can have a value of \pm 1. Of course, real electrons have a spin of \pm
\frac12, but the model is traditionally simplified by rescaling the spin, since this doesn’t affect the resulting predictions. The final knob that is present in the system is the magnetic field B, which is taken as a scalar. The Ising model is not an accurate description of a ferromagnet, since spins are quantum-mechanical objects, and can be oriented in any direction, but it is a simple model has shows many of the same properties held by a ferromagnet.

The total energy for an Ising model is:

E = \sum_i B_i S_i + \sum_{ij}^{NN} J_i S_i S_j

Here you can see that the magnetic field B_i is given in energy units and is allowed to be inhomogeneous—which is to say that it may be different at different sites. You can think of this as rescaling it by the magnetic moment of the electron. The second sum is over pairs of lattice sites that are nearest neighbors, and has a set of parameters J_i, with energy units, which describes the interaction between neighboring spins.

Your first task will be to write a function that given matrices describing B, J and the spins, will compute the energy. For this task, we will restrict ourselves to two-dimensional models, so a matrix is a reasonable choice to describe the spins and magnetic field. A second task is to write a function that given a matrix describing a set of spins will create a picture of that set of spins.

Microcanonical ensemble

Many of the interesting things that happen in ferromagnets happen when you change the temperature. Changing temperature computationally is possible, but requires considerable understanding of statistical mechanics—or the use of methods that you don’t understand. Instead, we are going to control the energy, which you should understand, and then find out the the temperature later.

If we let a system change while holding the energy fixed, the set of microstates it might change to is called the microcanonical ensemble. We will begin by exploring the microcanonical ensemble. In contrast, if we held the temperature fixed and allow the energy to change, then we would be using the canonical ensemble. The microcanonical ensemble is simpler, because within the microcanonical ensemble every microstate has the same energy, and is equally probable.

A microstate is a single possible state that the system could be in, which defines all possible things that could change in the system. In an Ising model, a microstate corresponds to the matrix that holds all the spins in the system. In contrast, a macrostate is by a set of measurements that you might have done to a system, and could correspond to many possible microstates. In the Ising model, a macrostate could be defined by the total energy, the total spin, or by both of them. You can distinguish macrostates from microstates by asking if you could possibly define two different systems that would have the same state.

A key postulate of statistical mechanics is that within a microcanonical ensemble—that is, if you take a system and isolate it so it is unable to exchange energy with its environment—all microstates are equally probable. This postulate allows us to make physical predictions, provided we are able to appropriately sample this ensemble.

Monte Carlo approach

In real systems, random transitions happen, and we can model this computationally using random numbers. Numerical methods that involve random numbers are called Monte Carlo methods, named after an area in Monaco famous for its casino. Monte Carlo methods can allow us to compute results that would be too challenging to compute using a precise, deterministic approach.

In our Ising problem, we know that within the microcanonical ensemble every microstate is equally probable, so if we were able to enumerate all the microstates corresponding to a given energy, we could compute any averaged quantity we should desire. But this is completely infeasible because even for moderately sized systems there are way too many possible microstates. So instead we look for an approach that will allow us to sample microstates with equal probability. Of course, this is what the real world does: the system evolves from one microstate to another in a quasirandom manner, but doesn’t actually explore every possible microstate.

The challenge in a microcanonical Monte Carlo approach is in constraining the energy to be fixed, since most possible transitions will end up changing the energy somewhat. We handle this by allowing small changes in energy, thus keeping the energy approximately constant.

The Monte Carlo approach for a microcanonical ensemble consists of the following code beyond what you have already written:

  1. A function that suggests a random change to make to a microstate.
  2. A desired energy level, with a tolerance value, so any energy within this range is considered acceptable.
  3. An “initializing” loop, which starts with any initial state and makes random changes until the energy is acceptable, accepting only those changes that move the energy in the right direction.
  4. A “simulation” loop, which makes a bunch of changes, only keeping those changes that leave the energy in the acceptable range.

To compute thermodynamic quantities (e.g. the magnetization), you will average over all the acceptable microstates that you have explored.

Your first task is to implement these functions, generating a sequence of microstates.

Finding the temperature

We will begin by studying a system with J=0, which is to say, with no interactions between neighboring spins. This is a particularly simple system, and we will use it to improve our understanding of how the Ising system behaves in an inhomogeneous magnetic field. For this problem, you can use a simple linear gradient in the magnetic field.

Once you can compute a sequence of possible states, you will want to compute averages and probabilities over all those states. You can begin by computing the average magnetization of each spin, and plotting this as a function of the magnetic field. Observe what happens to this plot when you change the value of the energy.

Try plotting the relative probability of the spin being up or down (i.e. the number of times a given spin is up divided by the number of times it is down), as a function of magnetic field. This should be a simpler plot than the magnetization plot. Try taking a suitable logarithm to see if you can simplify this plot even further. This plot will allow us to find the temperature of a given system (as we will discuss in class).

Temperature versus energy

Once you have observed the Boltzmann factor, have your program fit the curve to find the temperature. The details for this process will be given in class. Try adjusting the total energy, and for each total energy solve for the temperature, so you can create a plot of internal energy (i.e. total energy) versus temperature for your system.

Adding interactions

See what happens when you add a negative value for J. In order to use our previous results as a “thermometer”, keep J=0 for part of your system, and use the same range of B_i values for that region as you did last time. For the J<0 portion of the system, pick some moderately small value for B. That way you can compute the energy distribution in that region in order to determine the temperature. Both portions should be reasonably large.

Try a few different energies, and visually observe what happens. Now work out the temperature for each simulation based on the thermometer section, and plot the mean polarization versus temperature.

Project

Please pick an interesting physics problem to solve, and solve it. You should pick a problem that you cannot solve without using a computer.