Code beautification with uncrustify
[alexxy/gromacs.git] / src / gromacs / legacyheaders / split.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  *                        VERSION 3.2.0
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2004, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  *
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  *
30  * For more info, check our website at http://www.gromacs.org
31  *
32  * And Hey:
33  * Gromacs Runs On Most of All Computer Systems
34  */
35
36 #ifndef _split_h
37 #define _split_h
38
39 /*
40  * Determine on which node a particle should reside and on which
41  * node is also should be available. The distribution algorithm
42  * should account for the actual ring architecture and how nodes
43  * are numbered. The typedef t_splitd has two separate structures that
44  * describe the distribution:
45  *
46  * The nodeinfo part describes which node containst which particles,
47  * while the nodeids part describes on which node(s) a particle can be
48  * found and what local particle number is assigned to it.
49  *
50  */
51
52 #include <stdio.h>
53 #include "typedefs.h"
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 typedef enum {
60     SPLIT_NONE, SPLIT_SORTX, SPLIT_REDUCE, SPLIT_NR
61 } t_splitalg;
62
63 typedef struct
64 {
65     int      hid;
66     atom_id *nodeid;
67 } t_nodeids;
68
69 typedef struct
70 {
71     int  nr;    /* Length of the long list.                         */
72     int *lst;   /* The actual list.                                 */
73 } t_nlist;
74
75 typedef struct
76 {
77     t_nlist home;   /* List of home particles.                          */
78 } t_nodeinfo;
79
80 typedef struct
81 {
82     int         nnodes;   /* Number of nodes this splitinfo is for.      */
83     t_nodeinfo *nodeinfo; /* Home and available particles for each node. */
84     int         nnodeids; /* Number of particles this splitinfo is for.       */
85     t_nodeids  *nodeids;  /* List of node id's for every particle,       */
86     /* entry[nodeid] gives the local atom id (NO_ATID if*/
87     /* not available). Entry[MAXNODES] contains home    */
88     /* node's id.                                  */
89 } t_splitd;
90
91 void init_splitd(t_splitd *splitd, int nnodes, int nnodeids);
92 /*
93  * Initialises the splitd data structure for the specified number of
94  * nodes (nnodes) and number of atoms (nnodeids).
95  */
96
97 void make_splitd(t_splitalg algorithm, int nnodes, t_topology *top,
98                  rvec *x, t_splitd *splitd, char *loadfile);
99 /*
100  * Initialises the splitd data structure for the specified number of
101  * nodes (nnodes) and number of atoms (top) and fills it using
102  * the specified algorithm (algorithm):
103  *
104  *    SPLIT_NONE   : Generate partial systems by dividing it into nnodes
105  *                   consecutive, equal, parts without any intelligence.
106  *    SPLIT_SORTX  : Like SPLIT_NONE but sort the coordinates before
107  *                   dividing the system into nnodes consecutive, equal,
108  *                   parts.
109  *    SPLIT_REDUCE : Like SPLIT_NONE but minimise the bond lengths, i.e
110  *                   invoke the reduce algorithm before dividing the
111  *                   system into nnodes consecutive, equal, parts.
112  *
113  * The topology (top) and the coordinates (x) are not modified. The
114  * calculations of bonded forces are assigned to the node with
115  * the highest id that has one of the needed particles as home particle.
116  */
117
118 long wr_split(FILE *fp, t_splitd *splitd);
119 /*
120  * Writes the split descriptor (splitd) to the file specified by fp.
121  */
122
123 long rd_split(FILE *fp, t_splitd *splitd);
124 /*
125  * Reads the split descriptor (splitd) from the file specified by fp.
126  */
127
128 void rm_splitd(t_splitd *splitd);
129 /*
130  * Frees all allocated space for the splitd data structure.
131  */
132
133 void pr_splitd(FILE *fp, int indent, char *title, t_splitd *splitd);
134 /*
135  * This routine prints out a (human) readable representation of
136  * the split descriptor to the file fp. Ident specifies the
137  * number of spaces the text should be indented. Title is used
138  * to print a header text.
139  */
140
141 void split_topology(t_splitalg algorithm, int nnodes, t_topology *top,
142                     rvec x[], char *loadfile);
143 /*
144  * Distributes the non-bonded forces defined in top over nnodes nodes
145  * using the algoritm specified by algorithm. The distribution is made
146  * by creating a split descriptor and then putting a bonded force on the
147  * highest home node number of the paricles involved.
148  */
149
150 #ifdef __cplusplus
151 }
152 #endif
153
154 #endif  /* _split_h */