Gromacs  2025-dev-20241003-bd59e46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
gmx::test Namespace Reference

Description

Testing utilities namespace.

This namespace contains utilities for writing unit tests, mostly from the Testing Utilities (testutils) module.

Namespaces

 anonymous_namespace{abstractoptionstorage.cpp}
 
 anonymous_namespace{accessor_policy.cpp}
 
 anonymous_namespace{analysisdata.cpp}
 
 anonymous_namespace{angle.cpp}
 
 anonymous_namespace{arraydata.cpp}
 
 anonymous_namespace{arrayref.cpp}
 
 anonymous_namespace{arrayrefwithpadding.cpp}
 
 anonymous_namespace{autocorr.cpp}
 
 anonymous_namespace{average.cpp}
 
 anonymous_namespace{base.cpp}
 
 anonymous_namespace{bonded.cpp}
 
 anonymous_namespace{booltype.cpp}
 
 anonymous_namespace{boxdeformation.cpp}
 
 anonymous_namespace{boxmatrix.cpp}
 
 anonymous_namespace{calc_verletbuf.cpp}
 
 anonymous_namespace{calcvir.cpp}
 
 anonymous_namespace{checkpoint.cpp}
 
 anonymous_namespace{checkpointdata.cpp}
 
 anonymous_namespace{clustsize.cpp}
 
 anonymous_namespace{cmdlinehelpmodule.cpp}
 
 anonymous_namespace{cmdlinehelpwriter.cpp}
 
 anonymous_namespace{cmdlinemodulemanager.cpp}
 
 anonymous_namespace{cmdlinemodulemanagertest.cpp}
 
 anonymous_namespace{cmdlineparser.cpp}
 
 anonymous_namespace{cmdlinerunner.cpp}
 
 anonymous_namespace{cmdlinetest.cpp}
 
 anonymous_namespace{com.cpp}
 
 anonymous_namespace{complex.cpp}
 
 anonymous_namespace{conftest.cpp}
 
 anonymous_namespace{constantacceleration.cpp}
 
 anonymous_namespace{constr.cpp}
 
 anonymous_namespace{convert-tpr-fixture.h}
 
 anonymous_namespace{convert-tpr-with-leaks.cpp}
 
 anonymous_namespace{convert-tpr.cpp}
 
 anonymous_namespace{convert_trj.cpp}
 
 anonymous_namespace{cpuinfo.cpp}
 
 anonymous_namespace{cstringutil.cpp}
 
 anonymous_namespace{defaultinitializationallocator.cpp}
 
 anonymous_namespace{densityfittingforce.cpp}
 
 anonymous_namespace{device_management.cpp}
 
 anonymous_namespace{device_stream_manager.cpp}
 
 anonymous_namespace{distance.cpp}
 
 anonymous_namespace{dofit.cpp}
 
 anonymous_namespace{dssp.cpp}
 
 anonymous_namespace{ebin.cpp}
 
 anonymous_namespace{editconf.cpp}
 
 anonymous_namespace{electricfield.cpp}
 
 anonymous_namespace{enerdata.cpp}
 
 anonymous_namespace{energydrifttracker.cpp}
 
 anonymous_namespace{energyoutput.cpp}
 
 anonymous_namespace{energyterm.cpp}
 
 anonymous_namespace{entropy.cpp}
 
 anonymous_namespace{enumerationhelpers.cpp}
 
 anonymous_namespace{ewaldsurfaceterm.cpp}
 
 anonymous_namespace{exactcontinuation.cpp}
 
 anonymous_namespace{exclusions.cpp}
 
 anonymous_namespace{expanded.cpp}
 
 anonymous_namespace{expfit.cpp}
 
 anonymous_namespace{exponentialdistribution.cpp}
 
 anonymous_namespace{exponentialmovingaverage.cpp}
 
 anonymous_namespace{extensions.cpp}
 
 anonymous_namespace{extents.cpp}
 
 anonymous_namespace{extract_cluster.cpp}
 
 anonymous_namespace{fft.cpp}
 
 anonymous_namespace{fileioxdrserializer.cpp}
 
 anonymous_namespace{filematchers.cpp}
 
 anonymous_namespace{filemd5.cpp}
 
 anonymous_namespace{filenameoption.cpp}
 
 anonymous_namespace{filenameoptionmanager.cpp}
 
 anonymous_namespace{filenm.cpp}
 
 anonymous_namespace{filetypes.cpp}
 
 anonymous_namespace{fixedcapacityvector.cpp}
 
 anonymous_namespace{forcebuffers.cpp}
 
 anonymous_namespace{freeenergy.cpp}
 
 anonymous_namespace{freeenergyparameters.cpp}
 
 anonymous_namespace{freevolume.cpp}
 
 anonymous_namespace{freezegroups.cpp}
 
 anonymous_namespace{functions.cpp}
 
 anonymous_namespace{gammadistribution.cpp}
 
 anonymous_namespace{gausstransform.cpp}
 
 anonymous_namespace{gen_maxwell_velocities.cpp}
 
 anonymous_namespace{genconf.cpp}
 
 anonymous_namespace{genion.cpp}
 
 anonymous_namespace{gmx_chi.cpp}
 
 anonymous_namespace{gmx_mindist.cpp}
 
 anonymous_namespace{gmx_traj.cpp}
 
 anonymous_namespace{gpp_atomtype.cpp}
 
 anonymous_namespace{gpueventsynchronizer.cpp}
 
 anonymous_namespace{grompp_directives.cpp}
 
 anonymous_namespace{haloexchange_mpi.cpp}
 
 anonymous_namespace{hardwaretopology.cpp}
 
 anonymous_namespace{hashedmap.cpp}
 
 anonymous_namespace{helpformat.cpp}
 
 anonymous_namespace{helpmanager.cpp}
 
 anonymous_namespace{helpwritercontext.cpp}
 
 anonymous_namespace{helpwriting.cpp}
 
 anonymous_namespace{histogram.cpp}
 
 anonymous_namespace{idef.cpp}
 
 anonymous_namespace{index.cpp}
 
 anonymous_namespace{indexutil.cpp}
 
 anonymous_namespace{initialconstraints.cpp}
 
 anonymous_namespace{inmemoryserializer.cpp}
 
 anonymous_namespace{insert_molecules.cpp}
 
 anonymous_namespace{interactivetest.cpp}
 
 anonymous_namespace{invertmatrix.cpp}
 
 anonymous_namespace{kernel_test.cpp}
 
 anonymous_namespace{kernelsetup.cpp}
 
 anonymous_namespace{keyvaluetreeserializer.cpp}
 
 anonymous_namespace{keyvaluetreetransform.cpp}
 
 anonymous_namespace{langevin.cpp}
 
 anonymous_namespace{layouts.cpp}
 
 anonymous_namespace{leapfrog.cpp}
 
 anonymous_namespace{legacyenergy.cpp}
 
 anonymous_namespace{lifetime.cpp}
 
 anonymous_namespace{listoflists.cpp}
 
 anonymous_namespace{logger.cpp}
 
 anonymous_namespace{loggertest.cpp}
 
 anonymous_namespace{make_ndx.cpp}
 
 anonymous_namespace{manager.cpp}
 
 anonymous_namespace{manyautocorrelation.cpp}
 
 anonymous_namespace{massrepartitioning.cpp}
 
 anonymous_namespace{matio.cpp}
 
 anonymous_namespace{matrix.cpp}
 
 anonymous_namespace{mdmodulesnotifier.cpp}
 
 anonymous_namespace{mdspan.cpp}
 
 anonymous_namespace{message_string_collector.cpp}
 
 anonymous_namespace{minimize.cpp}
 
 anonymous_namespace{mock_datamodule.cpp}
 
 anonymous_namespace{mockhardwaretopology.cpp}
 
 anonymous_namespace{moduletest.cpp}
 
 anonymous_namespace{mpitest.cpp}
 
 anonymous_namespace{mrcdensitymap.cpp}
 
 anonymous_namespace{mrcdensitymapheader.cpp}
 
 anonymous_namespace{mrcserializer.cpp}
 
 anonymous_namespace{msd.cpp}
 
 anonymous_namespace{mshift.cpp}
 
 anonymous_namespace{mtop.cpp}
 
 anonymous_namespace{multidimarray.cpp}
 
 anonymous_namespace{multiple_time_stepping.cpp}
 
 anonymous_namespace{multipletimestepping.cpp}
 
 anonymous_namespace{naming.cpp}
 
 anonymous_namespace{nb_free_energy.cpp}
 
 anonymous_namespace{neldermead.cpp}
 
 anonymous_namespace{nonbonded_bench.cpp}
 
 anonymous_namespace{normaldistribution.cpp}
 
 anonymous_namespace{normalmodes.cpp}
 
 anonymous_namespace{observablesreducer.cpp}
 
 anonymous_namespace{optimization.cpp}
 
 anonymous_namespace{option.cpp}
 
 anonymous_namespace{optionsassigner.cpp}
 
 anonymous_namespace{outputfiles.cpp}
 
 anonymous_namespace{pairdist.cpp}
 
 anonymous_namespace{pairs.cpp}
 
 anonymous_namespace{pargs.cpp}
 
 anonymous_namespace{parrinellorahman.cpp}
 
 anonymous_namespace{path.cpp}
 
 anonymous_namespace{pdb2gmx.cpp}
 
 anonymous_namespace{physicalnodecommunicator.cpp}
 
 anonymous_namespace{physicalnodecommunicator_mpi.cpp}
 
 anonymous_namespace{pmebsplinetest.cpp}
 
 anonymous_namespace{pmegathertest.cpp}
 
 anonymous_namespace{pmesolvetest.cpp}
 
 anonymous_namespace{pmesplinespreadtest.cpp}
 
 anonymous_namespace{pmetest.cpp}
 
 anonymous_namespace{poscalc.cpp}
 
 anonymous_namespace{position_restraints.cpp}
 
 anonymous_namespace{pull.cpp}
 
 anonymous_namespace{pull_rotation.cpp}
 
 anonymous_namespace{range.cpp}
 
 anonymous_namespace{rdf.cpp}
 
 anonymous_namespace{refdata.cpp}
 
 anonymous_namespace{refdata_tests.cpp}
 
 anonymous_namespace{refdata_xml.cpp}
 
 anonymous_namespace{repeatingsection.cpp}
 
 anonymous_namespace{rerun.cpp}
 
 anonymous_namespace{sasa.cpp}
 
 anonymous_namespace{scalar.cpp}
 
 anonymous_namespace{scalar_math.cpp}
 
 anonymous_namespace{scalar_util.cpp}
 
 anonymous_namespace{scattering.cpp}
 
 anonymous_namespace{seed.cpp}
 
 anonymous_namespace{select.cpp}
 
 anonymous_namespace{selectioncollection.cpp}
 
 anonymous_namespace{selectionoption.cpp}
 
 anonymous_namespace{settle.cpp}
 
 anonymous_namespace{shake.cpp}
 
 anonymous_namespace{simd_floatingpoint_util.cpp}
 
 anonymous_namespace{simple_mdrun.cpp}
 
 anonymous_namespace{simulationdatabase.cpp}
 
 anonymous_namespace{simulator.cpp}
 
 anonymous_namespace{solvate.cpp}
 
 anonymous_namespace{splinetable.cpp}
 
 anonymous_namespace{strconvert.cpp}
 
 anonymous_namespace{stringtest.cpp}
 
 anonymous_namespace{stringtoenumvalueconverter.cpp}
 
 anonymous_namespace{stringutil.cpp}
 
 anonymous_namespace{surfacearea.cpp}
 
 anonymous_namespace{symtab.cpp}
 
 anonymous_namespace{tabulatednormaldistribution.cpp}
 
 anonymous_namespace{template_mp.cpp}
 
 anonymous_namespace{testasserts.cpp}
 
 anonymous_namespace{testinit.cpp}
 
 anonymous_namespace{testoptions.cpp}
 
 anonymous_namespace{testsystem.cpp}
 
 anonymous_namespace{textblockmatchers.cpp}
 
 anonymous_namespace{textreader.cpp}
 
 anonymous_namespace{textwriter.cpp}
 
 anonymous_namespace{threadaffinity.cpp}
 
 anonymous_namespace{threadaffinity_mpi.cpp}
 
 anonymous_namespace{threefry.cpp}
 
 anonymous_namespace{timeunitmanager.cpp}
 
 anonymous_namespace{timing.cpp}
 
 anonymous_namespace{tngio.cpp}
 
 anonymous_namespace{topologyinformation.cpp}
 
 anonymous_namespace{topsort.cpp}
 
 anonymous_namespace{tpitest.cpp}
 
 anonymous_namespace{trajectory.cpp}
 
 anonymous_namespace{treesupport.cpp}
 
 anonymous_namespace{trjconv.cpp}
 
 anonymous_namespace{uniformintdistribution.cpp}
 
 anonymous_namespace{uniformrealdistribution.cpp}
 
 anonymous_namespace{unionfind.cpp}
 
 anonymous_namespace{updategroups.cpp}
 
 anonymous_namespace{updategroupscog.cpp}
 
 anonymous_namespace{usergpuids.cpp}
 
 anonymous_namespace{vectypes.cpp}
 
 anonymous_namespace{virtualsites.cpp}
 
 anonymous_namespace{wholemoleculetransform.cpp}
 
 anonymous_namespace{xvgio.cpp}
 
 anonymous_namespace{xvgtest.cpp}
 
 anonymous_namespace{xvgtest_tests.cpp}
 

