1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Pure-Rust Ising model Monte Carlo on periodic Bravais lattices.
//!
//! # Algorithms
//!
//! | Move | Function |
//! |------|----------|
//! | Metropolis / Gibbs sweep | [`run_sweep_loop`] (`sweep_mode`) |
//! | Wolff / Swendsen-Wang | [`run_sweep_loop`] (`cluster_mode`) |
//! | Parallel tempering | [`run_sweep_loop`] (`pt_interval`) |
//! | Houdayer / Jörg / CMR | [`run_sweep_loop`] (`overlap_cluster`) |
//!
//! Replicas are parallelized over threads with [`rayon`].
//! Multiple disorder realizations can be run in parallel with [`run_sweep_parallel`].
//!
//! # Quick start
//!
//! ```
//! use spin_sim::config::*;
//! use spin_sim::{Lattice, Realization, run_sweep_loop};
//!
//! let lattice = Lattice::new(vec![16, 16]);
//! let n_spins = lattice.n_spins;
//! let n_neighbors = lattice.n_neighbors;
//! let temps = vec![2.0, 2.27, 2.5];
//!
//! // Uniform ferromagnetic couplings
//! let couplings = vec![1.0f32; n_spins * n_neighbors];
//! let mut real = Realization::new(&lattice, couplings, &temps, 2, 42);
//!
//! let config = SimConfig {
//! n_sweeps: 5000,
//! warmup_sweeps: 1000,
//! sweep_mode: SweepMode::Metropolis,
//! cluster_update: Some(ClusterConfig {
//! interval: 1,
//! mode: ClusterMode::Wolff,
//! collect_stats: false,
//! }),
//! pt_interval: Some(1),
//! overlap_cluster: None,
//! autocorrelation_max_lag: None,
//! sequential: false,
//! equilibration_diagnostic: false,
//! };
//!
//! use std::sync::atomic::AtomicBool;
//! let interrupted = AtomicBool::new(false);
//! let result = run_sweep_loop(
//! &lattice, &mut real, 2, temps.len(), &config, &interrupted, &|| {}, 0,
//! ).unwrap();
//! ```
//!
//! For a Python interface, see the [`peapods`](https://pypi.org/project/peapods/) package.
pub use Lattice;
pub use ;
pub use ;