molcrafts-molpack
Packmol-grade molecular packing in pure Rust, with Python bindings. Part of the molrs toolkit.
Install
CLI
Rust library
Python
CLI
The molpack binary accepts Packmol-style .inp scripts. Use the official
Packmol user guide as the
script-language reference; molpack documents only invocation behavior and
extensions here. Relative file paths in the script are resolved against the
script's own directory (file-arg mode) or the current directory (stdin mode).
# File argument (paths resolved relative to the .inp file's directory)
# Stdin — compatible with Packmol usage
|
molpack script additions
| Addition | Description |
|---|---|
avoid_overlap <no|false|0> |
Disable the default fixed-solute initial-placement guard. Leave it on unless you need to reproduce a less guarded initialization. |
filetype sdf |
Read SDF/MOL inputs. Read-only. |
filetype lammps_dump |
Read LAMMPS dump inputs and write .lammpstrj outputs. |
filetype lammps_data |
Read LAMMPS data inputs. Read-only. |
Unknown top-level keywords are rejected instead of ignored. Output format is
inferred from the output extension.
Quick start
Rust
use ;
let positions = ;
let radii = ;
let target = from_coords
.with_name
.with_restraint;
// `pack` returns the packed, topology-complete `molrs::Frame`.
// Every tuning knob has a Packmol-matching default, so `new().pack(...)`
// is a complete call; `200` is the outer-loop budget.
let frame = new.pack?;
// For full diagnostics, use `pack_with_report` → `PackResult`
// (`frame`, `fdist`, `frest`, `converged`).
let report = new.pack_with_report?;
Python
=
=
=
Examples
Five canonical workloads ship in examples/ (they need the io feature
to read the bundled structure files):
The same workloads run through the CLI from their bundled .inp scripts,
e.g. cargo run --release --features cli --bin molpack -- examples/pack_mixture/mixture.inp.
Python equivalents are in python/examples/.
A measurement harness also lives under examples/: mt_scaling (parallel
speed-up-vs-size sweep, needs --features rayon).
Testing
&& &&
Documentation
- Guide — the Markdown chapters under
docs/: install, getting started, concepts, examples, Packmol parity, architecture, and extending. - Rust API —
cargo doc --open, or docs.rs. The four long-form chapters (getting started, concepts, architecture, extending) are also embedded in the rustdoc asmolpack::getting_started,molpack::concepts,molpack::architecture, andmolpack::extending. - Python — the binding docs under
docs/python/(installation, guide, examples, and the Python API reference), published as the Python section of the same Zensical site.
Contributing
See CONTRIBUTING.md. Bugs and feature requests via GitHub Issues.
License
BSD-3-Clause
References
- Martínez, L.; Andrade, R.; Birgin, E. G.; Martínez, J. M. PACKMOL: A package for building initial configurations for molecular dynamics simulations. J. Comput. Chem. 2009, 30 (13), 2157–2164. https://doi.org/10.1002/jcc.21224