Examples
This section collects minimal, self-contained scripts for the three standard mcpy workflows: canonical Monte Carlo, grand-canonical Monte Carlo, and replica-exchange GCMC.
Before browsing the individual examples, it is useful to recall the acceptance rules each workflow relies on and the thermodynamic definitions used downstream to build phase diagrams. The full derivations live in Ensembles and Calibrating species_radii; what follows is a quick reference.
Acceptance rules
GCMC insertion and deletion
Number-changing moves carry an extra de-Broglie factor relative to the Metropolis form:
Deletion \((N \rightarrow N-1)\):
Insertion \((N \rightarrow N+1)\):
with activity \(z = e^{\beta \mu}\) and thermal de Broglie wavelength \(\Lambda = h/\sqrt{2\pi m k_B T}\). The accessible free volume \(V_{\mathrm{free}}\) – estimated by the cell, with element-wise exclusion radii – replaces the geometric \(V\) of the textbook expressions (see Calibrating species_radii).
Phase diagrams from GCMC ensembles
The formation-energy construction, the lower-envelope logic, and the post-processing utilities are described in Building phase diagrams from GCMC output. The replica-exchange examples below end in exactly that analysis.
Examples by workflow
Canonical Monte Carlo (NVT)
Grand Canonical Monte Carlo (GCMC)
- Grand Canonical Monte Carlo on a small Ag(111) surface with a custom simulation cell
- GCMC of O on an Ag octahedral nanoparticle
- GCMC of H on a Pt/Au bimetallic nanoparticle with metal permutations
- GCMC of O on a supported Ag nanoparticle
- GCMC of O on a supported Ag nanoparticle (dome region)
- Minimal GCMC on an Ag(111) slab