Skip to main content

pylattica is a package for fast prototyping of lattice models for chemistry and materials science

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylattica-0.1.6.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylattica-0.1.6-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file pylattica-0.1.6.tar.gz.

File metadata

  • Download URL: pylattica-0.1.6.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pylattica-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0793fb7b70c283bd9e497640320b8998f0b3d430b308a8a360d2cd2310ae8404
MD5 fd0ec68f2673844dff1992c0a0193b36
BLAKE2b-256 7d32185d2a0b342763fa504ab07f372211004b7e1576361d38e43f3f6ecd71b5

See more details on using hashes here.

File details

Details for the file pylattica-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pylattica-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pylattica-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7f56782361111feea131940d29d61a149c2edb38dd8b0ec8db547b6557ab6c
MD5 1bca1ea2fdfea518df7a9087c26ab0a2
BLAKE2b-256 94dc9f893c25a5bdef0ace497182e289876696859c290442d49b5d12468acf3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page