Third year CMP compulsory experiment
This is the Programming-Ising experiment (Programming for simple simulations). This experiment is compulsory for students taking the chemistry with molecular physics option. If you are looking for the 3rd year Liquid simulation experiment, you will find it here.
Introduction
In the first year, you were introduced to Python, a scripting language which is rapidly becoming the de facto language for everyday scientific programming. Python is an interpreted, rather than compiled language, and is rather more forgiving than older languages such as C or FORTRAN. This reduces the amount of time that we need to spend programming and debugging. The downside to all this is that the execution of a Python program is much slower than a compiled equivalent. As a compromise, we usually let large codes written in a compiled language (usually C/C++) do the hefty numerical work for us, and then use scripting languages like Python to analyse the results.
These large codes for numerical work (you may have already used GAUSSIAN for electronic structure calculations) typically take arcane text files as input, and produce equally arcane text files as output. If, for the sake of example, you run twenty different molecular dynamics simulations, and each of them produces an output file which contains information about the density of the system, then extracting this information by hand would be very tedious (and if you run hundreds or thousands of simulations, virtually impossible), but this sort of task is the thing at which languages like Python really excel.
In this exercise, you are going to use the Python that you learned in the first year to write a code to perform Monte-Carlo simulations of the 2D Ising model, a set of spins on a lattice which is used to model ferromagnetic behaviour, and also to analyse the results of the simulation to find the heat capacity of the system and the Curie temperature — the temperature below which the system is able to maintain a spontaneous magnetisation.
Assessment
At the end of this experiment you must submit a report, writing up your findings. Each section of the experiment has a number of tasks that you should complete, labelled TASK. If this is a mathematical exercise, your report should contain a short summary of the solution. If it is a graphical exercise, you should include the relevant image. Your report should explain briefly what you did in each stage of the experiment, and what your findings were.
YOU MUST SUBMIT YOUR REPORT BY 12 NOON ON THE WEDNESDAY FOLLOWING THE EXPERIMENT.
YOU MUST SUBMIT YOUR REPORT USING BLACKBOARD - INSTRUCTIONS WILL BE PROVIDED BY EMAIL BEFORE THE DEADLINE.
Your report should contain the source code to *any* Python scripts that you write during the experiment, annotated with comments. You can write your report in Word or LaTeX, but you should submit a **single PDF file**.
The mark breakdown for the tasks is given below. You will also be assessed on the quality of the code and the report.
Task 1a-c: 6 marks
Task 2a-b: 10 marks
Task 3a-c: 12 marks
Task 4a-c: 10 marks
Task 5a-b: 12 marks
Task 6: 10 marks
Task 7a-b: 10 marks
Task 8a-d: 20 marks
Report + Code: 10 marks
Total: 100 marks
This mark will be divided by 5 and rounded to the nearest integer to obtain a final mark out of 20.
For clarity, code included in the report should be written in a monospaced font (e.g. Courier) or a pasted screenshot. The former can be easily achieved in LaTeX by placing your code inside a \texttt{} command. The code, except where relevant to discussion, can be placed in an appendix.
If you wish, you are welcome to do the experiment on your own computer. You will need the Anaconda scientific Python distribution (if you are a Windows, Mac or Linux user). You may ask for help with installing this, but it is not part of the experiment — students who have scientific questions will take priority.
Getting Help
The demonstrators for this exercise are Aidan Chapman (aidan.chapman16@imperial.ac.uk), Jonathan Hedley (jonathan.hedley16@imperial.ac.uk), Dr. Juan Olarte-Plata (j.olarte@imperial.ac.uk) and Dr Suman Saurab (s.saurabh@imperial.ac.uk). The assessors will be Aidan Chapman, Jonathan Hedley and Prof. Fernando Bresme. The demonstrators will be available online via Teams between 10-12 and 2-4 pm on each day of the experiment (Note: the experiment does not "run" on Wednesdays). If you have questions outside of these times, you are of course welcome to send them by e-mail.
The member of academic staff responsible for this exercise is Prof. Fernando Bresme (f.bresme@imperial.ac.uk).
Structure of this Experiment
This experimental manual has been broken up into a number of subsections. Direct links to each of them may be found below. You should attempt them in order, and you should complete all of them to finish the experiment.