changed reading hint
[gromacs/adressmacs.git] / include / split.h
bloba4b60aac5b1e6c777f1fa92a7ccb5aa9e61b9163
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 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Green Red Orange Magenta Azure Cyan Skyblue
30 #ifndef _split_h
31 #define _split_h
33 static char *SRCID_split_h = "$Id$";
35 #ifdef HAVE_IDENT
36 #ident "@(#) split.h 1.20 12/16/92"
37 #endif /* HAVE_IDENT */
40 * Determine on which processor a particle should reside and on which
41 * processor is also should be available. The distribution algorithm
42 * should account for the actual ring architecture and how processors
43 * are numbered. The typedef t_splitd has two separate structures that
44 * describe the distribution:
46 * The procinfo part describes which processor containst which particles,
47 * while the pids part describes on which processor(s) a particle can be
48 * found and what local particle number is assigned to it.
52 #include <stdio.h>
53 #include "typedefs.h"
55 typedef enum {SPLIT_NONE,SPLIT_SORTX,SPLIT_REDUCE,SPLIT_NR} t_splitalg;
57 typedef struct
59 int hid;
60 atom_id *pid;
61 } t_pids;
63 typedef struct
65 int nr; /* Length of the long list. */
66 int *lst; /* The actual list. */
67 } t_nlist;
69 typedef struct
71 t_nlist home; /* List of home particles. */
72 } t_procinfo;
74 typedef struct
76 int nprocs; /* Number of processors this splitinfo is for. */
77 t_procinfo *procinfo; /* Home and available particles for each processor. */
78 int npids; /* Number of particles this splitinfo is for. */
79 t_pids *pids; /* List of processor id's for every particle, */
80 /* entry[pid] gives the local atom id (NO_ATID if */
81 /* not available). Entry[MAXPROC] contains home */
82 /* processor's id. */
83 } t_splitd;
85 extern void init_splitd(t_splitd *splitd,int nprocs,int npids);
87 * Initialises the splitd data structure for the specified number of
88 * processors (nprocs) and number of atoms (npids).
91 extern void make_splitd(t_splitalg algorithm,int nprocs,t_topology *top,
92 rvec *x,t_splitd *splitd,char *loadfile);
94 * Initialises the splitd data structure for the specified number of
95 * processors (nprocs) and number of atoms (top) and fills it using
96 * the specified algorithm (algorithm):
98 * SPLIT_NONE : Generate partial systems by dividing it into nprocs
99 * consecutive, equal, parts without any intelligence.
100 * SPLIT_SORTX : Like SPLIT_NONE but sort the coordinates before
101 * dividing the system into nprocs consecutive, equal,
102 * parts.
103 * SPLIT_REDUCE : Like SPLIT_NONE but minimise the bond lengths, i.e
104 * invoke the reduce algorithm before dividing the
105 * system into nprocs consecutive, equal, parts.
107 * The topology (top) and the coordinates (x) are not modified. The
108 * calculations of bonded forces are assigned to the processor with
109 * the highest id that has one of the needed particles as home particle.
112 extern long wr_split(FILE *fp,t_splitd *splitd);
114 * Writes the split descriptor (splitd) to the file specified by fp.
117 extern long rd_split(FILE *fp,t_splitd *splitd);
119 * Reads the split descriptor (splitd) from the file specified by fp.
122 extern void rm_splitd(t_splitd *splitd);
124 * Frees all allocated space for the splitd data structure.
127 extern void pr_splitd(FILE *fp,int indent,char *title,t_splitd *splitd);
129 * This routine prints out a (human) readable representation of
130 * the split descriptor to the file fp. Ident specifies the
131 * number of spaces the text should be indented. Title is used
132 * to print a header text.
135 extern void split_topology(t_splitalg algorithm,int nprocs,t_topology *top,
136 rvec x[],char *loadfile);
138 * Distributes the non-bonded forces defined in top over nprocs processors
139 * using the algoritm specified by algorithm. The distribution is made
140 * by creating a split descriptor and then putting a bonded force on the
141 * highest home processor number of the paricles involved.
145 #endif /* _split_h */