47 stable releases
2.20.0 | Oct 21, 2021 |
---|---|
2.19.2 | Jul 19, 2021 |
2.19.1 | Jun 23, 2021 |
2.16.3 | Mar 30, 2021 |
2.10.1 | Nov 27, 2020 |
#1235 in Algorithms
335KB
8K
SLoC
IsingMonteCarlo
-
(Mostly incomplete) docs: https://docs.rs/qmc/
-
Python binding: https://github.com/Renmusxd/PyIsingMonteCarlo
-
WASM binding: https://github.com/Renmusxd/WASMIsingMonteCarlo
lib.rs
:
qmc
is a library for simulating classical and quantum ising systems on a lattice
using monte carlo methods.
The sse library contains built-in classes to handle ising models, as well as classes which handle arbitrary interactions.
It also offers a few feature gated modules:
- parallel tempering system using the
tempering
orparallel-tempering
feature gates. - autocorrelation calculations on variables, bonds, or arbitrary values: use
autocorrelations
- graph serialization using serde with the
serialize
feature.
Basic Quantum Ising Example
use qmc::sse::*;
use rand::prelude::*;
// H = J_ij s_i s_j
let edges = vec![
((0, 1), -1.0), // ((i, j), J)
((1, 2), 1.0),
((2, 3), 1.0),
((3, 0), 1.0)
];
let transverse = 1.0;
let longitudinal = 0.0;
let beta = 1.0;
// Make an ising model using default system prng.
let rng = rand::thread_rng();
let mut g = DefaultQmcIsingGraph::<ThreadRng>::new_with_rng(edges, transverse, longitudinal, 3, rng, None);
// Take timesteps
g.timesteps(1000, beta);
// Take timesteps and sample states (as Vec<Vec<bool>>).
let (state, average_energy) = g.timesteps_sample(1000, beta, None);
Dependencies
~0.3–1.6MB
~31K SLoC