Update instructions in containers.rst
[gromacs.git] / src / programs / mdrun / tests / terminationhelper.h
blob74fa419991d845512b4be3621157faaa99c22233
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2016,2018,2019, 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.
36 /*! \internal \file
37 * \brief Declares functionality used to test mdrun termination
38 * functionality under different conditions
40 * \author Mark Abraham <mark.j.abraham@gmail.com>
41 * \ingroup module_mdrun_integration_tests
43 #ifndef GMX_MDRUN_TESTS_TERMINATIONHELPER_H
44 #define GMX_MDRUN_TESTS_TERMINATIONHELPER_H
46 #include "testutils/cmdlinetest.h"
48 #include "moduletest.h"
50 namespace gmx
52 namespace test
55 /*! \internal
56 * \brief Help test mdrun termination behaviour
58 * This helper class provides re-usable code to ensure that some
59 * termination behaviour of mdrun works. It runs a simulation that
60 * stops after a very short -maxh time, writes a checkpoint, checks
61 * that the checkpoint exists, and then restarts with it (probably
62 * doing no MD steps in the restart).
64 * \todo This approach is not very elegant, but "stuff doesn't
65 * segfault or give a fatal error" is a useful result. We can improve
66 * it when we can mock out more do_md() functionality. Before that,
67 * we'd probably prefer not to run this test case in per-patchset
68 * verification, but this is the best we can do for now.
70 * \ingroup module_mdrun_integration_tests
72 class TerminationHelper
74 public:
75 //! Constructor
76 TerminationHelper(TestFileManager* fileManager, CommandLine* mdrunCaller, SimulationRunner* runner);
77 /*! \brief Do a short simulation, likely terminated by -maxh
79 * \param[in] expectedCptFileName The name of the checkpoint
80 * file that mdrun will write (which has to be customizable,
81 * if we are testing a multi-simulation). */
82 void runFirstMdrun(const std::string& expectedCptFileName);
83 //! Check that the restart works, but don't do any more MD steps.
84 void runSecondMdrun();
85 //! Check that the restart works without appending, but don't do any more MD steps.
86 void runSecondMdrunWithNoAppend();
88 protected:
89 //! Object to help call mdrun
90 CommandLine* mdrunCaller_;
91 //! Object to coordinate running a simulation
92 SimulationRunner* runner_;
95 } // namespace test
96 } // namespace gmx
98 #endif