SYCL: Avoid using no_init read accessor in rocFFT
[alexxy/gromacs.git] / src / gromacs / mdrun / legacysimulator.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2015,2016,2017,2018,2019,2020, 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.
8  *
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.
13  *
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.
18  *
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.
23  *
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.
31  *
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.
34  */
35 /*! \internal
36  * \brief Declares the simulator interface for mdrun
37  *
38  * \author David van der Spoel <david.vanderspoel@icm.uu.se>
39  * \author Mark Abraham <mark.j.abraham@gmail.com>
40  * \ingroup module_mdrun
41  */
42 #ifndef GMX_MDRUN_LEGACYSIMULATOR_H
43 #define GMX_MDRUN_LEGACYSIMULATOR_H
44
45 #include <cstdio>
46
47 #include <memory>
48
49 #include "gromacs/utility/basedefinitions.h"
50 #include "gromacs/utility/real.h"
51
52 #include "isimulator.h"
53
54 namespace gmx
55 {
56
57 //! Function type for simulator code.
58 using SimulatorFunctionType = void();
59
60 /*! \internal
61  * \brief Struct to handle setting up and running the different simulation types.
62  *
63  * This struct is a mere aggregate of parameters to pass to run a
64  * simulation, so that future changes to names and types of them consume
65  * less time when refactoring other code.
66  *
67  * Having multiple simulation types as member functions isn't a good
68  * design, and we definitely only intend one to be called, but the
69  * goal is to make it easy to change the names and types of members
70  * without having to make identical changes in several places in the
71  * code. Once many of them have become modules, we should change this
72  * approach.
73  */
74 class LegacySimulator : public ISimulator, private LegacySimulatorData
75 {
76 private:
77     //! Implements the normal MD simulations.
78     SimulatorFunctionType do_md;
79     //! Implements the rerun functionality.
80     SimulatorFunctionType do_rerun;
81     //! Implements steepest descent EM.
82     SimulatorFunctionType do_steep;
83     //! Implements conjugate gradient energy minimization
84     SimulatorFunctionType do_cg;
85     //! Implements onjugate gradient energy minimization using the L-BFGS algorithm
86     SimulatorFunctionType do_lbfgs;
87     //! Implements normal mode analysis
88     SimulatorFunctionType do_nm;
89     //! Implements test particle insertion
90     SimulatorFunctionType do_tpi;
91     //! Implements MiMiC QM/MM workflow
92     SimulatorFunctionType do_mimic;
93     // Use the constructor of the base class
94     using LegacySimulatorData::LegacySimulatorData;
95
96 public:
97     // Only builder can construct
98     friend class SimulatorBuilder;
99
100     /*! \brief Function to run the correct SimulatorFunctionType,
101      * based on the .mdp integrator field. */
102     void run() override;
103 };
104
105 } // namespace gmx
106
107 #endif // GMX_MDRUN_LEGACYSIMULATOR_H