mofchecker-next
A fast, drop-in replacement for MOFChecker 2.0 — same diagnostics, same API, ~12× faster on the geometric diagnostics (~7× with open-metal-site detection), built on Rust kernels and rustworkx graph algorithms.
Designed for the workloads where the original is painful: validating thousands of model-generated MOFs (e.g. from a diffusion model), where the slow paths — floating-solvent extraction and dimensionality — dominate.
💪 Getting started
from mofchecker_next import MOFChecker
mc = MOFChecker.from_cif("structure.cif") # also .from_ase(atoms) / MOFChecker(structure)
mc.has_atomic_overlaps, mc.has_lone_molecule, mc.has_oms, mc.metal_number
descriptors = mc.get_mof_descriptors() # OrderedDict of every diagnostic
Validating many structures? mofchecker_next.batch parallelizes across structures, builds each graph once, and never aborts the run on a single bad structure:
from mofchecker_next.batch import check_structures
# inputs may be CIF paths, pymatgen Structures, ASE Atoms, or a mix
results = check_structures(inputs, n_workers=16) # all CPUs by default
bad = [r for r in results if r["has_atomic_overlaps"]]
# subset to skip work: composition-only descriptors skip graph construction entirely
fast = check_structures(inputs, descriptors=["has_atomic_overlaps", "has_overcoordinated_c"])
Each result is a dict with index, id, n_atoms, and the requested descriptors. DEFAULT_DESCRIPTORS is the in-scope diagnostic suite (including bit-exact has_high_charges); ALL_DESCRIPTORS adds metadata, symmetry, and graph hashes. A structure that fails gets an error field (on_error="record") instead of aborting the batch.
🚀 Installation
pip install mofchecker-next
Latest from source (needs a Rust toolchain):
pip install git+https://github.com/henk789/mofchecker-next.git
✨ Why use it
- ⚡ Fast. On 150-atom QMOF MOFs, the geometric diagnostic set runs in ~101 ms/structure single-core vs ~1.20 s for MOFChecker 2.0 (~12×); ~77 structures/s across 10 cores. The win is the floating-solvent and 3D-connectivity paths, ported off networkx onto rustworkx; the numeric kernels (distances, contacts, connected components, OMS Voronoi/order-parameters, EQeq) are Rust.
- 🔌 Drop-in.
MOFChecker-compatible class — same properties, sameget_mof_descriptors(). Switch the import and existing code keeps working. - ✅ Parity-verified. 100% agreement with MOFChecker 2.0 on real QMOFs (4500/4500 descriptor-comparisons over 250 structures × 18 descriptors; 16/16 on the reference test CIFs). See Parity below.
- 📦 Built for batches. Parallel
check_structures, graph built once per structure, failures isolated. - 🔋 Bit-exact charges.
has_high_chargesis a faithful Rust port of EQeq (bit-exact equilibrated charges). - 🔁 Reproducible.
symmetry_hashis deterministic (the reference's depends on Python hash randomization).
⚡ Performance
30 QMOF relaxed 150-atom MOFs, cold batch (each structure processed once), MOFChecker 2.0 vs mofchecker-next on identical inputs, dedicated compute node, 1 vs 10 cores. Reproduce with scripts/benchmark_throughput.py (the structure set is pinned + fingerprinted so before/after runs are comparable).
Geometric diagnostic set (the structural/graph checks; excludes open-metal-site detection):
| per structure | throughput | speedup | |
|---|---|---|---|
| MOFChecker 2.0 — 1 core | 1201 ms | 0.8 /s | 1× |
| mofchecker-next — 1 core | 101 ms | 9.9 /s | 11.9× |
| MOFChecker 2.0 — 10 cores | 162 ms | 6.2 /s | 1× |
| mofchecker-next — 10 cores | 13.1 ms | 76.6 /s | 12.4× |
Full geometric suite (includes has_oms open-metal-site order parameters):
| per structure | throughput | speedup | |
|---|---|---|---|
| MOFChecker 2.0 — 1 core | 1535 ms | 0.7 /s | 1× |
| mofchecker-next — 1 core | 140 ms | 7.1 /s | 10.9× |
| MOFChecker 2.0 — 10 cores | 197 ms | 5.1 /s | 1× |
| mofchecker-next — 10 cores | 20.0 ms | 49.9 /s | 9.8× |
Where the speedup comes from — it is concentrated in one check. MOFChecker's floating-solvent detection (has_lone_molecule) builds a 3×3×3 supercell graph via pymatgen StructureGraph.__mul__ (networkx union/relabel of 27 copies, ~940 ms/structure here) and 3D-connectivity runs Larsen dimensionality over networkx. These are replaced by direct integer image-offset algorithms on a rustworkx graph — O(N+E), no supercell — making has_lone_molecule ~94× faster (~940 ms → ~10 ms); it dominates the reference's runtime, so it drives the speedup. has_oms now uses Rust for Voronoi facet-neighbor selection and pymatgen-compatible local order-parameter formulas. Speedup also grows with structure size and is higher on generated/distorted structures (more disconnected fragments).
⚙️ How it works
Python owns CIF/structure loading, pymatgen integration, and orchestration. The heavy lifting is delegated:
- Rust (
_rustPyO3 extension): minimum-image distances, short contacts, neighbor candidates, connected components, graph degrees, OMS Voronoi/order-parameters, and the EQeq charge solve. - rustworkx (
checks/_subgraph_rx.py): floating-solvent / lone-molecule detection (finite connected components via an image-offset consistency test) and Larsen dimensionality (rank of the lattice-image vectors a component spans). These replace the networkx-heavy paths. - structuregraph_helpers is retained for the logic-critical, non-hot pieces it does well: graph construction (tuned VESTA cutoffs) and the Weisfeiler–Lehman graph hashes.
The structure graph is built once per MOFChecker and reused across all checks.
✅ Parity
Verified against a MOFChecker 2.0 checkout (used only as a behavioral oracle) via the harnesses in scripts/:
- Real QMOFs: 4500/4500 descriptor-comparisons (250 structures × 18 descriptors) — 100%.
- Reference test CIFs: 16/16.
- Generated (distorted) structures: 3899/3900. The single difference is
has_lone_molecule, where mofchecker-next is more correct — see Limitations.
Reproduce: scripts/qmof_parity.py (real QMOFs), scripts/generated_parity.py (generated CIFs), scripts/validate_subgraph_rx.py (floating-solvent port). Point them at a local QMOF CIF directory with QMOF_DIR=....
⚠️ Limitations & deliberate differences
- Healing not implemented.
adding_hydrogen/adding_linkerraiseNotImplementedError. - No porosity.
is_porousreturnsNone(no bundled Zeo++). has_lone_moleculeis more correct than the reference. MOFChecker 2.0's supercell + in-cell-filter heuristic silently misses finite molecules that wrap the unit-cell boundary (the origin-cell copy is truncated at the supercell face). mofchecker-next detects them via a topological finite-component test. This is the only descriptor that ever disagrees with the reference, only on pathological/distorted structures (0 disagreements on real QMOFs).- Graph construction is still the floor. pymatgen's VESTA neighbor-finding is unchanged; the speedup is in the graph algorithms, not bond perception.
- Determinism.
symmetry_hashis deterministic by design and will not match the reference's randomized value across runs.
⚖️ License
The published package is GPLv2, because it bundles py/mofchecker_next/eqeq/ — a faithful translation of EQeq (GPLv2, see py/mofchecker_next/eqeq/LICENSE) — and the GPL governs the combined work. The non-eqeq sources are MIT (LICENSE); for an MIT-only build, omit the eqeq subpackage and the has_high_charges diagnostic.
The MOFChecker 2.0 checkout used as the behavioral oracle (ANCSA 1.0) is not redistributed; see external/REFERENCE.md to reproduce it locally.
🛠️ For developers
Build, test, and release
python -m maturin develop --release # build the Rust extension into the venv
python -m pytest -q # Python tests
cargo test --release --manifest-path rust/Cargo.toml # Rust tests
# Source builds need libclang available for qhull-sys/bindgen.
Layout
py/mofchecker_next/— Python package (checks/,diagnostics.py, theeqeqsubpackage).py/mofchecker_next/checks/_subgraph_rx.py— rustworkx floating-solvent + dimensionality.rust/— the_rustPyO3 extension (geometry + OMS + EQeq kernels).scripts/— parity harnesses and the speed benchmark.tests/— Rust and Python unit tests.docs/DIAGNOSTIC_INVENTORY.md— per-diagnostic parity status.
Making a release — wheels are built and published by .github/workflows/release.yml via PyPI Trusted Publishing on a version tag:
git tag v0.1.0 && git push origin v0.1.0
Metadata
Release files for mofchecker-next 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mofchecker_next-0.1.2.tar.gz | 54.8 kB | With provenance | Details for mofchecker_next-0.1.2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| mofchecker_next-0.1.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for mofchecker_next-0.1.2-cp310-abi3-win_amd64.whl |
| mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details for mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl |
| mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl |
| mofchecker_next-0.1.2-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for mofchecker_next-0.1.2-cp310-abi3-macosx_11_0_arm64.whl |
Total release size: 2.0 MB
Release files / mofchecker_next-0.1.2.tar.gz
| Download URL | mofchecker_next-0.1.2.tar.gz |
|---|---|
| Size | 54.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7335255f803ff0a41d9f297ca426fa64a20be360cfc590f2317e6f7d21deb1df
|
|
BLAKE2b-256 checksum How to use checksums |
8f8128909479a6d9ea2d1775d9c214e10139fc7a57532e44609af22be0fe4de6
|
| 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 19, 2026.
Transparency logRelease files / mofchecker_next-0.1.2-cp310-abi3-win_amd64.whl
| Download URL | mofchecker_next-0.1.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 384.1 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d65cd0b21943c32f4ff41c90dd06e2eb90dd9c62ebaca5b959ba366b698fbf6e
|
|
BLAKE2b-256 checksum How to use checksums |
8881295dd6094974219e262085c26a137840cbd544a88362ea3c54240b80c75f
|
| 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 19, 2026.
Transparency logRelease files / mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 548.2 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f8afa467720b4c9dc7f9a61a2db9846bc5aac0c62dc757bc4a09a909856833c9
|
|
BLAKE2b-256 checksum How to use checksums |
042b4eb2daa0ad8a380d9b69bc6bd84f04f2b094a2f3af55920e4ecfe5993ece
|
| 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 19, 2026.
Transparency logRelease files / mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | mofchecker_next-0.1.2-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 529.9 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3152659c57904a30fb271e37db2e1b5fccf9cbec05cef94a93a52970521c8a19
|
|
BLAKE2b-256 checksum How to use checksums |
a25c01b55404bf0e0401b5cd9e18ce166479b3847a4a0126425c4f9b87ef310d
|
| 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 19, 2026.
Transparency logRelease files / mofchecker_next-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | mofchecker_next-0.1.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 475.7 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0f04cac337a538b8353e9e8641836a5a72dac1bd6cda9920ecdd32b65fdd52f7
|
|
BLAKE2b-256 checksum How to use checksums |
4d56c822985047972bdb12301287c24d98aaa0557c56ea0aecd92f73303df08e
|
| 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 19, 2026.
Transparency logSecurity for mofchecker-next 0.1.2
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.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for mofchecker_next-0.1.2.tar.gz
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 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.