Separate simulation database used in tests
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 4 Sep 2018 13:16:06 +0000 (15:16 +0200)
committerPaul Bauer <paul.bauer.q@gmail.com>
Fri, 7 Sep 2018 07:21:54 +0000 (09:21 +0200)
Change-Id: Id76b6cf1438b5b432ec51e98d2ce170bba01caa2

src/programs/mdrun/tests/CMakeLists.txt
src/programs/mdrun/tests/mdruncomparison.h
src/programs/mdrun/tests/rerun.cpp
src/programs/mdrun/tests/simulationdatabase.cpp [moved from src/programs/mdrun/tests/mdruncomparison.cpp with 98% similarity]
src/programs/mdrun/tests/simulationdatabase.h [new file with mode: 0644]

index 8d5b6f801b0588269abe386073778c4b9b552a81..45d9412d2d16245b19d4ed2998a50b23be7fa9ef 100644 (file)
@@ -35,8 +35,8 @@
 # make an "object library" for code that we re-use for both kinds of tests
 add_library(mdrun_test_objlib OBJECT
     energyreader.cpp
-    mdruncomparison.cpp
     moduletest.cpp
+    simulationdatabase.cpp
     terminationhelper.cpp
     # PME tests
     pmetest.cpp
index 2dcfff52632a0f3904cc6b9ef51d1b514557098a..4c19e72103bfce8ebb253e5b97f28cc5250e6d0a 100644 (file)
 #define GMX_MDRUN_TESTS_MDRUNCOMPARISON_H
 
 #include <functional>
-#include <map>
-#include <string>
-#include <utility>
-#include <vector>
+#include <memory>
 
 #include <gtest/gtest.h>
 
-#include "testutils/cmdlinetest.h"
-
-#include "moduletest.h"
-
 namespace gmx
 {
 
 namespace test
 {
 
-//! Helper typedef
-using MdpFieldValues = std::map<std::string, std::string>;
-
-/*! \brief 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 \c simulationName keys are
- *     - argon12
- *     - argon5832
- *     - spc5
- *     - spc216
- *     - alanine_vsite_vacuo
- *     - alanine_vsite_solvated
- *     - nonanol
- *
- * 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.
- *
- * \param[in]    simulationName   The name of the simulation, which indexes the database
- * \param[in]    integrator       The integrator to use
- * \param[in]    tcoupl           The temperature-coupling algorithm to use
- * \param[in]    pcoupl           The pressure-coupling algorithm to use
- * \return                        Mdp file values
- *
- * \throws  std::bad_alloc     if out of memory
- *          std::out_of_range  if \c simulationName is not in the database */
-MdpFieldValues
-prepareMdpFieldValues(const char *simulationName,
-                      const char *integrator,
-                      const char *tcoupl,
-                      const char *pcoupl);
-
-/*! \brief Make a string containing an .mdp file from the \c mdpFieldValues.
- *
- * \throws  std::bad_alloc     if out of memory */
-std::string
-prepareMdpFileContents(const MdpFieldValues &mdpFieldValues);
-
 /*! \internal
  * \brief Manages returning a pair of frames from two
  * equivalent simulations that are meaningful to compare. */
index e6b153a9de431d29639b9f54f4e65bf8fbced140..5ee7fb5b10bf57a7b5ffd60bdad1341e5cb2f9b3 100644 (file)
@@ -65,6 +65,8 @@
 #include "energycomparison.h"
 #include "energyreader.h"
 #include "mdruncomparison.h"
+#include "moduletest.h"
+#include "simulationdatabase.h"
 #include "trajectorycomparison.h"
 #include "trajectoryreader.h"
 
similarity index 98%
rename from src/programs/mdrun/tests/mdruncomparison.cpp
rename to src/programs/mdrun/tests/simulationdatabase.cpp
index 736b739afce06120e5e9bf679fa45afb3c16727a..72ff4bb6a2d1f13a602a20605431a3be1b9cb1d0 100644 (file)
  */
 /*! \internal \file
  * \brief
- * Implements declarations from in mdruncomparison.h.
+ * Implements declarations from in simulationdatabase.h
  *
  * \author Mark Abraham <mark.j.abraham@gmail.com>
  * \ingroup module_mdrun_integration_tests
  */
 #include "gmxpre.h"
 
-#include "mdruncomparison.h"
+#include "simulationdatabase.h"
 
 #include <map>
 #include <string>
-#include <utility>
-#include <vector>
 
 #include "gromacs/utility/stringutil.h"
 
diff --git a/src/programs/mdrun/tests/simulationdatabase.h b/src/programs/mdrun/tests/simulationdatabase.h
new file mode 100644 (file)
index 0000000..cafeb04
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2018, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \libinternal
+ *
+ * \brief Functionality for testing whether calls to mdrun produce the
+ * same energy and force quantities when they should do so.
+ */
+#ifndef GMX_MDRUN_TESTS_SIMULATIONDATABASE_H
+#define GMX_MDRUN_TESTS_SIMULATIONDATABASE_H
+
+#include <map>
+#include <string>
+
+namespace gmx
+{
+
+namespace test
+{
+
+//! Helper typedef
+using MdpFieldValues = std::map<std::string, std::string>;
+
+/*! \brief 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 \c simulationName keys are
+ *     - argon12
+ *     - argon5832
+ *     - spc5
+ *     - spc216
+ *     - alanine_vsite_vacuo
+ *     - alanine_vsite_solvated
+ *     - nonanol
+ *
+ * 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.
+ *
+ * \param[in]    simulationName   The name of the simulation, which indexes the database
+ * \param[in]    integrator       The integrator to use
+ * \param[in]    tcoupl           The temperature-coupling algorithm to use
+ * \param[in]    pcoupl           The pressure-coupling algorithm to use
+ * \return                        Mdp file values
+ *
+ * \throws  std::bad_alloc     if out of memory
+ *          std::out_of_range  if \c simulationName is not in the database */
+MdpFieldValues
+prepareMdpFieldValues(const char *simulationName,
+                      const char *integrator,
+                      const char *tcoupl,
+                      const char *pcoupl);
+
+/*! \brief Make a string containing an .mdp file from the \c mdpFieldValues.
+ *
+ * \throws  std::bad_alloc     if out of memory */
+std::string
+prepareMdpFileContents(const MdpFieldValues &mdpFieldValues);
+
+} // namespace test
+} // namespace gmx
+
+#endif