Skip to main content

mmcif

Correctness-first mmCIF, BinaryCIF and PDB structure IO with typed numbering, for Rust and Python.

Every residue in an mmCIF file has two addresses: the author numbering people read off papers and viewers, and the label numbering the file defines. They often disagree, and tools that keep only one put constraints and selections on the wrong residue without saying so. This project keeps both as separate types and converts between them only when you ask.

Example

Heavy chain H of antibody 12e8 numbers its CDR residues with insertion codes. Author residue H 100A is label residue B 105: the chain, the number and the insertion code all differ.

curl -O https://files.rcsb.org/download/12e8.cif
import mmcif_io

structure = mmcif_io.read("12e8.cif")
print(structure.to_label("H", 100, "A"))  # ('B', 105)
use mmcif_model::{AuthResidueKey, AuthSeqId, InsCode};

let structure = mmcif_model::read("12e8.cif")?;
let key = AuthResidueKey { chain: "H".into(), seq: AuthSeqId::new(100), ins_code: InsCode::new('A') };
assert_eq!(structure.numbering().to_label(&key)?.to_string(), "B/105");

Install

pip install mmcif-io
cargo add mmcif-model
cargo install mmcif-cli

mmcif-io is the Python package, imported as mmcif_io. mmcif-model is the Rust entry point. mmcif-cli installs the mmcif command. The Rust crates and the Python package share one version number and release together.

How it differs

mmcif gemmi 0.7.5 pdbtbx 0.12.0
Reads BinaryCIF Yes No No
Label and author numbering Separate types, explicit conversion Both stored on each residue Author only, label used when author is missing
Biological assemblies Expanded, including composite operator expressions Expanded, but skips assemblies with unrecognised details and expands only the first group of a composite expression Not expanded
Languages Rust, Python C++, Python Rust

Checked on 21 October 2026 against gemmi 0.7.5 and pdbtbx 0.12.0. gemmi is the broader toolkit. This project competes on numbering, BinaryCIF and assembly correctness, not on breadth.

Correctness

Every push to main and every pull request runs the same entries through this project and gemmi, comparing atom counts, coordinates, occupancies, B-factors, residue keys, label numbering, entities and expanded assemblies. Any difference without a written explanation fails the build.

The corpus covers insertion codes, alternate conformations, microheterogeneity, numbering divergence, assembly operators, branched entities, multi-character chain ids and multiple models, plus a baseline set: 44 entries today. All 44 agree with gemmi except in assembly expansion on two entries, where 4,872 differences are each explained by a rule in harness/explained.toml. To reproduce:

pip install -r harness/requirements.txt
python corpus/fetch.py
python harness/run.py

For every corpus entry, writing a parsed document and parsing it again gives the same document. The CIF tokenizer, the BinaryCIF decoder, the PDB reader and structure building are fuzzed in CI.

Design specifications

mmcif check reads a BoltzGen design specification and resolves every residue reference against the structure it names. BoltzGen addresses chains by label id, so writing the author id is an easy mistake. In 12e8, label chain H is a water chain:

error[no-polymer-residues]: chain H in 12e8.cif has no polymer residues
 --> binder.yaml:6:17
  |
6 |             id: H
  |                 ^ it holds HOH
  = help: author chain H is label chain B; polymer chains in the file: A, B, C, D

Where an index in a specification selects a different residue under author numbering, it warns and names the author residue the index selects. It also checks that every sampled length is satisfiable and that bonds and distances are geometrically possible against the coordinates in the file.

mmcif lower spec.yaml --to boltzgen and mmcif lower spec.yaml --to rfd3 write a checked specification out for BoltzGen or RFdiffusion3. Where a backend cannot express part of a specification, such as a disulfide bond for RFdiffusion3, lowering refuses and points at the line instead of dropping it. These types and formats may change before 1.0.

Crates

Crate
mmcif-model Typed structure model: hierarchy, numbering, altlocs, entities, assemblies. Start here.
mmcif-cif Lossless CIF tokenizer, table layer and BinaryCIF decoder
mmcif-ccd Compiled, versioned index of the Chemical Component Dictionary
mmcif-geom Neighbour grid queries over atomic coordinates
mmcif-io Python bindings for all of the above
mmcif-cli The mmcif command
mmcif-ir Design specification model: slots, determinacy, constraints
mmcif-spec Design specification parser and checker
mmcif-lower Lowering to BoltzGen and RFdiffusion3

License

MIT or Apache-2.0, at your option.

Metadata

Release files for mmcif-io 0.2.1

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

Source distribution (sdist)

Source distribution for mmcif-io 0.2.1
File Size Uploaded Provenance
mmcif_io-0.2.1.tar.gz 215.7 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for mmcif-io 0.2.1
File
mmcif_io-0.2.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
mmcif_io-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
mmcif_io-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
mmcif_io-0.2.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Total release size: 8.9 MB

Release files / mmcif_io-0.2.1.tar.gz

Download URL mmcif_io-0.2.1.tar.gz
Size 215.7 kB
Tags Source
SHA-256 checksum
How to use checksums
47dc569d4515222a6fee7dfe3088d3456b38e5ab8e9e4e90deab50ac9735dedc
BLAKE2b-256 checksum
How to use checksums
f4ce6954b0abf02238cfba139cca26bab0c12d40d8b275a101316805d688906f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / mmcif_io-0.2.1-cp310-abi3-win_amd64.whl

Download URL mmcif_io-0.2.1-cp310-abi3-win_amd64.whl
Size 540.0 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d51d0dfd14d25abca534944171e4ca56e5f62ec577ad93770e5bb14e64deca2d
BLAKE2b-256 checksum
How to use checksums
30720d897a9b28e5dfa95a8ddd7eaf8fd5f498c198266cd2908a389a95161017
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / mmcif_io-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL mmcif_io-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9d4e465cd640d11db62e1d3d26547a4a65aa5ba3c32f1dea9e186f08df28ca71
BLAKE2b-256 checksum
How to use checksums
7d703c42b507655a4baa145fbfafd44d74ba22e9e97f30b27c928bbd2a2377aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / mmcif_io-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL mmcif_io-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.4 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
188246627cbb3e94fe0a23dade75a1468094c657cc289d76da77e621a157daa3
BLAKE2b-256 checksum
How to use checksums
c39038d5a9e5592c0edf3c2d599452b4c1911dddeedafce5762be381b50f4969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / mmcif_io-0.2.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL mmcif_io-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
Size 686.9 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
eeda9e615e9d36eb62502bd0bac35d974e211fb875f7ab1c55df9c3a964bc2bb
BLAKE2b-256 checksum
How to use checksums
55b0d65a337cb0f88d6ce591e3f7454b51787c676f39129d6c20613d920c9652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Security for mmcif-io 0.2.1

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.

Select from 5 files

Attestation for mmcif_io-0.2.1.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 Oct 22, 2026.

Transparency log

A 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.

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