Metadata-Version: 2.4
Name: dprs
Version: 0.1.13
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Summary: Directed percolation-type models in Rust
Keywords: directed percolation,phase transition
Author-email: "Colin P. Stark" <cstarkjp@gmail.com>
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: documentation, https://cstarkjp.github.io/DPRS
Project-URL: homepage, https://cstarkjp.github.io/DPRS
Project-URL: repository, https://github.com/cstarkjp/DPRS

# Directed Percolation in Rust and Python

[![](https://github.com/cstarkjp/DPRS/actions/workflows/pypi.yml/badge.svg?style=cache-control=no-cache)](https://github.com/cstarkjp/DPRS/actions/workflows/pypi.yml)
[![](https://github.com/cstarkjp/DPRS/actions/workflows/unittest-macos.yml/badge.svg?style=cache-control=no-cache)](https://github.com/cstarkjp/DPRS/actions/workflows/unittest-macos.yml)
[![](https://github.com/cstarkjp/DPRS/actions/workflows/unittest-linux.yml/badge.svg?style=cache-control=no-cache)](https://github.com/cstarkjp/DPRS/actions/workflows/unittest-linux.yml)
[![](https://github.com/cstarkjp/DPRS/actions/workflows/unittest-windows.yml/badge.svg?style=cache-control=no-cache)](https://github.com/cstarkjp/DPRS/actions/workflows/unittest-windows.yml)

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 ~ p=0.53891, n_x=300, t=200](https://raw.githubusercontent.com/cstarkjp/DPRS/main/docs/images/lattice_p0p538910_s5_nx300.png)

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++). 

Fast run times are achieved through parallelization using the [`Rayon`](https://docs.rs/rayon/latest/rayon/) crate. 
We anticipate boosting performance further with GPU-compute using [`wgpu`](https://wgpu.rs/).

See [here](docs/HOWTO.md) for some rough "how-to" notes on wrapping Rust with Python.

## Demos

For now, only DP has been implemented.  A series of related models are in development.


![2d DP t-decay of mean order parameter mean ρ(t), for p_c ~ p=0.163145, n_x=30000, n_y=30000, t=50000](https://raw.githubusercontent.com/cstarkjp/DPRS/main/docs/images/ρmean_p0p163145_s1_nx30000_ny30000.png)

### DP

DP model simulations are demonstrated in the following Jupyter notebooks:

- [**1d DP** for a small lattice, to visualize t evolution](https://github.com/cstarkjp/DPRS/tree/main/notebooks/dp_1d_quick.ipynb)

- [**1d DP** for a large lattice and large number of iterations, to validate t-decay of mean ρ(t)](https://github.com/cstarkjp/DPRS/tree/main/notebooks/dp_1d.ipynb)

- [**2d DP** for a large lattice and large number of iterations, to validate t-decay of mean ρ(t)](https://github.com/cstarkjp/DPRS/tree/main/notebooks/dp_2d.ipynb)

Related pure-Python demos can be found here:

 - [Python demos](https://github.com/cstarkjp/DPRS/tree/main/demos/)




