PME load balancing now checks for PME grid restrictions
[gromacs.git] / include / split.h
blobfcc43c8dd0c06b9151191fd361f92852184369ec
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 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * 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.
39 #ifndef _split_h
40 #define _split_h
43 * Determine on which node a particle should reside and on which
44 * node is also should be available. The distribution algorithm
45 * should account for the actual ring architecture and how nodes
46 * are numbered. The typedef t_splitd has two separate structures that
47 * describe the distribution:
49 * The nodeinfo part describes which node containst which particles,
50 * while the nodeids part describes on which node(s) a particle can be
51 * found and what local particle number is assigned to it.
55 #include <stdio.h>
56 #include "typedefs.h"
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
62 typedef enum {
63 SPLIT_NONE, SPLIT_SORTX, SPLIT_REDUCE, SPLIT_NR
64 } t_splitalg;
66 typedef struct
68 int hid;
69 atom_id *nodeid;
70 } t_nodeids;
72 typedef struct
74 int nr; /* Length of the long list. */
75 int *lst; /* The actual list. */
76 } t_nlist;
78 typedef struct
80 t_nlist home; /* List of home particles. */
81 } t_nodeinfo;
83 typedef struct
85 int nnodes; /* Number of nodes this splitinfo is for. */
86 t_nodeinfo *nodeinfo; /* Home and available particles for each node. */
87 int nnodeids; /* Number of particles this splitinfo is for. */
88 t_nodeids *nodeids; /* List of node id's for every particle, */
89 /* entry[nodeid] gives the local atom id (NO_ATID if*/
90 /* not available). Entry[MAXNODES] contains home */
91 /* node's id. */
92 } t_splitd;
94 void init_splitd(t_splitd *splitd, int nnodes, int nnodeids);
96 * Initialises the splitd data structure for the specified number of
97 * nodes (nnodes) and number of atoms (nnodeids).
100 void make_splitd(t_splitalg algorithm, int nnodes, t_topology *top,
101 rvec *x, t_splitd *splitd, char *loadfile);
103 * Initialises the splitd data structure for the specified number of
104 * nodes (nnodes) and number of atoms (top) and fills it using
105 * the specified algorithm (algorithm):
107 * SPLIT_NONE : Generate partial systems by dividing it into nnodes
108 * consecutive, equal, parts without any intelligence.
109 * SPLIT_SORTX : Like SPLIT_NONE but sort the coordinates before
110 * dividing the system into nnodes consecutive, equal,
111 * parts.
112 * SPLIT_REDUCE : Like SPLIT_NONE but minimise the bond lengths, i.e
113 * invoke the reduce algorithm before dividing the
114 * system into nnodes consecutive, equal, parts.
116 * The topology (top) and the coordinates (x) are not modified. The
117 * calculations of bonded forces are assigned to the node with
118 * the highest id that has one of the needed particles as home particle.
121 long wr_split(FILE *fp, t_splitd *splitd);
123 * Writes the split descriptor (splitd) to the file specified by fp.
126 long rd_split(FILE *fp, t_splitd *splitd);
128 * Reads the split descriptor (splitd) from the file specified by fp.
131 void rm_splitd(t_splitd *splitd);
133 * Frees all allocated space for the splitd data structure.
136 void pr_splitd(FILE *fp, int indent, char *title, t_splitd *splitd);
138 * This routine prints out a (human) readable representation of
139 * the split descriptor to the file fp. Ident specifies the
140 * number of spaces the text should be indented. Title is used
141 * to print a header text.
144 void split_topology(t_splitalg algorithm, int nnodes, t_topology *top,
145 rvec x[], char *loadfile);
147 * Distributes the non-bonded forces defined in top over nnodes nodes
148 * using the algoritm specified by algorithm. The distribution is made
149 * by creating a split descriptor and then putting a bonded force on the
150 * highest home node number of the paricles involved.
153 #ifdef __cplusplus
155 #endif
157 #endif /* _split_h */