f4f4dc7e5e249cc9e4fffa4e263811e7214cba07
[alexxy/gromacs.git] / src / gromacs / domdec / domdec_setup.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 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 /*! \internal \file
36  *
37  * \brief Declares functions for choosing the DD grid setup
38  *
39  * \author Berk Hess <hess@kth.se>
40  * \ingroup module_domdec
41  */
42 #ifndef GMX_DOMDEC_DOMDEC_SETUP_H
43 #define GMX_DOMDEC_DOMDEC_SETUP_H
44
45 #include "gromacs/math/vec.h"
46
47 struct DDSystemInfo;
48 struct gmx_ddbox_t;
49 struct gmx_mtop_t;
50 struct t_commrec;
51 struct t_inputrec;
52
53 namespace gmx
54 {
55 class MDLogger;
56 } // namespace
57
58 /*! \brief Returns the volume fraction of the system that is communicated */
59 real comm_box_frac(const ivec dd_nc, real cutoff, const gmx_ddbox_t *ddbox);
60
61 /*! \internal
62  * \brief Describes the DD grid setup
63  *
64  * This struct is for temporary use when choosing and initializing
65  * the domain decomposition grid.
66  */
67 struct DDGridSetup
68 {
69     //! The number of separate PME ranks, 0 if none or all ranks do PME
70     int  numPmeOnlyRanks = 0;
71     //! The number of domains along each dimension
72     ivec numDomains      = { 0, 0, 0 };
73     //! The mininum required cell size in nm
74     real cellsizeLimit   = 0;
75     //! The number of dimensions which we decompose in domains
76     int  numDDDimensions = 0;
77     //! The domain decomposition dimensions, the first numDDDimensions entries are used
78     ivec ddDimensions    = { -1, -1, -1 };
79 };
80
81 /*! \brief Determines the optimal DD cell setup dd->nc and possibly npmenodes
82  * for the system.
83  */
84 DDGridSetup
85 dd_choose_grid(const gmx::MDLogger &mdlog,
86                const t_commrec *cr,
87                const t_inputrec *ir,
88                const gmx_mtop_t *mtop,
89                const matrix box, const gmx_ddbox_t *ddbox,
90                int numPmeRanksRequested,
91                bool request1DAnd1Pulse,
92                bool bDynLoadBal, real dlb_scale,
93                const DDSystemInfo &systemInfo);
94
95 #endif