Fix random typos
[alexxy/gromacs.git] / src / gromacs / mdtypes / imdpoptionprovider.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2016,2017,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.
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 /*! \libinternal \file
36  * \brief
37  * Declares gmx::IMdpOptionProvider.
38  *
39  * See \ref page_mdmodules for an overview of this and associated interfaces.
40  *
41  * \inlibraryapi
42  * \ingroup module_mdtypes
43  */
44 #ifndef GMX_MDTYPES_IMDPOPTIONPROVIDER_H
45 #define GMX_MDTYPES_IMDPOPTIONPROVIDER_H
46
47 namespace gmx
48 {
49
50 class IKeyValueTreeTransformRules;
51 class IOptionsContainerWithSections;
52 class KeyValueTreeObjectBuilder;
53
54 /*! \libinternal \brief
55  * Interface for handling mdp/tpr input to a mdrun module.
56  *
57  * This interface provides a mechanism for modules to contribute data that
58  * traditionally has been kept in t_inputrec.  This is essentially parameters
59  * read from an mdp file and subsequently stored in a tpr file.
60  *
61  * The main method to implement is initMdpOptions().  This declares a set of
62  * options in nested sections.  When declaring options, the module defines its
63  * own internal variables where the values will be stored (see \ref
64  * module_options for an overview).  The section structure for the options also
65  * defines an internal data representation in the form of a generic key-value
66  * tree.  This is used to store the values in the tpr file, and also for
67  * broadcasting, gmx dump, and gmx check.
68  *
69  * Implementation of initMdpTransform() is required for populating the options
70  * from the current flat mdp format.  It specifies how the mdp parameters map
71  * into the options structure/internal key-value tree specified in
72  * initMdpOptions().
73  *
74  * See \ref page_mdmodules for more details on how mdp parsing and related
75  * functionality works with this interface.
76  *
77  * \inlibraryapi
78  * \ingroup module_mdtypes
79  */
80 class IMdpOptionProvider
81 {
82 public:
83     /*! \brief
84      * Initializes a transform from mdp values to sectioned options.
85      *
86      * The transform is specified from a flat KeyValueTreeObject that
87      * contains each mdp value as a property, to a structured
88      * key-value tree that should match the options defined in
89      * initMdpOptions().
90      *
91      * This method may be removed once the flat mdp file is replaced with a
92      * more structure input file (that can be directly read into the
93      * internal key-value tree), and there is no longer any need for
94      * backward compatibility with old files.
95      */
96     virtual void initMdpTransform(IKeyValueTreeTransformRules* transform) = 0;
97     /*! \brief
98      * Initializes options that declare input (mdp) parameters for this
99      * module.
100      */
101     virtual void initMdpOptions(IOptionsContainerWithSections* options) = 0;
102     //! Prepares to write a flat key-value tree like an mdp file.
103     virtual void buildMdpOutput(KeyValueTreeObjectBuilder* builder) const = 0;
104
105 protected:
106     virtual ~IMdpOptionProvider() {}
107 };
108
109 } // namespace gmx
110
111 #endif