For the final project of Computational Physics we encourage you to define your own project!
The only requirement we ask for is that it should be a simulation of a physics-related project (but we consider physics-related rather broad, and e.g. simulation of biological systems or an engineering problem are also absolutely ok). We do advise you though to start from a project where there is some existing literature. in this way you have a starting point as well as something to compare your simulation to for validation.
We encourage you to discuss your project idea with us during the time of class, or remotely via the planning issue #1.
In any case, you need to fill in a short plan (a few lines) together with a reference to literature in the planning issue, and have it agreed by us before May 27 (i.e. latest two weeks before the presentation).
If you have problems to come up with a good project, we can provide you with proven project ideas. But we first want you to try coming up with your own project! Having designed your own project will also give a small bonus for the grade.
This week, we have implemented the high-speed Metropolis algorithm using NumPy
and Numba
. The evolution of the simulation can be seen in the animated .gif
below, where we begin with a completely homogeneous lattice state, and slowly increase the temperature past the critical temperature
Note: The
where τ is the relaxation time, i.e. the number of metropolis iterations allocated for the system to equilibrate for a given temperature.
Here, we see another animated .gif
, where we begin with a completely random spin lattice, and immediately quench the system to
Now, let us look at the comparison of the phase space and the energy space side by side for a given Metropolis run. Below, see that as we quench down to
Using the same side-by-side view, let us look at what happens if we lower the temperature slowly instead. Here, we begin with
This week, we incorporated the observable calculations into the Metropolis()
python function itself. The incorporated observables are the followings
-
normalised magnetisation squared,
$\frac{\left\langle M^2\right\rangle}{N^2}=\frac{1}{N^2}\left\langle\left(\sum_{i=1}^{N} \cos \theta_{i}\right)^{2}+\left(\sum_{i=1}^{N} \sin \theta_{i}\right)^{2}\right\rangle$ , where$N=L\times L$ . - specific heat capacity per spin,
$c / k_{\mathrm{B}}=\frac{\left\langle E^{2}\right\rangle-{\langle E\rangle}^{2}}{\left(k_{\mathrm{B}} T\right)^{2}}$ , where$k_B$ is the Boltzmann constant.
The calculation of the observables can be seen in Observables.ipynb
.
Below, we find the results for these two observables for the following simulation set-up:
- system size,
$L=30$ . - equilibrating time,
$\tau=500000$ - extra time,
$\tau_\mathrm{extra}=\tau$ - initial temperature
$T_\mathrm{init}=0.2T_c$ - final temperature
$T_\mathrm{final}=2.0T_c$ - number of points between
$T_\mathrm{init}$ and$T_\mathrm{final}$ ,$\tau_n=100$ - coupling constant,
$J=1$
Note: The observables were calculated by averaging over a temporal ensemble in the time-range after the equilibrating time, i.e. the extra time, τ_extra.
Using the set-up as described above, we obtain the following result for the normalised magnetisation squared.
From the wikipedia page for XY model, we see the results for the same system size
By comparing the two images, we see that they are somewhat similar with some minor differences. This can be attributed to insufficient equilibrating time or extra time.
Using the set-up as described above, we obtain the following result for the specific heat capacity per spin.
From the wikipedia page for XY model, we see the results for the same system size
Again, by comparing the two images, we see that they are somewhat similar with some minor differences. This can be attributed to insufficient equilibrating time or extra time.
The invaded cluster algorithm can be useful for simulating the critical point the xy model. It is based on the idea of percolation. The procedure of a single alogorithm itarion is as follows:
- Generate a random unit vector
$\hat n$ in 2D. - Create a cluster with a single element at every point in the lattice, i.e.
$ s_i$ . - Check if a cluster and one random neighbor are aligned, that is,
$s_i\cdot\hat n s_j\cdot\hat n > 0 $ . - If so, add them to the cluster with probability
$P(\beta) = 1 -e^{-J\beta}$ . - Continue this process until a single cluster spans the lattice, i.e. crosses from left to right or top bottom.
- Flip all clusters with probability 1/2 with respect to
$\hat n$ . We start from an anbitrary temperature$T$ , and by allowing the system to relax and measuring the new temperature, we update the system. Ultimately, one obtains the critical temperature of the system without any a pripori knowledge.
We have implemented the evolution rule for the cluster formation and percolation. In the following video one can observe a lattice percolation model of size