Skip to main content

pylattica - A Framework for Lattice and Cellular Automata Simulation

GitHub Workflow Status Codecov

pylattica is a Python library for prototyping and constructing cellular automaton and lattice models. The core features of these models are:

  • There is a simulation state that evolves over time by repeatedly applying some unchanging rule
  • The state of the simulation has a topology defined by a network of sites (i.e. each site has an unchanging set of neighbor sites)
  • Each site has a state value associated with it that could change at each simulation step
  • The future state of a site is determined by the state of its neighbor sites

These rules capture many common models in chemistry and materials science. For instance, in the Ising Model, spins are updated with probabilities related to the neighboring spins. In a Lattice Gas Automaton, the velocities of particles are determined collisions with neighboring particles. In lattice Monte Carlo simulations of surface catalysis, adsorption, desorption, and surface diffusion are dependent on the occupancy of neighboring sites.

pylattica aims to provide a general framework for prototyping these types of lattice simulations. It prioritizes providing a straightforward method for experimenting with different interaction rules and interaction neighborhoods. It provides some simple utilities for analyzing simulation states, and in the case of square grid systems, it provides visualization tools for the system state itself. Additionally, since this tool is focused on materials science, there is functionality for mapping system states to CIF files (for use in crystal lattice simulations).

Installation

pylattica can be installed from the PyPi source by running:

pip install pylattica

It can also be installed by cloning this repository, then running the following in the root of the repository:

pip install .

Documentation

Detailed documentation for this library can be found here.

Jupyter Notebook Examples

Example notebooks are included in docs/guides.

Note about Windows

pylattica makes use of Python's fork functionality in the multiprocessing library. This functionality is not available on windows, so certain features (the parallel keyword for the SynchronousRunner) will not be available on Windows platforms.

Development

Installation for development

To install pylattica for development purposes, use the standard editable installation command:

pip install -e .

from the root of the repository.

Running tests

After you have installed the repository, ensure that pytest is installed, then run:

pytest

from the root of the repository.

Building Documentation

The docs for this project are built using mkdocs. To build the documentation

pip install '.[docs]'
mkdocs build

To run the documentation server locally:

mkdocs serve

Linting

This project uses the black package for style and formatting, and prospector for type checking and other lint warnings. These packages are not listed as dependencies of this project, so you can install them manually. This is partially because this project doesn't rely on specific versions of them, and we expect developers to have their own installations already. You can run them as follows:

To assess the changes that will happen if you run the black linter, run the following:

black --check src

To automatically make the changes, remove the --check flag:

black src

To run all other linters with prospector, use this:

prospector

In the top of this repository.

Metadata

Release files for pylattica 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylattica 0.1.7
File Size Uploaded
pylattica-0.1.7.tar.gz 50.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylattica 0.1.7
File Interpreter ABI Platform
pylattica-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 117.2 kB

Release files / pylattica-0.1.7.tar.gz

Download URL pylattica-0.1.7.tar.gz
Size 50.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d3301a3c393006e243f2b7c4fe6bfa4d96f3eb55f601e9c473e61f3d917b38d4
BLAKE2b-256 checksum
How to use checksums
b1a761f98086fd1b593551d413b1bef6ecd90627406c05f19150a58317e865c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / pylattica-0.1.7-py3-none-any.whl

Download URL pylattica-0.1.7-py3-none-any.whl
Size 66.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fac0ee5bb0823de0318a326214f9056c5155e9dff6e2490111ea2827381cf98d
BLAKE2b-256 checksum
How to use checksums
48ad5bf210e615d22c074479b68ca28f91b8b3e6462c72fe74bc62d0977c9437
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page