Skip to main content

MolCrysKit: Molecular Crystal Toolkit

License: MIT Python Version PyPI unit-tests

Overview

MolCrysKit is a Python toolkit designed for handling molecular crystals, providing utilities for parsing crystallographic data, identifying molecules within crystals, and performing various analyses on molecular crystals using graph theory and the Atomic Simulation Environment (ASE).

Key Features

  • Robust Molecule Identification: Identify individual molecules within a crystal structure using graph-based algorithms
  • Disorder Handling: Process disordered structures with graph algorithms
  • Topological Surface Generation: Create surface slabs while preserving molecular topology
  • Hydrogen Completion: Add hydrogen atoms with heuristic geometric placement rules
  • Cluster Carving: Disorder resolution → desolvation → coordination-shell cluster extraction
  • Nanocluster Carving: Build arbitrary finite shapes while preserving complete molecular or unit-cell topology
  • LLM-based AI agent Friendliness: Try on https://matmaster.bohrium.com/matmaster or build your own skill for your agent
  • Bundled Agent Skills: use mck skills list, show, and tree for read-only progressive access to shipped workflows


Molecule Identification


Disorder Handling


Topological Surface Generation


Hydrogen Completion


Cluster Carving


Shape Operations

Installation

pip install "molcrys-kit[desktop]"

pip install molcrys-kit installs the core profile: NumPy, NetworkX, and Click. That profile reads CIF structures, resolves special-position disorder, and exports CIF and plain molecular XYZ without SciPy, ASE, pymatgen, or spglib. The [desktop] extra adds SciPy, ASE, pymatgen, spglib, and defusedxml. It is the install to use for the rest of the toolkit, including POSCAR and ExtXYZ export and Mercury .mryx import.

Pymatgen users who want the namespace import path (from pymatgen.analysis.molcrys import ...) can also install the thin addon package pymatgen-analysis-molcrys (see addons/pymatgen-analysis-molcrys/).

From source (development)

git clone https://github.com/SchrodingersCattt/MolCrysKit.git
cd MolCrysKit
pip install -e ".[dev]"
# optional pymatgen namespace addon
pip install -e addons/pymatgen-analysis-molcrys

All dependencies are declared in pyproject.toml (there is no separate requirements.txt). requires-python = ">=3.10". The available extras are:

Extra Adds
[desktop] scipy, ase, pymatgen, spglib, defusedxml
[test] pytest, pytest-cov
[vis] nglview, py3Dmol for 3-D visualisation in notebooks
[dev] [test] + [vis] + [desktop] + build, ruff==0.15.14, pre-commit, nbstripout, twine

A contributor environment is pip install -e ".[dev]". The full test environment is pip install -e ".[test,desktop]". The core package, with no extra, is the lightweight profile.

Optional separate formatting commit

In an activated [dev] environment, run pre-commit install --hook-type pre-commit and python scripts/install_style_hook.py from the repository root. The first command installs the existing lint and file checks. The second installs an optional Git post-commit hook (and refuses to overwrite an existing one). After a commit, this hook runs Ruff format on Python files in that commit. If formatting changes them, it creates a separate style: format Python from previous commit commit. It skips formatting when tracked files have uncommitted changes, so it never incorporates unrelated work. Git worktrees of the same clone share the hooks directory; install this hook only if you want it available to that clone's worktrees. The usual Ruff format hook remains available manually with pre-commit run ruff-format --hook-stage manual --all-files.

Ruff formats whitespace and layout, but it does not rewrite dense logic into more readable steps. The follow-up commit only happens when formatting actually changes a file; a commit that is already formatted gets no extra commit.

Quick Start

Here's a simple example of how to use MolCrysKit:

import molcrys_kit as mck
from ase import Atoms

# 1. Create a toy system (e.g., 2 Water molecules in a unit cell)
# In practice, you would typically load this from a file: atoms = read('cif_file.cif')
atoms = Atoms(
    symbols=['O', 'H', 'H', 'O', 'H', 'H'],
    positions=[
        [1.0, 1.0, 1.0], [1.8, 1.0, 1.0], [0.7, 1.6, 1.0],  # Molecule 1
        [5.0, 5.0, 5.0], [5.8, 5.0, 5.0], [4.7, 5.6, 5.0]   # Molecule 2
    ],
    cell=[10.0, 10.0, 10.0],
    pbc=True
)

