Install¶
molpack ships three surfaces — the CLI binary, the Rust crate, and the
Python binding. Pick the one that matches your workflow; they share the same
engine and packing model.
CLI¶
For Packmol-style .inp scripts:
Path resolution
In file-arg mode (molpack job.inp), relative paths inside the script are
resolved against the script directory. In stdin mode they resolve
against the current working directory.
Rust crate¶
For programmatic use from Rust:
Optional features (crate defaults to none enabled):
| Feature | Purpose |
|---|---|
cli |
molpack binary + clap (implies io) |
io |
Template reading / output writing through the molrs reader and writer of each file's format (script::StructureFormat), and XyzTrajectoryCallback |
rayon |
Parallel objective evaluation |
A force-field optimizer bound through with_optimizer (e.g. molrs's Lbfgs)
needs molrs's ff feature; enable it on your own molcrafts-molrs dependency.
# Cargo.toml — common combinations
molcrafts-molpack = { version = "0.8", features = ["io", "rayon"] }
Python binding¶
For notebooks and pipelines (Python 3.12+):
molcrafts-molpy is installed as a dependency and provides mp.Frame plus
PDB / XYZ readers (import molpy as mp). The wheel itself is I/O-free — pass
frames in, get frames out.
Pre-built wheels
Wheels are published for CPython 3.12 and 3.13 on Linux (manylinux x86-64) and macOS (universal2). Other platforms fall back to the sdist and need a Rust toolchain to build.
Build from source¶
When you are modifying the crate or Python binding, clone
molpy into a sibling directory named
molpy. Path dependencies resolve ../molpy/crates/molrs and
../molpy/crates/molrs-ffi. molpack 0.8 builds on the molrs 0.20 line:
the release tag v0.20.0. Both wheels must share that minor line;
import molpack raises ImportError when they do not.
# sibling layout
# workspace/
# ├── molpy/ ← git clone https://github.com/MolCrafts/molpy
# └── molpack/
git clone https://github.com/MolCrafts/molpack
cd molpack
# Rust library + CLI
cargo build --features cli
# Python wheel (editable)
cd python && maturin develop --release
See Development for tests, hooks, and contribution workflow.