Partial commit of the project to remove all static variables.
[gromacs.git] / include / split.h
blobab7fa5399474d1429ae60705fc9d117c52d408c4
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.1
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
29 * And Hey:
30 * Getting the Right Output Means no Artefacts in Calculating Stuff
33 #ifndef _split_h
34 #define _split_h
36 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
41 * Determine on which node a particle should reside and on which
42 * node is also should be available. The distribution algorithm
43 * should account for the actual ring architecture and how nodes
44 * are numbered. The typedef t_splitd has two separate structures that
45 * describe the distribution:
47 * The nodeinfo part describes which node containst which particles,
48 * while the nodeids part describes on which node(s) a particle can be
49 * found and what local particle number is assigned to it.
53 #include <stdio.h>
54 #include "typedefs.h"
56 typedef enum {SPLIT_NONE,SPLIT_SORTX,SPLIT_REDUCE,SPLIT_NR} t_splitalg;
58 typedef struct
60 int hid;
61 atom_id *nodeid;
62 } t_nodeids;
64 typedef struct
66 int nr; /* Length of the long list. */
67 int *lst; /* The actual list. */
68 } t_nlist;
70 typedef struct
72 t_nlist home; /* List of home particles. */
73 } t_nodeinfo;
75 typedef struct
77 int nnodes; /* Number of nodes this splitinfo is for. */
78 t_nodeinfo *nodeinfo; /* Home and available particles for each node. */
79 int nnodeids; /* Number of particles this splitinfo is for. */
80 t_nodeids *nodeids; /* List of node id's for every particle, */
81 /* entry[nodeid] gives the local atom id (NO_ATID if*/
82 /* not available). Entry[MAXNODES] contains home */
83 /* node's id. */
84 } t_splitd;
86 extern void init_splitd(t_splitd *splitd,int nnodes,int nnodeids);
88 * Initialises the splitd data structure for the specified number of
89 * nodes (nnodes) and number of atoms (nnodeids).
92 extern void make_splitd(t_splitalg algorithm,int nnodes,t_topology *top,
93 rvec *x,t_splitd *splitd,char *loadfile);
95 * Initialises the splitd data structure for the specified number of
96 * nodes (nnodes) and number of atoms (top) and fills it using
97 * the specified algorithm (algorithm):
99 * SPLIT_NONE : Generate partial systems by dividing it into nnodes
100 * consecutive, equal, parts without any intelligence.
101 * SPLIT_SORTX : Like SPLIT_NONE but sort the coordinates before
102 * dividing the system into nnodes consecutive, equal,
103 * parts.
104 * SPLIT_REDUCE : Like SPLIT_NONE but minimise the bond lengths, i.e
105 * invoke the reduce algorithm before dividing the
106 * system into nnodes consecutive, equal, parts.
108 * The topology (top) and the coordinates (x) are not modified. The
109 * calculations of bonded forces are assigned to the node with
110 * the highest id that has one of the needed particles as home particle.
113 extern long wr_split(FILE *fp,t_splitd *splitd);
115 * Writes the split descriptor (splitd) to the file specified by fp.
118 extern long rd_split(FILE *fp,t_splitd *splitd);
120 * Reads the split descriptor (splitd) from the file specified by fp.
123 extern void rm_splitd(t_splitd *splitd);
125 * Frees all allocated space for the splitd data structure.
128 extern void pr_splitd(FILE *fp,int indent,char *title,t_splitd *splitd);
130 * This routine prints out a (human) readable representation of
131 * the split descriptor to the file fp. Ident specifies the
132 * number of spaces the text should be indented. Title is used
133 * to print a header text.
136 extern void split_topology(t_splitalg algorithm,int nnodes,t_topology *top,
137 rvec x[],char *loadfile);
139 * Distributes the non-bonded forces defined in top over nnodes nodes
140 * using the algoritm specified by algorithm. The distribution is made
141 * by creating a split descriptor and then putting a bonded force on the
142 * highest home node number of the paricles involved.
146 #endif /* _split_h */