Classes

class  AnalysisDataTestInputPointSet
 Represents a single set of points in AnalysisDataTestInputFrame structure. More...
 
class  AnalysisDataTestInputFrame
 Represents a single frame in AnalysisDataTestInput structure. More...
 
class  AnalysisDataTestInput
 Represents static input data for AbstractAnalysisData tests. More...
 
class  AnalysisDataTestFixture
 Test fixture for AbstractAnalysisData testing. More...
 
struct  AwhTestParameters
 Struct that gathers all input for setting up and using a Bias. More...
 
class  BiasTest
 Test fixture for testing Bias updates. More...
 
class  BiasFepLambdaStateTest
 Test fixture for testing Bias updates. More...
 
class  BiasStateTest
 Test fixture for testing Bias updates. More...
 
class  UserInputTest
 Test user input data reading. More...
 
class  FrictionMetricTest
 Test fixture for testing Friction metric, including storing to, and restoring from, history. More...
 
class  MockModule
 Mock implementation of gmx::ICommandLineModule. More...
 
class  MockOptionsModule
 Mock implementation of gmx::ICommandLineOptionsModule. More...
 
class  CommandLineModuleManagerTestBase
 Test fixture for tests using gmx::CommandLineModuleManager. More...
 
class  TrajectoryFrameWriterTest
 Test fixture to test different file types are supported by the CoordinateFile. More...
 
class  ModuleSelection
 Helper class for tests that need an initialized selection. More...
 
class  ModuleTest
 Test fixture to test matching file types for modules. More...
 
class  SetAtomsSupportedFiles
 Helper to test supported file names. More...
 
class  SetAtomsUnSupportedFiles
 Helper to test supported file names. More...
 
class  AnyOutputSupportedFiles
 Helper to test supported file names. More...
 
class  NoOptionalOutput
 Helper to test support for disabling all output options. More...
 
class  OutputSelectorDeathTest
 Helper to test that invalid selection is rejected. More...
 
class  SetVelocitySupportedFiles
 Helper to test supported file names. More...
 
class  SetVelocityUnSupportedFiles
 Helper to test supported file names. More...
 
class  SetForceSupportedFiles
 Helper to test supported file names. More...
 
class  SetForceUnSupportedFiles
 Helper to test supported file names. More...
 
class  SetPrecisionSupportedFiles
 Helper to test supported file names. More...
 
class  SetPrecisionUnSupportedFiles
 Helper to test supported file names. More...
 
class  FlagTest
 Test fixture to test user inputs. More...
 
class  SetAtomsTest
 Test fixture to prepare a setatoms object to pass data through. More...
 
class  SetBothTimeTest
 Test fixture to prepare a setatoms object to pass data through. More...
 
class  SetStartTimeTest
 Test fixture to prepare a setatoms object to pass data through. More...
 
class  SetTimeStepTest
 Test fixture to prepare a setatoms object to pass data through. More...
 
class  HostMemoryTest
 Typed test fixture for infrastructure for host-side memory used for GPU transfers. More...
 
struct  HostAllocatorTest
 Typed test fixture. More...
 
struct  HostAllocatorTestNoMem
 Typed test fixture (no mem/gpu initializtion - much faster) More...
 
struct  HostAllocatorTestNoMemCopyable
 Typed test fixture for tests requiring a copyable type. More...
 
class  PaddedVectorTest
 Typed test fixture. More...
 
class  SignalTest
 Test fixture for mdrun signalling. More...
 
struct  TestSystem
 Description of the system used for testing. More...
 
class  TopologyManager
 Helps create and manage the lifetime of topology and related data structures. More...
 
class  SimdBaseTest
 Base class for SIMD test fixtures. More...
 
class  GyrateModuleTest
 Test fixture for the gyrate analysis module. More...
 
class  HbondModuleTest
 Test fixture for the hbond analysis module. More...
 
class  AbstractTrajectoryAnalysisModuleTestFixture
 Test fixture for trajectory analysis modules. More...
 
class  TrajectoryAnalysisModuleTestFixture
 Test fixture for a trajectory analysis module. More...
 
class  AllocatorTest
 Templated test fixture. More...
 
struct  MaxNumFrames
 Named struct indicating the max number of frames to be compared. More...
 
class  DensityFittingTest
 End to end test for the density fitting functionality in mdrun. More...
 
class  EnergyComparison
 Function object to compare all energy terms of reference with all matching terms from test within the given tolerances. More...
 
class  EnergyFrameReader
 Manages returning an EnergyFrame containing required energy term values read from successive frames of an .edr file. More...
 
class  FramePairManager
 Manages returning a pair of frames from two equivalent simulations that are meaningful to compare. More...
 
class  MimicTest
 Test fixture for bonded interactions. More...
 
class  SimulationRunner
 Helper object for running grompp and mdrun in integration tests of mdrun functionality. More...
 
class  MdrunTestFixtureBase
 Declares test fixture base class for integration tests of mdrun functionality. More...
 
class  MdrunTestFixture
 Declares test fixture class for integration tests of mdrun functionality that use a single call of mdrun. More...
 
class  ParameterizedMdrunTestFixture
 Parameterized test fixture for mdrun integration tests. More...
 
class  NumRanksPerSimulation
 Test flag setting the number of ranks per simulation. More...
 
class  MultiSimTest
 Test fixture for multi-sim functionality. More...
 
struct  ReferenceFileNames
 Helper type of output file names for the reference mdrun call. More...
 
class  PeriodicActionsTest
 Test fixture base for comparing a simulator with one that does everything every step. More...
 
struct  PrintReplicaExchangeParametersToString
 Helper struct printing custom test name. More...
 
class  BondedInteractionsTest
 Test fixture for bonded interactions. More...
 
class  TerminationHelper
 Help test mdrun termination behaviour. More...
 
struct  TrajectoryTolerances
 Helper struct for testing different trajectory components with different tolerances. More...
 
struct  TrajectoryFrameMatchSettings
 Helper struct to specify the expected behaviour of compareFrames(). More...
 
class  TrajectoryComparison
 Function object to compare the fields of two frames vs each others or one frame vs reference data for equality given the matchSettings_ and tolerances_. More...
 
class  CommandLine
 Helper class for tests that need to construct command lines. More...
 
class  CommandLineTestHelper
 Helper class for tests that construct command lines that need to reference existing files. More...
 
class  CommandLineTestBase
 Test fixture for tests that call a single command-line program with input/output files. More...
 
class  ConfMatch
 Match the contents as an gro file. More...
 
class  IFileMatcher
 Represents a file matcher, matching file contents against reference (or other) data. More...
 
class  IFileMatcherSettings
 Represents a factory for creating a file matcher. More...
 
class  TextFileMatch
 Use a ITextBlockMatcher for matching the contents. More...
 
class  NoContentsMatch
 Do not check the contents of the file. More...
 
class  InteractiveTestHelper
 Helper class for testing interactive sessions. More...
 
class  LoggerTestHelper
 Helper class for tests to check output written to a logger. More...
 
class  AllowAnyRankCount
 Helper for GMX_MPI_TEST to permit any rank count. More...
 
class  RequireRankCount
 Helper for GMX_MPI_TEST to permit only a specific rank count. More...
 
class  RequireMinimumRankCount
 Helper for GMX_MPI_TEST to permit only a specific rank count. More...
 
class  NameOfTestFromTuple
 Function object that helps GoogleTest name our test cases. More...
 
class  RefDataFilenameMaker
 Functor to name a refdata filename for this test. More...
 
struct  PrefixFormatter
 Functor to add a prefix to the return from formatter for T. More...
 
class  TestReferenceData
 Handles creation of and comparison to test reference data. More...
 
class  TestReferenceChecker
 Handles comparison to test reference data. More...
 
class  StdioTestHelper
 Helper class for tests where code reads directly from stdin. More...
 
class  StringTestBase
 Test fixture for tests that check string formatting. More...
 
class  TestDevice
 A structure to describe a hardware context that persists over the lifetime of the test binary. More...
 
class  TestHardwareEnvironment
 This class performs one-time test initialization, enumerating the hardware. More...
 
class  FloatingPointDifference
 Computes and represents a floating-point difference value. More...
 
class  FloatingPointTolerance
 Specifies a floating-point comparison tolerance and checks whether a difference is within the tolerance. More...
 
class  TestException
 Exception class for reporting errors in tests. More...
 
class  TestFileManager
 Helper for tests that need input and output files. More...
 
class  TestFileInputRedirector
 In-memory implementation for IFileInputRedirector for tests. More...
 
class  TestFileOutputRedirector
 In-memory implementation of IFileOutputRedirector for tests. More...
 
class  TestOptionsProvider
 Provides additional options for the test executable. More...
 
class  ITextBlockMatcher
 Represents a text matcher, matching text stream contents against reference data. More...
 
class  ITextBlockMatcherSettings
 Represents a factory for creating a text matcher. More...
 
class  ExactTextMatch
 Use an exact text match (the contents should be exactly equal). More...
 
class  NoTextMatch
 Do not match the text (the contents are ignored). More...
 
class  FilteringExactTextMatch
 Use an exact text match after scrubbing lines of the text that match the supplied regular expressions. More...
 
class  TprAndFileManager
 Helper to bundle generated TPR and the file manager to clean it up. More...
 
class  TrajectoryFrameReader
 Manages returning a t_trxframe whose contents were read from successive frames of an trajectory file. More...
 
class  XvgMatch
 Match the contents as an xvg file. More...
 
class  FloatTypeMatcher
 Implementation class for RealEq matcher. More...
 
class  RVecMatcher
 Implementation class for RvecEq matcher. More...
 

Typedefs

typedef std::shared_ptr
< MockAnalysisDataModule > 
MockAnalysisDataModulePointer
 Smart pointer to manage an MockAnalysisDataModule object.
 
