Make essential dynamics a C++ type.
[gromacs.git] / src / gromacs / essentialdynamics / edsam.h
blob68f422c30b4db48a3124af594ba80ab226ed3948
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
37 /*! \libinternal \file
39 * \brief
40 * Declares functions to calculate both essential dynamics constraints
41 * as well as flooding potentials and forces.
43 * \authors Bert de Groot <bgroot@gwdg.de>, Oliver Lange <oliver.lange@tum.de>,
44 * Carsten Kutzner <ckutzne@gwdg.de>
46 * \inlibraryapi
48 #ifndef GMX_ESSENTIALDYNAMICS_EDSAM_H
49 #define GMX_ESSENTIALDYNAMICS_EDSAM_H
51 #include <memory>
53 #include "gromacs/math/vectypes.h"
54 #include "gromacs/utility/basedefinitions.h"
55 #include "gromacs/utility/classhelpers.h"
57 /*! \brief Abstract type for essential dynamics
59 * The main type is defined only in edsam.cpp
61 struct gmx_edsam;
62 struct gmx_domdec_t;
63 struct gmx_mtop_t;
64 struct gmx_output_env_t;
65 struct ObservablesHistory;
66 struct t_commrec;
67 struct t_filenm;
68 struct t_inputrec;
69 class t_state;
71 namespace gmx
73 class Constraints;
74 class EssentialDynamics
76 public:
77 EssentialDynamics();
78 ~EssentialDynamics();
80 /*! \brief Getter for working data
82 * This is needed while the module is still under
83 * construction. */
84 gmx_edsam *getLegacyED();
85 private:
86 class Impl;
88 PrivateImplPointer<Impl> impl_;
90 } // namespace gmx
92 /*! \brief Applies essential dynamics constrains as defined in the .edi input file.
94 * \param ir MD input parameter record.
95 * \param step Number of the time step.
96 * \param cr Data needed for MPI communication.
97 * \param xs The local positions on this processor.
98 * \param v The local velocities.
99 * \param box The simulation box.
100 * \param ed The essential dynamics data.
102 void do_edsam(const t_inputrec *ir, int64_t step,
103 const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam *ed);
106 /*! \brief Initializes the essential dynamics and flooding module.
108 * \param ediFileName Essential dynamics input file.
109 * \param edoFileName Output file for essential dynamics data.
110 * \param mtop Molecular topology.
111 * \param ir MD input parameter record.
112 * \param cr Data needed for MPI communication.
113 * \param constr Data structure keeping the constraint information.
114 * \param globalState The global state, only used on the master rank.
115 * \param oh The observables history container.
116 * \param oenv The output environment information.
117 * \param bAppend Append to existing output files?
119 * \returns A pointer to the ED data structure.
121 std::unique_ptr<gmx::EssentialDynamics> init_edsam(
122 const char *ediFileName,
123 const char *edoFileName,
124 const gmx_mtop_t *mtop,
125 const t_inputrec *ir,
126 const t_commrec *cr,
127 gmx::Constraints *constr,
128 const t_state *globalState,
129 ObservablesHistory *oh,
130 const gmx_output_env_t *oenv,
131 gmx_bool bAppend);
133 /*! \brief Make a selection of the home atoms for the ED groups.
135 * Should be called at every domain decomposition.
137 * \param dd Domain decomposition data.
138 * \param ed Essential dynamics and flooding data.
140 void dd_make_local_ed_indices(gmx_domdec_t *dd, gmx_edsam * ed);
143 /*! \brief Evaluate the flooding potential(s) and forces as requested in the .edi input file.
145 * \param cr Data needed for MPI communication.
146 * \param ir MD input parameter record.
147 * \param x Positions on the local processor.
148 * \param force Forcefield forces to which the flooding forces are added.
149 * \param ed The essential dynamics data.
150 * \param box The simulation box.
151 * \param step Number of the time step.
152 * \param bNS Are we in a neighbor searching step?
154 void do_flood(const t_commrec *cr,
155 const t_inputrec *ir,
156 const rvec x[],
157 rvec force[],
158 const gmx_edsam *ed,
159 matrix box,
160 int64_t step,
161 gmx_bool bNS);
163 #endif