Python¶
Packmol-grade molecular packing in Rust, with a first-class Python binding.
molpack arranges \(N\) molecule types under geometric restraints without
overlaps. The engine is a faithful port of Packmol's GENCAN-driven algorithm
(Martínez et al. 2009); five canonical workloads stay pinned against Packmol
reference output.
At a glance¶
import molrs
from molpack import GencanPack, Target
frame = molrs.io.read_pdb("water.pdb")
water = (
Target(frame, count=100)
.with_name("water")
.with_restraint(molrs.core.Cuboid([0.0, 0.0, 0.0], [40.0, 40.0, 40.0]))
)
packer = GencanPack().with_tolerance(2.0).with_seed(42)
result = packer.run([water], max_loops=200)
print(f"packed {result.frame['atoms'].n_rows} atoms")
Next steps¶
Installation
pip install and verification.
Quickstart
First pack end-to-end.
Targets
Templates, counts, fixed placement.
Restraints
Geometric and collective restraints.
Packer
Builder options, diagnostics, callbacks.
Chain growth
Dense polymer melts via the CbmcGrow engine.
Periodic boundaries
PBC rules and validation.
Examples
Packmol-equivalent workloads.
API reference
Class-by-class summary.
See also¶
- Rust crate:
molcrafts-molpack— the underlying engine molcrafts-molrs— frame I/O and theFramedata model (installed as a dependency)