molcrafts-molpack 0.1.2

Faithful Rust port of Packmol molecular packing (split off from molrs)
Documentation
# Install

`molpack` ships three surfaces — the CLI binary, the Rust crate, and the
Python binding. Pick the one that matches your workflow; they share the same
engine and packing model.

## CLI

For Packmol-style `.inp` scripts:

```bash
cargo install molcrafts-molpack --features cli
molpack --help
```

!!! tip "Path resolution"
    In file-arg mode (`molpack job.inp`), relative paths inside the script are
    resolved against the **script directory**. In stdin mode they resolve
    against the current working directory.

## Rust crate

For programmatic use from Rust:

```bash
cargo add molcrafts-molpack
```

Optional features (crate defaults to none enabled):

| Feature | Purpose |
|---|---|
| `cli` | `molpack` binary + clap (implies `io`) |
| `io` | PDB / XYZ / SDF / LAMMPS readers via molrs |
| `rayon` | Parallel objective evaluation |
| `ff` | Force-field geometry relaxer (MMFF + L-BFGS) |

```toml
# Cargo.toml — common combinations
molcrafts-molpack = { version = "0.1", features = ["io", "rayon"] }
```

## Python binding

For notebooks and pipelines (Python 3.12+):

```bash
pip install molcrafts-molpack
```

`molcrafts-molrs` is installed as a dependency and provides `molrs.Frame` plus
PDB / XYZ readers. The wheel itself is I/O-free — pass frames in, get frames
out.

```python
import molpack
print(molpack.Molpack)
```

!!! note "Pre-built wheels"
    Wheels are published for CPython **3.12** and **3.13** on Linux
    (manylinux x86-64) and macOS (universal2). Other platforms fall back to the
    sdist and need a Rust toolchain to build.

## Build from source

When you are modifying the crate or Python binding, check out **molrs** as a
sibling (path deps resolve `../molrs/molrs`):

```bash
# sibling layout
# workspace/
# ├── molrs/
# └── molpack/

git clone https://github.com/MolCrafts/molpack
cd molpack

# Rust library + CLI
cargo build --features cli

# Python wheel (editable)
cd python && maturin develop --release
```

See [Development](development/) for tests, hooks, and contribution workflow.