Crystal growth and grain boundaries with the phase-field crystal model

Metals are patchworks of crystals, and much of their strength is settled at the seams, where rows of atoms fail to line up. One equation for one smooth field is enough to grow those seams from a liquid. In crystal you can plant the seeds and watch.

Published
16 November 2026
Shows
A flat box about 28 atom spacings across
Examples
One crystal, two, nine, or a flash freeze
Method
Phase-field crystal (Elder & Grant)
Download
247 KB engine, 96 KB compressed
Open crystal Source code on GitHub Inspired by pyPFC on GitHub
Contents
  1. Two seeds, one seam
  2. An equation with no atoms in it
  3. Why a lone crystal stops
  4. Catching the light
  5. Limits
  6. Further reading
A lit 3D view from above of a crystal surface: rows of atom-bumps in several grains, some catching the light brightly, meeting along crooked seams
fig. 1 — several grains after they have grown into each other, seen from above. The seams between them are grain boundaries.

Polish a piece of steel, etch it and put it under a microscope, and it breaks up into patches. These are grains, crystals whose rows of atoms run in different directions. The seams between them, the grain boundaries, decide a good deal of how the metal behaves: how strong it is, how it corrodes, how it creeps when hot.

The seams are left over from freezing. Crystals start at many points in a melt, pointing whichever way they happen to, and grow until they run into one another. crystal replays that at the scale of atoms, laid out like a micrograph, with a scale bar on the picture and a count of grains, atoms and misfits underneath.

Two seeds, one seam

Press Two crystals meet. Two small seeds go into a cold liquid, their rows tilted at 2.9° and 34.4°. The liquid beside them copies whichever pattern it touches, and for a while there are simply two flawless crystals growing.

Then they touch. By step 1,500 the box holds 863 atoms, and 52 are misfits, without the six neighbours that every atom inside a perfect hexagonal crystal has. They mark the cores of dislocations along the seam, and they glow. Leave it running and the boundary tidies itself, but only so far: at step 10,000 there are still 36.

The two tilts cannot be reconciled by shuffling a few atoms. One whole grain would have to turn, and grains this size turn very little. Small ones squeezed between large neighbours do slowly rotate to fit, in the model as in real metals, which you can watch in Many grains.

An equation with no atoms in it

Simulating this is awkward. Molecular dynamics follows every atom, but with a time step of a femtosecond it takes far too long to watch a crystal grow. Classical phase-field models are fast, but their solid is a smooth blob, with no rows to mismatch.

The phase-field crystal model, introduced by Elder and colleagues in 2002, sits between the two. It follows a single quantity, ψ, the density of material averaged over the fast vibrations of atoms, which allows steps thousands of times longer than molecular dynamics. In a liquid ψ is flat. In a crystal it gathers into regular peaks, one to an atom, and all of it follows from one equation:

∂ψ/∂t = ∇²[(r + (1 + ∇²)²) ψ + ψ³](1)

The outer ∇² only moves material about, never making or destroying it. The (1 + ∇²)² term rewards ripples of one wavelength, which becomes the spacing between atoms. The ψ³ term stops the peaks growing without limit. In two dimensions the winning pattern is hexagonal. Elasticity, dislocations and grain boundaries all follow without being written in.

Why a lone crystal stops

The equation has two settings, r and ψ̄, labelled Temperature and Amount of material in the app. The more negative r is, the colder the box and the stronger the pull towards a crystal. ψ̄ is the average density, and it cannot change as the simulation runs.

A crystal is denser than its liquid, which means growth thins the liquid around it. With One crystal, at r = −0.40 and ψ̄ = −0.380, the grain has 623 atoms at step 3,000 and only 682 at step 10,000. It has all but stopped, with liquid still round it, because there is no spare material left. Nudge the amount of material up and it carries on.

Push far enough, until |ψ̄| falls below √(−r/3), and no seed is needed. The liquid is then unstable, and the faintest noise in it grows into crystal everywhere at once. Flash freeze does this, and leaves many small grains crowded with misfits.

Catching the light

Drawn flat, every grain would be a field of identical dots. Here ψ is drawn as height, turning atoms into lit bumps, much as a scanning tunnelling microscope shows a real crystal face. A grain glints when its rows line up with the light, as the patches on galvanised steel flash when you turn it in the sun. Drag the view and different grains light up. A rainbow setting colours them by tilt instead.

The tilt comes from the atoms themselves. The app finds the peaks in ψ and averages the directions to their neighbours in the sixfold way devised by Steinhardt, Nelson and Ronchetti. One crystal is planted at 11.5°, and at step 1,500 its grain still measures 11.5°. The engine’s tests require a lone seed to grow with a single tilt, and the average density to stay put to ten decimal places over 2,000 steps, since a leak of material would spoil everything in the section above.

Derivatives turn into multiplications in Fourier space, where the equation is stepped with its stiff linear part treated implicitly. A step on the standard 256 × 256 grid takes a few milliseconds, quick enough to grow a grain while you watch.

Limits

This is a flat crystal in a box that wraps round at its edges, about 28 atom spacings across on the standard grid. Lengths and times are the model’s own units, with no particular metal behind them. The grain count is an estimate: neighbours with almost equal tilts can be counted as one, and a bent grain as two. The code is written from the published equations and shares none with the research codes listed below.

Further reading