科研 Skill
GROMACS分子动力学工作流
gromacs-workflow
Covers end-to-end MD simulations with GROMACS: topology/.mdp construction, energy minimization, NVT/NPT equilibration. Use for GROMACS-based biomolecular or materials MD.
SKILL.md
GROMACS Workflow
Description
This skill covers end-to-end molecular dynamics simulations using GROMACS: topology construction and the .top/.itp hierarchy, .mdp parameter anatomy for energy minimization, NVT, NPT, and production runs, the grompp → mdrun → analysis pipeline, cutoff and PME setup, thermostat and barostat selection, constraint algorithms (LINCS, SETTLE), force-field compatibility (AMBER, CHARMM, OPLS-AA, GROMOS, Martini), HPC execution with MPI/OpenMP/GPU offload, and restart continuation. GROMACS is the standard tool for biomolecular and soft-matter simulations and is the reference code for AMBER, CHARMM36, and OPLS-AA force fields. Invoke this skill when setting up, running, diagnosing, or extending any GROMACS simulation.
Domain Context
GROMACS integrates Newton's equations of motion using a leap-frog Verlet integrator (the md integrator) or stochastic dynamics (sd). Its distinctive architecture separates the run-input file (.tpr, compiled from topology + mdp + coordinates by grompp) from the raw inputs (.top, .mdp, .gro), which means all simulation parameters are locked into the binary .tpr before mdrun starts. This compile-then-run model makes GROMACS simulations highly reproducible but requires re-running grompp whenever any parameter changes.
Several domain assumptions govern GROMACS applicability:
- Fixed topology: The bond list, angle list, dihedral list, and improper list are defined at the start of the simulation in the
.topfile and cannot change during the run. GROMACS is not a reactive MD code. Bond-breaking, proton transfer, and chemical reactions require reactive force fields (ReaxFF via PLUMED or an external code) or QM/MM. - Classical nuclei: GROMACS integrates classical equations of motion. Zero-point energy and nuclear tunneling are ignored. For proton dynamics at low temperature, path-integral extensions (GROMACS + i-PI) are required.
- Long-range electrostatics are always present in biomolecular systems. Biomolecular and drug-like systems have partial charges on every atom. PME (Particle Mesh Ewald) is mandatory; a plain cutoff produces artifacts in electrostatic energy and forces that invalidate free energy calculations, solvation energies, and structural properties of charged systems.
- Force-field and water-model pairing is non-negotiable. AMBER ff14SB was parameterized with TIP3P; CHARMM36m with mTIP3P (a modified TIP3P with different LJ parameters). Using TIP4P with ff14SB or TIP3P with CHARMM36m introduces systematic density and structural errors that cannot be corrected by re-equilibration.
- GROMACS units: nm, kJ/mol, ps, K, bar. All
.mdpdistance parameters (rcoulomb, rvdw, rlist, box vectors) are in nanometres, not Ångströms. This is the single most frequent source of silently wrong input from users familiar with LAMMPS or AMBER.
When to Use This Skill
- Biomolecular simulations: proteins, nucleic acids, lipid bilayers, carbohydrates, protein–ligand complexes in explicit solvent.
- Organic molecular liquids, polymer melts, and soft-matter systems where AMBER, CHARMM, OPLS-AA, or GROMOS force fields have validated parameters.
- Coarse-grained simulations using the Martini force field (Martini 2 or Martini 3) for membrane proteins, lipid self-assembly, or polymer systems at mesoscale.
- Free energy perturbation and alchemical calculations (GROMACS has the most mature free-energy infrastructure among open-source MD codes).
- Enhanced sampling with PLUMED: metadynamics, umbrella sampling, replica exchange MD.
- Large-scale biomolecular simulations (10⁴–10⁷ atoms) where GROMACS GPU offload and PME scaling are required for throughput.
When Not to Use This Skill
- Materials science simulations of metals, ceramics, or semiconductors. EAM, Tersoff, Stillinger-Weber, and COMB are not natively supported in GROMACS. Use LAMMPS for materials force fields. GROMACS can use these systems via PLUMED or external FF interfaces, but the workflow is non-standard.
- Reactive MD (bond-breaking). Fixed topology precludes bond formation and breaking. Use LAMMPS with ReaxFF, or ML potentials in an appropriate code.
- When a custom ML interatomic potential (MACE, NequIP, DeePMD) is the force field. GROMACS has no native MLP pair-style interface. Use LAMMPS (see
mlp-to-lammps) or ASE for MLP-driven MD. - Very large inorganic systems (> 10⁶ atoms) where PME is a bottleneck. LAMMPS scales better for non-biomolecular systems because it can use truncated potentials without long-range electrostatics.
- When only single-point energies and forces are needed. Use ASE with the relevant calculator; GROMACS requires a full
.tprcompilation andmdruninvocation even for a single energy evaluation.
Core Concepts
.top(topology file): The top-level text file that defines the entire system: which force-field parameter files to include, which molecule types exist, and the number of each molecule type in the simulation box. The[ system ]section gives a human-readable name;[ molecules ]lists molecule name + count in the order they appear in the coordinate file. The atom count in[ molecules ]must exactly match the coordinate file..itp(include topology file): Modular topology fragment included into.topvia#include. Contains one or more[ moleculetype ]definitions with[ atoms ],[ bonds ],[ angles ],[ dihedrals ],[ impropers ], and[ pairs ]sections. Force-field libraries are distributed as collections of.itpfiles (e.g.,amber14sb.ff/aminoacids.itp,charmm36-jul2022.ff/proteins.itp)..tpr(run input file): Binary file produced bygrompp. Contains the complete simulation state: topology, mdp parameters, and starting coordinates. Once compiled, the.tprcannot be edited; any change requires re-runninggrompp. The.tpris the canonical input tomdrunand ensures reproducibility — the same.tpralways produces the same trajectory..mdp(molecular dynamics parameter file): Plain-text file specifying all simulation parameters: integrator, timestep, output frequencies, cutoffs, thermostat, barostat, constraints, and PME accuracy. One.mdpper stage (EM → NVT → NPT → production). Template.mdpfiles from CHARMM-GUI or the GROMACS manual are the recommended starting points..gro(coordinate file): GROMACS format for atomic positions (and optionally velocities), one atom per line, with box vectors at the end. Coordinates are in nanometres. Can be read by ASE and MDAnalysis. Not suitable for long trajectories (one frame only); use.xtcor.trrfor trajectories..xtc(compressed trajectory): Single-precision lossy-compressed trajectory. Stores positions only; forces and velocities are not included. Standard format for long production runs. Readable by MDAnalysis, VMD, PyMOL, and OVITO..trr(full-precision trajectory): Full-precision trajectory storing positions, velocities, and forces at each saved frame. Required for: velocity-dependent observables (VACF, kinetic energy per molecule), free energy calculations, and restart checkpoints. Significantly larger than.xtc..edr(energy file): Binary file containing all thermodynamic observables (temperature, pressure, potential energy, kinetic energy, density, volume, box dimensions, and force-field energy terms) at everynstenergysteps. Parsed withgmx energyor thepanedrPython library. This is the primary source for thermodynamic averages; do not use the.logfile for analysis (it has lower precision)..cpt(checkpoint file): Binary restart file written everynstcheckpointsteps (default: every hour of wall time). Contains full simulation state: positions, velocities, random number generator state, and simulation step counter. Use withgmx mdrun -cpi prefix.cptto continue a run without loss of statistics.grompp: Preprocessor that compiles.mdp+.top+.gro→.tpr. Performs extensive topology and parameter validation before the run starts.gromppwarnings should be treated as errors — they indicate physical inconsistencies that will silently corrupt the simulation. Use-maxwarn 0only when you understand every warning and have confirmed it is safe.mdrun: The simulation engine. Reads a.tprand produces.xtc/.trr,.edr,.log,.cpt, and final.gro. The most performance-critical step; uses MPI, OpenMP, and GPU offload.- LINCS (Linear Constraint Solver): GROMACS default constraint algorithm for bond-length constraints. Applied to bonds involving hydrogen (h-bonds setting) or all bonds (all-bonds). Implemented via a matrix factorization that is parallel-efficient and numerically stable.
lincs-order = 4is the default; increase to 6–8 for stiff bonds or large timesteps. LINCS replaces SHAKE for most GROMACS applications. - SETTLE: Analytical constraint algorithm for three-site rigid water models (TIP3P, SPC, SPC/E). Faster and more accurate than LINCS for three-point water. Applied automatically to all water molecules when
constraints = h-bondsor higher and a rigid water model is used. - V-rescale thermostat (Bussi–Donadio–Parrinello): Stochastic velocity rescaling that generates the canonical (NVT) ensemble correctly. Temperature fluctuations follow the Maxwell-Boltzmann distribution. Recommended for production NVT. Replaces Berendsen for all production applications.
tau-t = 0.1 psis a typical coupling constant. [EXPERT REVIEW NEEDED] - Parrinello-Rahman barostat: Correct NPT ensemble; generates proper pressure fluctuations and compressibility. Requires pre-equilibrated density (start from Berendsen NPT if the system is far from equilibrium — P-R oscillates dangerously from cold starts).
tau-p = 2.0 psis typical for condensed-phase systems. [EXPERT REVIEW NEEDED] - Verlet cutoff scheme: GROMACS 2018+ exclusively uses the Verlet cutoff scheme with a buffer region determined by the
verlet-buffer-toleranceparameter. The oldergroupscheme was removed in GROMACS 2021. The Verlet scheme guarantees energy conservation and is required for GPU offload.
Key Workflows
Full steps for each part are in references/key-workflows/; open the one you need:
- Workflow 1: Topology construction — the
.top/.itphierarchy —references/key-workflows/01-workflow-1-topology-construction-the-top-itp-hie.md: The topology is the most error-prone part of a GROMACS setup. Every atom in the coordinate file must have a matching entry in[ molecules ]; every molecule type must be defined in an included.itp; every atom type must appear in the fo… - Workflow 2:
.mdpparameter anatomy — four-stage protocol —references/key-workflows/02-workflow-2-mdp-parameter-anatomy-four-stage-prot.md: A standard GROMACS simulation uses four separate.mdpfiles: energy minimization (EM), NVT equilibration, NPT equilibration, and production. Each stage has distinct parameter requirements. - Workflow 3:
grompp → mdrunpipeline —references/key-workflows/03-workflow-3-grompp-mdrun-pipeline.md: The standard four-stage pipeline: each stage produces a checkpoint and coordinate file that feeds the next stage. Always checkgromppoutput before submittingmdrunto a cluster. - Workflow 4: PME setup, cutoffs, constraints, and neighbor lists —
references/key-workflows/04-workflow-4-pme-setup-cutoffs-constraints-and-nei.md: PME configuration is the most common source of energy conservation failures. Parameters must be consistent across all stages. - Workflow 5: Thermostat and barostat selection —
references/key-workflows/05-workflow-5-thermostat-and-barostat-selection.md: The coupling algorithm determines the statistical ensemble. Choosing the wrong one invalidates thermodynamic fluctuation-based properties and can cause non-physical trajectories. - Workflow 6: HPC execution — MPI, OpenMP, and GPU offload —
references/key-workflows/06-workflow-6-hpc-execution-mpi-openmp-and-gpu-offl.md: GROMACS performance depends critically on matching the parallelization strategy to the available hardware and system size. Misconfigured parallelization can reduce throughput by 10×. - Workflow 7: Analysis — energy, coordinates, and structural observables —
references/key-workflows/07-workflow-7-analysis-energy-coordinates-and-struc.md: All GROMACS analysis starts with coordinate pre-processing (gmx trjconv) to handle PBC and centering, then extraction of specific observables. - Workflow 8: Restart, continuation, and reproducibility —
references/key-workflows/08-workflow-8-restart-continuation-and-reproducibil.md
Common Failure Modes
Moved to references/common-failure-modes.md to keep this file short; read it when this part is needed.
Best Practices
- Always use
gmx grompp -maxwarn 0for production runs. Every warning fromgromppindicates a physical inconsistency. Investigate and fix each warning before submitting to a cluster. Increasing-maxwarnto suppress warnings without understanding them is the most common cause of silently wrong GROMACS simulations. - Use CHARMM-GUI for all non-trivial system construction. Manually building
.topfiles for membrane proteins, protein-ligand complexes, or glycosylated systems is error-prone. CHARMM-GUI validates topology against the force-field database and provides consistent.mdptemplates, index groups, and step-by-step scripts. - Verify atom count consistency at every step. After
pdb2gmx,solvate, andgenion, inspect the[ molecules ]section and compare the total atom count to the.grofile line count minus 3. One mismatch →gromppwill reject the topology. - Pre-equilibrate with Berendsen barostat before switching to Parrinello-Rahman. Start every NPT simulation with
pcoupl = Berendsenfor 200–500 ps, then switch to Parrinello-Rahman. Parrinello-Rahman applied from a high-stress starting geometry oscillates uncontrollably and may crash the simulation. C-rescale (GROMACS 2021+) is an excellent alternative that converges quickly while producing the correct NPT ensemble. - Record the
.tprSHA-256 hash for every production run. The.tprencodes the complete simulation specification (topology + parameters + starting coordinates) in a single binary file. The hash fully identifies the simulation for reproducibility purposes. Store it in the run directory README alongside the GROMACS version. - Run
panedranalysis rather thangmx energyfor thermodynamic averages.panedrreads.edrfiles directly into a pandas DataFrame, enabling block averaging, autocorrelation time estimation, and stationarity checks that thegmx energy.xvgoutput requires manual processing for. Install withpip install panedr. - Use
gmx trjconv -pbc mol -centerbefore any structural analysis. Trajectories frommdrunhave molecules split across PBC boundaries. All RDF, RMSD, and SASA calculations require whole molecules. Apply the correction pipeline (Workflow 7) before any analysis and save the processed trajectory separately. - Match
nstlistandrcoulombto the Verlet buffer. Settingnstlist = 10withrcoulomb = 1.2 nmgives a neighbor-list buffer of ~0.05 nm. If performance is critical, increasenstlistto 20–40 and letverlet-buffer-toleranceset the buffer automatically. Do not setnstlist = 1in production — it is 5–10× slower with no accuracy benefit. - For HPC runs, always set
-maxhto 1–2 hours below the job wall time.mdrun -maxh 23.5for a 24-hour job ensures GROMACS writes a final checkpoint before the job is killed by the scheduler. Without-maxh, a job killed at the wall time may leave a corrupt or absent.cpt, forcing the entire run to restart. - Keep a clean copy of the pre-production
.tpr. The.tprused forgmx trjconv,gmx rdf,gmx rms, and all other analysis commands must correspond to the production trajectory. If the.tpris regenerated with different parameters, topology-based selections (atom type, residue, molecule) may produce wrong results. Never overwriteproduction.tprafter a production run begins.
Integration with Other Skills
- md-equilibration: This skill provides GROMACS-specific mdp syntax for equilibration (V-rescale, Parrinello-Rahman, density checks with
gmx energy). That skill provides the physical criteria and diagnostic workflows (block averaging, stationarity tests, flying ice cube detection) that determine when the GROMACS equilibration stages have succeeded. Both skills must be used together. - md-analysis: Workflow 7 here covers GROMACS-native analysis tools (
gmx rdf,gmx msd,gmx hbond,gmx trjconv). That skill covers MDAnalysis- and OVITO-based analysis that applies to GROMACS trajectories loaded via the.tpr+.xtcinterface. The PBC pre-processing from Workflow 7 here is a prerequisite for the analysis in that skill. - md-force-fields: That skill covers the physical basis, parameterization domain, and transferability of AMBER, CHARMM, OPLS-AA, and GROMOS force fields. This skill provides the GROMACS-specific deployment: topology hierarchy,
.itpstructure,[ defaults ]section, andspecial_bondssettings that implement those force fields correctly in GROMACS. - enhanced-sampling: GROMACS is the reference code for PLUMED-driven enhanced sampling (metadynamics, umbrella sampling, replica exchange MD). The production
.tprproduced in Workflow 3 here is the starting point for PLUMED-patchedmdrunin that skill. The equilibration protocol here is a prerequisite before enhanced sampling begins. - free-energy-md: GROMACS has the most mature free energy perturbation (FEP) and alchemical transformation infrastructure among open-source MD codes. That skill covers the
lambdacoupling parameter mdp settings, thedhdl.xvgoutput, and MBAR/BAR analysis. This skill's equilibration and topology construction are prerequisites for any GROMACS FEP calculation. - coarse-grained-md: The Martini coarse-grained force field (Martini 2 and Martini 3) runs natively in GROMACS using the same
.top/.itp/.mdpinfrastructure covered here, with modified cutoffs (rcoulomb = 1.1 nm, rvdw = 1.1 nm for Martini), energy-shift vdW modifier, and LINCS-free integration. That skill covers Martini-specific parameterization and CHARMM-GUI Martini Maker setup. - reproducibility-workflow: The
.tprSHA-256 hash, GROMACS version, force-field.itphashes, and.mdpfiles together form the minimal reproducibility record for a GROMACS simulation. That skill covers DVC-based data provenance, MLflow run tracking, and theREADMEstructure for archiving simulation inputs alongside results. - scientific-visualization: GROMACS trajectories (
.xtc+.tpr) are loaded by VMD, PyMOL, OVITO, and MDAnalysis for visualization. That skill covers rendering proteins with secondary structure coloring, lipid bilayer visualization, and per-atom property mapping from GROMACS analysis outputs (RMSF, SASA, order parameters).
Key References
- Abraham, M. J., et al. (2015). GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers. SoftwareX, 1–2, 19–25. https://doi.org/10.1016/j.softx.2015.06.001
- Bussi, G., Donadio, D., & Parrinello, M. (2007). Canonical sampling through velocity rescaling. Journal of Chemical Physics, 126(1), 014101. https://doi.org/10.1063/1.2408420
- Parrinello, M. & Rahman, A. (1981). Polymorphic transitions in single crystals: A new molecular dynamics method. Journal of Applied Physics, 52(12), 7182–7190. https://doi.org/10.1063/1.328693
- Hess, B., et al. (1997). LINCS: A linear constraint solver for molecular simulations. Journal of Computational Chemistry, 18(12), 1463–1472. https://doi.org/10.1002/(SICI)1096-987X(199709)18:12<1463::AID-JCC4>3.0.CO;2-H
- Huang, J., et al. (2017). CHARMM36m: An improved force field for folded and intrinsically disordered proteins. Nature Methods, 14(1), 71–73. https://doi.org/10.1038/nmeth.4067
- Maier, J. A., et al. (2015). ff14SB: Improving the accuracy of protein side chain and backbone parameters from ff99SB. Journal of Chemical Theory and Computation, 11(8), 3696–3713. https://doi.org/10.1021/acs.jctc.5b00255
- Darden, T., York, D., & Pedersen, L. (1993). Particle mesh Ewald: An N log(N) method for Ewald sums in large systems. Journal of Chemical Physics, 98(12), 10089–10092. https://doi.org/10.1063/1.464397
示例提示词
我想用GROMACS搭建从拓扑构建到生产运行的完整MD模拟流程。
所属插件
安装该插件会一并获得同领域的 35 个 Skill / MCP。
同插件的其他科研 Skill
- 主动学习构建机器学习势训练集Runs active-learning workflows for ML interatomic potentials: uncertainty-guided MD exploration, DFT oracle labeling, query strategy. Use when expanding an MLP training set.
- AiiDA计算工作流管理Covers AiiDA, a provenance-first Python workflow engine for computational materials science: calculation input generation, remote submission. Use when orchestrating reproducible DFT/MD campaigns.
- ASE原子模拟环境Covers the Atomic Simulation Environment (ASE) as an atomistic workflow hub: Atoms objects, calculators, optimizers, trajectories. Use when scripting or converting structures across DFT/MD codes.
- 粗粒化分子动力学模拟Covers coarse-grained molecular dynamics: mapping atomistic structures to CG beads, parameterizing Martini/IBI/force-matching force fields. Use when atomistic timescales are too short.
- CP2K第一性原理分子动力学Covers end-to-end DFT, AIMD, and atomistic workflows with CP2K using the Gaussian-and-plane-waves method: input construction, convergence testing. Use for CP2K-based simulations.
- 扩散模型生成晶体结构Covers de novo crystal structure generation with score-based diffusion and flow-matching models (MatterGen, DiffCSP, CDVAE). Use when generating candidate structures, not analyzing existing ones.
- 晶体图神经网络性质预测Covers graph neural networks for crystal and periodic-material property prediction: crystal graph construction, periodic neighbor finding. Use when building GNN property predictors for crystals.
- 平面波DFT收敛性测试Covers systematic convergence testing for plane-wave DFT: cutoff energy, k-point mesh density, smearing. Use before trusting DFT energies, forces, or derived properties as converged.
- 机器学习势DFT数据集生成Covers generating DFT-labeled datasets for training ML interatomic potentials: configuration-space coverage. Use when building an MLP training dataset from scratch.
- 点缺陷第一性原理计算Covers first-principles point-defect modeling: vacancy/interstitial/antisite/substitutional construction, charge-state calculations. Use for defect thermodynamics studies.
- 第一性原理声子谱计算Covers lattice dynamics from first principles: phonon dispersion, phonon DOS. Use when computing vibrational or thermodynamic properties from DFT.
- 表面模型DFT计算Covers surface slab model construction and DFT calculation: Miller-index generation, termination selection, slab/vacuum convergence. Use for surface science and catalysis DFT studies.
- 弹性常数计算工作流Computes single-crystal and polycrystalline elastic constants from DFT or MD stress-strain data and checks mechanical stability. Use when deriving stiffness tensors or bulk/shear modulus.
- 增强采样自由能计算Covers enhanced sampling methods for atomistic MD (metadynamics, umbrella sampling. Use for rare-event or slow-transition sampling.
- 状态方程拟合Covers equation-of-state fitting from DFT/ML-potential energy-volume data: Birch-Murnaghan, Vinet, and Murnaghan forms. Use when fitting an EOS to compression data.
- 机器学习势微调迁移训练Covers fine-tuning pretrained universal ML interatomic potentials on system-specific DFT data. Use when adapting a universal MLP to a new system.
- 分子动力学自由能计算Covers quantitative free-energy calculations from MD: alchemical FEP/TI/BAR/MBAR, umbrella-sampling PMF. Use when computing thermodynamic free energies from simulation.
- 高通量DFT自动化筛选Covers automated large-scale DFT screening: workflow graphs with atomate2/jobflow/AiiDA, input-set standardization, custodian error handling. Use for high-throughput DFT screening campaigns.
- LAMMPS分子动力学工作流Covers end-to-end MD simulations with LAMMPS: input script anatomy, force-field deployment, ensemble control, equilibration. Use for LAMMPS-based classical molecular dynamics.
- MACE机器学习势训练Covers training MACE machine-learned interatomic potentials: extxyz dataset preparation, isolated-atom energies, train/val/test splitting. Use for MACE-specific MLP training workflows.
- MatGL图神经网络框架Covers building, applying, validating, and fine-tuning MatGL graph-neural-network models for property prediction and interatomic potentials. Use for pretrained GNN workflows via MatGL.
- 分子动力学轨迹后处理分析Covers quantitative post-processing of atomistic MD trajectories: loading LAMMPS/GROMACS/ASE trajectories and computing RDF, coordination numbers. Use for structural MD trajectory analysis.
- 分子动力学平衡过程设计Covers bringing an atomistic simulation from its initial configuration to a representative equilibrium state before production statistics: ensemble. Use before collecting production MD data.
- 分子动力学力场选型验证Covers selection, validation, and deployment of classical interatomic force fields for MD: physical basis and transferability limits of EAM, MEAM, Tersoff. Use when choosing a force field.
常见问题
GROMACS分子动力学工作流能做什么?
Covers end-to-end MD simulations with GROMACS: topology/.mdp construction, energy minimization, NVT/NPT equilibration. Use for GROMACS-based biomolecular or materials MD。
如何安装GROMACS分子动力学工作流?
在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「GROMACS分子动力学工作流」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。
GROMACS分子动力学工作流需要哪些权限?
该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。
GROMACS分子动力学工作流经过官方审核吗?
是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。