Skip to content

Packmol Script Notes

The CLI reads Packmol-style .inp files. For the script language itself, use the official Packmol user guide as the reference. molpack intentionally keeps that job shape: global settings, then one structure ... end structure block per molecule type.

tolerance 2.0
filetype pdb
output packed.pdb

structure water.pdb
  number 1000
  inside box 0. 0. 0. 40. 40. 40.
end structure

This page only documents molpack-specific behavior and extensions. If a Packmol keyword is not listed here, treat Packmol's manual as the source of truth and use Packmol parity for implementation-level compatibility notes.

Invocation and paths

  • molpack mixture.inp: paths inside mixture.inp resolve relative to the directory that contains mixture.inp.
  • molpack < mixture.inp: paths resolve relative to the current working directory.

This matches the two common Packmol invocation styles while making file-argument mode safe to run from another directory.

molpack additions

Keyword Meaning
avoid_overlap <yes\|no\|true\|false\|1\|0> Controls whether initial random placements are rejected when they overlap a fixed molecule. Default: on. Use avoid_overlap no only when you explicitly want Packmol's fixed-solute exclusion guard disabled.
filetype sdf Read SDF/MOL inputs through the CLI. Read-only.
filetype lammps_dump Read LAMMPS dump inputs and write .lammpstrj outputs.
filetype lammps_data Read LAMMPS data inputs. Read-only.

Output format is inferred from the output extension. The extra molpack output extension is .lammpstrj for LAMMPS dump trajectories.

Strict parsing

molpack rejects unknown keywords instead of silently ignoring them. A misspelled top-level keyword returns ScriptError::UnknownKeyword, which prevents broken inputs from falling through to an expensive or invalid packing run.

Supported Packmol subset

The parser covers the Packmol syntax used by the bundled examples and regression suite:

  • global tolerance, seed, filetype, output, nloop, and pbc;
  • structure ... end structure blocks;
  • number, center, centerofmass, and fixed;
  • whole-molecule and atoms ... end atoms restraints;
  • inside/outside box, cube, sphere, ellipsoid, and cylinder;
  • over plane, above plane, and below plane.

Atom indices in .inp files are 1-based, matching Packmol. When translating the same model to Python or Rust, subtract 1 because those APIs use 0-based indices.