Gromacs  2025.0-dev-20241011-013a99c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
gmx::test::SimulationRunner Class Reference

#include <programs/mdrun/tests/moduletest.h>

Description

Helper object for running grompp and mdrun in integration tests of mdrun functionality.

Objects of this class must be owned by objects descended from MdrunTestFixtureBase, which sets up necessary infrastructure for it. Such an object may own more than one SimulationRunner.

The setup phase creates various temporary files for input and output that are common for mdrun tests, using the file manager object of the fixture that owns this object. Individual tests should create any extra filenames similarly, so that the test users's current working directory does not get littered with files left over from tests.

Any method in this class may throw std::bad_alloc if out of memory.

By default, the convenience methods callGrompp() and callMdrun() just prepare and run a default call to mdrun. If there is a need to customize the command-line for grompp or mdrun (e.g. to invoke -maxwarn n, or -reprod), then make a CommandLine object with the appropriate flags and pass that into the routines that accept such.

Public Member Functions

 SimulationRunner (TestFileManager *fileManager)
 Initializes a runner with given manager for temporary files.
 
void useEmptyMdpFile ()
 Use an empty .mdp file as input to grompp.
 
void useStringAsMdpFile (const char *mdpString)
 Use a given string as input to grompp.
 
void useStringAsMdpFile (const std::string &mdpString)
 Use a given string as input to grompp.
 
void useStringAsNdxFile (const char *ndxString) const
 Use a string as -n input to grompp.
 
void useTopG96AndNdxFromDatabase (const std::string &name)
 Use a standard .top and .g96 file as input to grompp.
 
void useTopGroAndNdxFromDatabase (const std::string &name)
 Use a standard .top and .gro file as input to grompp.
 
void useGroFromDatabase (const char *name)
 Use a standard .gro file as input to grompp.
 
void useNdxFromDatabase (const std::string &name)
 Use a standard .ndx as input to grompp.
 
void useTopGroAndMdpFromFepTestDatabase (const std::string &name)
 Use .top, .gro, and .mdp from FEP test database.
 
void setMaxWarn (int maxwarn)
 Set a maxmum number of acceptable warnings.
 
int callGrompp (const CommandLine &callerRef)
 Calls grompp (on rank 0, with a customized command line) to prepare for the mdrun test.
 
int callGrompp ()
 Convenience wrapper for a default call to callGrompp.
 
int callGromppOnThisRank (const CommandLine &callerRef)
 Calls grompp (on this rank, with a customized command line) to prepare for the mdrun test.
 
int callGromppOnThisRank ()
 Convenience wrapper for a default call to callGromppOnThisRank.
 
int callNmeig () const
 Calls nmeig for testing.
 
int callMdrun (const CommandLine &callerRef)
 Calls mdrun for testing with a customized command line.
 
int callMdrun ()
 Convenience wrapper for calling mdrun for testing with default command line.
 
int changeTprNsteps (int nsteps) const
 Calls convert-tpr on this rank to set a new number of steps in the tpr.
 

Public Attributes

SimulationRunnerMdpSource mdpSource_
 How the mdp options are defined.
 
std::string mdpInputContents_
 What will be written into a temporary mdp file before the grompp call.
 
Names for frequently used grompp and mdrun output files

These strings can be set to point to files present in the source tree, or to temporary files created for the test fixture. In the latter case, IntegrationTestFixture::fileManager_ should be used to fill these strings with paths to files, so that they are created in a temporary directory and (by default behaviour of TestFileManager) deleted when the test is complete.

std::string topFileName_
 
std::string groFileName_
 
std::string mdpFileName_
 
std::string fullPrecisionTrajectoryFileName_
 
std::string reducedPrecisionTrajectoryFileName_
 
std::string groOutputFileName_
 
std::string cptOutputFileName_
 
std::string ndxFileName_
 
std::string mdpOutputFileName_
 
std::string tprFileName_
 
std::string logFileName_
 
std::string edrFileName_
 
std::string mtxFileName_
 
std::string swapFileName_
 
std::string dhdlFileName_
 
int nsteps_
 
int maxwarn_
 

The documentation for this class was generated from the following files: