Skip to main content

mckit — MatCraft Toolkit

A modular Python framework for building and analyzing atomic structures. Backed by ASE and pymatgen for materials modelling.

Features

  • Operations — modelling materials
  • Observations — inspect structures and run sanity checks

1. Usage

Installation

You can simply use:

pip install matcraft-kit

For development, clone the repository and install in editable mode:

pip install -e ".[dev]"

CLI

# for observations:
mckit observe -h
# for operations:
mckit operate -h

2. Development

Click to expand development instructions

Prerequisites

  • Python ≥ 3.9
  • pip

Setup

# Clone the repository
git clone <repo-url>
cd matcraft-kit

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate        # Linux/macOS
# .venv\Scripts\activate         # Windows

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

Project Structure

mckit/
├── __init__.py              # Package root — exports public API
├── core/
│   ├── lattice.py           # Lattice dataclass (3×3 matrix, ASE Cell-backed)
│   └── tool.py              # Abstract base classes: Operation, Observation
├── operate/
│   ├── bulk.py              # BulkBuilder — standard crystal structures
│   └── surface.py           # SurfaceBuilder, TerminationAnalyzer, MoleculeDetector
├── observe/
│   ├── inspect.py              # StructureInspect — structural summary
│   └── fundamental.py       # FundamentalCheck — geometric validity checks
└── io/
    ├── reader.py            # read_structure() -> ASE Atoms
    └── writer.py            # write_structure() — ASE io.write

Architecture

The framework follows an Operation / Observation pattern:

  • Operation (abstract) — tools that build or modify structures. Subclasses implement apply(...) and return ase.Atoms.
  • Observation (abstract) — tools that inspect structures without modifying them. Subclasses implement observe(structure) → Any.

Both are single-method ABCs defined in mckit.core.tool, making it straightforward to add new operations or observations.

Core data flow:

File (CIF, VASP, ...) ──read_structure()──▶ ase.Atoms ──Operation──▶ ase.Atoms ──write_structure()──▶ File
                                                │
                                                └──Observation──▶ dict / CheckResult / ...

Running Tests

pytest

With coverage:

pytest --cov=mckit --cov-report=term-missing

Adding a New Operation

Create a file under mckit/operate/ and subclass Operation:

from ase import Atoms
from mckit.core.tool import Operation

class MyBuilder(Operation):
    """Build or modify a structure."""

    def apply(self, *, some_param: float, **kwargs) -> Atoms:
        # ... your logic here ...
        return new_structure

Then re-export it from mckit/operate/__init__.py.

Adding a New Observation

Create a file under mckit/observe/ and subclass Observation:

from ase import Atoms
from mckit.core.tool import Observation

class MyAnalysis(Observation):
    """Inspect a structure and return results."""

    def observe(self, structure: Atoms, **kwargs):
        # ... your logic here ...
        return result_dict

Then re-export it from mckit/observe/__init__.py.

Dependencies

Package Purpose
numpy ≥ 1.21 Numerical computing
ase ≥ 3.22 Atomic Simulation Environment — crystal builders, I/O, coordinate transforms
pymatgen ≥ 2022.0.0 Python Materials Genomics — CIF parsing, symmetry analysis

Metadata

Release files for matcraft-kit 0.1.5

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

Source distribution (sdist)

Source distribution for matcraft-kit 0.1.5
File Size Uploaded
matcraft_kit-0.1.5.tar.gz 86.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matcraft-kit 0.1.5
File Interpreter ABI Platform
matcraft_kit-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 177.6 kB

Release files / matcraft_kit-0.1.5.tar.gz

Download URL matcraft_kit-0.1.5.tar.gz
Size 86.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0bce64a986aa3767518e06de7e50235dae8808c3ea9646075c5e0311d6069a6e
BLAKE2b-256 checksum
How to use checksums
03c74db94007990ec0f8b049868504359fd27208ec315e8b061157659687f2fe
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 10, 2026.

Transparency log

Release files / matcraft_kit-0.1.5-py3-none-any.whl

Download URL matcraft_kit-0.1.5-py3-none-any.whl
Size 91.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cdbfaebd3d59034a546edc0a449773df8ba41e430b74903018290ababd70ac6
BLAKE2b-256 checksum
How to use checksums
d5de7f31decb48bd488f39ce300c01652e61c97298b44021f4c36adbbe9d4cea
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 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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