Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dbe43e9
feat: add slurm cluster autodiscovery (#11)
gregorweiss Jun 12, 2026
03fa949
feat: add Parsl-based parallel build orchestration (#17)
maxscheurer Jun 18, 2026
b4989f0
feat: add Parsl-based GROMACS simulation orchestration
gregorweiss Aug 12, 2026
7e3ef27
Add proteinbox models: ProteinSpecies, ProteinBoxComposition, Pdb2gmx…
MSiggel May 31, 2026
f4904d7
Add setup/protein.py: pdb2gmx wrapper, PDB cleaning, topology utilities
MSiggel May 31, 2026
0671729
Add relax_with_protein_restraints() to openmm_utils.py
MSiggel May 31, 2026
295d7e2
Add build_proteinbox() and wire up dispatch in workflows.py
MSiggel May 31, 2026
9c3209f
Add proteinbox MDP run schedule files (CHARMM36m settings)
MSiggel May 31, 2026
9ce204b
Track proteinbox MDP files (force-add past .gitignore *.mdp rule)
MSiggel May 31, 2026
6b07575
Add proteinbox tests and example YAML
MSiggel May 31, 2026
e325743
Fix review findings: Path import, cwd paths, metadata, protonation
MSiggel May 31, 2026
a305c25
Add force field check, fix grompp cleanup, fix file handle leak
MSiggel May 31, 2026
0436d51
Add force field registry with auto-download and fix charge parsing
MSiggel May 31, 2026
59150e5
Add [gromacs] config section for gmx path and force field management
MSiggel May 31, 2026
6aead54
Align proteinbox gromacs configuration
MSiggel May 31, 2026
7cff1bc
Fix proteinbox lint formatting
MSiggel May 31, 2026
2180342
Mock gmx binary in proteinbox unit test
MSiggel May 31, 2026
3124f7d
Address review: clearer proteinbox config key names
MSiggel Sep 2, 2026
3665bc7
Fix proteinbox correctness issues from review
MSiggel Sep 3, 2026
5ddf2f9
Bundle force field into proteinbox topology and reject LJ-PME variant
MSiggel Sep 3, 2026
11643e3
Support multi-chain proteins with explicit chain declaration
MSiggel Sep 3, 2026
1d83335
Return None from ProteinSpecies.charge instead of raising
MSiggel Sep 3, 2026
f0176f6
Support proteinbox in CSV pipeline and clean build intermediates
MSiggel Sep 3, 2026
f92895a
Fix proteinbox CSV->YAML serialization and add CSV example
MSiggel Sep 3, 2026
c563d9a
Harden proteinbox residue and force-field handling
MSiggel Sep 3, 2026
2450d80
Lock pdbfixer dependency for proteinbox
MSiggel Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
pull_request:
branches:
- main
- develop
workflow_dispatch:

jobs:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
cov.xml
*.cover
*.py,cover
.hypothesis/
Expand Down Expand Up @@ -194,4 +195,10 @@ charmm36.ff/
!docs/public/diagrams/**/*.png
!docs/public/mdfactory-logo-v1.0.png

# Allow GROMACS test fixtures
!mdfactory/tests/fixtures/**

.pixi/

# local proteinbox end-to-end build outputs for inspection (not for commit)
proteinbox_e2e_outputs/
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

- Marc Siggel — Merck KGaA, Darmstadt, Germany
- Maximilian Scheurer — Merck KGaA, Darmstadt, Germany
- Gregor Weiss — Merck KGaA, Darmstadt, Germany
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MDFactory is a high-throughput library for setting up molecular dynamics (MD) si

- **System building** — Mixedbox, bilayer, and LNP build types from YAML or CSV input
- **Parametrization** — OpenFF/SMIRNOFF and CGenFF with automatic per-molecule caching
- **Batch processing** — CSV-driven Nextflow pipelines for parallel builds and GROMACS runs on HPC
- **Batch processing** — CSV-driven Parsl pipelines for parallel builds and GROMACS runs on HPC
- **Analysis** — Registered analysis and artifact types with parquet output, local or SLURM execution
- **Data integration** — Push/pull/sync across SQLite, CSV, and Palantir Foundry backends

Expand Down Expand Up @@ -83,7 +83,7 @@ pip install -e .[dev]
mdfactory build system.yaml simulation_dir
```

See the [Quick Start guide](https://emdgroup.github.io/mdfactory/docs/quick-start) for details on bulk CSV input and Nextflow pipelines.
See the [Quick Start guide](https://emdgroup.github.io/mdfactory/docs/quick-start) for details on bulk CSV input and running simulations.

## Configuration

Expand Down
13 changes: 13 additions & 0 deletions config_templates/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
[cgenff]
SILCSBIODIR =

[gromacs]
; GMX_PATH defaults to looking up "gmx" on PATH
GMX_PATH =
; FORCEFIELD_DIR defaults to <platformdirs.user_data_dir>/forcefields
FORCEFIELD_DIR =

[storage]
; PARAMETERS defaults to <platformdirs.user_data_dir>/parameters
PARAMETERS =
Expand Down Expand Up @@ -40,3 +46,10 @@ ANALYSIS_NAME = analysis
RUN_DB_PATH = /Group Functions/mdfactory/runs
ANALYSIS_DB_PATH = /Group Functions/mdfactory/analysis
ARTIFACT_DB_PATH = /Group Functions/mdfactory/artifacts

[slurm]
; Optional manual overrides. When empty, values are autodiscovered via sinfo/sacctmgr.
ACCOUNT =
PARTITION_CPU =
PARTITION_GPU =
DEFAULT_QOS =
21 changes: 19 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ This folder contains the Fumadocs + Next.js application that renders the MDFacto
documentation. The site mixes hand-written guides with API pages generated straight from the
Python package.

## Prerequisites
## Quick start with pixi

The root `pyproject.toml` defines a `docs` environment that installs Bun, the JS
dependencies, and `fumapy-generate` automatically:

```bash
pixi run -e docs docs-dev # dev server with hot-reload
pixi run -e docs docs-build # full static build to docs/out/
pixi run -e docs docs-generate # regenerate API docs only
```

Each command chains through `docs-install` → `docs-fumapy` automatically, so a
single command handles all setup. On subsequent runs the dependency steps are
fast (no-op when already satisfied).

## Manual setup (without pixi)

### Prerequisites

- [Bun](https://bun.sh/) 1.0+ (fast JavaScript runtime and package manager)
- Python 3.11 (to install `mdfactory` and `fumapy`)
Expand All @@ -18,7 +35,7 @@ python3.11 -m pip install -e .. # expose the local packa
python3.11 -m pip install ./node_modules/fumadocs-python
```

## Commands
### Commands

```bash
bun run docs:generate # runs fumapy-generate + converts JSON into MDX
Expand Down
24 changes: 19 additions & 5 deletions docs/content/docs/developer-guide/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ graph TD
flowchart LR
A[CSV or YAML inputs] --> B[prepare-build or build]
B --> C[Simulation directories]
C --> D[Local run or Nextflow]
C --> D[Local run or Parsl orchestration]
D --> E[Trajectory and output files]
E --> F[Simulation.run_analysis / run_artifact]
F --> G[.analysis parquet, artifacts, metadata.json]
Expand Down Expand Up @@ -164,12 +164,26 @@ For analysis and artifact sync, the code uses:

## Workflow orchestration

The repository contains Nextflow scripts under `workflows/`. The scripts that most directly align with the current CLI are:
The `mdfactory/orchestration/` package provides Parsl-based parallel orchestration for both building and simulating systems on local machines or SLURM clusters.

- `build.nf`
- `simulate.nf`
### Architecture layers

These scripts wrap the checked-in `mdfactory prepare-build` and `mdfactory build` commands plus a fixed GROMACS run chain.
```mermaid
graph TD
A[CLI: build --slurm / simulate --slurm] --> B[config.py: ExecutorConfig / SlurmExecutorConfig]
B --> C[session.py: parsl_session context manager]
C --> D[apps.py: Parsl python_app / bash_app definitions]
D --> E[stages.py: STAGE_REGISTRY + run_stage dispatch]
E --> F[build.py: build_systems / simulate.py: run_simulations]
F --> G[Rich progress UI + result collection]
```

- **`config.py`**: Pydantic models for local and SLURM execution. `ExecutorConfig` handles local runs; `SlurmExecutorConfig` adds SLURM-specific fields (account, partition, walltime, gres, per-stage overrides). Both serialize to/from YAML via `from_yaml()` and `model_dump()`.
- **`session.py`**: `parsl_session()` context manager that owns the Parsl DataFlowKernel lifecycle. On exit it calls `parsl.clear()` and explicitly `scancel`s any lingering SLURM job IDs.
- **`apps.py`**: Defines `get_build_app()` (python\_app for system building), `get_grompp_app()` and `get_mdrun_app()` (bash\_apps for GROMACS). Nearly all conditional logic (GPU, MPI, thread counts, restart flags) is resolved in Python before generating the bash script — the only permitted runtime branch is a small `if/elif/else/fi` block for binary detection when `gmx_binary` is set to `auto`.
- **`stages.py`**: `STAGE_REGISTRY` declares the canonical pipeline (EM → NVT → NPT → Production) as `StageSpec` dataclasses. `run_stage()` is the single generic dispatch function for all stages.
- **`build.py`** / **`simulate.py`**: Top-level entry points. `build_systems()` submits parallel build tasks; `run_simulations()` chains stages sequentially per simulation with checkpoint detection and trajectory validation.
- **`tui.py`**: Interactive SLURM configuration wizard using `questionary`. Auto-discovers cluster hardware via `sinfo`/`sacctmgr` and persists the result as a reusable YAML file.

## Extension points

Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MDFactory is an open source, end-to-end simulation manager for high-throughput m
/>

<FeatureCards>
<FeatureCard icon="layers" title="Batch Processing" description="CSV-driven: one row = one system. Run hundreds of systems in parallel via Nextflow on HPC." />
<FeatureCard icon="layers" title="Batch Processing" description="CSV-driven: one row = one system. Run hundreds of systems in parallel via Parsl on HPC." />
<FeatureCard icon="puzzle" title="Modular Pipeline" description="Pluggable build types (mixedbox, bilayer, LNP) with swappable force fields (OpenFF, CGenFF)." />
<FeatureCard icon="bar-chart" title="Analysis Framework" description="11+ registered analysis types with parquet + JSON metadata output and extensible registry." />
<FeatureCard icon="database" title="Data Integration" description="SQLite, CSV, and Palantir Foundry backends with intelligent push/pull/sync via CLI." />
Expand Down
26 changes: 13 additions & 13 deletions docs/content/docs/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,29 @@ This writes GROMACS-ready build output into `simulation_dir`.
</Step>
<Step>

## Run with Nextflow (optional)
## Run simulations (optional)

For high-throughput runs, use the checked-in workflows:
Run the GROMACS simulation chain (EM → NVT → NPT → Production) locally:

Build many systems from CSV:
```bash
mdfactory simulate output_systems/
```

For high-throughput runs on a SLURM cluster, generate a config interactively and pass it:

```bash
nextflow run workflows/build.nf \
--csv_file sample_input.csv \
--output_dir output_systems
mdfactory config slurm # interactive wizard → saves slurm_executor.yaml
mdfactory simulate output_systems/ --slurm slurm_executor.yaml
```

Run the GROMACS chain using the generated summary YAML:
Or use `--slurm tui` to launch the wizard inline:

```bash
nextflow run workflows/simulate.nf \
-c workflows/simulate.config \
--base_dir output_systems \
--config_yaml output_systems/sample_input.yaml
mdfactory simulate output_systems/ --slurm tui
```

<Callout type="warn" title="Cluster-specific configuration">
The shipped `simulate.config` contains SLURM settings tuned for a specific cluster. Edit this file to match your HPC environment before running. See [Running on HPC Clusters](/docs/user-guide/running-on-hpc) for details.
<Callout type="info" title="Parsl dependency">
SLURM orchestration requires the `parsl` extra: `pip install "mdfactory[parsl]"`. See [Running on HPC Clusters](/docs/user-guide/running-on-hpc) for details.
</Callout>

</Step>
Expand Down
87 changes: 85 additions & 2 deletions docs/content/docs/user-guide/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ mdfactory prepare-build <input.csv> [output_dir]

### `mdfactory build`

Build one simulation from a YAML file into the chosen output directory.
Build MD system(s) from YAML, CSV, or summary input. Supports three input modes:

- **Single YAML**: builds one system locally
- **CSV file**: builds systems from each row (parallel with `--slurm`, sequential without)
- **Summary YAML**: dispatches builds for previously prepared systems

```bash
mdfactory build <input.yaml> [output_dir]
mdfactory build <input> [options]
```

Options:

- `--output` — output directory (default: `.`)
- `--slurm` — SLURM executor config: path to YAML file, or `'tui'` for interactive setup
- `--dry-run` — print what would be built without executing

### `mdfactory check-csv`

Validate a CSV by converting each row into a `BuildInput` model and, for bilayers, running the current buildability checks.
Expand All @@ -31,6 +41,79 @@ Validate a CSV by converting each row into a `BuildInput` model and, for bilayer
mdfactory check-csv <input.csv>
```

## Simulation commands

### `mdfactory simulate`

Run GROMACS MD simulations via Parsl. The simulation pipeline runs four stages by default: EM → NVT → NPT → Production.

```bash
mdfactory simulate <source> [options]
```

Options:

- `--slurm` — SLURM config YAML or `'tui'` for interactive setup
- `--stages` — stages to run (EM, NVT, NPT, Production); defaults to all
- `--checkpoint` — checkpoint mode: `auto` (default), `skip`, `force`
- `--hash` — filter by hash prefix (can specify multiple)
- `--dry-run` — preview plan without executing
- `--clean` — remove simulation outputs before running (respects `--stages` filter)
- `--max-rescue` — max rescue tiers for physics failures (default: 3; set to 0 to disable)

Usage examples:

```bash
# Local execution (all stages)
mdfactory simulate output_dir/

# SLURM with interactive config
mdfactory simulate output_dir/ --slurm tui

# Resume from checkpoint with existing config
mdfactory simulate output_dir/ --slurm gpu.yaml --checkpoint auto

# Equilibration only
mdfactory simulate output_dir/ --stages EM NVT NPT

# Filter specific simulations
mdfactory simulate output_dir/ --hash abc123 def456

# Dry-run preview
mdfactory simulate output_dir/ --slurm gpu.yaml --dry-run

# Clean outputs and re-run (e.g. after a killed job left stale checkpoints)
mdfactory simulate output_dir/ --clean --slurm gpu.yaml

# Clean only Production stage before re-running it
mdfactory simulate output_dir/ --clean --stages Production --slurm gpu.yaml

# Preview what --clean would delete without acting
mdfactory simulate output_dir/ --clean --dry-run
```

## Configuration commands

### `mdfactory config slurm`

Interactive wizard to configure a SLURM executor and save to YAML. Queries the local SLURM scheduler for available accounts, partitions, and hardware, then walks through resource selection interactively.

The result is saved to a YAML file that can be reused with `mdfactory build --slurm <file>` or `mdfactory simulate --slurm <file>`.

On non-SLURM machines, falls back to manual text entry.

```bash
mdfactory config slurm
```

### `mdfactory config cluster`

Show discovered SLURM cluster information. Queries the local SLURM scheduler and displays available partitions, accounts, and QOS policies. Useful for verifying autodiscovery before submitting jobs.

```bash
mdfactory config cluster [--json]
```

## Utility commands

### `mdfactory clean`
Expand Down
Loading
Loading