Configuration¶
SimulationConfig(lattice=LatticeConfig(), algorithm=Algorithm.METROPOLIS, seed=DEFAULT_SEED, temperatures=(2.269,), n_sweeps=DEFAULT_N_SWEEPS, n_thermalization=DEFAULT_N_THERMALIZATION, measurement_interval=DEFAULT_MEASUREMENT_INTERVAL, compute_correlation=False, adaptive=AdaptiveConfig(), mode=ExecutionMode.COOLDOWN, swap_interval=1)
dataclass
¶
Configuration for a Monte Carlo simulation run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice
|
LatticeConfig
|
Lattice geometry and coupling parameters. |
LatticeConfig()
|
algorithm
|
Algorithm
|
Monte Carlo update algorithm to use. |
METROPOLIS
|
seed
|
int
|
Random seed for reproducibility. |
DEFAULT_SEED
|
temperatures
|
tuple[float, ...]
|
Temperatures to simulate at (in descending order for cool-down). |
(2.269,)
|
n_sweeps
|
int
|
Number of MC sweeps per temperature point. |
DEFAULT_N_SWEEPS
|
n_thermalization
|
int
|
Number of thermalization sweeps before measurement. |
DEFAULT_N_THERMALIZATION
|
measurement_interval
|
int
|
Collect a measurement every this many sweeps. |
DEFAULT_MEASUREMENT_INTERVAL
|
compute_correlation
|
bool
|
Whether to compute the correlation function. |
False
|
mode
|
ExecutionMode
|
Execution strategy. COOLDOWN (default) processes temperatures sequentially via cool-down. INDEPENDENT runs each temperature in parallel from random initialization using all CPU cores. |
COOLDOWN
|
LatticeConfig(lattice_type=LatticeType.SQUARE, size=DEFAULT_LATTICE_SIZE, j1=DEFAULT_J1, j2=DEFAULT_J2, j3=DEFAULT_J3, h=DEFAULT_H)
dataclass
¶
Configuration for lattice geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lattice_type
|
LatticeType
|
Type of lattice geometry. |
SQUARE
|
size
|
int
|
Linear size L of the lattice (creates L x L for 2D). |
DEFAULT_LATTICE_SIZE
|
j1
|
float
|
Nearest-neighbor coupling strength. |
DEFAULT_J1
|
j2
|
float
|
Next-nearest-neighbor coupling strength. |
DEFAULT_J2
|
j3
|
float
|
Third-nearest-neighbor coupling strength. |
DEFAULT_J3
|
h
|
float
|
External magnetic field. |
DEFAULT_H
|
AdaptiveConfig(enabled=False, min_thermalization_sweeps=DEFAULT_ADAPTIVE_MIN_THERMALIZATION, max_thermalization_sweeps=DEFAULT_ADAPTIVE_MAX_THERMALIZATION, c_window=DEFAULT_ADAPTIVE_C_WINDOW, min_independent_samples=DEFAULT_ADAPTIVE_MIN_INDEPENDENT_SAMPLES, max_total_sweeps=DEFAULT_ADAPTIVE_MAX_TOTAL_SWEEPS, tau_multiplier=DEFAULT_ADAPTIVE_TAU_MULTIPLIER)
dataclass
¶
Configuration for adaptive thermalization and measurement spacing.
When enabled, the simulation records energy during thermalization sweeps,
uses MSER to verify equilibration, estimates the integrated autocorrelation
time (tau_int) via Sokal's windowing method, and sets the measurement
interval to tau_multiplier * tau_int for independent samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether to use adaptive mode. When False (default), the simulation uses fixed n_sweeps / measurement_interval / n_thermalization. |
False
|
min_thermalization_sweeps
|
int
|
Minimum thermalization sweeps per temperature (including cool-down). |
DEFAULT_ADAPTIVE_MIN_THERMALIZATION
|
max_thermalization_sweeps
|
int
|
Maximum thermalization sweeps (cap to prevent runaway near T_c). |
DEFAULT_ADAPTIVE_MAX_THERMALIZATION
|
c_window
|
float
|
Sokal windowing constant for tau_int estimation. |
DEFAULT_ADAPTIVE_C_WINDOW
|
min_independent_samples
|
int
|
Target number of effectively independent samples per temperature. |
DEFAULT_ADAPTIVE_MIN_INDEPENDENT_SAMPLES
|
max_total_sweeps
|
int
|
Hard cap on total sweeps per temperature (thermalization + production). |
DEFAULT_ADAPTIVE_MAX_TOTAL_SWEEPS
|
tau_multiplier
|
float
|
Measurement interval = tau_multiplier * tau_int. Using 2*tau gives ~86% independence between consecutive samples. |
DEFAULT_ADAPTIVE_TAU_MULTIPLIER
|
LatticeType
¶
Bases: str, Enum
Available lattice geometries.
Algorithm
¶
Bases: str, Enum
Available Monte Carlo update algorithms.
ExecutionMode
¶
Bases: str, Enum
Execution strategy for temperature scans.
COOLDOWN: Sequential cool-down — carry spins from high T to low T. Best for avoiding metastable states. Single-threaded. INDEPENDENT: Each temperature runs independently from random init. Fully parallelized via Rayon. Uses all CPU cores.