2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 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.
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 #ifndef GMX_MIMIC_COMMUNICATOR_H
37 #define GMX_MIMIC_COMMUNICATOR_H
39 #include "gromacs/gpu_utils/hostallocator.h"
40 #include "gromacs/math/paddedvector.h"
41 #include "gromacs/mdlib/constr.h"
42 #include "gromacs/topology/topology.h"
43 #include "gromacs/utility/futil.h"
50 * Class-wrapper around MiMiC communication library
51 * It uses GROMACS' unit conversion to switch from GROMACS' units to a.u.
53 * \author Viacheslav Bolnykh <v.bolnykh@hpc-leap.eu>
54 * \ingroup module_mimic
56 class MimicCommunicator
61 * Initializes the communicator
66 * Sends the data needed for MiMiC initialization
68 * That includes number of atoms, element numbers, charges, masses,
69 * maximal order of multipoles (0 for point-charge forcefields),
70 * number of molecules, number of atoms per each molecule,
71 * bond constraints data
73 * @param mtop global topology data
74 * @param coords coordinates of all atoms
76 static void sendInitData(gmx_mtop_t
* mtop
, PaddedHostVector
<gmx::RVec
> coords
);
79 * Gets the number of MD steps to perform from MiMiC
81 * @return nsteps the number of MD steps to perform
83 static int64_t getStepNumber();
86 * Receive and array of updated atomic coordinates from MiMiC
88 * @param x array of coordinates to fill
89 * @param natoms number of atoms in the system
91 static void getCoords(PaddedHostVector
<RVec
>* x
, int natoms
);
94 * Send the potential energy value to MiMiC
96 * @param energy energy value to send
98 static void sendEnergies(real energy
);
101 * Send classical forces acting on all atoms in the system
104 * @param forces array of forces to send
105 * @param natoms number of atoms in the system
107 static void sendForces(ArrayRef
<gmx::RVec
> forces
, int natoms
);
110 * Finish communications and disconnect from the server
112 static void finalize();
117 #endif // GMX_MIMIC_COMMUNICATOR_H