MoleculeKit#

A Python library for reading, writing, and manipulating biomolecular structures and trajectories. Built around the Molecule class for proteins, nucleic acids, and MD systems, with a full system-preparation pipeline (systemPrepare()) that handles protonation at a chosen pH, non-standard residues, custom residues from SMILES, mutation, and gap modeling.

🎓 Tutorials

Step-by-step lessons. Start here if you’re new.

Tutorials
🛠 How-to guides

Task-focused recipes. “How do I X?”

How-to guides
📖 Reference

Full API documentation, generated from source.

API reference
💡 Explanation

Concepts and mental models.

Explanation

Installation#

pip install moleculekit

See Installation for conda, uv, and the full setup.

Quick start#

from moleculekit.molecule import Molecule
from moleculekit.tools.preparation import systemPrepare

mol = Molecule("3PTB")   # fetches trypsin from RCSB

# Template the benzamidine ligand (BEN) from its RCSB SMILES so the
# preparation pipeline gets correct bond orders, formal charges, and
# hydrogens for the non-canonical residue.
mol.templateResidueFromSmiles(
    mol.resname == "BEN",
    smiles="NC(=N)c1ccccc1",
    addHs=True,
)

# Add hydrogens to the whole system, predict pKa values, and titrate
# at the chosen pH.
prepared, specs = systemPrepare(mol, pH=7.4)

# Open the prepared structure in the built-in browser viewer.
prepared.view(viewer="molstar")

Citing#

Stefan Doerr, Matthew J. Harvey, Frank Noé, and Gianni De Fabritiis. HTMD: High-throughput molecular dynamics for molecular discovery. J. Chem. Theory Comput. 2016, 12 (4), 1845–1852. doi:10.1021/acs.jctc.6b00049