Apply clang-format to source tree
[alexxy/gromacs.git] / src / api / cpp / include / gmxapi / md / mdmodule.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 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
36 #ifndef GMXAPI_MDMODULE_H
37 #define GMXAPI_MDMODULE_H
38 /*! \file
39  * \brief Declare MDModule class for interacting with GROMACS library.
40  *
41  * \author M. Eric Irrgang <ericirrgang@gmail.com>
42  * \ingroup gmxapi_md
43  */
44
45 #include <memory>
46
47 #include "gmxapi/gromacsfwd.h"
48
49 namespace gmxapi
50 {
51
52 /*!
53  * \brief Base class for computational components of MD containers.
54  *
55  * Instances of this class and its descendents provide member functions that return
56  * GROMACS library objects that are not defined in this API, but which should be
57  * defined in the public part of the GROMACS library API. Forward declarations of the library
58  * classes are in gmxapi/gromacsfwd.h so that basic API clients only need to compile
59  * and link against the gmxapi target. To extend the API may require GROMACS library
60  * headers and possibly linking against `libgromacs`. Refer to the GROMACS developer
61  * documentation for details.
62  *
63  * gmxapi::MDModule participates in the binding protocol described for gmxapi::Session.
64  *
65  * For portability, a shared_ptr to MDModule can be passed within the
66  * gmxapi::MDHolder wrapper declared in gmxapi.h
67  *
68  * \ingroup gmxapi_md
69  */
70 class MDModule
71 {
72 public:
73     virtual ~MDModule();
74
75     /*!
76      * \brief Get a user-friendly identifier for an instance.
77      *
78      * \return see documentation for specific MDModule implementations.
79      */
80     virtual const char* name() const;
81
82     /*!
83      * \brief Allows module to provide a restraint implementation.
84      *
85      * To implement a restraint, override this function.
86      * \return shared ownership of a restraint implementation or nullptr if not implemented.
87      *
88      * With future maturation, this interface will presumably be revised to something
89      * more abstract, though I'm not sure what form that would take. We will probably
90      * still need to have a general set of possible module types defined with the API,
91      * in which case it does make sense to have clearly typed dispatching, and
92      * `bool hasRestraint = module->getRestraint() != nullptr;` might be the simplest thing.
93      *
94      * Implementing a restraint is explained in the GROMACS developer documentation,
95      * which is currently built separately from the GMXAPI documentation.
96      * Also, refer to the sample plugin in a repository hosted in the same
97      * place this git repository is found.
98      */
99     virtual std::shared_ptr<::gmx::IRestraintPotential> getRestraint();
100 };
101
102
103 } // end namespace gmxapi
104
105 #endif // GMXAPI_MDMODULE_H