Simplify PME GPU constants
[gromacs.git] / src / gromacs / ewald / pme_pp_communication.h
blob329284d4e4404e88feebf06a1d7636d8727c866c
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 by the GROMACS development team.
7 * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
8 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
9 * and including many others, as listed in the AUTHORS file in the
10 * top-level source directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
38 /*! \internal \file
40 * \brief This file contains declarations and constants necessary for
41 * coordinating the communication for the offload of long-ranged PME
42 * work to separate MPI rank, for computing energies and forces
43 * (Coulomb and LJ).
45 * \author Berk Hess <hess@kth.se>
46 * \author Mark Abraham <mark.j.abraham@gmail.com>
47 * \ingroup module_ewald
50 #include "gromacs/math/vectypes.h"
51 #include "gromacs/mdlib/sighandler.h"
52 #include "gromacs/utility/real.h"
54 /*! \brief MPI Tags used to separate communication of different types of quantities */
55 enum
57 eCommType_ChargeA,
58 eCommType_ChargeB,
59 eCommType_SQRTC6A,
60 eCommType_SQRTC6B,
61 eCommType_SigmaA,
62 eCommType_SigmaB,
63 eCommType_NR,
64 eCommType_COORD,
65 eCommType_CNB
68 //@{
69 /*! \brief Flags used to coordinate PP-PME communication and computation phases
71 * Some parts of the code(gmx_pme_send_q, gmx_pme_recv_q_x) assume
72 * that the six first flags are exactly in this order.
75 #define PP_PME_CHARGE (1 << 0)
76 #define PP_PME_CHARGEB (1 << 1)
77 #define PP_PME_SQRTC6 (1 << 2)
78 #define PP_PME_SQRTC6B (1 << 3)
79 #define PP_PME_SIGMA (1 << 4)
80 #define PP_PME_SIGMAB (1 << 5)
81 #define PP_PME_COORD (1 << 6)
82 #define PP_PME_ENER_VIR (1 << 9)
83 #define PP_PME_FINISH (1 << 10)
84 #define PP_PME_SWITCHGRID (1 << 11)
85 #define PP_PME_RESETCOUNTERS (1 << 12)
86 #define PP_PME_GPUCOMMS (1 << 13)
87 //@}
89 /*! \brief Return values for gmx_pme_recv_q_x */
90 enum
92 pmerecvqxX, /* calculate PME mesh interactions for new x */
93 pmerecvqxFINISH, /* the simulation should finish, we should quit */
94 pmerecvqxSWITCHGRID, /* change the PME grid size */
95 pmerecvqxRESETCOUNTERS /* reset the cycle and flop counters */
98 /*! \internal
99 * \brief Helper struct for PP-PME communication of parameters.
101 * The contents are communicated over MPI in memcpy style, so should
102 * remain suitable for that.
104 struct gmx_pme_comm_n_box_t
106 int natoms; /**< Number of atoms */
107 matrix box; /**< Box */
108 int maxshift_x; /**< Maximum shift in x direction */
109 int maxshift_y; /**< Maximum shift in y direction */
110 real lambda_q; /**< Free-energy lambda for electrostatics */
111 real lambda_lj; /**< Free-energy lambda for Lennard-Jones */
112 unsigned int flags; /**< Control flags */
113 int64_t step; /**< MD integration step number */
114 //@{
115 /*! \brief Used in PME grid tuning */
116 ivec grid_size;
117 real ewaldcoeff_q;
118 real ewaldcoeff_lj;
119 //@}
122 /*! \internal
123 * \brief Helper struct for PP-PME communication of virial and energy.
125 * The contents are communicated over MPI in memcpy style, so should
126 * remain suitable for that.
128 struct gmx_pme_comm_vir_ene_t
130 //@{
131 /*! \brief Virial, energy, and derivative of potential w.r.t. lambda for charge and Lennard-Jones */
132 matrix vir_q;
133 matrix vir_lj;
134 real energy_q;
135 real energy_lj;
136 real dvdlambda_q;
137 real dvdlambda_lj;
138 //@}
139 float cycles; /**< Counter of CPU cycles used */
140 gmx_stop_cond_t stop_cond; /**< Flag used in responding to an external signal to terminate */