qmc 2.2.2

Quantum Monte Carlo simulations in Rust
Documentation
use qmc::classical::graph::Edge;
use qmc::sse::fast_ops::*;
use qmc::sse::qmc_ising::QMCIsingGraph;
use qmc::sse::simple_ops::*;
use qmc::sse::*;
use rand::prelude::*;

fn one_d_periodic(l: usize) -> Vec<(Edge, f64)> {
    (0..l).map(|i| ((i, (i + 1) % l), 1.0)).collect()
}

#[test]
fn single_cluster_test() {
    let l = 8;

    let rng: StdRng = SeedableRng::seed_from_u64(1234);
    let mut g = QMCIsingGraph::<ThreadRng, SimpleOpDiagonal, SimpleOpLooper>::new_with_rng(
        one_d_periodic(l),
        1.0,
        l,
        rng,
        Some(vec![true; l]),
    );
    let beta = 1.0;
    g.timesteps(1, beta);
    let state_a = g.into_vec();

    let rng: StdRng = SeedableRng::seed_from_u64(1234);
    let mut g = QMCIsingGraph::<ThreadRng, FastOps, FastOps>::new_with_rng(
        one_d_periodic(l),
        1.0,
        l,
        rng,
        Some(vec![true; l]),
    );
    let beta = 1.0;
    g.timesteps(1, beta);
    let state_b = g.into_vec();

    assert_eq!(state_a, state_b);
}