# 2. Initialize MolecularCrystal (Automatically identifies molecules via graph logic)
crystal = mck.MolecularCrystal.from_ase(atoms)

# 3. Access Crystal & Molecular Properties
print(f"Lattice Parameters: {crystal.get_lattice_parameters()}")
print(f"Identified Molecules: {len(crystal.molecules)}") 

mol = crystal.molecules[0]
print(f"Molecule 1 Formula: {mol.get_chemical_formula()}")
print(f"Molecule 1 Center of Mass: {mol.get_center_of_mass()}")

Citation

If you use MolCrysKit in academic work, please cite:

Guo, M.-Y.; Zhang, W.-X. MolCrysKit: A Topology-Aware Toolkit for Bridging Experimental Molecular-Crystal Structures and Simulation-Ready Modeling. J. Chem. Inf. Model. 2026, 66 (9), 4999-5007. https://doi.org/10.1021/acs.jcim.6c00168

For exact reproduction of the published JCIM results, use the archived v0.1.0 release together with the versioned container image and the material under paper/. The main branch may continue to evolve after publication.

Docker / Cloud

See Docker Guide for local Docker, Bohrium cloud deployment, and GHCR image publication.

Command Line Interface

Installing MolCrysKit also installs the mck command. The CLI is self-documenting; use --help at any level to see the exact arguments for your installed version:

mck --help
mck io --help
mck operate --help
mck analyze --help
mck operate cluster --help
mck operate nanocluster --help
mck operate void --help
mck build chain --help
mck validate-periodic-bundle --help
mck skills --help
mck skills list --json

The command groups roughly mirror the Python package layout:

  • mck io ... — inspect molecular-crystal contents, extract molecules, and convert structures (info, molecules, extract-molecule, convert).
  • mck operate ... — generate modified structures (disorder, disorder-supercell, add-h, slab, cluster, nanocluster, void, supercell, vacancy, desolvate, interpolate, reorient).
  • mck analyze ... — print analysis reports (summary, bfdh, interactions, bond-orders, polyhedra, polyhedron-network, net-topology, sanity-check).
  • mck build chain ... — construct a geometry-native periodic chain bundle.
  • mck validate-periodic-bundle ... — validate a periodic bundle and its sidecar.

Documentation

You are… Start here
Using the library API & Capabilities · Tutorials · Periodic chains · Periodic quotient graphs · Periodic net topology
AI agent (using the library) API & Capabilities — read "Capability Map" then "Module Index"
AI agent (modifying code) AGENTS.md · Architecture
Docker / cloud Docker Guide

molcrys_kit/ — source code · scripts/ — diagnostic utilities · examples/ — CIF structure files

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for molcrys-kit 0.9.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 molcrys-kit 0.9.1
File Size Uploaded Provenance Actions
molcrys_kit-0.9.1.tar.gz 9.0 MB With provenance Details for molcrys_kit-0.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for molcrys-kit 0.9.1
File Interpreter ABI Platform Actions
molcrys_kit-0.9.1-py3-none-any.whl Python 3 none any Details for molcrys_kit-0.9.1-py3-none-any.whl

Total release size: 11.5 MB

Release files / molcrys_kit-0.9.1.tar.gz

Download URL molcrys_kit-0.9.1.tar.gz
Size 9.0 MB
Tags Source
SHA-256 checksum
How to use checksums
27ccf0123b5a30602302b215e0d5e9aaa5d71ab8afd08eaf5577a252fabc8d87
BLAKE2b-256 checksum
How to use checksums
028060d13dd4cc6eea7e0c31f0c73d8dc6dcd00f6d8dad3ceea3aec6cfe47c00
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 Nov 24, 2026.

Transparency log

Release files / molcrys_kit-0.9.1-py3-none-any.whl

Download URL molcrys_kit-0.9.1-py3-none-any.whl
Size 2.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
82ae542e724a3e57d756589e49ca5ea51dbaf26453375f04982758edfb8da298
BLAKE2b-256 checksum
How to use checksums
1fe7037b8e037d7f8a1ad080c2b0ca62bc9a2198786d68ffc2b4c42ca32cc945
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 Nov 24, 2026.

Transparency log

Security for molcrys-kit 0.9.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for molcrys_kit-0.9.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 Nov 24, 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