Properly finalize MPI on mdrun -version. Fixes #1313
[gromacs.git] / include / partdec.h
blobbebd30e692da05b6a9c2b2079b5b158fa4e2f622
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
39 #ifndef _partdec_h
40 #define _partdec_h
41 #include "visibility.h"
42 #include "vsite.h"
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
49 #define GMX_LEFT 0 /* channel to the left processor */
50 #define GMX_RIGHT 1 /* channel to the right processor */
52 /* These are the good old ring communication routines */
54 void gmx_tx(const t_commrec *cr, int dir, void *buf, int bufsize);
56 * Asynchronously sends bufsize bytes from the buffer pointed to by buf
57 * over the communication channel, identified by chan. The buffer becomes
58 * available after a successful call of gmx_tx_wait(dir).
61 void gmx_tx_wait(const t_commrec *cr, int dir);
63 * Waits until the asynchronous send operation associated with chan has
64 * succeeded. This makes the buffer of the send operation available to
65 * the sending process.
68 void gmx_rx(const t_commrec *cr, int dir, void *buf, int bufsize);
70 * Asynchronously receives bufsize bytes in the buffer pointed to by buf
71 * from communication channel identified by chan. The buffer becomes
72 * available after a successful call of gmx_rx_wait(chan).
75 void gmx_rx_wait(const t_commrec *cr, int dir);
77 * Waits until the asynchronous receive operation, associated with chan,
78 * has succeeded. This makes the buffer of the receive operation
79 * available to the receiving process.
82 void gmx_left_right(int nnodes, int nodeid,
83 int *left, int *right);
84 /* Get left and right proc id. */
86 void gmx_tx_rx(const t_commrec *cr,
87 int send_dir, void *send_buf, int send_bufsize,
88 int recv_dir, void *recv_buf, int recv_bufsize);
89 /* Communicate simultaneously left and right */
91 void gmx_tx_rx_real(const t_commrec *cr,
92 int send_dir, real *send_buf, int send_bufsize,
93 int recv_dir, real *recv_buf, int recv_bufsize);
94 /* Communicate simultaneously left and right, reals only */
96 void gmx_wait(const t_commrec *cr, int dir_send, int dir_recv);
97 /* Wait for communication to finish */
99 void pd_move_f(const t_commrec *cr, rvec f[], t_nrnb *nrnb);
100 /* Sum the forces over the nodes */
102 int *pd_cgindex(const t_commrec *cr);
104 int *pd_index(const t_commrec *cr);
106 int pd_shift(const t_commrec *cr);
108 int pd_bshift(const t_commrec *cr);
110 GMX_LIBMD_EXPORT
111 void pd_cg_range(const t_commrec *cr, int *cg0, int *cg1);
112 /* Get the range for the home charge groups */
114 GMX_LIBMD_EXPORT
115 void pd_at_range(const t_commrec *cr, int *at0, int *at1);
116 /* Get the range for the home particles */
118 GMX_LIBMD_EXPORT
119 gmx_localtop_t *split_system(FILE *log,
120 gmx_mtop_t *mtop, t_inputrec *inputrec,
121 t_commrec *cr);
122 /* Split the system over N processors. */
124 gmx_bool setup_parallel_vsites(t_idef *idef, t_commrec *cr,
125 t_comm_vsites *vsitecomm);
127 GMX_LIBMD_EXPORT
128 t_state *partdec_init_local_state(t_commrec *cr, t_state *state_global);
129 /* Generate a local state struct from the global one */
131 void
132 pd_get_constraint_range(gmx_partdec_p_t pd, int *start, int *natoms);
135 int *
136 pd_constraints_nlocalatoms(gmx_partdec_p_t pd);
138 /* Move x0 and also x1 if x1!=NULL */
139 void
140 pd_move_x_constraints(t_commrec * cr,
141 rvec * x0,
142 rvec * x1);
144 #ifdef __cplusplus
146 #endif
148 #endif