Velocities and forces for selections.
[gromacs/qmmm-gamess-us.git] / include / split.h
blobc3297c35f54934a87603f8949f2bd51769d4cfe2
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.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _split_h
37 #define _split_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
44 * Determine on which node a particle should reside and on which
45 * node is also should be available. The distribution algorithm
46 * should account for the actual ring architecture and how nodes
47 * are numbered. The typedef t_splitd has two separate structures that
48 * describe the distribution:
50 * The nodeinfo part describes which node containst which particles,
51 * while the nodeids part describes on which node(s) a particle can be
52 * found and what local particle number is assigned to it.
56 #include <stdio.h>
57 #include "typedefs.h"
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
63 typedef enum {SPLIT_NONE,SPLIT_SORTX,SPLIT_REDUCE,SPLIT_NR} t_splitalg;
65 typedef struct
67 int hid;
68 atom_id *nodeid;
69 } t_nodeids;
71 typedef struct
73 int nr; /* Length of the long list. */
74 int *lst; /* The actual list. */
75 } t_nlist;
77 typedef struct
79 t_nlist home; /* List of home particles. */
80 } t_nodeinfo;
82 typedef struct
84 int nnodes; /* Number of nodes this splitinfo is for. */
85 t_nodeinfo *nodeinfo; /* Home and available particles for each node. */
86 int nnodeids; /* Number of particles this splitinfo is for. */
87 t_nodeids *nodeids; /* List of node id's for every particle, */
88 /* entry[nodeid] gives the local atom id (NO_ATID if*/
89 /* not available). Entry[MAXNODES] contains home */
90 /* node's id. */
91 } t_splitd;
93 extern void init_splitd(t_splitd *splitd,int nnodes,int nnodeids);
95 * Initialises the splitd data structure for the specified number of
96 * nodes (nnodes) and number of atoms (nnodeids).
99 extern void make_splitd(t_splitalg algorithm,int nnodes,t_topology *top,
100 rvec *x,t_splitd *splitd,char *loadfile);
102 * Initialises the splitd data structure for the specified number of
103 * nodes (nnodes) and number of atoms (top) and fills it using
104 * the specified algorithm (algorithm):
106 * SPLIT_NONE : Generate partial systems by dividing it into nnodes
107 * consecutive, equal, parts without any intelligence.
108 * SPLIT_SORTX : Like SPLIT_NONE but sort the coordinates before
109 * dividing the system into nnodes consecutive, equal,
110 * parts.
111 * SPLIT_REDUCE : Like SPLIT_NONE but minimise the bond lengths, i.e
112 * invoke the reduce algorithm before dividing the
113 * system into nnodes consecutive, equal, parts.
115 * The topology (top) and the coordinates (x) are not modified. The
116 * calculations of bonded forces are assigned to the node with
117 * the highest id that has one of the needed particles as home particle.
120 extern long wr_split(FILE *fp,t_splitd *splitd);
122 * Writes the split descriptor (splitd) to the file specified by fp.
125 extern long rd_split(FILE *fp,t_splitd *splitd);
127 * Reads the split descriptor (splitd) from the file specified by fp.
130 extern void rm_splitd(t_splitd *splitd);
132 * Frees all allocated space for the splitd data structure.
135 extern void pr_splitd(FILE *fp,int indent,char *title,t_splitd *splitd);
137 * This routine prints out a (human) readable representation of
138 * the split descriptor to the file fp. Ident specifies the
139 * number of spaces the text should be indented. Title is used
140 * to print a header text.
143 extern void split_topology(t_splitalg algorithm,int nnodes,t_topology *top,
144 rvec x[],char *loadfile);
146 * Distributes the non-bonded forces defined in top over nnodes nodes
147 * using the algoritm specified by algorithm. The distribution is made
148 * by creating a split descriptor and then putting a bonded force on the
149 * highest home node number of the paricles involved.
152 #ifdef __cplusplus
154 #endif
156 #endif /* _split_h */