Task #2566

Refactor pdb2gmx into c++ framework

Added by Joe Jordan 8 months ago. Updated 5 months ago.

preprocessing (pdb2gmx,grompp)
Target version:


In order to have better with external callers (e.g. python API) having pdb2gmx implemented as a real c++ class structure will be beneficial. The first step is to re-implement pdb2gmx as an ICommandLineOptionsModule. Ideally, this should be coupled with a move away from pointers and towards references. Eventually I have some interest in taking this in a direction similar to the IForceProvider framework where there would be a sort of [structureFileFormat]2gmx functionality that can accommodate heterogeneous data and maybe handle some basic modeling tasks like combining pdbs or adding a few missing residues. Before that can happen though, a number of changes will be necessary.


  • Ensure variables have only as much scope as needed
  • turn pointers into references where possible
  • better naming of variables
  • decide which functions should be members of class pdb2gmx
  • turn some redundant functions into template functions
  • (hard maybe on this) think about how to handle reading in of forcefield information

Related issues

Related to GROMACS - Task #1587: improve the configurability of regression testsNew

Associated revisions

Revision 27a4d57c (diff)
Added by Mark Abraham 7 months ago

Replacement for pdb2gmx tests

This test directly asserts upon the .top and .gro files that are
written out, using fragments of the
regressiontests/complex/aminoacids/conf.gro because these cover all
basic amino acid types. It also adds testing for hydrogen vsites for
amber and charmm.

We now omit doing an energy minimization after the string checks,
which was always a doubtful way to test pdb2gmx. These tests are still
too slow to run with other pre- and post-submit testing, so a new
CTest category has been made for them, and that category is excluded
from Jenkins builds by default. Developers will still run these by
default with "make check" or "ctest" but that should be fast enough on
a workstation. Later we can probably refactor them to use in-memory
buffers and be fast enough to put with the other tests.

Modified pdb2gmx to avoid writing fractional charges for every atom in
the [atoms] output, which isn't very useful for users and makes
writing tests more difficult.

Fixed unstable sorting of dihedrals whose parameters are strings that
identify macros.

Added new capability for refdata tests to filter out lines that vary
at run time by supplying a regex that matches the lines to skip.
That's not ideal, but useful for now. Better would be to refactor
tools so that e.g. header output can go to a different stream, but
first we should have basic tests in place.

Added tests for Regex. Fixed minor bug in c++ stdlib regex
implementation of Regex. Noted the remaining reason why we have
Regex supported by two different implementations.

Minor updates to use compat::make_unique

Extended functionality of CommandLine for convenient use.

Refs #1587, #2566

Change-Id: I6a4aeb1a4c460621ca89a0dc6177567fa09d9200

Revision e47c992c (diff)
Added by Joe Jordan 7 months ago

remove most debug flags from gmxpreprocess

To make pdb2gmx more readable as part of #2566 I
removed the debug info. I went ahead and removed
most debug info from other gmxpreprocess tools as

Change-Id: I88919d1f166d7f44508b4fcfae156ffa051b4d70

Revision 2363a20f (diff)
Added by Joe Jordan 6 months ago

change some char to string in gmxpreprocess

Related to #2566 and #2570. As part of the refactoring of
pdb2gmx one thing that becomes clear is that a lot of variables
could have better defined scope and readability could be
improved if some char's are converted to string's. This can
ripple through the code base of gmxpreprocess. I have followed
some of those ripples here and will continue to follow in
later changes.

Change-Id: I0d12704ef27c06a4f64f8d1e8638760c8c7019ae


#1 Updated by Gerrit Code Review Bot 8 months ago

Gerrit received a related patchset '2' for Issue #2566.
Uploader: Joe Jordan ()
Change-Id: gromacs~master~I6dd750d0761c474415c02e9ae36d7ddb1fbbda10
Gerrit URL:

#2 Updated by Joe Jordan 8 months ago

  • Tracker changed from Bug to Task
  • Affected version deleted (future)

#3 Updated by Mark Abraham 8 months ago

  • Related to Task #1587: improve the configurability of regression tests added

#4 Updated by Gerrit Code Review Bot 7 months ago

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

#5 Updated by Gerrit Code Review Bot 7 months ago

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

#6 Updated by Joe Jordan 5 months ago

  • Status changed from Feedback wanted to Closed

Also available in: Atom PDF