1. Introduction to the course#

1.1. Overview#

Questions

  • Why do we care about atomistic simulation?

  • How does atomistic simulation connect to the development of physics?

  • How is this course assessed?

Objectives

  • Import the software stack required for this course

  • Find appropriate software documentation

Keypoints

  • Atomistic simulation predicts material behaviour from first principles — cheaper and safer than experiment for many questions

  • Nearly a century old: from Quantum Mechanics (1920’s) to DFT (1960’s) to today’s ML models and Exascale computing

  • Quantum optics is our motivating theme: but the same skills transfer to batteries, catalysts, semiconductors, and beyond

  • The software stack: ASE, GPAW, MACE: Python based and open source

  • Official Docs, Materials Modelling Stack Exchange, GitHub: knowing where to look is half the skill

1.2. Lab Slides#

The slides for this lab are embedded below. 📥 Download slides (.pptx)  |  Open in full screen

1.3. Assessment#

See the Assessment page. We will assign groups: fill in this form to help ensure that groups are well balanced.

1.4. Setting up the software stack#

This course uses specialist scientific software for atomistic modelling: Atomistic Simulation Environment, GPAW and MACE. All of the software is Python-based and open source. See the Installation page for setup instructions.

1.4.1. Exercise: Checking your installation#

Run the code cell below to make sure that ASE, GPAW and MACE are installed correctly. Why do we also need to install NumPy and Matplotlib?

import ase
print(f"ASE version: {ase.__version__}")

import numpy as np
print(f"NumPy version: {np.__version__}")

import matplotlib
print(f"Matplotlib version: {matplotlib.__version__}")

#import mace
#print(f"MACE version: {mace.__version__}")

#import gpaw
#print(f"GPAW version: {gpaw.__version__}")
ASE version: 3.22.1
NumPy version: 1.24.3
Matplotlib version: 3.7.1

1.4.2. Exercise: Running a basic calculation#

A calculator in ASE is an object that can compute physical properties (energy, forces, stress) for a given Atoms configuration. Calculators fall into three broad categories:

  1. Built-in calculators Pure Python implementations bundled with ASE. The Effective Medium Theory (EMT) potential is a fast interatomic potential for metals.

  2. File-based calculators ASE writes input files, calls an external code as a subprocess, and reads back the output. Supports a range of Density Functional Theory codes.

  3. Machine-learned potentials Modern neural-network and Gaussian approximation potentials are increasingly used as fast surrogates for DFT. These are particularly exciting for large-scale simulations of complex materials, such as those used in quantum optics.

# Import the EMT calculator (no external code needed)
from ase.calculators.emt import EMT
from ase.build import bulk

# Build an aluminium FCC structure
al = bulk('Al', 'fcc', a=4.05)
al.calc = EMT()

# Compute energy
energy = al.get_potential_energy()
print(f"Al total energy: {energy:.4f} eV")
print(f"Al energy per atom: {energy/len(al):.4f} eV/atom")
Al total energy: -0.0015 eV
Al energy per atom: -0.0015 eV/atom

1.5. Where to Get Help#

In Jupyter notebooks, you can get help on any ASE object or method using ?:

from ase import Atoms
Atoms?          # full docstring
Atoms.get_positions?   # method docstring

Tab-completion is also very useful for exploring:

Atoms.[TAB]   # lists all methods and attributes

1.5.1. Exercise: Browsing the documentation#

Spend 10 minutes browsing the ASE documentation — get a feel for how it’s laid out

1.5.2. Exercise: Built-in docstrings#

Try help(Atoms) in a notebook cell — see the built-in docstrings for yourself

1.5.3. Extension task: The environmental cost of materials simulation#

Many materials simulation codes run on high-performance computing clusters that draw significant electrical power. This exercise asks you to estimate that cost for a realistic workflow and reflect on what it means for how you plan your research.

This task asks you to estimate the energy consumption and CO₂ emissions of running a materials simulation code on 32 Archer2 nodes for a total of 120 hours.

  1. Before you touch a keyboard or an AI tool, spend 5-10 minutes with a pen and paper working through the following:

  • What are the units you need for compute intensity, energy consumption and CO2 emissions?

  • Where does each conversion factor come from, and how much might it vary?

  • What’s a sensible number to compare it to — something a non-specialist would immediately grasp?

  1. Once you know what is needed you can search for data. Do not trust the first source you see, cross-check wherever possible, and always record your sources.

  2. Finally, write a piece of Python code to implement the method.

You can use Claude or a similar tool during this exercise, but only as an intermediate step between your own thinking and your own critical analysis. Remember that there is also a significant environmental cost associated with large language models.