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