Skip to content

Monte Carlo

moves

MC move records and their attempts (SPEC §10.4; contracts: plan task 3-T01).

Swap, Transmute and Displace are frozen records a user builds before any model is loaded, so this module imports neither torch nor MACE nor ASE. They are checked against the workload and the superset by Simulation.run(mc=...) (§7.6). Species stay as given (symbols or atomic numbers); the driver maps them to atomic numbers. build_attempt builds the captured attempt of a move: 3-T09 (swaps, transmutations), 3-T10 (displacements, fastmace.mc.displace).

Swap dataclass

Swap the species of two atoms (§10.4): a pair type uniformly from pairs, then one atom of each species uniformly. every MD steps, then attempts attempts. velocities: exchange (default; the atoms swap velocities), rescale, redraw or redraw_all.

Transmute dataclass

Change one atom's species within the transmutable set species (§10.4, semi-grand canonical).

velocities: rescale, redraw or redraw_all; None takes the default (rescale, or redraw_all when the integrator fixes the centre of mass). mu: configurational chemical potential differences in eV against a reference species (configurational_mu converts full ones); absent species have 0. formal_charges: q_s per species (0 if absent), for the parity rule ΔZ − Δq even (§10.4 "Charge and spin"). Both are stored as sorted pairs.

Displace dataclass

Displace one atom uniformly within a sphere of radius delta_A (§10.4). adaptive=True retunes δ after every block while it is set (toward 30 % acceptance, at most delta_A), and each value is recorded; a fixed δ keeps the chain's detailed balance, so sample with adaptive=False.

configurational_mu

configurational_mu(
    mu_full: Mapping[Any, float],
    temperature_K: float,
    reference: Any,
    masses: Mapping[Any, float] | None = None,
) -> dict[Any, float]

Configurational chemical-potential differences from full ones (§10.4): Δμ_s^conf = Δμ_s^full + (3/2) k_B T ln(m_s / m_ref).

mu_full maps species to Δμ_s^full in eV relative to reference (whose own entry, if given, must be 0). masses in amu, by species; None takes ASE's standard atomic masses. The result has the keys of mu_full, for fm.mc.Transmute(mu=...).