Skip to main content

site-analysis

Build Status Documentation Status PyPI version status

site-analysis is a Python module for analysing molecular dynamics simulations of solid-state ion transport, by assigning positions of mobile ions to specific “sites” within the host structure.

The code uses pymatgen Structure objects as its input format for MD trajectories. Any trajectory source that can produce pymatgen structures can be used as input.

The code can use the following definitions for assigning mobile ions to sites:

  1. Spherical cutoff: Atoms occupy a site if they lie within a spherical cutoff from a fixed position.
  2. Voronoi decomposition: Atoms are assigned to sites based on a Voronoi decomposition of the lattice into discrete volumes.
  3. Polyhedral decomposition: Atoms are assigned to sites based on occupation of polyhedra defined by the instantaneous positions of lattice atoms.
  4. Dynamic Voronoi sites: Sites using Voronoi decomposition but with centres calculated dynamically based on framework atom positions.

Quick Start

from site_analysis.builders import TrajectoryBuilder
from pymatgen.io.vasp import Xdatcar

# Load MD trajectory as a list of pymatgen Structure objects.
# Here we load from a VASP XDATCAR file, but any source of
# pymatgen Structure objects can be used as input.
xdatcar = Xdatcar("example_data/XDATCAR")
md_structures = xdatcar.structures

# Define sites and track Li+ ion movements between them
trajectory = (TrajectoryBuilder()
              .with_structure(md_structures[0])  # Use first frame as reference
              .with_mobile_species("Li")
              .with_spherical_sites(centres=[[0.25, 0.25, 0.25],
                                             [0.75, 0.25, 0.25]],
                                    radii=1.5)
              .build())

trajectory.trajectory_from_structures(md_structures)

# Get site occupancies over time
print(trajectory.atoms_trajectory)  # Which site each atom occupies
print(trajectory.sites_trajectory)  # Which atoms in each site

For detailed examples and tutorials, see the documentation.

Executable Jupyter notebook tutorials are available in the tutorials/ directory. These are not included when installing via pip — to run them locally, clone the repository:

git clone https://github.com/bjmorgan/site-analysis.git
cd site-analysis/tutorials
jupyter notebook

Installation

Standard Installation

pip install site-analysis

For faster polyhedral site analysis, install with numba acceleration:

pip install site-analysis[fast]

Development Installation

For development or to access the latest features:

# Clone the repository
git clone https://github.com/bjmorgan/site-analysis.git
cd site-analysis

# Install in development mode with dev dependencies
pip install -e ".[dev]"

Documentation

Complete documentation, including tutorials, examples, and API reference, is available at Read the Docs.

Testing

Automated testing of the latest build happens on GitHub Actions.

To run tests locally:

# Using pytest (recommended)
pytest

# Using unittest
python -m unittest discover

The code requires Python 3.10 or above.

Contributing

Bug reports, feature requests, and pull requests are welcome. See CONTRIBUTING.md for guidelines.

Metadata

Release files for site-analysis 1.8.0

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

Source distribution (sdist)

Source distribution for site-analysis 1.8.0
File Size Uploaded
site_analysis-1.8.0.tar.gz 126.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for site-analysis 1.8.0
File Interpreter ABI Platform
site_analysis-1.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 202.8 kB

Release files / site_analysis-1.8.0.tar.gz

Download URL site_analysis-1.8.0.tar.gz
Size 126.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c92cdc28e11610f6e36da5ab595dee8d84966ddaadc136421cb0f7071477190a
BLAKE2b-256 checksum
How to use checksums
576f68e6d8df395445958322190cd210c95a94a80e1f6fe7775f7745e5d150f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release files / site_analysis-1.8.0-py3-none-any.whl

Download URL site_analysis-1.8.0-py3-none-any.whl
Size 76.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7d13c33c5fbcbb31b3ae58e3fc6708e571faaa5254a34c1044f4baa8ade3dc8
BLAKE2b-256 checksum
How to use checksums
52e3ddbfffdee88c41a378e938bd8887e3f38c34ec189666e593372e8c21ef1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.8.0 This release

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.3.0

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.0.2

2 release files

0.0.1

3 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