Skip to content

Manual

molpack

Build non-overlapping initial configurations for molecular dynamics. Give molpack molecular templates, per-type counts, and geometric restraints, and it returns coordinates that satisfy every constraint — a faithful port of Packmol's GENCAN engine in pure Rust.

molpack

At a glance

Templates and counts in, packed coordinates out

molpack takes a set of molecular templates, a copy count for each, and the geometric restraints each type must satisfy. It then places every copy so that nothing overlaps and every constraint holds:

import molrs
from molpack import InsideBoxRestraint, Molpack, Target

frame = molrs.read_pdb("water.pdb")             # one molecule template

water = (
    Target(frame, count=1000)                   # 1000 copies
    .with_name("water")
    .with_restraint(InsideBoxRestraint([0, 0, 0], [40, 40, 40]))
)

packed = Molpack().with_seed(42).pack([water], max_loops=200)

The same engine drives a Packmol-compatible CLI and a native Rust API, so a mixture defined once can be packed from a shell script, a Rust program, or Python. The Getting Started chapter walks through a full mixture end to end; the Examples collect the five canonical workloads.

Find your page

The manual in six chapters