Task #2566

Refactor pdb2gmx into c++ framework

Added by Joe Jordan 13 days ago. Updated 13 days ago.

Feedback wanted
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 3 days 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


#1 Updated by Gerrit Code Review Bot 13 days 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 13 days ago

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

#3 Updated by Mark Abraham 12 days ago

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

Also available in: Atom PDF