typedef std::tuple
< AwhHistogramGrowthType,
AwhPotentialType,
BiasParams::DisableUpdateSkips
BiasTestParameters
 Convenience typedef: growth type enum, potential type enum, disable update skips.
 
using DummyConverterPointer = std::unique_ptr< DummyConverter >
 Convenience typedef for dummy module.
 
typedef gmx::unique_cptr
< gmx_pme_t, gmx_pme_destroy
PmeSafePointer
 A safe pointer type for PME.
 
typedef std::vector< realChargesVector
 Charges.
 
typedef std::vector< RVecCoordinatesVector
 Coordinates.
 
typedef ArrayRef< RVecForcesVector
 Forces.
 
typedef std::vector< IVecGridLineIndicesVector
 Gridline indices.
 
typedef ArrayRef< const realSplineParamsDimVector
 Spline parameters (theta or dtheta). A reference to a single dimension's spline data; this means (atomCount * pmeOrder) values or derivatives.
 
typedef std::array
< SplineParamsDimVector, DIM > 
SplineParamsVector
 Spline parameters (theta or dtheta) in all 3 dimensions.
 
template<typename ValueType >
using SparseGridValuesInput = std::map< IVec, ValueType >
 Non-zero grid values for test input; keys are 3d indices (IVec)
 
typedef SparseGridValuesInput
< real
SparseRealGridValuesInput
 Non-zero real grid values.
 
typedef SparseGridValuesInput
< t_complex > 
SparseComplexGridValuesInput
 Non-zero complex grid values.
 
template<typename ValueType >
using SparseGridValuesOutput = std::map< std::string, ValueType >
 Non-zero grid values for test output; keys are string representations of the cells' 3d indices (IVec); this allows for better sorting.
 
typedef SparseGridValuesOutput
< real
SparseRealGridValuesOutput
 Non-zero real grid values.
 
typedef SparseGridValuesOutput
< t_complex > 
SparseComplexGridValuesOutput
 Non-zero complex grid values.
 
typedef std::array< real, DIM
*DIM > 
Matrix3x3
 TODO: make proper C++ matrix for the whole Gromacs, get rid of this.
 
using GpuFftTestParams = std::tuple< std::tuple< IVec, int, int >, FftBackend >
 
using GpuFftTestGridParams = std::tuple_element< 0, GpuFftTestParams >::type
 
using XvgrTimeReadingParams = std::tuple< bool, bool >
 Convienience type for testing read_xvg_time. More...
 
typedef ::testing::Types
< int32_t, real, RVec,
test::MoveOnly > 
TestTypes
 The types used in testing of all operations.
 
using TestTypesCopyable = ::testing::Types< int32_t, real, RVec >
 The types used in testing minus move only types.
 
template<typename T >
using HostAllocatorTestCopyable = HostAllocatorTest< T >
 Typed test fixture for tests requiring a copyable type.
 
using AllocatorTypesToTest = ::testing::Types< HostAllocator< real >, HostAllocator< int32_t >, HostAllocator< RVec >, HostAllocator< MoveOnly >>
 Declare allocator types to test.
 
using Implementations = ::testing::Types< std::allocator< int32_t >, std::allocator< float >, std::allocator< double >, std::allocator< BasicVector< float >>, std::allocator< BasicVector< double >>, AlignedAllocator< int32_t >, AlignedAllocator< float >, AlignedAllocator< double >, AlignedAllocator< BasicVector< float >>, AlignedAllocator< BasicVector< double >>>
 The types used in testing.
 
using MtsIntervalTestParams = std::tuple< std::string, int >
 Test fixture base for parametrizing interval tests.
 
using GyrateTestParamsMerge = std::tuple< std::string, std::string >
 
using HbondTestParamsMerge = std::tuple< std::string, std::tuple< std::string, std::string >, std::string >
 
typedef
gmx::test::DispersionCorrectionTestFixture 
DispersionCorrectionTest
 Test fixture for mdrun with dispersion correction.
 
using EnergyTermsToCompare = std::unordered_map< std::string, FloatingPointTolerance >
 Convenience type.
 
typedef std::unique_ptr
< EnergyFrameReader
EnergyFrameReaderPtr
 Convenience smart pointer typedef.
 
typedef unique_cptr< ener_file,
done_ener_file > 
ener_file_ptr
 Convenience smart pointer typedef.
 
typedef unique_cptr
< t_enxframe, done_enxframe
enxframe_ptr
 Convenience smart pointer typedef.
 
typedef gmx::test::ImdTestFixture ImdTest
 Test fixture for mdrun with IMD settings.
 
typedef MultiSimTest MultiSimTerminationTest
 Convenience typedef.
 
typedef std::unique_ptr
< CommandLine
CommandLinePointer
 Convenience typedef.
 
typedef std::tuple
< NumRanksPerSimulation,
IntegrationAlgorithm,
TemperatureCoupling,
PressureCoupling
MultiSimTestParams
 The parameters of the MultiSimTest class.
 
typedef
gmx::test::OriresTestFixture 
OriresTest
 Test fixture for mdrun with orires.
 
using PropagationParameters = MdpFieldValues
 Mdp parameters that determine the manner of simulation propagation.
 
using PeriodicOutputParameters = MdpFieldValues
 Mdp parameters that should only affect the observations, not the simulation propagation.
 
