Skip to content

DPRS

Directed percolation-type models in Rust

In this project, we implement directed percolation (DP) and similar lattice models in Rust. The Rust code is accessed via a Python wrapper to make experimentation as convenient as possible. Jupyter notebooks are used to implement the Python-wrapped simulations.

1d DP evolution for \(p_c \approx p=0.53891\), \(n_x=300\), \(t=200\)
Figure 1: 1d DP evolution for \(p_c \approx p=0.53891\), \(n_x=300\), \(t=200\)

We have two motivations for adopting Rust: one is to ensure maximum performance; another is to achieve this in a memory-safe and bug-free fashion (which is not easy to do in C or C++).

2d DP \(t\)-decay of mean order parameter \(\overline\rho(t)\), for \(p_c \approx p=0.163145\), \(n_x=30000\), \(n_y=30000\), \(t=50000\)
Figure 2: 2d DP \(t\)-decay of mean order parameter \(\overline\rho(t)\), for \(p_c \approx p=0.163145\), \(n_x=30000\), \(n_y=30000\), \(t=50000\)

Fast run times are achieved through parallelization using the Rayon crate. We anticipate boosting performance further with GPU-compute using wgpu.

See here for some demos.

See here for some rough "how-to" notes on wrapping Rust with Python.