pub struct IsingModel {
pub spins: Vec<Vec<i8>>,
pub j_coupling: f64,
pub temperature: f64,
}Expand description
2D Ising model on an n×n grid with periodic boundary conditions
Fields§
§spins: Vec<Vec<i8>>§j_coupling: f64§temperature: f64Implementations§
Source§impl IsingModel
impl IsingModel
Sourcepub fn new(n: usize, j: f64, temp: f64) -> Self
pub fn new(n: usize, j: f64, temp: f64) -> Self
Create an n×n Ising model with a deterministic initial spin pattern
Sourcepub fn magnetization(&self) -> f64
pub fn magnetization(&self) -> f64
Magnetization per site |Σ s_i| / N²
Sourcepub fn metropolis_step(&mut self, rng: &mut u64)
pub fn metropolis_step(&mut self, rng: &mut u64)
One Metropolis-Hastings step: propose flipping a random spin
Auto Trait Implementations§
impl Freeze for IsingModel
impl RefUnwindSafe for IsingModel
impl Send for IsingModel
impl Sync for IsingModel
impl Unpin for IsingModel
impl UnsafeUnpin for IsingModel
impl UnwindSafe for IsingModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more