Skip to main content

CI

chainorder

Chain decomposition and order parameters for ReO3-type anion ordering.

What this is

chainorder is a small NumPy + ASE library for analysing anion ordering of ReO3-type solid solutions (NbO2F, TiOF2, and any other cubic MX3-topology system). It takes an on-lattice ASE Atoms object in an orthorhombic supercell, decomposes the three edge-midpoint anion sublattices into per-direction chains, and exposes a small set of order parameters computed either over the full 3D occupation (coherent structure factor, <111> circulation) or along individual chain directions (Fourier spectra, pair correlation, motif frequencies, inter-chain correlation).

Installation

Requires Python 3.11+, NumPy, and ASE.

pip install chainorder

To install the latest development version directly from GitHub:

pip install git+https://github.com/bjmorgan/chainorder.git

For development, clone and install in editable mode with the test and type-checking extras:

git clone git@github.com:bjmorgan/chainorder.git
cd chainorder
pip install -e ".[dev]"

Quickstart

from ase.io import read
from chainorder import SublatticeOccupation, order_params

atoms = read("frame.xyz")                                   # any ASE-readable format
occ = SublatticeOccupation.from_atoms(atoms, N=6, species="F")  # supercell size (cubic shorthand)

sf = order_params.structure_factor(occ)                      # 3D structure factor
circ = order_params.circulation_invariants(occ, period=3)    # <111> chirality + coherence
spectrum = order_params.chain_fft(occ.x)                     # per x-chain FFT
g_r = order_params.along_chain_correlation(occ.x)            # g(r) along x-chains
freqs = order_params.motif_frequencies(occ.x, window_length=3)   # length-3 motif frequencies
G = order_params.inter_chain_correlation(occ.x, period=3)   # period-p phase correlation

A full trajectory is just a loop: per frame, build a SublatticeOccupation and call whichever order parameter(s) you need.

Public API at a glance

chainorder:

  • SublatticeOccupation -- frozen dataclass holding the decomposed anion occupation. Construct it from an ASE Atoms with SublatticeOccupation.from_atoms(atoms, N=...). The primary field .occupation is a read-only (3, Nx, Ny, Nz) integer array; .x, .y, .z are chain-layout transpose views suited to the single-direction tools below.
  • order_params -- submodule of order parameters:
    • structure_factor(occ) -- coherent 3D structure factor of the full anion sublattice.
    • circulation_invariants(occ, period=p) -- chirality and coherence of the <111> screw ordering, projected onto the cubic point group.
    • chain_fft(arr) -- discrete Fourier transform along each chain.
    • along_chain_correlation(arr) -- pair correlation g(r) along chains, grand-averaged over the chain-plane.
    • motif_frequencies(arr, window_length=N) -- per-chain frequency of each distinct length-window_length motif (bit pattern).
    • inter_chain_correlation(arr, period=p) -- spatial autocorrelation of the period-p Fourier component across the chain plane.

structure_factor and circulation_invariants take the whole SublatticeOccupation; the other four take a single chain-layout array (occ.x, occ.y, or occ.z).

Each function's docstring covers shape conventions, normalisation, and edge cases in detail.

  • docs/concepts.md -- problem framing, data model, and what each order parameter measures, with concrete example cases.
  • docs/tutorial.ipynb -- end-to-end worked example applying all five order parameters to four reference structures, with plots.

Metadata

Release files for chainorder 0.2.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 chainorder 0.2.0
File Size Uploaded
chainorder-0.2.0.tar.gz 31.5 kB Details

Built distribution (wheel)

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

Total release size: 49.6 kB

Release files / chainorder-0.2.0.tar.gz

Download URL chainorder-0.2.0.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
63a4e0af566016fa0ded160af24066232c4d1c5dfed020e97563e792b206a96a
BLAKE2b-256 checksum
How to use checksums
113d92f4f0113acff25eca1cb5ca571044250db7351dd3fc23b52d9da65dbe7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 24, 2026.

Transparency log

Release files / chainorder-0.2.0-py3-none-any.whl

Download URL chainorder-0.2.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5f9805d2519fb073890f55fe6882b09e2744ea75612efeb6c611265f8370d22
BLAKE2b-256 checksum
How to use checksums
92992ca941280b1eb7fa9f1b5600032daa0c4bec60f21fc9eab8af840949f782
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

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