Skip to content

GROMACS: grompp refuses topologies with position restraints (no -r passed) #253

Closed

Description

@ohlincha

GROMACS energy minimisation (runtype Optimize) of a clay/water system with a MINFF topology is rejected before submission by the Launch check (gromacs.launchpp):

command: /usr/bin/gmx grompp -f gromacs.mdp -c conf.gro -p topol.top -o .../check.tpr -po .../mdout.mdp -maxwarn 0
Fatal error:
Cannot find position restraint file restraint.gro (option -r).
From GROMACS-2018, you need to specify the position restraint coordinate files
explicitly to avoid mistakes, although you can still use the same file as you
specify for the -c option.

Inputs. The structure is em.gro and the topology processed.top. processed.top is grompp's -pp output from the original setup, which was run with define = -Dcis_Oct_Mg2cis_Fe3cis_k500 -DOPC3_IOD_LM -DFLEXIBLE -DPOSRES_noH. Its #ifdef blocks are therefore resolved, and it holds three unconditional [ position_restraints ] sections (molecule types MMT1–MMT3).

Cause. A topology with position restraints needs a reference structure on grompp's -r. ECCE never passes -r, neither in the launch check (gromacs.launchpp) nor, presumably, in the job script that gensub writes. So any topology with restraints is refused, whether they come from a processed topology or from a define = -DPOSRES the user set.

Proposed fix.

  • Pass -r to grompp in both places whenever the topology (after #include, and with the job's define) has a [ position_restraints ] section. Use the input structure (conf.gro) unless the user supplies a separate reference structure; GROMACS allows the same file for -c and -r.
  • Possibly offer an optional "restraint reference" file in the GROMACS editor.
  • Add a test case with a restrained topology to the GROMACS tests.

Related: MINFF (#241). Not worked on yet (budget); logged for the next round.

Activity

  1. ohlincha commented on Oct 9, 2026

    @ohlincha
    CollaboratorAuthor

    Fixed on branch wip/a9-more (277057c), not yet on main.

    Change. Both grompp calls now pass the starting structure as the position-restraint reference, -r conf.gro: the launch check (scripts/parsers/gromacs.launchpp) and the job script written by scripts/gensub. The job script did have the same gap as the launch check. -r is passed unconditionally. grompp ignores it for a topology without restraints, so no parsing of the topology or of define is needed.

    Verification (GROMACS 2025.2).

    • The reported inputs (em.gro as conf.gro, processed.top as topol.top): without -r, grompp stops with "Cannot find position restraint file restraint.gro (option -r)". With -r conf.gro it builds the .tpr. The old gromacs.launchpp rejects these inputs and the new one accepts them.
    • The original em.mdp still fails, with a different cause. Its define = -D... -DPOSRES_noH names macros that the processed topology no longer uses, because grompp -pp has already resolved them. grompp raises this as a warning, and the check runs with -maxwarn 0, so the warning stops it. With a processed topology, the define line must go. ECCE's own .mdp (md.gmxtask) writes no define.
    • tests/gromacs_md: the four existing stages (unrestrained SPC water box: steep, NVT, NPT, MD) pass with -r. A new case is added: three SPC waters, with the first one held by an unconditional [ position_restraints ]. It goes through gromacs.launchpp, the gensub job script and mdrun, and the .tpr contains the restraint. Without -r, grompp refuses this case with the same error.

    Not done: a separate "restraint reference" file in the GROMACS editor. The starting structure is always the reference.

  2. ohlincha commented on Oct 12, 2026

    @ohlincha
    CollaboratorAuthor

    The fix is on main (277057c, merged in af9e0a9) and was verified with the reported inputs (em.gro, processed.top) and the new restrained case in tests/gromacs_md. A walkthrough with the full MINFF workflow comes with the GROMACS round. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions