Projects
The Computational Physics project — if you choose to submit one — is worth one unit of further work, so roughly 10% of your final mark for the year. It involves choosing a problem from the project list in Section 4. You will analyse the problem, write and test Python code to investigate it, then write up your work in a report. Like E1 and E2, you can expect it to involve 40 to 50 hours’ work. This includes reading and research, coding, experimentation and gathering results, and writing your report.
Students may start their project work once the project list is published by 17th February. The deadline for submission of the project report is 16:00 on the first Monday of Full Easter term (1st May 2023). Submissions made after that time will not be marked 1. I suggest you proceed as if the deadline is 16.00 on Friday 28th April, and use the final weekend if you really need to.
Bear in mind that everything in your report should be your own work, and your submission will be treated as a declaration of this fact. The rules regarding cheating and plagiarism in the Physics course handbook (Page 34) apply here. It is OK for you to use code that others — that’s what a library is, after all — but in all cases the attribution should be clear.
Notwithstanding the above, please also use the discussions to ask each other questions and share knowledge.
1 The report
Your report will take the form of repository submitted to GitHub classroom (see Section 2). It should consist of a Jupyter notebook containing the body of the report, with all plots rendered (you can check how it will look on GitHub), together with any additional code written for the project as modules in .py
files, and any data that you have produced in the course of running your code (e.g. simulation data in the form of .npy
or .npz
files) that is analyzed further in your report.
When the cells in the notebook are executed, all analysis and figures should be reproduced quickly. Execution should not cause long runs of simulation code, for example. While you should feel free to use other (open source) libraries in your code, please limit your report notebook to the standard libraries we have used in the computational physics course (NumPy, SciPy, Matplotlib).
Please see Keeping Laboratory Notes and Writing Formal Reports for further guidance. There is no prescription on the length of your report, except that it should provide a comprehensive account of the work you have done.
For a guide to the presentation of Python code, see PEP 8 and this explanation.
2 Submission
The submission instructions are the same as for the exercises. Around 17th February you will receive a GitHub Classroom link inviting you to accept the project as an assignment. Please change the name of your repo to <project-name>-<CRSid>
for ease of marking.
You should take advantage of the fact that you are using GitHub to regularly commit to your project repository and push the commits to GitHub. That way there is no danger of you accidentally missing the deadline: your last commit to the repository on GitHub will constitute your submission.
3 Marking
The credit for the project is one unit of further work (like TP1, TP2, E1, E2, etc.). The projects are marked out of ten in the four categories:
- Analysis of the computational physics aspects of the problem (possible algorithms, their complexity, etc.).
- Details of implementation of the algorithm and its performance (e.g. in terms of run time on what hardware). This will include the description in the report as well as the accompanying code, and will include a judgement of style, readability (including comments and docstrings) and quality.
- Results, analysis of errors (if applicable), tests and discussion of the relevant computational physics.
- Overall presentation of the report, structure, etc.
Although presentation only enters in the last category, bear in mind that assessors will not be able to get a good sense of what you have done unless your work is presented clearly throughout. In particular, it will make your assessor’s life easier (always a good thing) if there are sections that clearly refer to the first three points.
As a general guide, you should present your work as if your assessor is completely ignorant of both the problem and computational approaches to it. Alternatively, present your work as if to yourself before you began working on it.
4 The projects
For all of these projects the basic protocol is the same:
- Understand the physical problem
- Learn about the available algorithms, including their theoretical complexity / performance
- Implement the algorithm(s)
- Gather results about the performance of the method
You will need do some research and reading before starting, so follow the links and references2. But read pragmatically: look for the algorithm description or pseudo-code and start thinking about how you will translate it into your own code.
4.1 Percolation
Percolation is an extremely simple statistical mechanical model that has been used as a testbed for many theoretical concepts and numerical techniques over the decades.
One of the most popular and efficient algorithms for percolation is Newman and Ziff (2000). Implement and study this algorithm. You may wish to compare the Newman–Ziff algorithm with other algorithms e.g. Mertens (2022).
4.2 Hierarchical methods for \(N\)-body simulation
The fast multipole method and the Barnes Hut method are two methods to study pairwise interactions in \(N\)-body systems that lower the complexity to \(O(N\log N)\) from the naive \(O(N^2)\). Implement these methods and compare their performance on different tasks.
4.3 Cluster algorithms for Monte Carlo
Study the performance of cluster algorithms for statistical mechanics models such as the Ising model and hard disks — as described in these lectures — and compare them with the Metropolis algorithm. You should analyze the autocorrelation time of the algorithms and the issue of critical slowing down.
4.4 Lyapunov exponents
Lyapunov exponents quantify chaos in a dynamical system by the exponential divergence of neighbouring trajectories. Sandri (1996) as well as Chapter 3 of Pikovsky and Politi (2016) describe numerical methods for their computation.
It’s probably easier to start with discrete time dynamical systems, moving on to the continuous time case if you have time. Wikipedia has an extensive list of chaotic maps e.g. the Hénon map. See the section “LCEs of of Discrete Systems” of Sandri (1996).
4.5 Multi-spin encoding for Ising models
In an Ising model the lattice variables can take only two values. The idea behind multispin encoding is to use 64 bit data (uint64
say) to simulate multiple copies of the Ising model, so that a degree of parallelism comes “for free”. This requires bitwise operations to be performed on the integers.
Implement and test multispin encoding for the square lattice Ising model. Multispin encoding is introduced in Jacobs and Rebbi (1981) and also described in Section 10.1 of Böttcher and Herrmann (2021).
4.6 The Fermi–Pasta–Ulam–Tsingou problem
A fundamental problem in statistical physics is: how does a mechanical system thermalize? FPUT studied this question in a model of a chain of masses coupled by weakly anharmonic springs. Dauxois and Ruffo (2008) is a nice review of the problem, which also includes sample MATLAB code that you could use as a starting point. You may have to explore other integration schemes (e.g. symplectic integrators).
4.7 Lenia
Lenia is a recently invented (discovered?) cellular automaton: somewhat similar to Conway’s Game of Life but with continuous variables.
There are lots of resources on Lenia, including the original paper (Chan (2018)), a GitHub repo, webpage, as well as this article and colab notebook from Google research. Produce your own implementation and investigate its properties!
4.8 Time evolving block decimation (TEBD)
Using Glen Evenbly’s site as a starting point, investigate the use of TEBD to solve quantum spin chains (see the linear algebra lecture). Investigate real and imaginary time dynamics (the latter for finding the ground state), including the evolution of the expectation values of spins, starting from different initial states. See the original paper (Vidal (2004)) for ideas of what to calculate.
4.9 The Wavefunction Collapse Algorithm
Despite the name, the wavefunction collapse algorithm is not strictly about physics but rather texture synthesis: think making landscapes in computer games procedurally. There are potential connections with statistical physics: see this Twitter thread
There is an implementation in Python here, but you will need to write your own. Markov Junior is a newer algorithm by the same author.
4.10 Schrödinger’s smoke
Schrödinger’s smoke is a recent alogrithm for the simulation of incompressible fluids. The original paper (Chern et al. (2016)) describes the algorithm in Section 2: it is based on the split-step method and FFT as discussed in the FFT lecture.
The project webpage includes Matlab code. This is an ambitious project. It’s probably best starting with a two dimensional fluid as a proof of principle.
References
Footnotes
See the NST rules on late submission. For the avoidance of doubt, the project is a piece of work for which the submission date is specified in Examination Regulations (Ordinances), and therefore the final paragraph applies.↩︎
Most should be freely available (to you) online: don’t forget the “CU” in CUP stands for Cambridge University.↩︎