Installation¶
From PyPI¶
The PyPI package molcrafts-molpack installs a Python module named molpack:
Pre-built wheels are published for CPython 3.12–3.13 on Linux (x86_64, aarch64), macOS (x86_64, arm64), and Windows (x86_64).
With molcrafts-molrs (recommended)¶
molpack accepts molrs.Frame objects directly — the recommended way
to load PDB and XYZ files:
import molrs
from molpack import InsideBoxRestraint, Molpack, Target
frame = molrs.read_pdb("water.pdb")
water = (
Target(frame, count=100)
.with_name("water")
.with_restraint(InsideBoxRestraint([0.0, 0.0, 0.0], [40.0, 40.0, 40.0]))
)
frame = Molpack().with_seed(42).pack([water], max_loops=200)
Target takes a molrs.Frame (or a molpy.Frame), resolved zero-copy
through its FFI capsule, so one of molcrafts-molrs / molcrafts-molpy
is required to build targets from a structure.
Building from source¶
Requires a Rust toolchain (1.91+) and maturin:
git clone https://github.com/MolCrafts/molpack
cd molpack/python
pip install maturin
maturin develop --release
This builds against the local molpack Rust crate under ../.