Use trivalue option for GMX_HWLOC
[gromacs.git] / src / programs / mdrun / tests / mdruncomparisonfixture.h
blob10de82489a537dffcad7662d460ba607c0554299
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2016, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
35 /*! \libinternal
37 * \brief Functionality for testing whether calls to mdrun produce the
38 * same energy and force quantities when they should do so.
40 #ifndef GMX_MDRUN_TESTS_MDRUNCOMPARISONFIXTURE_H
41 #define GMX_MDRUN_TESTS_MDRUNCOMPARISONFIXTURE_H
43 #include <map>
44 #include <string>
45 #include <utility>
46 #include <vector>
48 #include <gtest/gtest.h>
50 #include "testutils/cmdlinetest.h"
52 #include "moduletest.h"
54 namespace gmx
57 namespace test
60 class EnergyFrame;
61 class TrajectoryFrame;
62 class FloatingPointTolerance;
64 /*! \libinternal
65 * \brief Declares abstract base text fixture class for integration
66 * tests of mdrun functionality that will compare multiple calls to
67 * mdrun.
69 * An internal database of several kinds of simulation useful for such
70 * comparisons is available.
72 * Any method in this class may throw std::bad_alloc if out of memory.
74 * \ingroup module_mdrun_integration_tests
76 class MdrunComparisonFixture : public MdrunTestFixture
78 public:
79 //! Destructor
80 virtual ~MdrunComparisonFixture();
81 //! Helper typedef
82 typedef std::map<std::string, std::string> MdpFieldValues;
83 /*! \brief Prepare .mdp values to do a simulation
85 * A database of several kinds of simulation useful for different
86 * kinds of tests is available.
87 * - argon12
88 * - argon5832
89 * - spc5
90 * - spc216
91 * - alanine_vsite_vacuo
92 * - alanine_vsite_solvated
93 * - nonanol
95 * Some of these systems are pretty minimal, because having
96 * few atoms means few interactions, highly reproducible
97 * forces, and allows tests to focus on the correctness of the
98 * implementation of high-level mdrun features. The boxes are
99 * of a reasonable size so that domain decomposition is
100 * possible. The pressure-coupling parameters are isotropic,
101 * and set up so that there will not be dramatic collapse of
102 * volume over the handful of MD steps that will be run. A
103 * single temperature-coupling group is used.
105 * This is separate from prepareMdpFile, so that derived
106 * classes can react to the .mdp settings, e.g. by stopping a
107 * run after half the steps.
109 * \throws std::bad_alloc if out of memory
110 * std::out_of_range if \c simulationName is not in the database */
111 MdpFieldValues prepareMdpFieldValues(const char *simulationName);
112 /*! \brief Set up an .mdp file that permits a highly reproducible
113 * simulation.
115 * \throws std::bad_alloc if out of memory */
116 void prepareMdpFile(const MdpFieldValues &mdpFieldValues,
117 const char *integrator,
118 const char *tcoupl,
119 const char *pcoupl);
120 /*! \brief Run mdrun two ways in a test. Subclasses must override this method.
122 * It is expected that this method calls
123 * prepareMdpFieldValues() and prepareMdpFile() to help set up
124 * a call to grompp with gromppCallerRef. Then mdrun will be
125 * called and perhaps energies and forces compared. */
126 virtual void runTest(const CommandLine &gromppCallerRef,
127 const char *simulationName,
128 const char *integrator,
129 const char *tcoupl,
130 const char *pcoupl,
131 FloatingPointTolerance tolerance) = 0;
132 //! Convenience overload of runTest() for cases that don't need to customize the command line for grompp
133 virtual void runTest(const char *simulationName,
134 const char *integrator,
135 const char *tcoupl,
136 const char *pcoupl,
137 FloatingPointTolerance tolerance);
140 } // namespace test
141 } // namespace gmx
143 #endif