OPLS-AA / LAMMPS / Gaussian skills for the pi coding agent — packaged with the discipline that keeps molecular-simulation agents safe on shared HPC.
The gap it closes
General-purpose coding agents will gladly run NumPy on a login node, invent SLURM directives, and overwrite working force-field files. molagent replaces those failure modes with executable rules, battle-tested skills, and a config that travels between clusters.
python -c "import numpy" on the login node and admins file a ticket.--account, hour-units off-by-60.fix shake bites — lives in screenshots in Slack.tool_call hook intercepts heavy-compute Python on the login node; configurable strict/warn/off.molagent.json declares accounts, partitions, walltimes, modules; skills read it through a stdlib-only helper./critic and /verify commands inject role-protocols stored in agents/*.md.Highlights
A pi package that registers an extension, twelve skills, eight prompt templates, and a steering library — all driven from a single config file.
From mol2 → LigParGen / BOSS parameterisation → LAMMPS data files → DFT-refined charges → dihedral re-fits.
A tool_call hook intercepts numpy / scipy / rdkit / torch on login nodes. strict blocks, warn confirms, off disables.
Binaries, SLURM accounts, partition fallbacks, LAMMPS defaults, scratch dirs — all in molagent.json. /molagent:init auto-discovers what it can.
A stdlib-only Python helper renders {{ placeholder }} SLURM templates and dispatches to sbatch, mpirun, or prints them for review.
Markdown role definitions under agents/ turn into /critic and /verify slash commands. Devil's-advocate review and blind re-derivation, on demand.
Rule set, cluster reference, LAMMPS / Gaussian / plot-discipline notes, and an incident-log archive — loaded on demand with /hpc, /lammps, /gaussian, /incident-log.
How it fits together
Four steps, each ~30 seconds. The first three configure the agent; the fourth is the agent doing the work.
Pi reads package.json, registers the extension, and auto-discovers skills/ and prompts/.
pi install git:git@github.com:your-org/pi-molagent
# or project-local:
pi install -l ./pi-molagent
Pi looks for AGENTS.md in cwd-and-ancestors and in ~/.pi/agent/. Point it at the bundled rule set:
ln -s /abs/path/to/pi-molagent/steering/AGENTS.md \
~/.pi/agent/AGENTS.md
Inside pi, /molagent:init writes a starter .pi/molagent.json with auto-detected binary paths and a sensible ntasks.
/molagent:init # write .pi/molagent.json
/molagent:doctor # see what's ready / blocked
Skills read the merged config from $MOLAGENT_EFFECTIVE_CONFIG. The runner renders SLURM templates and dispatches according to runner.mode.
"Parameterise this monomer with OPLS-AA and submit
a 2 ns NVE on Puma high_priority."
12 skills
Each skill is a SKILL.md + script directory. Pi auto-discovers them; the agent invokes one when the task description matches.
structure-analyze Mol2 / PDB analysis, ring detection, OPLS atom typingpolymer-builder Oligomers and chains from a monomer mol2ligpargen-from-mol OPLS-AA parameterisation via LigParGen + BOSSopls-pipeline End-to-end OPLS-AA: param → data → validatesolvent-pack Packmol solvent boxes with LAMMPS equilibrationmerge-data Merge multiple LAMMPS data files into one systemwrap-unwrap Wrap / unwrap LAMMPS trajectories across PBCextract-molecules Extract and renumber molecules from bulk datadft-charges DFT charges (Gaussian g16, Hirshfeld / RESP)dihedral-fit-pipeline DFT scan → LAMMPS dihedral coefficientsplot-standards Publication-quality matplotlib defaultsfind-skills List and describe available molagent skills