Skip to main content

 molpy

A programmable toolkit for molecular simulation workflows

CI PyPI Python License Ruff

Documentation  ·  Quick start  ·  Examples  ·  Ecosystem

MolPy is a Python toolkit for the full molecular-system workflow — parsing, building, editing, typing, analyzing, and reading/writing simulation formats. Packing a box is the job of the companion package molpack.

Under active development. Public APIs may change between minor releases.

Vision

Molecular modeling is fragmented. Every simulation code has its own file formats and conventions; every task — parsing, building, typing, analysis, visualization — lives in a separate library; and moving a system between them means writing throwaway glue.

molpy aims to be the common foundation beneath that workflow: one explicit, programmable representation of a molecular system that every stage can share. Parse a structure into it, build on it, type and analyze it — then hand the same object onward, with no conversion step in between.

That representation is meant to be built on, not just used. It is the data model the MolCrafts ecosystem extends — visualization, experiment management, agent access — and it reads the same whether a human writes it or an agent calls it.

Capabilities

Each row is one src/molpy/ module — parse or build a structure, edit and type it, analyze or minimize it, then read and write it across formats.

Module Capability
core Explicit data model — editable Atomistic topology graph, Frame/Block columnar arrays, ForceField, Box
parser SMILES / SMARTS (SmilesIR, SmartsPattern); moltemplate .lt reader
builder System assembly — polymers, crosslinking, polydispersity, virtual sites, AmberTools facade
conformer 3D coordinate generation (native ETKDG + MMFF cleanup)
typifier Atom typing — OPLS-AA, CL&P, MMFF, GAFF via AmberTools
potential · optimize Energy & force potentials with L-BFGS minimization
compute Analysis modules under molpy.compute — rdf/msd/dielectric/spectra/order/voronoi/… (native kernels)
io Read/write — PDB, GRO, LAMMPS data, XYZ, force fields, trajectories, …
engine MD input generation & run management — LAMMPS, CP2K, OpenMM
wrapper · adapter External CLIs (Antechamber, tleap, …) and optional RDKit in-memory bridge

Install

pip install molcrafts-molpy

# Browser (Pyodide) — needs molcrafts-molrs Pyodide wheel on PyPI:
# await micropip.install("molcrafts-molrs")
# await micropip.install("molcrafts-molpy")

Core dependencies: NumPy and molrs (molcrafts-molrs>=0.14.0,<0.15) plus the MolCrafts logging/config packages. Optional: RDKit (adapter example), AmberTools (GAFF charges).

Nightly builds. Bleeding-edge snapshots are published to the separate project molcrafts-molpy-nightly (versioned X.Y.Z.devN) on every push to the nightly branch. Install with pip install --pre molcrafts-molpy-nightly. It imports as molpy, so it cannot be installed alongside the stable molcrafts-molpy (same as tensorflow vs tf-nightly).

Install from source (development)
git clone https://github.com/MolCrafts/molpy.git
cd molpy
uv sync --extra dev
pre-commit install --hook-type pre-commit --hook-type pre-push
# the two gates (same as the hooks / CI):
uv run --no-project --with 'tox>=4.23' --with ruff==0.16.1 --with ty==0.0.65 tox -e lint
uv run --extra dev python -m pytest tests/ -n auto

[tool.uv.sources] points molcrafts-molrs at the sibling checkout ../molrs/molrs-python, so uv sync builds the Rust core with your toolchain (rustup). After editing molrs, rebuild what uv installed:

uv sync --extra dev --reinstall-package molcrafts-molrs

See docs/developer/development-setup for the full workflow.

Quick start

Parse a SMILES string, assign OPLS-AA types, and write LAMMPS input files:

import molpy as mp

mol       = mp.SmilesIR("CCO").to_atomistic()     # ethanol from SMILES
mol3d, _  = mp.Conformer(seed=42).generate(mol)   # 3D coordinates

typifier  = mp.typifier.OPLSAATypifier(           # bundled OPLS-AA
    mp.data.get_forcefield_path("oplsaa.xml")
)
typed     = typifier.typify(mol3d)

mp.io.write_lammps_system("output/", typed.to_frame(), typifier.forcefield())
# → output/system.data  output/system.ff

More workflows — packed solvent boxes, virtual-site models, polymer chains and networks (the stress test for MolPy's editing machinery), AmberTools parameterization — are in the Example Gallery and the task-oriented Guides.

Documentation

Full documentation, including executable notebooks: docs.molcrafts.org/molpy

MolCrafts ecosystem

Project Role
molpy Python toolkit — the shared molecular data model & workflow layer — this repo
molrs Rust core — molecular data structures & compute kernels (native + WASM)
molpack Packmol-grade molecular packing (Rust + Python)
molvis WebGL molecular visualization & editing
molexp Workflow & experiment-management platform
molnex Molecular machine-learning framework
molq Unified job queue — local / SLURM / PBS / LSF
molcfg Layered configuration library
mollog Structured logging, stdlib-compatible
molhub Molecular dataset hub
molmcp MCP server for the ecosystem
molrec Atomistic record specification

Contributing

Issues and pull requests are welcome — see Contributing.

License

BSD-3-Clause — see LICENSE.


Crafted with 💚 by MolCrafts

Metadata

Release files for molcrafts-molpy 0.14.0

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

Source distribution (sdist)

Source distribution for molcrafts-molpy 0.14.0
File Size Uploaded Provenance
molcrafts_molpy-0.14.0.tar.gz 296.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for molcrafts-molpy 0.14.0
File Interpreter ABI Platform
molcrafts_molpy-0.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 659.6 kB

Release files / molcrafts_molpy-0.14.0.tar.gz

Download URL molcrafts_molpy-0.14.0.tar.gz
Size 296.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b8c7011fb45a914d309ed9fc344adf78d75359ef5749b7a4f23682a27545f0f9
BLAKE2b-256 checksum
How to use checksums
c362a5e9458dd95e18f9c1da99d0763a455ca2727d7fce32609c1b762bf40df7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Release files / molcrafts_molpy-0.14.0-py3-none-any.whl

Download URL molcrafts_molpy-0.14.0-py3-none-any.whl
Size 363.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a860f660d8b0fa07c85118c47ba2893e0383f261a1b01a539534d55f7a86e4a
BLAKE2b-256 checksum
How to use checksums
72ccc5d8c272cb6af19d5833dfbceb7f5f43f2574e8193d96f9375b6c0351d3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Security for molcrafts-molpy 0.14.0

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for molcrafts_molpy-0.14.0.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 Sep 20, 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.

Release history Release notifications | RSS feed

This release

0.14.0 This release

2 release files Full provenance

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