All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
TransitionTable.__str__()for formatted text display with auto-detected integer/float formatting.TransitionTable._repr_html_()for automatic HTML table rendering in Jupyter notebooks.- Displaying Tables section in the transition tables guide.
- Minimum Python version bumped from 3.10 to 3.11 (required by pymatgen-core).
- Runtime dependency changed from
pymatgentopymatgen-core; fullpymatgenmoved to dev dependencies.
Site.residence_times()method for computing per-atom consecutive-occupation run lengths from site trajectory data.filter_lengthparameter for smoothing brief boundary-crossing artefacts before computing run lengths.Trajectory.transition_counts_by_site(),Trajectory.transition_counts_by_label(),Trajectory.transition_probabilities_by_site(), andTrajectory.transition_probabilities_by_label()methods for aggregating per-site transition data.TransitionTableclass: a labelled square matrix with.matrix,.get(),.to_dict(), and.reorder()access patterns.TransitionTableexported from top-levelsite_analysispackage.include_edge_runsparameter to control whether runs truncated by trajectory boundaries are included (excluded by default to avoid biasing towards shorter times).TransitionTable.filter()method for filtering transitions by site label.- Residence time analysis guide in documentation.
site_analysis.distancesmodule providing minimum-image convention distance functions (mic_distance,all_mic_distances,frac_to_cart) with optional numba acceleration, independent of pymatgen.indices_for_species()helper intools.pyreplacingstructure.indices_from_symbol().- Builder validation:
TrajectoryBuilder.build()now checks for same-species atom pairs in the reference structure closer thanmin_atom_distance(default 0.5), catching incorrect Wyckoff positions that produce duplicate sites. Configurable via.with_min_atom_distance(). - Builder validation: post-build duplicate site detection for polyhedral and dynamic Voronoi sites (rejects sites sharing the same vertex/reference indices).
- Pymatgen decoupling (#59): Structure and Lattice objects are now only used at public API boundaries (
TrajectoryBuilder,analyse_structure,ReferenceBasedSites,StructureAligner.align). All internal computation operates on numpy arrays and lattice matrices. This is a purely internal refactoring — the public TrajectoryBuilder API is unchanged.Atom.assign_coords()accepts a coordinate array instead of a Structure.correct_pbc()andunwrap_vertices_to_reference_center()accept a lattice matrix instead of a Lattice.assign_site_occupations()accepts a lattice matrix instead of a Structure across all site collection types.SphericalSite.contains_point()andcontains_atom()accept a lattice matrix instead of a Lattice.PolyhedralSite.assign_vertex_coords()accepts arrays instead of a Structure.DynamicVoronoiSite.calculate_centre()accepts arrays instead of a Structure.calculate_species_distances(),site_index_mapping(), andget_coordination_indices()accept arrays instead of Structure objects.StructureAligneroptimisation loop no longer creates temporary Structure objects per iteration.IndexMapperandCoordinationEnvironmentFinderextract arrays at their boundaries.ReferenceBasedSiteseagerly extracts arrays from both structures in its constructor.
Site.contains_point()andSite.contains_atom()base class signatures no longer use*args/**kwargs. Subclasses declare concrete keyword-only parameters, so invalid arguments raiseTypeErrorimmediately.PriorityAssignmentMixinis now generic over site type (PriorityAssignmentMixin[SiteT]), so_get_priority_sitesyields the concrete site type.PolyhedralSite.contains_point()no longer accepts astructureparameter. Usenotify_structure_changed()orassign_vertex_coords()to set vertex coordinates before calling.PolyhedralSiteCollection.sites_contain_points()accepts arrays instead of a Structure, with length validation.
- Fixed type 2 (Mg) site Wyckoff position in argyrodite reference structure. The coordinate
[0.23, 0.92, 0.09]was on the 96i general position, producing 384 duplicate sites. Replaced with[0.77, 0.585, 0.585]on the 48h special position. - Removed stale
# type: ignoreon scipy import (scipy-stubs now provides types). - Removed unused pymatgen imports from
polyhedral_site.py,dynamic_voronoi_site.py,site_collection.py,site.py, andindex_mapper.py. - Fixed
get_vertex_indicesdeprecation warning referencing non-existentget_coordinating_indices(should beget_coordination_indices).
Benchmarked on Li6PS5Cl argyrodite (1056 sites, 192 mobile Li atoms, 140 MD frames):
| Site type | Before (ms/frame) | After (ms/frame) | Speedup |
|---|---|---|---|
| Polyhedral | 9.95 | 7.26 | 1.37x |
| Voronoi | 7.35 | 3.28 | 2.24x |
| Dynamic Voronoi | 7.86 | 3.59 | 2.19x |
| Spherical | 4.79 | 1.70 | 2.82x |
Speedups come from replacing pymatgen's Cython lattice.get_all_distances with numba-accelerated all_mic_distances, and eliminating per-atom pymatgen PeriodicSite object creation in assign_coords.
- Replaced deprecated
tqdm_notebookwithtqdm.auto, which auto-detects the environment (terminal, Jupyter notebook, Jupyter lab). Theprogressparameter ontrajectory_from_structuresis now a simple boolean. - Added PEP 561
py.typedmarker for downstream type checking support. - Added
types-tqdmdev dependency; removed inline# type: ignoreon tqdm import. - Removed redundant mypy ignores for
tqdm,pymatgen, andscipy(now covered by type stubs). - Added Python 3.14 to CI test matrix; separated mypy into its own CI job.
- Removed
progress='notebook'option fromtrajectory_from_structures(tqdm.autohandles environment detection automatically).
- Extracted shared priority-based site assignment logic into
PriorityAssignmentMixin, used by bothPolyhedralSiteCollectionandSphericalSiteCollection. - Improved priority heuristic for both site collections: tracks two recent distinct sites (catches bounce-back) and uses precomputed distance-ranked site ordering instead of neighbour-cutoff-based ordering. ~68% fewer containment checks and ~1.4x wall-clock speedup on argyrodite Li6PS5Cl trajectories.
- Unified duplicated PBC correction logic into
correct_pbc()inpbc_utils, used by bothPolyhedralSiteandDynamicVoronoiSite. - Dissolved
containment.py: movedHAS_NUMBAto_compat.py, PBC shift updates topbc_utils.py, and face topology cache intopolyhedral_site.py.
- Removed
neighbour_cutoffparameter fromSphericalSiteCollection(distance-ranked ordering replaces neighbour-based ordering). - Removed
containmentmodule (internals relocated; no public API change).
- Batch vectorised centre calculation for
DynamicVoronoiSitecollections, grouped by reference count. After the first frame, incremental PBC shift updates avoid per-site O(27-image) unwrapping (~4x speedup on MD trajectories). SiteCollectionnow owns site reset viareset().Trajectory.reset()delegates tosite_collection.reset(), ensuring collection-level caches are properly cleared.
- Optional Numba acceleration for polyhedral site containment testing (~7x speedup). Install with
pip install site-analysis[fast].
- Cached face topology with JIT-compiled surface normal queries, replacing per-timestep Delaunay construction.
- Lazy vertex coordinate assignment defers PBC correction until a site is actually queried.
- PBC image shift caching avoids the expensive 27-image distance search.
- Per-atom PBC image computation (
x_pbccomputed once per atom per frame rather than once per atom-site pair). algoparameter oncontains_point/contains_atomis deprecated; algorithm is now selected automatically.
- Fixed
use_reference_centerstypo in PBC handling documentation.
- Replaced deprecated
typingimports (Optional,Union,List, etc.) with built-in equivalents. - Replaced defensive
assertstatements with proper exceptions (ValueError,TypeError,RuntimeError). - Standardised indentation to 4 spaces across all source files.
- Removed redundant
objectinheritance fromAtomandTrajectory. - Replaced type-narrowing hacks with annotations.
- Consolidated lazy initialisation helpers in
ReferenceBasedSites. - Use public
assign_coords()API instead of accessing privateAtom._frac_coords.
- Fixed
StructureAligner._run_differential_evolutionmutating the caller'sminimizer_optionsdict. - Fixed incorrect docstrings (typos, wrong default values, mismatched parameter names).
- Fixed float distance truncation in
get_coordination_indices(neighbour distances were cast toint). - Fixed
append_timestepdropping timestept=0(truthiness check treated 0 as falsy). - Fixed transitions from site index 0 not being recorded (truthiness check treated 0 as falsy).
- Fixed
contains_point_snloop structure (inside.append()was inside the inner face loop). - Fixed
Atom.from_dictcrashing whenfrac_coordsis absent. - Removed debug
printstatement fromPolyhedralSite.__init__. - Removed dead code and variable shadowing in
Trajectory.__init__. - Fixed
x_pbcdocstring (stated(9, 3)return shape; actual shape is(8, 3)).
- Fixed quickstart example to work out-of-the-box (#31).
- Added
example_data/XDATCARwith a minimal Li trajectory for the quickstart example. - Added helpful error message when mobile species is not found in structure.
Trajectory.site_summaries()method returning structured summary statistics for all sites.Trajectory.write_site_summaries(filename)method for exporting summaries to JSON.- Optional
metricsparameter for selecting specific statistics (occupancy, transitions, etc.). - Numpy array inputs for
PolyhedralSite. - Description label for
tqdmprogress output.
- Optimised
SphericalSiteCollectionsite assignment using the same priority-based algorithm introduced in 1.2.0, reducing complexity from O(N^2) to O(kN). - Configurable
neighbour_cutoffparameter (default 10.0 A) for distance-based neighbour determination.
most_frequent_transitions()method onSiteclass.
- Optimised
PolyhedralSiteCollectionsite assignment with a priority-based algorithm leveraging spatial relationships and learned transition patterns. 10x speedup for large systems (1440 sites).
- Fixed errors in PBC handling documentation.
- Reference-centre PBC unwrapping method that correctly handles coordination environments spanning more than half the simulation cell. This is now the default.
- Previous spread-based method remains available via
use_reference_centers=False. - PBC concepts documentation.
- Fixed bug in mapping central atom indices to coordination environments.
- Fixed handling of unwrapped mobile atom coordinates.
- Fixed
ImportErrorwhen importingReferenceBasedSites.
- Fixed missing
reference_workflowsubpackage in PyPI distribution.
First stable release, accompanying the JOSS paper submission.
- Refactored structure alignment for modularity.
- Added global minimiser option (
differential_evolution) for structure alignment. - Exposed alignment tolerance parameter in Trajectory Builder and Reference-Based Sites workflows.
- Added comprehensive documentation.
most_recent_siteproperty onAtomfor tracking last known site.- O(1) site lookup dictionary in
SiteCollection.
- Priority-based site checking in
PolyhedralSiteCollectionandSphericalSiteCollection(check most recent site first).
TrajectoryBuilder.build()now numbers generated sites from zero.- Multiple site definitions (of the same type) supported in a single trajectory.
- Separated structure alignment from site mapping in the builder API.
- Intelligent defaults for alignment and mapping species.
- Dynamic Voronoi site types.
ReferenceBasedSitesworkflow for generating sites from reference structures.- Trajectory builders.
- Minimum Python version increased to 3.10.
- Migrated to
pyproject.toml.
Initial release.