Task #2735

Allow gmx_genrestr to write correct position restraints for molecules after the first molecule

Added by Joe Jordan 7 months ago. Updated 6 months ago.

preprocessing (pdb2gmx,grompp)
Target version:


If you want to have position restraints for multiple chains in a protein, this is currently not allowed by gmx_genrestr. There is no reason for this and it is a simple change to a single line of gmxana/gmx_genpr.cpp.

With the current code,

for (i = 0; i < igrp; i++)
    fprintf(out, "%4d %4d %10g %10g %10g\n",
            ind_grp[i]+1, 1, fc[XX], fc[YY], fc[ZZ]);

the attached script fails to make the B chain restraints. But with a simple change,
for (i = 0; i < igrp; i++)
    fprintf(out, "%4d %4d %10g %10g %10g\n",
            i+1, 1, fc[XX], fc[YY], fc[ZZ]);

the script runs successfully. Additionally, the second version is the way writing position restraints (for all heavy atoms) in pdb2gmx works.

I might argue that this is actually a bug, but perhaps there may be some reason it needs to work this way that I don't know about. (915 Bytes) simple script to demonstrate issue in gmx genrestr Joe Jordan, 11/05/2018 07:41 PM
chainTer.pdb (19.7 KB) chainTer.pdb input structure to script Joe Jordan, 11/05/2018 07:41 PM
ca.mdp (39 Bytes) ca.mdp input mdp file Joe Jordan, 11/05/2018 07:41 PM (1.38 KB) Joe Jordan, 11/09/2018 12:19 PM


#1 Updated by Gerrit Code Review Bot 7 months ago

Gerrit received a related patchset '1' for Issue #2735.
Uploader: Joe Jordan ()
Change-Id: gromacs~master~Ifd849020da98b8052f0f965e53a079c6bddfc2d5
Gerrit URL:

#2 Updated by Joe Jordan 6 months ago

I tested this to make sure that mdrun also works and everything seems fine. I created a slightly more elaborate script to demonstrate this. I think it might be a good idea to turn this script into an integration test using the test fixtures and starting from a suitably equilibrated box.

Also available in: Atom PDF