Skip to main content

Analysis tools for tracking ion migration through crystallographic sites

Project description

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.

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

site_analysis-1.8.0.tar.gz (126.7 kB view details)

Uploaded Source

Built Distribution

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

site_analysis-1.8.0-py3-none-any.whl (76.1 kB view details)

Uploaded Python 3

File details

Details for the file site_analysis-1.8.0.tar.gz.

File metadata

  • Download URL: site_analysis-1.8.0.tar.gz
  • Upload date:
  • Size: 126.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for site_analysis-1.8.0.tar.gz
Algorithm Hash digest
SHA256 c92cdc28e11610f6e36da5ab595dee8d84966ddaadc136421cb0f7071477190a
MD5 3d0807de9f30f8677fcd3896c80690af
BLAKE2b-256 576f68e6d8df395445958322190cd210c95a94a80e1f6fe7775f7745e5d150f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for site_analysis-1.8.0.tar.gz:

Publisher: python-publish.yml on bjmorgan/site-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file site_analysis-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: site_analysis-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 76.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for site_analysis-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7d13c33c5fbcbb31b3ae58e3fc6708e571faaa5254a34c1044f4baa8ade3dc8
MD5 8f6745b0bfec27e198555cf5a03f79f5
BLAKE2b-256 52e3ddbfffdee88c41a378e938bd8887e3f38c34ec189666e593372e8c21ef1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for site_analysis-1.8.0-py3-none-any.whl:

Publisher: python-publish.yml on bjmorgan/site-analysis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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