Skip to content
MolCraftsPublic

About

A fast, clean, and composable toolkit for molecular modeling

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

50 stars

Watchers

1 watching

Forks

 molpy

A multi-language toolkit for molecular systems

CI PyPI crates.io Python License

molpy  ·  molrs  ·  rustdoc  ·  Python API

This repository is molpy. The core is Rust, published as the crate molcrafts-molrs and imported as molrs. Python, WebAssembly, C and C++ each bind that core, and none of them reimplements it. NumPy is written in C and is still NumPy. molpy is written in Rust and is still molpy.

The manual opens on molpy. The next page is molrs, the core. Rust's reference is rustdoc. Python's reference is generated from the docstrings. WebAssembly, C and C++ are documented by wasm-bindgen, cbindgen and the CXX bridge.

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

Layout

Path What it is Published as
crates/molrs/ the core, crate molcrafts-molrs, library molrs crates.io molcrafts-molrs
crates/molrs-ffi/ handles and capsules, the only ABI —
molpy/ Python binding, import molpy as mp, native module molpy._core PyPI molcrafts-molpy
molwasm/ WebAssembly binding npm @molcrafts/molwasm
molc/ C API, header molc.h, symbols molc_* GitHub release archive
molcxx/ C++ bridge (FrameView, zero-copy) built from source
docs/ the manual. The first page is molpy; it continues in molrs docs.molcrafts.org/molpy

There is no Python package named molrs. Lengths in a Frame are ångströms. The version of every binding is [workspace.package].version in the root Cargo.toml.

Packing a box is molpack, a separate crate that depends on molrs.

Install

Language Install Use
Python pip install molcrafts-molpy import molpy as mp
Python in the browser await micropip.install("molcrafts-molpy") import molpy as mp
Rust cargo add molcrafts-molrs use molrs::…
JavaScript npm install @molcrafts/molwasm the wasm-bindgen API
C molc-*.tar.gz from releases #include "molc.h"
C++ build molcxx/ the CXX bridge

core, perceive, op and optimize are always compiled. Name the Cargo features you need, or full while exploring. full does not include stream, and *.mrec paths need filesystem.

molrs = { package = "molcrafts-molrs", version = "0.20", features = ["io", "smiles"] }

The Python wheel carries the native core as molpy._core. AmberTools is optional, and only for the programs molpy still shells out to.

Build from source

rust-toolchain.toml pins the toolchain.

git clone https://github.com/MolCrafts/molpy.git
cd molpy
uvx pre-commit install
uv --directory molpy sync --extra dev
scripts/check.sh verify

Each binding is its own Cargo workspace. Build it with cargo build --manifest-path <dir>/Cargo.toml. The core uses the cargo mrs-* aliases in .cargo/config.toml. All of them share <repo>/target.

The same molecule

import molpy as mp

mol = mp.io.smiles.read_smiles("CCO").to_atomistic()
use molrs::io::smiles::SmilesIr;

let mol = SmilesIr::parse("CCO")?.to_atomistic()?;

The Rust door needs the smiles feature. The chapters after molrs in the manual walk the same model from Python: the tutorials, the guides and the compute section.

MolCrafts

Project Role
molpy this repository
molpack molecular packing
molvis visualization
molexp experiment management
molnex molecular machine learning
molq job queue
molcfg configuration
mollog logging
molhub dataset hub
molmcp MCP server
molrec record specification

Contributing

See Contributing.

License

BSD-3-Clause. See LICENSE.

About

A fast, clean, and composable toolkit for molecular modeling

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

50 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages