This release is a pre-release and may not be stable for production use.
molpy
A programmable toolkit for molecular simulation workflows
MolPy is a Python toolkit for the full molecular-system workflow — parsing, building, editing, typing, analyzing, packing, and reading/writing simulation formats.
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 (atoms, bonds, angles, dihedrals), Frame/Block columnar arrays, ForceField, Box |
parser |
Grammar-based parsing — SMILES, SMARTS, BigSMILES, G-BigSMILES, CGSmiles |
builder |
System assembly — linear / branched / cyclic polymers, polydispersity sampling (Schulz-Zimm, Poisson, Flory-Schulz), residue management |
embed |
3D coordinate generation for parsed or built topologies |
op · reacter |
Structure editing — geometric transforms; template-based reactions with leaving-group selectors and LAMMPS fix bond/react templates |
typifier |
Atom typing — OPLS-AA, GAFF / GAFF2, custom SMARTS / SMIRKS typifiers |
potential · optimize |
Energy & force potentials with L-BFGS minimization |
compute |
Analysis — RDF, MSD, clustering, shape & gyration, dielectric, neighbor lists, custom operators |
pack |
Packmol-based packing with density targets |
io |
Read and write — PDB, GRO, LAMMPS data, XYZ, JSON, HDF5, force fields, and trajectories |
engine |
MD input generation & run management — LAMMPS, CP2K |
wrapper · adapter |
External CLIs (Antechamber, Prepgen) and library bridges (RDKit, OpenBabel) |
Install
pip install molcrafts-molpy
Core dependencies: NumPy, python-igraph, Lark, Pint, and molrs (the Rust numerical core). Optional: RDKit (3D geometry), AmberTools (GAFF charges).
Nightly builds. Bleeding-edge snapshots are published to the separate project
molcrafts-molpy-nightly(versionedX.Y.Z.devN) on every push to thenightlybranch. Install withpip install --pre molcrafts-molpy-nightly. It imports asmolpy, so it cannot be installed alongside the stablemolcrafts-molpy(same astensorflowvstf-nightly).
Install from source (development)
git clone https://github.com/MolCrafts/molpy.git
cd molpy
pip install -e ".[dev]"
pre-commit install
pytest tests/ -m "not external"
pip install -e ".[dev]" pulls the published molcrafts-molrs wheel from
PyPI. To develop molpy against a local molrs checkout (e.g. when changing
the Rust core), build molrs editable first — molrs ships its Python bindings as
a maturin project that needs the Rust toolchain via
rustup:
git clone https://github.com/MolCrafts/molrs.git
cd molrs
pip install maturin
maturin develop -m molrs-python/Cargo.toml --release # installs `molrs` editable
cd ../molpy
pip install -e ".[dev]" # resolves molrs from the local build
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.parser.parse_molecule("CCO") # ethanol from SMILES
ff = mp.io.read_xml_forcefield("oplsaa.xml") # bundled OPLS-AA
typed = mp.typifier.OplsAtomisticTypifier(ff).typify(mol)
mp.io.write_lammps_system("output/", typed.to_frame(), ff)
# → output/system.data output/system.in
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: molpy.molcrafts.org
- Getting Started — install and first example
- Example Gallery — short copy-paste workflows
- Guides — task-oriented notebooks
- Concepts — data model deep dives
- API Reference — full API
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.
MolPy ports or adapts code, algorithms, and data from other projects (freud, foyer, OpenMM, moltemplate, RDKit, and others). All third-party attributions and their license terms are consolidated in Third-Party Attributions.
Metadata
Release files for molcrafts-molpy-nightly 0.7.0.dev202607080245
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| molcrafts_molpy_nightly-0.7.0.dev202607080245.tar.gz | 465.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| molcrafts_molpy_nightly-0.7.0.dev202607080245-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.0 MB
Release files / molcrafts_molpy_nightly-0.7.0.dev202607080245.tar.gz
| Download URL | molcrafts_molpy_nightly-0.7.0.dev202607080245.tar.gz |
|---|---|
| Size | 465.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4bf4b77a79a69dd3d286a079584d56c3e49c18e92d8d24d1efcf8e7bbdd9656a
|
|
BLAKE2b-256 checksum How to use checksums |
b7428b94f9e034045f1a436a118b93791a11f8c84fae40dce0268b39ae784d36
|
| 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 Jul 8, 2026.
Transparency logRelease files / molcrafts_molpy_nightly-0.7.0.dev202607080245-py3-none-any.whl
| Download URL | molcrafts_molpy_nightly-0.7.0.dev202607080245-py3-none-any.whl |
|---|---|
| Size | 557.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4b8285d6ea51f9416c534adc7f1cc90eab047df30f32be1589756cc703455e5
|
|
BLAKE2b-256 checksum How to use checksums |
311beafa2bb9c7e46ddd89fd205761dc7e4d2b057aedea0caa0e586a039fbf47
|
| 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 Jul 8, 2026.
Transparency logSecurity for molcrafts-molpy-nightly 0.7.0.dev202607080245
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.
Attestation for molcrafts_molpy_nightly-0.7.0.dev202607080245.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 Jul 8, 2026.
Transparency logA 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.