using OutputParameterGeneratorFunction ) = std::vector< PeriodicOutputParameters >(*)(
 Function type to produce sets of .mdp parameters for testing periodic output.
 
typedef MultiSimTest ReplicaExchangeEnsembleTest
 Convenience typedef.
 
typedef MultiSimTest ReplicaExchangeTerminationTest
 Convenience typedef.
 
typedef MultiSimTest ReplicaExchangeTest
 Convenience typedef.
 
typedef std::tuple
< std::string, std::string > 
SimulationOptionTuple
 
typedef gmx::test::SwapTestFixture CompelTest
 Test fixture for mdrun with "Computational Electrophysiology" settings,.
 
typedef MdrunTestFixture MdrunTerminationTest
 Convenience typedef.
 
typedef std::unique_ptr
< IFileMatcher
FileMatcherPointer
 Smart pointer for managing a IFileMatcher.
 
using MdpFieldValues = std::map< std::string, std::string >
 Helper typedef.
 
typedef std::unique_ptr
< ITextBlockMatcher
TextBlockMatcherPointer
 Smart pointer for managing a ITextBlockMatcher.
 
typedef unique_cptr
< gmx_output_env_t,
output_env_done > 
oenv_ptr
 Convenience smart pointer typedef.
 
typedef unique_cptr
< t_trxstatus, close_trx > 
trxstatus_file_ptr
 Convenience smart pointer typedef.
 
typedef unique_cptr
< t_trxframe, done_trxframe
trxframe_ptr
 Convenience smart pointer typedef.
 

Enumerations

enum  TestEnums { efTestString, efTestInt, efTestFloat }
 Test enums to decide on how to use options framework.
 
enum  PmeLayoutTransform { GpuToHost, HostToGpu }
 A binary enum for spline data layout transformation.
 
enum  CodePath : int { CodePath::CPU, CodePath::GPU, CodePath::Count }
 Hardware code path being tested. More...
 
enum  PmeSolveAlgorithm : int { PmeSolveAlgorithm::Coulomb, PmeSolveAlgorithm::LennardJones, PmeSolveAlgorithm::Count }
 PME solver type. More...
 
enum  SimulationRunnerMdpSource { SimulationRunnerMdpSource::Undefined, SimulationRunnerMdpSource::String, SimulationRunnerMdpSource::File, SimulationRunnerMdpSource::Count }
 How the mdp file of the SimulationRunner is defined. More...
 
enum  ComparisonConditions : int {
  CompareIfBothFound, NoComparison, MustCompare, CompareIfReferenceFound,
  CompareIfTestFound, Count
}
 Enumeration controlling how data within trajectory frames are compared.
 
enum  ReferenceDataMode : int {
  ReferenceDataMode::Compare, ReferenceDataMode::CreateMissing, ReferenceDataMode::UpdateChanged, ReferenceDataMode::UpdateAll,
  ReferenceDataMode::Count
}
 Mode of operation for reference data handling. More...
 
enum  MdpParameterDatabase {
  Default, Pull, Awh, ExpandedEnsemble,
  Count
}
 Strong type denoting mdp parameters needed to test specific algorithms.
 

Functions

std::vector< char > awhDimParamSerialized (AwhCoordinateProviderType inputCoordinateProvider=AwhCoordinateProviderType::Pull, int inputCoordIndex=0, double inputOrigin=0.5, double inputEnd=1.5, double inputPeriod=0,double inputDiffusion=0.1/(0.144129616073222 *2))
 Prepare a memory buffer with serialized AwhDimParams. More...
 
static std::vector< char > awhBiasParamSerialized (AwhHistogramGrowthType eawhgrowth, double beta, double inputErrorScaling, ArrayRef< const std::vector< char >> dimensionParameterBuffers, int shareGroup, bool inputUserData, AwhTargetType eTargetType, bool scaleTargetByMetric)
 Prepare a memory buffer with serialized AwhBiasParams. More...
 
static std::vector< char > awhParamSerialized (AwhHistogramGrowthType eawhgrowth, AwhPotentialType eawhpotential, double beta, double inputErrorScaling, int64_t inputSeed, ArrayRef< const std::vector< char >> dimensionParameterBuffers, int biasShareGroup, bool inputUserData, AwhTargetType eTargetType, bool scaleTargetByMetric)
 Prepare a memory buffer with serialized AwhParams. More...
 
AwhTestParameters getAwhTestParameters (AwhHistogramGrowthType eawhgrowth, AwhPotentialType eawhpotential, ArrayRef< const std::vector< char >> dimensionParameterBuffers, bool inputUserData, double beta, bool useAwhFep, double inputErrorScaling, int numFepLambdaStates, int biasShareGroup, AwhTargetType eTargetType, bool scaleTargetByMetric)
 Helper function to set up the C-style AWH parameters for the test. More...
 
TrajectoryFrameWriterPointer createMinimalTrajectoryFrameWriter (const std::string &filename, const TopologyInformation &topology, const Selection &selection, OutputRequirements requirements)
 Create minimal TrajectoryFrameWriter using the provided builder. More...
 
static void splitAndAddValues (OptionsAssigner *assigner, const std::string &optionValues, TestEnums type)
 Helper function to split string with multiple values into option settings. More...
 
MessageStringCollector getSkipMessagesIfNecessary (const t_inputrec &inputRec, CodePath mode)
 Returns message describing why PME in this mode is not supported for this inputRec, or empty of messages when PME is supported.
 
uint64_t getSplineModuliDoublePrecisionUlps (int splineOrder)
 For double precision checks, the recursive interpolation and use of trig functions in make_dft_mod require a lot more flops, and thus opportunity for deviation between implementations.
 
PmeSafePointer pmeInitWrapper (const t_inputrec *inputRec, const CodePath mode, const DeviceContext *deviceContext, const DeviceStream *deviceStream, const PmeGpuProgram *pmeGpuProgram, const Matrix3x3 &box, const real ewaldCoeff_q, const real ewaldCoeff_lj)
 PME initialization.
 
PmeSafePointer pmeInitEmpty (const t_inputrec *inputRec)
 Simple PME initialization based on inputrec only.
 
std::unique_ptr
< StatePropagatorDataGpu > 
makeStatePropagatorDataGpu (const gmx_pme_t &pme, const DeviceContext *deviceContext, const DeviceStream *deviceStream)
 Make a GPU state-propagator manager.
 
void pmeInitAtoms (gmx_pme_t *pme, StatePropagatorDataGpu *stateGpu, const CodePath mode, const CoordinatesVector &coordinates, const ChargesVector &charges)
 PME initialization with atom data. More...
 
static realpmeGetRealGridInternal (const gmx_pme_t *pme)
 Getting local PME real grid pointer for test I/O.
 
static void pmeGetRealGridSizesInternal (const gmx_pme_t *pme, CodePath mode, IVec &gridSize, IVec &paddedGridSize)
 Getting local PME real grid dimensions.
 
static t_complex * pmeGetComplexGridInternal (gmx_pme_t *pme)
 Getting local PME complex grid pointer for test I/O.
 
static void pmeGetComplexGridSizesInternal (const gmx_pme_t *pme, IVec &gridSize, IVec &paddedGridSize)
 Getting local PME complex grid dimensions.
 
template<typename ValueType >
static void pmeGetGridAndSizesInternal (gmx_pme_t *, CodePath, ValueType *&, IVec &, IVec &)=delete
 Getting the PME grid memory buffer and its sizes - template definition.
 
template<>
void pmeGetGridAndSizesInternal< real > (gmx_pme_t *pme, CodePath mode, real *&grid, IVec &gridSize, IVec &paddedGridSize)
 Getting the PME real grid memory buffer and its sizes.
 
template<>
void pmeGetGridAndSizesInternal< t_complex > (gmx_pme_t *pme, CodePath, t_complex *&grid, IVec &gridSize, IVec &paddedGridSize)
 Getting the PME complex grid memory buffer and its sizes.
 
void pmePerformSplineAndSpread (gmx_pme_t *pme, CodePath mode, bool computeSplines, bool spreadCharges)
 PME spline calculation and charge spreading. More...
 
static realpmeGetSplineDataInternal (const gmx_pme_t *pme, PmeSplineDataType type, int dimIndex)
 Getting the internal spline data buffer pointer.
 
void pmePerformSolve (gmx_pme_t *pme, CodePath mode, PmeSolveAlgorithm method, real cellVolume, GridOrdering gridOrdering, bool computeEnergyAndVirial)
 PME solving.
 
void pmePerformGather (gmx_pme_t *pme, CodePath mode, ForcesVector &forces)
 PME force gathering.
 
void pmeFinalizeTest (const gmx_pme_t *pme, CodePath mode)
 PME test finalization before fetching the outputs.
 
static int getSplineParamFullIndex (int order, int splineIndex, int dimIndex, int atomIndex, int atomsPerWarp)
 Gets a unique index to an element in a spline parameter buffer. More...
 
static void pme_gpu_transform_spline_atom_data (PmeGpu *pmeGpu, const PmeAtomComm *atc, PmeSplineDataType type, int dimIndex, PmeLayoutTransform transform)
 Rearranges the atom spline data between the GPU and host layouts. Only used for test purposes so far, likely to be horribly slow. More...
 
void pmeSetSplineData (const gmx_pme_t *pme, CodePath mode, const SplineParamsDimVector &splineValues, PmeSplineDataType type, int dimIndex)
 Setting atom spline values/derivatives to be used in spread/gather. More...
 
void pmeSetGridLineIndices (gmx_pme_t *pme, CodePath mode, const GridLineIndicesVector &gridLineIndices)
 Setting gridline indices to be used in spread/gather. More...
 
size_t pmeGetGridPlainIndexInternal (const IVec &index, const IVec &paddedGridSize, GridOrdering gridOrdering)
 Getting plain index into the complex 3d grid.
 
template<typename ValueType >
static void pmeSetGridInternal (gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering, const SparseGridValuesInput< ValueType > &gridValues)
 Setting real or complex grid.
 
void pmeSetRealGrid (gmx_pme_t *pme, CodePath mode, const SparseRealGridValuesInput &gridValues)
 Setting real grid to be used in gather.
 
void pmeSetComplexGrid (gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering, const SparseComplexGridValuesInput &gridValues)
 Setting complex grid to be used in solve.
 
SplineParamsDimVector pmeGetSplineData (const gmx_pme_t *pme, CodePath mode, PmeSplineDataType type, int dimIndex)
 Getting the single dimension's spline values or derivatives.
 
GridLineIndicesVector pmeGetGridlineIndices (const gmx_pme_t *pme, CodePath mode)
 Getting the gridline indices.
 
template<typename ValueType >
static SparseGridValuesOutput
< ValueType > 
pmeGetGridInternal (gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering)
 Getting real or complex grid - only non zero values.
 
SparseRealGridValuesOutput pmeGetRealGrid (gmx_pme_t *pme, CodePath mode)
 Getting the real grid (spreading output of pmePerformSplineAndSpread())
 
SparseComplexGridValuesOutput pmeGetComplexGrid (gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering)
 Getting the complex grid output of pmePerformSolve()
 
PmeOutput pmeGetReciprocalEnergyAndVirial (const gmx_pme_t *pme, CodePath mode, PmeSolveAlgorithm method)
 Getting the reciprocal energy and virial.
 
std::string makeRefDataFileName ()
 Construct a refdata filename for a test. More...
 
std::string makeHardwareContextName (int hardwareContextIndex)
 Make a terse description of the hardware context suitable for use in naming the test case. More...
 
ArrayRef< const
PmeTestHardwareContext > 
getPmeTestHardwareContexts ()
 Return a view of the current PME test hardware contexts.
 
void registerTestsDynamically ()
 Declaration of function used to dynamically register GoogleTest tests. More...
 
static GpuAwareMpiStatus getGpuAwareMpiStatusForFftBackend (const FftBackend fftBackend)
 
static void checkRealGrid (const IVec realGridSizeFull, const ivec realGridSize, const ivec realGridSizePadded, ArrayRef< const real > inputRealGrid, ArrayRef< real > outputRealGridValues)
 Check that the real grid after forward and backward 3D transforms matches the input real grid.
 
static unsigned long int getRequiredNumberOfDevices ()
 
template<typename T >
ArrayRef< char > charArrayRefFromArray (T *data, size_t size)
 Convenience function to transform a view into one with base type of (non-const) char. More...
 
template<typename T >
void runTest (const DeviceContext &deviceContext, ArrayRef< T > input, ArrayRef< T > output)
 Does a device transfer of input to the device in gpuInfo, and back to output.
 
void convertRVecToFloat3OnHost (ArrayRef< gmx::RVec > rVecOutput, ArrayRef< const gmx::RVec > rVecInput)
 Tests the compatibility of RVec and float3 using the conversion on host. More...
 
void convertRVecToFloat3OnDevice (ArrayRef< gmx::RVec > rVecOutput, ArrayRef< const gmx::RVec > rVecInput, const TestDevice *testDevice)
 Tests the compatibility of RVec and float3 using the conversion on device. More...
 
void saveFloat3InRVecFormat (ArrayRef< gmx::RVec > rVecOutput, const float3 *float3Output, int numElements)
 
static __global__ void convertRVecToFloat3OnDevice_kernel (DeviceBuffer< float3 > gm_float3Output, DeviceBuffer< RVec > gm_rVecInput, const int size)
 GPU kernel to perform type conversion on the device. More...
 
template<typename T >
void fillInputContents (ArrayRef< T > inputRef, int scaleFactorForElements)
 Initialization overload for non-BasicVector.
 
template<typename T >
void fillInputContents (ArrayRef< BasicVector< T >> inputRef, int scaleFactorForElements)
 Initialization overload for BasicVector.
 
template<typename PaddedVectorOfT >
void resizeAndFillInput (PaddedVectorOfT *input, int newSize, int scaleFactorForElements)
 Dispatcher function for filling.
 
template<typename T >
void compareViews (ArrayRef< T > input, ArrayRef< T > output)
 Comparison overload for non-BasicVector.
 
template<typename T , typename U >
std::enable_if_t
< std::is_same_v
< std::remove_const_t< T >
, std::remove_const_t< U >
>, void > 
compareViewsIgnoreConst (ArrayRef< T > input, ArrayRef< U > output)
 Comparison for non-BasicVector ignoring const qualifiers.
 
template<typename T >
void compareViews (ArrayRef< BasicVector< T >> input, ArrayRef< BasicVector< T >> output)
 Comparison overload for BasicVector<T>
 
static const std::array
< gmx::RVec, 51 > 
c_waterPositions ({{{.130,-.041,-.291},{.120,-.056,-.192},{.044,-.005,-.327},{-.854,-.406,.477},{-.900,-.334,.425},{-.858,-.386,.575},{.351,-.061,.853},{.401,-.147,.859},{.416,.016,.850},{-.067,-.796,.873},{-.129,-.811,.797},{-.119,-.785,.958},{-.635,-.312,-.356},{-.629,-.389,-.292},{-.687,-.338,-.436},{.321,-.919,.242},{.403,-.880,.200},{.294,-1.001,.193},{-.404,.735,.728},{-.409,.670,.803},{-.324,.794,.741},{.461,-.596,-.135},{.411,-.595,-.221},{.398,-.614,-.059},{-.751,-.086,.237},{-.811,-.148,.287},{-.720,-.130,.152},{.202,.285,-.364},{.122,.345,-.377},{.192,.236,-.278},{-.230,-.485,.081},{-.262,-.391,.071},{-.306,-.548,.069},{.464,-.119,.323},{.497,-.080,.409},{.540,-.126,.258},{-.462,.107,.426},{-.486,.070,.336},{-.363,.123,.430},{.249,-.077,-.621},{.306,-.142,-.571},{.233,-.110,-.714},{-.922,-.164,.904},{-.842,-.221,.925},{-.971,-.204,.827},{.382,.700,.480},{.427,.610,.477},{.288,.689,.513},{.781,.264,-.113},{.848,.203,-.070},{.708,.283,-.048}}})
 Database of 51 water atom input positions (taken from spc216.gro) for use as test inputs.
 
static real returnSmallValue (real L)
 Small value used for testing points close to edges. More...
 
static void readTprInput (const TprAndFileManager *tprHandle, gmx_mtop_t *mtop, t_inputrec *ir)
 Reads a tpr for the test. More...
 
static void compareDifferentIndices (const StringTableBuilder &builder, const StringTableEntry &firstSymbol, const StringTableEntry &otherSymbol, bool expectedOutcome)
 Check that symbols obtained from symtab compare correctly. More...
 
static int readIndexFromSerializer (const StringTableEntry &symbol)
 Helper to obtain the integer index from an entry. More...
 
static void stringMatches (const StringTable &symtab, const StringTableEntry &symbol, const char *string)
 Helper function to check that a string in matches when looked up in non finalized table. More...
 
void checkEnergiesAgainstReferenceData (const std::string &energyFilename, const EnergyTermsToCompare &energyTermsToCompare, TestReferenceChecker *checker, MaxNumFrames maxNumEnergyFrames)
 Check a subset of the energies found in an energy file against reference data. More...
 
void checkEnergiesAgainstReferenceData (const std::string &energyFilename, const EnergyTermsToCompare &energyTermsToCompare, TestReferenceChecker *checker)
 Check a subset of the energies found in an energy file against reference data. More...
 
EnergyFrameReaderPtr openEnergyFileToReadTerms (const std::string &filename, const std::vector< std::string > &requiredEnergyTermNames)
 Open the file and return an object that can read the required terms from frames of an .edr file. More...
 
static t_enxframe * make_enxframe ()
 Helper function to obtain resources.
 
void done_enxframe (t_enxframe *fr)
 Helper function to clean up resources. More...
 
int getNumberOfTestOpenMPThreads ()
 Returns the number of OpenMP threads to use. More...
 
template<typename Reader , typename Comparator >
bool compareFrames (Reader referenceFrameReader, Reader testFrameReader, const Comparator &comparator)
 Compare the next frame returned by testFrameReader with the matching frame from referenceTestReader using comparator. More...
 
std::vector
< PeriodicOutputParameters
outputParameters ()
 Return vector of mdp parameter sets to test. More...
 
std::vector
< PropagationParameters
simplePropagationParameters ()
 Returns sets of simple simulation propagators.
 
std::vector
< PropagationParameters
propagationParametersWithCoupling ()
 Returns sets of simulation propagators including coupling. More...
 
std::vector
< PropagationParameters
propagationParametersWithConstraints ()
 Returns sets of simulation propagators including coupling. More...
 
static std::string getReplicaExchangeOutputFromLogFile (const std::string &logFileName)
 Return replica exchange related output from logfile. More...
 
void runGrompp (SimulationRunner *runner, const std::vector< SimulationOptionTuple > &options)
 
void runMdrun (SimulationRunner *runner, const std::vector< SimulationOptionTuple > &options)
 
void compareEnergies (const std::string &edr1Name, const std::string &edr2Name, const EnergyTermsToCompare &energyTermsToCompare, const MaxNumFrames maxNumFrames)
 
void compareTrajectories (const std::string &trajectory1Name, const std::string &trajectory2Name, const TrajectoryComparison &trajectoryComparison)
 
static void organizeMdpFile (SimulationRunner *runner, int nsteps=2)
 Build a simple .mdp file.
 
static void compareBox (const TrajectoryFrame &reference, const TrajectoryFrame &test, const TrajectoryFrameMatchSettings &matchSettings, const FloatingPointTolerance tolerance)
 Compares the box from reference and test according to the matchSettings and tolerance. More...
 
static std::vector< RVecputAtomsInBox (const TrajectoryFrame &frame)
 Help put all atom coordinates in frame into its box. More...
 
static bool shouldDoComparison (const ComparisonConditions comparisonConditions, const bool referenceIsEmpty, const bool testIsEmpty)
 Return whether the comparisonConditions and emptiness of reference and test frames means that a comparison should be attempted. More...
 
static void compareCoordinates (const TrajectoryFrame &reference, const TrajectoryFrame &test, const TrajectoryFrameMatchSettings &matchSettings, const FloatingPointTolerance tolerance)
 Compares the position coordinates from reference and test according to the matchSettings and tolerance.
 
static void compareVelocities (const TrajectoryFrame &reference, const TrajectoryFrame &test, const TrajectoryFrameMatchSettings &matchSettings, const FloatingPointTolerance tolerance)
 Compares the velocities from reference and test according to the matchSettings and tolerance.
 
static void compareForces (const TrajectoryFrame &reference, const TrajectoryFrame &test, const TrajectoryFrameMatchSettings &matchSettings, const FloatingPointTolerance tolerance)
 Compares the forces from reference and test according to the matchSettings and tolerance.
 
static bool shouldDoComparison (ArrayRef< const RVec > values, ComparisonConditions comparisonConditions)
 Return whether the comparisonConditions and emptiness of the test frame means that a comparison should be attempted. More...
 
static void checkPositionsAgainstReference (const TrajectoryFrame &frame, const TrajectoryFrameMatchSettings &matchSettings, const TrajectoryTolerances &tolerance, TestReferenceChecker *checker)
 Compares the positions from frame to reference data according to the matchSettings and tolerance.
 
static void checkVelocitiesAgainstReference (const TrajectoryFrame &frame, const TrajectoryFrameMatchSettings &matchSettings, const TrajectoryTolerances &tolerance, TestReferenceChecker *checker)
 Compares the velocities from frame to reference data according to the matchSettings and tolerance.
 
static void checkForcesAgainstReference (const TrajectoryFrame &frame, const TrajectoryFrameMatchSettings &matchSettings, const TrajectoryTolerances &tolerance, TestReferenceChecker *checker)
 Compares the forces from frame to reference data according to the matchSettings and tolerance.
 
static void checkBoxAgainstReference (const TrajectoryFrame &frame, const TrajectoryFrameMatchSettings &matchSettings, const TrajectoryTolerances &tolerance, TestReferenceChecker *checker)
 Compares the box from frame to reference data according to the matchSettings and tolerance.
 
void checkConfFile (TextInputStream *input, TestReferenceChecker *checker, const ConfMatchSettings &settings)
 Adds content of a gro file to TestReferenceChecker object. More...
 
int getNumberOfTestMpiRanks ()
 Returns the number of MPI ranks to use for an MPI test. More...
 
bool threadMpiTestRunner (std::function< void()> testBody)
 Helper function for GMX_MPI_TEST().
 
static std::string useString (const std::string s)
 Formatter to pass std::string through.
 
template<typename T >
std::string toEmptyString (const T)
 Formatter to ignore test parameters in a self-documenting way.
 
ReferenceDataMode referenceDataMode ()
 Returns the global mode describing how reference data is handled.
 
void initReferenceData (IOptionsContainer *options)
 Initializes reference data handling. More...
 
int gmxSetenv (const char *name, const char *value, int overwrite)
 Workaround to make setenv work on Windows.
 
int gmxUnsetenv (const char *name)
 Workaround to make unsetenv work on Windows.
 
bool isNumberOfPpRanksSupported (const std::string &simulationName, int possibleNumberOfPpRanks)
 Return whether the number of ranks is supported by the simulation simulationName in the database. More...
 
std::string reportNumbersOfPpRanksSupported (const std::string &simulationName)
 Return a string describing the numbers of ranks supported for the simulation simulationName in the database.
 
MdpFieldValues prepareMdpFieldValues (const std::string &simulationName, const std::string &integrator, const std::string &tcoupl, const std::string &pcoupl, MdpParameterDatabase additionalMdpParameters=MdpParameterDatabase::Default)
 Set up values for an .mdp file that permits a highly reproducible simulation. More...
 
MdpFieldValues prepareMdpFieldValues (const char *simulationName, const char *integrator, const char *tcoupl, const char *pcoupl, MdpParameterDatabase additionalMdpParameters=MdpParameterDatabase::Default)
 Set up values for an .mdp file that permits a highly reproducible simulation. More...
 
std::string prepareMdpFileContents (const MdpFieldValues &mdpFieldValues)
 Make a string containing an .mdp file from the mdpFieldValues. More...
 
const TestHardwareEnvironmentgetTestHardwareEnvironment ()
 Get the global test environment.
 
static
inline::testing::AssertionResult 
plainAssertHelper (const char *, const ::testing::AssertionResult &expr)
 Helper method for (EXPECT|ASSERT)_PLAIN. More...
 
void checkTestNameLength (std::optional< std::string > testName=std::nullopt)
 Gives a GoogleTest assertion if the test's name is too long. More...
 
void initTestUtils (const std::filesystem::path &dataPath, const std::filesystem::path &tempPath, bool usesMpi, bool usesHardwareDetection, bool registersDynamically, int *argc, char ***argv)
 Initializes the test utilities library. More...
 
void finalizeTestUtils (bool usesHardwareDetection, bool registersDynamically)
 Finalizes the test utilities library. More...
 
template<typename TestFixture , typename TestCase , typename Combinations >
void registerTests (const std::string &testSuiteName, const NameOfTestFromTuple< typename TestFixture::ParamType > &testNamer, const Combinations &combinations)
 Register tests dynamically based on the execution context. More...
 
template<typename TestFixture , typename TestCase , typename Combinations >
void registerTests (const std::string &testSuiteName, std::string(*makeBriefNameOfTestCase)(const typename::testing::TestParamInfo< typename TestFixture::ParamType > &), std::string(*makeFullNameOfTestCase)(const typename::testing::TestParamInfo< typename TestFixture::ParamType > &, const std::string &), const Combinations &combinations)
 DEPRECATED Register tests dynamically based on the execution context. More...
 
testing::Matcher< std::tuple
< float, float > > 
FloatEq (const FloatingPointTolerance &tolerance)
 Make matcher for floats for use with GoogleMock that compare equal when tolerance is satisifed. More...
 
testing::Matcher< std::tuple
< double, double > > 
DoubleEq (const FloatingPointTolerance &tolerance)
 Make matcher for doubles for use with GoogleMock that compare equal when tolerance is satisifed. More...
 
testing::Matcher< std::tuple
< real, real > > 
RealEq (const FloatingPointTolerance &tolerance)
 Make matcher for reals for use with GoogleMock that compare equal when tolerance is satisifed. More...
 
testing::Matcher< std::tuple
< BasicVector< real >
, BasicVector< real > > > 
RVecEq (const FloatingPointTolerance &tolerance)
 Make matcher for RVecs for use with GoogleMock that compare equal when tolerance is satisifed. More...
 
void registerTestOptions (const char *name, TestOptionsProvider *provider)
 Registers a test option provider with the test framework. More...
 
void initTestOptions (IOptionsContainer *options)
 Initializes the options from all registered test providers. More...
 
void done_trxframe (t_trxframe *fr)
 Helper function to free all resources. More...
 
void checkXvgFile (TextInputStream *input, TestReferenceChecker *checker, const XvgMatchSettings &settings)
 Adds content of xvg file to TestReferenceChecker object. More...
 
void initMPIOutput ()
 Customizes test output and test failure handling for MPI runs. More...
 
static void throwIfNonEmptyAndOnlyWhitespace (const std::string &s, const char *id)
 Throw a TestException if the caller tries to write particular refdata that can't work. More...
 
static double convertDoubleReferenceValue (const std::string &value)
 Helper function to parse a floating-point reference data value.
 
ReferenceDataEntry::EntryPointer readReferenceDataFile (const std::string &path)
 Loads reference data from an XML file. More...
 
void writeReferenceDataFile (const std::string &path, const ReferenceDataEntry &root)
 Saves reference data to an XML file. More...
 
void addNWaterMolecules (gmx_mtop_t *mtop, int numWaters)
 Adds water molecules with settles to topology. More...
 
static t_trxframe * make_trxframe ()
 Helper function to obtain resources.
 
void registerDynamicalPmeGatherTests (const Range< int > hardwareContextIndexRange)
 
void registerDynamicalPmeSolveTests (const Range< int > hardwareContextIndexRange)
 
void registerDynamicalPmeSplineSpreadTests (Range< int > contextIndexRange)
 Functions that dynamically register test cases. More...
 
void checkTrajectoryAgainstReferenceData (const std::string &trajectoryFilename, const TrajectoryComparison &trajectoryComparison, TestReferenceChecker *checker)
 Helper function comparing a trajectory to reference. More...
 
void checkTrajectoryAgainstReferenceData (const std::string &trajectoryFilename, const TrajectoryComparison &trajectoryComparison, TestReferenceChecker *checker, MaxNumFrames maxNumFrames)
 
Assertions for floating-point comparison

These routines extend (EXPECT|ASSERT)_(FLOAT|DOUBLE)_EQ and (EXPECT|ASSERT)_NEAR from Google Test to provide more flexible assertions for floating-point values.

See gmx::test::FloatingPointTolerance for the possible ways to specify the tolerance, and gmx::test::FloatingPointDifference for some additional details of the difference calculation.

template<typename FloatType >
static
inline::testing::AssertionResult 
assertEqualWithinTolerance (const char *expr1, const char *expr2, const char *, FloatType value1, FloatType value2, const FloatingPointTolerance &tolerance)
 Assertion predicate formatter for comparing two floating-point values. More...
 

Variables

constexpr double g_coords []
 Database of 21 test coordinates that represent a trajectory */. More...
 
static constexpr int c_numLambdaStates = 16
 The number of lambda states to use in the tests.
 
constexpr double g_forces []
 The forces, per sample, below just provide a template to base the forces on. More...
 
constexpr double g_sampleWeightCentral = 0.8
 
constexpr double g_sampleWeightNeighbor = 0.1
 
constexpr double g_sampleTimeStep = 0.1
 
constexpr int g_numPointsPerDim = 10
 
const char *const trajectoryFileNames []
 Character array of different file names to test. More...
 
const char *const setAtomsSupported []
 Names here work for setAtoms module. More...
 
const char *const setAtomsUnSupported [] = { "spc2-traj.trr", "spc2-traj.xtc", "spc2-traj.g96" }
 Names here don't work for setAtoms module.
 
const char *const anySupported []
 Names here work for stuff that has no specific requirements. More...
 
const char *const setVelocitySupported []
 Names here work for setVelocity module. More...
 
const char *const setVelocityUnSupported [] = { "spc2-traj.xtc", "spc2-traj.pdb", "spc2-traj.g96" }
 Names here don't work for setVelocity module.
 
const char *const setForceSupported []
 Names here work for setForce module. More...
 
const char *const setForceUnSupported []
 Names here don't work for setForce module. More...
 
const char *const setPrecisionSupported []
 Names here work for setPrecision module. More...
 
const char *const setPrecisionUnSupported []
 Names here don't work for setPrecision module. More...
 
const std::map< std::string,
Matrix3x3
c_inputBoxes
 A couple of valid inputs for boxes. More...
 
std::vector< int > c_inputPmeOrders { 3, 4, 5 }
 Valid PME orders for testing.
 
constexpr int64_t c_splineModuliSinglePrecisionUlps = 1
 Spline moduli are computed in double precision, so they're very good in single precision.
 
std::vector
< GpuFftTestGridParams > const 
inputGrids
 
std::vector< FftBackend > const inputBackends
 
static constexpr int c_threadsPerBlock = 256
 Number of HIP threads in a block.
 
constexpr real relativeTolerance = 0.5 * std::numeric_limits<real>::epsilon()
 Relative tolerance for the expected floating point rounding error when wrapping large numbers.
 
constexpr real czero = 0.0
 zero
 
constexpr real c0 = 0.3333333333333333
 test constant 0.0 + 1.0/3.0
 
constexpr real c1 = 1.7142857142857144
 test constant 1.0 + 5.0/7.0
 
constexpr real c2 = 2.6923076923076925
 test constant 2.0 + 9.0/13.0
 
constexpr real c3 = 3.8947368421052633
 test constant 3.0 + 17.0/19.0
 
constexpr real c4 = 4.793103448275862
 test constant 4.0 + 23.0/29.0
 
constexpr real c5 = 5.837837837837838
 test constant 5.0 + 31.0/37.0
 
constexpr real c6 = 6.953488372093023
 test constant 6.0 + 41.0/43.0
 
constexpr real c7 = 7.886792452830189
 test constant 7.0 + 47.0/53.0
 
constexpr real c8 = 8.967213114754099
 test constant 8.0 + 59.0/61.0
 
static PeriodicOutputParameters g_basicPeriodicOutputParameters
 Some common choices of periodic output mdp parameters to simplify defining values for the combinations under test. More...
 
static const char * g_butaneTopFileFormatString
 Format string for building a configurable .top file.
 
static std::mutex s_testHardwareEnvironmentMutex
 Mutex for making the test hardware environment.
 
static std::unique_ptr
< TestHardwareEnvironment
s_testHardwareEnvironment
 The test hardware environment.
 
static bool g_bDeleteFilesAfterTest = true
 Controls whether TestFileManager should delete temporary files after the test finishes. More...
 

Typedef Documentation

using gmx::test::XvgrTimeReadingParams = typedef std::tuple<bool, bool>

Convienience type for testing read_xvg_time.

Fields are: haveStartTime, haveEndTime

Enumeration Type Documentation

enum gmx::test::CodePath : int
strong

Hardware code path being tested.

Enumerator
CPU 

CPU code path.

GPU 

GPU code path.

Count 

Total number of code paths.

enum gmx::test::PmeSolveAlgorithm : int
strong

PME solver type.

Enumerator
Coulomb 

Coulomb electrostatics.

LennardJones 

Lennard-Jones.

Count 

Total number of solvers.

How the mdp file of the SimulationRunner is defined.

Enumerator
Undefined 

The default behavior. Will result in an empty mdp file.

String 

Mdp options are set via string using SimulationRunner::useStringAsMdpFile.

File 

Mdp options are read from a file set in SimulationRunner::useTopGroAndMdpFromFepTestDatabase.

Count 

Signals the last enum entry.

Function Documentation

void gmx::test::addNWaterMolecules ( gmx_mtop_t *  mtop,
int  numWaters 
)

Adds water molecules with settles to topology.

Generates test topology with numWaters tip3p molecules. Useful for testing topology methods that require a valid mtop.

Parameters
[in,out]mtopHandle to global topology.
[in]numWatersNumber of water molecules that should be added to the topology.
static std::vector<char> gmx::test::awhBiasParamSerialized ( AwhHistogramGrowthType  eawhgrowth,
double  beta,
double  inputErrorScaling,
ArrayRef< const std::vector< char >>  dimensionParameterBuffers,
int  shareGroup,
bool  inputUserData,
AwhTargetType  eTargetType,
bool  scaleTargetByMetric 
)
static

Prepare a memory buffer with serialized AwhBiasParams.

Parameters
[in]eawhgrowthWay to grow potential.
[in]betaValue for 1/(kB*T).
[in]inputErrorScalingFactor for initial error scaling.
[in]dimensionParameterBuffersBuffers containing the dimension parameters.
[in]shareGroupshare group for, potentially, sharing the bias between simulations
[in]inputUserDataIf there is a user provided PMF estimate.
[in]eTargetTypeTarget distribution type.
[in]scaleTargetByMetricWhether to scale the target distribution based on the friction metric.
std::vector< char > gmx::test::awhDimParamSerialized ( AwhCoordinateProviderType  inputCoordinateProvider = AwhCoordinateProviderType::Pull,
int  inputCoordIndex = 0,
double  inputOrigin = 0.5,
double  inputEnd = 1.5,
double  inputPeriod = 0,
double  inputDiffusion = 0.1/(0.144129616073222 *2) 
)

Prepare a memory buffer with serialized AwhDimParams.

static std::vector<char> gmx::test::awhParamSerialized ( AwhHistogramGrowthType  eawhgrowth,
AwhPotentialType  eawhpotential,
double  beta,
double  inputErrorScaling,
int64_t  inputSeed,
ArrayRef< const std::vector< char >>  dimensionParameterBuffers,
int  biasShareGroup,
bool  inputUserData,
AwhTargetType  eTargetType,
bool  scaleTargetByMetric 
)
static

Prepare a memory buffer with serialized AwhParams.

Parameters
[in]eawhgrowthWay to grow potential.
[in]eawhpotentialWhich potential to use.
[in]betaValue for 1/(kB*T).
[in]inputErrorScalingFactor for initial error scaling.
[in]inputSeedSeed value to use.
[in]dimensionParameterBuffersBuffers containing the dimension parameters.
[in]biasShareGroupshare group for, potentially, sharing the bias over simulations
[in]inputUserDataIf there is a user provided PMF estimate.
[in]eTargetTypeTarget distribution type.
[in]scaleTargetByMetricWhether to scale the target distribution based on the friction metric.
template<typename T >
ArrayRef<char> gmx::test::charArrayRefFromArray ( T *  data,
size_t  size 
)

Convenience function to transform a view into one with base type of (non-const) char.

This transformation is useful for using containers with C APIs where the function signature is not declared const even where the semantics of the usage actually are const.

Parameters
[in]dataThe data pointer.
[in]sizeThe size of the data pointer (in T).
Template Parameters
TThe base type of the container
void gmx::test::checkConfFile ( TextInputStream *  input,
TestReferenceChecker *  checker,
const ConfMatchSettings &  settings 
)

Adds content of a gro file to TestReferenceChecker object.

Parameters
[in]inputStream that provides the gro content.
[in,out]checkerChecker to use.
[in]settingsSettings to use for matching.

Parses a gro file from the input stream, and checks the contents against reference data (only first two lines for now).

See Also
ConfMatch
void gmx::test::checkEnergiesAgainstReferenceData ( const std::string &  energyFilename,
const EnergyTermsToCompare &  energyTermsToCompare,
TestReferenceChecker *  checker,
MaxNumFrames  maxNumEnergyFrames 
)

Check a subset of the energies found in an energy file against reference data.

Opens the energy file, loops over all frames, matching the indicated energies against refdata at the given tolerance.

Parameters
[in]energyFilenameThe name of an energy file.
[in]energyTermsToCompareSet of energies to match at given tolerances.
[in]checkerRoot checker for reference data.
[in]maxNumEnergyFramesThe maximum number of frames to check
Todo:
This is quite similar to the functionality used in PmeTest, and we should consider reducing the duplication.
void gmx::test::checkEnergiesAgainstReferenceData ( const std::string &  energyFilename,
const EnergyTermsToCompare &  energyTermsToCompare,
TestReferenceChecker *  checker 
)

Check a subset of the energies found in an energy file against reference data.

Convenience overload using all frames

See Also
checkEnergiesAgainstReferenceData(const std::string&, const EnergyTermsToCompare&, TestReferenceChecker*, MaxNumFrames)
void gmx::test::checkTrajectoryAgainstReferenceData ( const std::string &  trajectoryFilename,
const TrajectoryComparison &  trajectoryComparison,
TestReferenceChecker *  checker 
)

Helper function comparing a trajectory to reference.

This opens a trajectory file, loops over its frames, and uses the trajectoryComparison and checker arguments to check each frame to reference data.

Optionally, the max number of trajectory frames to be compared can be specified to allow to only test the first few frames of a simulation, e.g. to avoid failures due to numerical divergence.

void gmx::test::checkXvgFile ( TextInputStream *  input,
TestReferenceChecker *  checker,
const XvgMatchSettings &  settings 
)

Adds content of xvg file to TestReferenceChecker object.

Parameters
[in]inputStream that provides the xvg content.
[in,out]checkerChecker to use.
[in]settingsSettings to use for matching.

Parses an xvg file from the input stream, and checks the contents against reference data. settings can be used to customize the matching. Only a single data set is supported (but multiple columns work). A subset of xmgrace formatting is also checked; static content that is nearly always the same is skipped.

See Also
XvgMatch
static void gmx::test::compareBox ( const TrajectoryFrame &  reference,
const TrajectoryFrame &  test,
const TrajectoryFrameMatchSettings &  matchSettings,
const FloatingPointTolerance  tolerance 
)
static

Compares the box from reference and test according to the matchSettings and tolerance.

Todo:
This could be streamlined when we have a proper 3D matrix class and view.
static void gmx::test::compareDifferentIndices ( const StringTableBuilder builder,
const StringTableEntry firstSymbol,
const StringTableEntry otherSymbol,
bool  expectedOutcome 
)
static

Check that symbols obtained from symtab compare correctly.

Helper function to find out if two entries obtained by a symtab lookup are equivalent or not, according to testing criteria. Checks that the indices match before finalizing storage.

Parameters
[in]builderStringTableBuilder table that contains the entries to validate.
[in]firstSymbolHandle into builder obtained from placing string in builder.
[in]otherSymbolOther handle from obtained from separate string deposit.
[in]expectedOutcomeIf the handles should result in equal entries or not.
template<typename Reader , typename Comparator >
bool gmx::test::compareFrames ( Reader  referenceFrameReader,
Reader  testFrameReader,
const Comparator &  comparator 
)

Compare the next frame returned by testFrameReader with the matching frame from referenceTestReader using comparator.

Returns
True when a successful comparison was made
void gmx::test::convertRVecToFloat3OnDevice ( ArrayRef< gmx::RVec rVecOutput,
ArrayRef< const gmx::RVec rVecInput,
const TestDevice *  testDevice 
)

Tests the compatibility of RVec and float3 using the conversion on device.

Parameters
[out]rVecOutputData in RVec format for the output.
[in]rVecInputData in RVec format with the input.
[in]testDeviceTest herdware environment to get DeviceContext and DeviceStream from.
static __global__ void gmx::test::convertRVecToFloat3OnDevice_kernel ( DeviceBuffer< float3 >  gm_float3Output,
DeviceBuffer< RVec >  gm_rVecInput,
const int  size 
)
static

GPU kernel to perform type conversion on the device.

Parameters
[out]gm_float3OutputBuffer to write the output into.
[in]gm_rVecInputInput data in RVec format.
[in]sizeSize of the data buffers.
void gmx::test::convertRVecToFloat3OnHost ( ArrayRef< gmx::RVec rVecOutput,
ArrayRef< const gmx::RVec rVecInput 
)

Tests the compatibility of RVec and float3 using the conversion on host.

Parameters
[out]rVecOutputData in RVec format for the output.
[in]rVecInputData in RVec format with the input.
TrajectoryFrameWriterPointer gmx::test::createMinimalTrajectoryFrameWriter ( const std::string &  filename,
const TopologyInformation &  topology,
const Selection &  selection,
OutputRequirements  requirements 
)
inline

Create minimal TrajectoryFrameWriter using the provided builder.

Parameters
[in]filenameName of file to create object for.
[in]topologyReference to input top.
[in]selectionReference to input selection.
[in]requirementsRequirements for constructing OutputManagar.
Exceptions
InconsistentInputErrorWhen builder can not create the CoordinateFile.
Returns
unique_ptr to new CoordinateFile object.
void gmx::test::done_enxframe ( t_enxframe *  fr)

Helper function to clean up resources.

Helper function to free resources (NB free_enxframe only frees the contents, not the pointer itself)

void gmx::test::done_trxframe ( t_trxframe *  fr)

Helper function to free all resources.

Helper function to clean up resources.

testing::Matcher< std::tuple< double, double > > gmx::test::DoubleEq ( const FloatingPointTolerance &  tolerance)

Make matcher for doubles for use with GoogleMock that compare equal when tolerance is satisifed.

Used like

EXPECT_THAT(testDoubles, Pointwise(DoubleEq(tolerance), referenceDoubles));

testing::Matcher< std::tuple< float, float > > gmx::test::FloatEq ( const FloatingPointTolerance &  tolerance)

Make matcher for floats for use with GoogleMock that compare equal when tolerance is satisifed.

Used like

EXPECT_THAT(testFloats, Pointwise(FloatEq(tolerance), referenceFloats));

AwhTestParameters gmx::test::getAwhTestParameters ( AwhHistogramGrowthType  eawhgrowth,
AwhPotentialType  eawhpotential,
ArrayRef< const std::vector< char >>  dimensionParameterBuffers,
bool  inputUserData,
double  beta,
bool  useAwhFep,
double  inputErrorScaling,
int  numFepLambdaStates,
int  biasShareGroup,
AwhTargetType  eTargetType,
bool  scaleTargetByMetric 
)

Helper function to set up the C-style AWH parameters for the test.

Builds the test input data from serialized data.

int gmx::test::getNumberOfTestOpenMPThreads ( )

Returns the number of OpenMP threads to use.

Returns
the number specified using -ntomp option, or the default.
static std::string gmx::test::getReplicaExchangeOutputFromLogFile ( const std::string &  logFileName)
static

Return replica exchange related output from logfile.

All replica exchange related output in log files start with 'Repl', making extraction easy. This function also removes the printing of energy differences, as the log files are compared exactly, and energy differences will slightly vary between runs.

Parameters
logFileNameName of log file
Returns
Replica exchange related output in log file
static int gmx::test::getSplineParamFullIndex ( int  order,
int  splineIndex,
int  dimIndex,
int  atomIndex,
int  atomsPerWarp 
)
static

Gets a unique index to an element in a spline parameter buffer.

These theta/dtheta buffers are laid out for GPU spread/gather kernels. The index is wrt the execution block, in range(0, atomsPerBlock * order * DIM).

This is a wrapper, only used in unit tests.

Parameters
[in]orderPME order
[in]splineIndexSpline contribution index (from 0 to order - 1)
[in]dimIndexDimension index (from 0 to 2)
[in]atomIndexAtom index wrt the block.
[in]atomsPerWarpNumber of atoms processed by a warp.
Returns
Index into theta or dtheta array using GPU layout.
bool gmx::test::isNumberOfPpRanksSupported ( const std::string &  simulationName,
int  possibleNumberOfPpRanks 
)

Return whether the number of ranks is supported by the simulation simulationName in the database.

This method lets test runners understand when end-to-end tests should be expected to work.

std::string gmx::test::makeHardwareContextName ( int  hardwareContextIndex)

Make a terse description of the hardware context suitable for use in naming the test case.

The full hardware device description is used in a SCOPED_TRACE message, but that is too long for the test name and has too many possible characters that might break GoogleTest.

std::string gmx::test::makeRefDataFileName ( )

Construct a refdata filename for a test.

We want the same reference data to apply to every hardware context for which we test PME. That means we need to store it in a file whose name relates to the name of the test, but excluding the part related to the context.

EnergyFrameReaderPtr gmx::test::openEnergyFileToReadTerms ( const std::string &  filename,
const std::vector< std::string > &  requiredEnergyTermNames 
)

Open the file and return an object that can read the required terms from frames of an .edr file.

Parameters
[in]filenameName of the energy file to use
[in]requiredEnergyTermNamesNames of the energy terms that the caller requires to be present for an .edr file frame to be considered valid
Exceptions
FileIOErrorIf the .edr file cannot be opened
APIErrorIf any required energy term is not present in the file
std::bad_allocWhen out of memory

This function is intended to have the main responsibility for making EnergyFrameReader objects.

std::vector< PeriodicOutputParameters > gmx::test::outputParameters ( )

Return vector of mdp parameter sets to test.

These are constructed to observe the mdp parameter choices that only affect when output is written agree with those that were written from a reference run where output was done every step. The numbers are chosen in the context of the defaults in prepareDefaultMdpFieldValues().

Todo:
Test nstlog, nstdhdl, nstxout-compressed
static void gmx::test::pme_gpu_transform_spline_atom_data ( PmeGpu pmeGpu,
const PmeAtomComm *  atc,
PmeSplineDataType  type,
int  dimIndex,
PmeLayoutTransform  transform 
)
static

Rearranges the atom spline data between the GPU and host layouts. Only used for test purposes so far, likely to be horribly slow.

Parameters
[in]pmeGpuThe PME GPU structure.
[out]atcThe PME CPU atom data structure (with a single-threaded layout).
[in]typeThe spline data type (values or derivatives).
[in]dimIndexDimension index.
[in]transformLayout transform type
void gmx::test::pmeInitAtoms ( gmx_pme_t *  pme,
StatePropagatorDataGpu *  stateGpu,
const CodePath  mode,
const CoordinatesVector &  coordinates,
const ChargesVector &  charges 
)

PME initialization with atom data.

PME initialization with atom data and system box.

void gmx::test::pmePerformSplineAndSpread ( gmx_pme_t *  pme,
CodePath  mode,
bool  computeSplines,
bool  spreadCharges 
)

PME spline calculation and charge spreading.

PME spline computation and charge spreading.

void gmx::test::pmeSetGridLineIndices ( gmx_pme_t *  pme,
CodePath  mode,
const GridLineIndicesVector &  gridLineIndices 
)

Setting gridline indices to be used in spread/gather.

Setting gridline indices be used in spread/gather.

void gmx::test::pmeSetSplineData ( const gmx_pme_t *  pme,
CodePath  mode,
const SplineParamsDimVector &  splineValues,
PmeSplineDataType  type,
int  dimIndex 
)

Setting atom spline values/derivatives to be used in spread/gather.

Setting atom spline values or derivatives to be used in spread/gather.

MdpFieldValues gmx::test::prepareMdpFieldValues ( const std::string &  simulationName,
const std::string &  integrator,
const std::string &  tcoupl,
const std::string &  pcoupl,
MdpParameterDatabase  additionalMdpParameters = MdpParameterDatabase::Default 
)

Set up values for an .mdp file that permits a highly reproducible simulation.

An internal database of several kinds of simulation useful for such comparisons is available, whose simulationName keys are

  • argon12
  • argon5832
  • tip3p5
  • spc2
  • spc216
  • alanine_vsite_vacuo
  • alanine_vsite_solvated
  • glycine_vacuo
  • glycine_no_constraints_vacuo
  • nonanol_vacuo

Some of these systems are pretty minimal, because having few atoms means few interactions, highly reproducible forces, and allows tests to focus on the correctness of the implementation of high-level mdrun features. The boxes are of a reasonable size so that domain decomposition is possible. The pressure-coupling parameters are isotropic, and set up so that there will not be dramatic collapse of volume over the handful of MD steps that will be run. A single temperature-coupling group is used.

Parameters
[in]simulationNameThe name of the simulation, which indexes the database
[in]integratorThe integrator to use
[in]tcouplThe temperature-coupling algorithm to use
[in]pcouplThe pressure-coupling algorithm to use
[in]additionalMdpParametersAdditional mdp parameters to be added
Returns
Mdp file values
Exceptions
std::bad_allocif out of memory
std::out_of_rangeif simulationName is not in the database
MdpFieldValues gmx::test::prepareMdpFieldValues ( const char *  simulationName,
const char *  integrator,
const char *  tcoupl,
const char *  pcoupl,
MdpParameterDatabase  additionalMdpParameters = MdpParameterDatabase::Default 
)

Set up values for an .mdp file that permits a highly reproducible simulation.

An internal database of several kinds of simulation useful for such comparisons is available, whose simulationName keys are

  • argon12
  • argon5832
  • tip3p5
  • spc2
  • spc216
  • alanine_vsite_vacuo
  • alanine_vsite_solvated
  • glycine_vacuo
  • glycine_no_constraints_vacuo
  • nonanol_vacuo

Some of these systems are pretty minimal, because having few atoms means few interactions, highly reproducible forces, and allows tests to focus on the correctness of the implementation of high-level mdrun features. The boxes are of a reasonable size so that domain decomposition is possible. The pressure-coupling parameters are isotropic, and set up so that there will not be dramatic collapse of volume over the handful of MD steps that will be run. A single temperature-coupling group is used.

Parameters
[in]simulationNameThe name of the simulation, which indexes the database
[in]integratorThe integrator to use
[in]tcouplThe temperature-coupling algorithm to use
[in]pcouplThe pressure-coupling algorithm to use
[in]additionalMdpParametersAdditional mdp parameters to be added
Returns
Mdp file values
Exceptions
std::bad_allocif out of memory
std::out_of_rangeif simulationName is not in the database
std::string gmx::test::prepareMdpFileContents ( const MdpFieldValues &  mdpFieldValues)

Make a string containing an .mdp file from the mdpFieldValues.

Exceptions
std::bad_allocif out of memory
std::vector< PropagationParameters > gmx::test::propagationParametersWithConstraints ( )

Returns sets of simulation propagators including coupling.

These are chosen to cover the commonly used space of propagation algorithms on systems with constraints.

std::vector< PropagationParameters > gmx::test::propagationParametersWithCoupling ( )

Returns sets of simulation propagators including coupling.

These are chosen to cover the commonly used space of propagation algorithms togther with the perdiods between their actions. The periods tested are chosen to be mutually co-prime and distinct from the pair search and user output period (4), so that over the duration of a short simulation many kinds of simulation step behavior are tested.

static std::vector<RVec> gmx::test::putAtomsInBox ( const TrajectoryFrame &  frame)
static

Help put all atom coordinates in frame into its box.

This can perhaps go away when frame->x is a container.

static int gmx::test::readIndexFromSerializer ( const StringTableEntry symbol)
static

Helper to obtain the integer index from an entry.

As the index is only used during (de-) serialization, use this machinery to obtain it.

Parameters
[in]symbolSingle StringTableEntry to obtain the index of.
Returns
Integer index to be used to obtain value from StringTable.
static void gmx::test::readTprInput ( const TprAndFileManager *  tprHandle,
gmx_mtop_t *  mtop,
t_inputrec *  ir 
)
static

Reads a tpr for the test.

Reads a tpr to have access to the system information for print out.

Parameters
[in]tprHandleHandle to the tpr to red in.
[in]mtopPointer to topology datastructure to populate.
[in]irPointer to inputrec to populate.
testing::Matcher< std::tuple< real, real > > gmx::test::RealEq ( const FloatingPointTolerance &  tolerance)

Make matcher for reals for use with GoogleMock that compare equal when tolerance is satisifed.

Used like

EXPECT_THAT(testReals, Pointwise(RealEq(tolerance), referenceReals));

void gmx::test::registerDynamicalPmeSplineSpreadTests ( Range< int >  contextIndexRange)

Functions that dynamically register test cases.

This are called by registerTestsDynamically and customize the range of test cases to suit the available hardware.

template<typename TestFixture , typename TestCase , typename Combinations >
void gmx::test::registerTests ( const std::string &  testSuiteName,
const NameOfTestFromTuple< typename TestFixture::ParamType > &  testNamer,
const Combinations &  combinations 
)

Register tests dynamically based on the execution context.

This template reduces code duplication across the dynamically registered tests, letting them register their tests more tersely.

Template Parameters
TestFixtureThe type of the test fixture
TestCaseThe type of the test case (derived from TestFixture)
CombinationsThe interal GoogleTest type describing the return from testing::Combine() intended to generate test parameters of type TestFixture::ParamType (which is typically a tuple).
Parameters
[in]testSuiteNameThe name of the test suite that shares the TestFixture
[in]testNamerFunctor to make the full name of the test case
[in]combinationsA generator of test values produced with testing::Combine()

Note that Combinations is actually well defined relative to TestFixture::ParamType, but its concrete type is an internal GoogleTest type, so we do not want to express it in code. In C++20, it would be better to declare the function parameter like const auto& combinations to achieve the same effect of hiding the concrete type.

template<typename TestFixture , typename TestCase , typename Combinations >
void gmx::test::registerTests ( const std::string &  testSuiteName,
std::string(*)(const typename::testing::TestParamInfo< typename TestFixture::ParamType > &)  makeBriefNameOfTestCase,
std::string(*)(const typename::testing::TestParamInfo< typename TestFixture::ParamType > &, const std::string &)  makeFullNameOfTestCase,
const Combinations &  combinations 
)

DEPRECATED Register tests dynamically based on the execution context.

New tests should use the above registerTests method. This method will be removed as part of #5027.

This template reduces code duplication across the dynamically registered tests, letting them register their tests more tersely.

Template Parameters
TestFixtureThe type of the test fixture
TestCaseThe type of the test case (derived from TestFixture)
CombinationsThe interal GoogleTest type describing the return from testing::Combine() intended to generate test parameters of type TestFixture::ParamType (which is typically a tuple).
Parameters
[in]testSuiteNameThe name of the test suite that shares the TestFixture
[in]makeBriefNameOfTestCaseFunction that will make the brief name of the test case, used for naming the refdata file
[in]makeFullNameOfTestCaseFunction that will make the full name of the test case
[in]combinationsA generator of test values produced with testing::Combine()

Note that Combinations is actually well defined relative to TestFixture::ParamType, but its concrete type is an internal GoogleTest type, so we do not want to express it in code. In C++20, it would be better to declare the function parameter like const auto& combinations to achieve the same effect of hiding the concrete type.

void gmx::test::registerTestsDynamically ( )

Declaration of function used to dynamically register GoogleTest tests.

When a test binary uses gmx_add_gtest_executable(exename DYNAMIC_REGISTRATION ...) it must provide an implementation of this method. The method is called before RUN_ALL_TESTS() and is expected to call testing::RegisterTest to register tests dynamically. This approach might be necessary to run the tests in a stable way over whichever hardware is detected at run time.

Normal test binaries do not need to implement this function.

gmx::test::TestHardwareEnvironment::gmxSetUp() should be called before this method, in case the test hardware environment is needed to help decide which tests to register.

static real gmx::test::returnSmallValue ( real  L)
static

Small value used for testing points close to edges.

The value is defined a bit arbitrarily. It should be small enough to test edge cases but not so small that the test fails because of rounding errors.

testing::Matcher< std::tuple< RVec, RVec > > gmx::test::RVecEq ( const FloatingPointTolerance &  tolerance)

Make matcher for RVecs for use with GoogleMock that compare equal when tolerance is satisifed.

Used like

EXPECT_THAT(testRVecs, Pointwise(RVecEq(tolerance), referenceRVecs));

static bool gmx::test::shouldDoComparison ( const ComparisonConditions  comparisonConditions,
const bool  referenceIsEmpty,
const bool  testIsEmpty 
)
static

Return whether the comparisonConditions and emptiness of reference and test frames means that a comparison should be attempted.

This allows the framework to determine whether it is an error if a comparison cannot be made.

static bool gmx::test::shouldDoComparison ( ArrayRef< const RVec >  values,
ComparisonConditions  comparisonConditions 
)
static

Return whether the comparisonConditions and emptiness of the test frame means that a comparison should be attempted.

This allows the framework to determine whether it is an error if a comparison cannot be made.

static void gmx::test::splitAndAddValues ( OptionsAssigner *  assigner,
const std::string &  optionValues,
TestEnums  type 
)
static

Helper function to split string with multiple values into option settings.

Parameters
[in]assignerOptions assigner to use.
[in]optionValuesString to split that contains option values.
[in]typeDetermine which input time we are using.
static void gmx::test::stringMatches ( const StringTable symtab,
const StringTableEntry symbol,
const char *  string 
)
static

Helper function to check that a string in matches when looked up in non finalized table.

Checks that a string looked up by using the index in the symbol table matches the string stored in the wrapper object obtained by entering a string.

Parameters
[in]symtabSymbol table that contains the entries.
[in]symbolThe entry obtained from placing a string in the symbol table.
[in]stringThe string the entry should match.
static void gmx::test::throwIfNonEmptyAndOnlyWhitespace ( const std::string &  s,
const char *  id 
)
static

Throw a TestException if the caller tries to write particular refdata that can't work.

If the string to write is non-empty and has only whitespace, TinyXML2 can't read it correctly, so throw an exception for this case, so that we can't accidentally use it and run into mysterious problems.

Todo:
Eliminate this limitation of TinyXML2. See e.g. https://github.com/leethomason/tinyxml2/issues/432

Variable Documentation

const char* const gmx::test::anySupported[]
Initial value:
= { "spc2-traj.trr",
"spc2-traj.xtc",
"spc2-traj.g96" }

Names here work for stuff that has no specific requirements.

PDB and GRO format are not tested here because they also require atoms information that is incompatible with the other output formats.

const std::map< std::string, Matrix3x3 > gmx::test::c_inputBoxes
Initial value:
= {
{ "rect", { { 8.0F, 0.0F, 0.0F, 0.0F, 3.4F, 0.0F, 0.0F, 0.0F, 2.0F } } },
{ "tric", { { 7.0F, 0.0F, 0.0F, 0.0F, 4.1F, 0.0F, 3.5F, 2.0F, 12.2F } } },
}

A couple of valid inputs for boxes.

PeriodicOutputParameters gmx::test::g_basicPeriodicOutputParameters
static
Initial value:
= {
{ "nstenergy", "0" }, { "nstlog", "0" }, { "nstxout", "0" },
{ "nstvout", "0" }, { "nstfout", "0" }, { "nstxout-compressed", "0" },
{ "nstdhdl", "0" }, { "description", "unknown" }
}

Some common choices of periodic output mdp parameters to simplify defining values for the combinations under test.

bool gmx::test::g_bDeleteFilesAfterTest = true
static

Controls whether TestFileManager should delete temporary files after the test finishes.

constexpr double gmx::test::g_coords
Initial value:
= { 0.62, 0.70, 0.68, 0.80, 0.93, 0.87, 1.16, 1.14, 0.95, 0.89, 0.91,
0.86, 0.88, 0.79, 0.75, 0.82, 0.74, 0.70, 0.68, 0.71, 0.73 }

Database of 21 test coordinates that represent a trajectory */.

Database of 80 test coordinates (fraction of point range) that represent a trajectory.

constexpr double gmx::test::g_forces[]
Initial value:
= {
0.10, 0.12, 0.15, 0.18, 0.10, 0.24, 0.26, 0.80, 0.84, 0.85, 0.83, 0.82, 0.65, 0.60, 0.73, 0.65,
0.45, 0.50, 0.65, 0.55, 0.56, 0.55, 0.50, 0.50, 0.53, 0.50, 0.40, 0.38, 0.18, 0.18, 0.10, 0.09,
0.13, 0.13, 0.13, 0.15, 0.20, 0.35, 0.50, 0.54, 0.30, 0.25, 0.35, 0.38, 0.23, 0.40, 0.50, 0.15,
0.25, 0.40, 0.50, 0.55, 0.53, 0.50, 0.32, 0.14, 0.20, 0.12, 0.15, 0.20, 0.33, 0.33, 0.35, 0.38,
0.62, 0.56, 0.64, 0.58, 0.66, 0.58, 0.58, 0.40, 0.32, 0.38, 0.50, 0.50, 0.30, 0.20, 0.20, 0.20
}

The forces, per sample, below just provide a template to base the forces on.

std::vector<FftBackend> const gmx::test::inputBackends
Initial value:
{
}
std::vector<GpuFftTestGridParams> const gmx::test::inputGrids
Initial value:
{ { IVec{ 5, 6, 9 }, 4, 1 },
{ IVec{ 5, 6, 9 }, 2, 2 },
{ IVec{ 5, 5, 10 }, 4, 1 },
{ IVec{ 5, 5, 10 }, 2, 2 } }
BasicVector< int > IVec
Shorthand for C++ ivec-equivalent type.
Definition: vectypes.h:344
const char* const gmx::test::setAtomsSupported[]
Initial value:
= {
"spc2-traj.gro",
"spc2-traj.pdb",
}

Names here work for setAtoms module.

const char* const gmx::test::setForceSupported[]
Initial value:
= {
"spc2-traj.trr",
}

Names here work for setForce module.

const char* const gmx::test::setForceUnSupported[]
Initial value:
= { "spc2-traj.xtc",
"spc2-traj.pdb",
"spc2-traj.gro",
"spc2-traj.g96" }

Names here don't work for setForce module.

const char* const gmx::test::setPrecisionSupported[]
Initial value:
= {
"spc2-traj.xtc",
}

Names here work for setPrecision module.

const char* const gmx::test::setPrecisionUnSupported[]
Initial value:
= { "spc2-traj.trr",
"spc2-traj.pdb",
"spc2-traj.gro",
"spc2-traj.g96" }

Names here don't work for setPrecision module.

const char* const gmx::test::setVelocitySupported[]
Initial value:
= {
"spc2-traj.gro",
"spc2-traj.trr",
}

Names here work for setVelocity module.

const char* const gmx::test::trajectoryFileNames[]
Initial value:
= { "spc2-traj.trr",
"spc2-traj.xtc", "spc2-traj.pdb",
"spc2-traj.gro", "spc2-traj.g96" }

Character array of different file names to test.