746b5a2a645530446c4618e873589312bdbb9abc
[alexxy/gromacs.git] / include / partdec.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 _partdec_h
37 #define _partdec_h
38
39 #include "vsite.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45
46 #define GMX_LEFT     0          /* channel to the left processor  */
47 #define GMX_RIGHT    1          /* channel to the right processor */
48
49 /* These are the good old ring communication routines */
50
51 void gmx_tx(const t_commrec *cr,int dir,void *buf,int bufsize);
52      /*
53       * Asynchronously sends bufsize bytes from the buffer pointed to by buf 
54       * over the communication channel, identified by chan. The buffer becomes 
55       * available after a successful call of gmx_tx_wait(dir).
56       */
57
58 void gmx_tx_wait(const t_commrec *cr, int dir);
59      /*
60       * Waits until the asynchronous send operation associated with chan has 
61       * succeeded. This makes the buffer of the send operation available to 
62       * the sending process.
63       */
64
65 void gmx_rx(const t_commrec *cr,int dir,void *buf,int bufsize);
66      /*
67       * Asynchronously receives bufsize bytes in the buffer pointed to by buf 
68       * from communication channel identified by chan. The buffer becomes 
69       * available after a successful call of gmx_rx_wait(chan).
70       */
71
72 void gmx_rx_wait(const t_commrec *cr, int dir);
73      /*
74       * Waits until the asynchronous receive operation, associated with chan, 
75       * has succeeded. This makes the buffer of the receive operation 
76       * available to the receiving process.
77       */
78
79 void gmx_left_right(int nnodes,int nodeid,
80                            int *left,int *right);
81 /* Get left and right proc id. */
82
83 void gmx_tx_rx(const t_commrec *cr,
84                       int send_dir,void *send_buf,int send_bufsize,
85                       int recv_dir,void *recv_buf,int recv_bufsize);
86 /* Communicate simultaneously left and right */
87                       
88 void gmx_tx_rx_real(const t_commrec *cr,
89                            int send_dir,real *send_buf,int send_bufsize,
90                            int recv_dir,real *recv_buf,int recv_bufsize);
91 /* Communicate simultaneously left and right, reals only */
92
93 void gmx_wait(const t_commrec *cr, int dir_send, int dir_recv);
94 /* Wait for communication to finish */
95
96 void pd_move_f(const t_commrec *cr,rvec f[],t_nrnb *nrnb);
97 /* Sum the forces over the nodes */
98
99 int *pd_cgindex(const t_commrec *cr);
100
101 int *pd_index(const t_commrec *cr);
102
103 int pd_shift(const t_commrec *cr);
104
105 int pd_bshift(const t_commrec *cr);
106
107 void pd_cg_range(const t_commrec *cr,int *cg0,int *cg1);
108 /* Get the range for the home charge groups */
109
110 void pd_at_range(const t_commrec *cr,int *at0,int *at1);
111 /* Get the range for the home particles */
112
113 gmx_localtop_t *split_system(FILE *log,
114                                     gmx_mtop_t *mtop,t_inputrec *inputrec,
115                                     t_commrec *cr);
116 /* Split the system over N processors. */
117
118 bool setup_parallel_vsites(t_idef *idef,t_commrec *cr,
119                                   t_comm_vsites *vsitecomm);
120
121 t_state *partdec_init_local_state(t_commrec *cr,t_state *state_global);
122 /* Generate a local state struct from the global one */
123
124 void
125 pd_get_constraint_range(gmx_partdec_p_t pd,int *start,int *natoms);
126
127
128 int *
129 pd_constraints_nlocalatoms(gmx_partdec_p_t pd);
130
131 /* Move x0 and also x1 if x1!=NULL */
132 void
133 pd_move_x_constraints(t_commrec *  cr,
134                                           rvec *       x0,
135                                           rvec *       x1);
136
137 #ifdef __cplusplus
138 }
139 #endif
140
141 #endif