Fixes for Bluegene/Q
[gromacs.git] / include / centerofmass.h
blob8c887a6461dc1b6d2b6c8c8acb96180f7b801009
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-2009, 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.
38 /*! \file
39 * \brief API for calculation of centers of mass/geometry.
41 * This header defines a few functions that can be used to calculate
42 * centers of mass/geometry for a group of atoms.
43 * These routines can be used independently of the other parts of the
44 * library, but they are also used internally by the selection engine.
45 * In most cases, it should not be necessary to call these functions
46 * directly.
47 * Instead, one should write an analysis tool such that it gets all
48 * positions through selections.
50 * The functions in the header can be divided into a few groups based on the
51 * parameters they take. The simplest group of functions calculates the center
52 * of a single group of atoms:
53 * - gmx_calc_cog(): Calculates the center of geometry (COG) of a given
54 * group of atoms.
55 * - gmx_calc_com(): Calculates the center of mass (COM) of a given group
56 * of atoms.
57 * - gmx_calc_comg(): Calculates either the COM or COG, based on a
58 * gmx_boolean flag.
60 * A second set of routines is provided for calculating the centers for groups
61 * that wrap over periodic boundaries (gmx_calc_cog_pbc(), gmx_calc_com_pbc(),
62 * gmx_calc_comg_pbc()). These functions are slower, because they need to
63 * adjust the center iteratively.
65 * It is also possible to calculate centers for several groups of atoms in
66 * one call. The functions gmx_calc_cog_block(), gmx_calc_com_block() and
67 * gmx_calc_comg_block() take an index group and a partitioning of that index
68 * group (as a \c t_block structure), and calculate the centers for
69 * each group defined by the \c t_block structure separately.
71 * Finally, there is a function gmx_calc_comg_blocka() that takes both the
72 * index group and the partitioning as a single \c t_blocka structure.
74 #ifndef CENTEROFMASS_H
75 #define CENTEROFMASS_H
77 #include "typedefs.h"
79 #ifdef __cplusplus
80 extern "C"
82 #endif
84 /** Calculate a single center of geometry. */
85 int
86 gmx_calc_cog(t_topology *top, rvec x[], int nrefat, atom_id index[], rvec xout);
87 /** Calculate a single center of mass. */
88 int
89 gmx_calc_com(t_topology *top, rvec x[], int nrefat, atom_id index[], rvec xout);
90 /** Calculate force on a single center of geometry. */
91 int
92 gmx_calc_cog_f(t_topology *top, rvec f[], int nrefat, atom_id index[], rvec fout);
93 /** Calculate a single center of mass/geometry. */
94 int
95 gmx_calc_comg(t_topology *top, rvec x[], int nrefat, atom_id index[],
96 gmx_bool bMass, rvec xout);
97 /** Calculate force on a single center of mass/geometry. */
98 int
99 gmx_calc_comg_f(t_topology *top, rvec f[], int nrefat, atom_id index[],
100 gmx_bool bMass, rvec fout);
102 /** Calculate a single center of geometry iteratively, taking PBC into account. */
104 gmx_calc_cog_pbc(t_topology *top, rvec x[], t_pbc *pbc,
105 int nrefat, atom_id index[], rvec xout);
106 /** Calculate a single center of mass iteratively, taking PBC into account. */
108 gmx_calc_com_pbc(t_topology *top, rvec x[], t_pbc *pbc,
109 int nrefat, atom_id index[], rvec xout);
110 /** Calculate a single center of mass/geometry iteratively with PBC. */
112 gmx_calc_comg_pbc(t_topology *top, rvec x[], t_pbc *pbc,
113 int nrefat, atom_id index[], gmx_bool bMass, rvec xout);
115 /** Calculate centers of geometry for a blocked index. */
117 gmx_calc_cog_block(t_topology *top, rvec x[], t_block *block,
118 atom_id index[], rvec xout[]);
119 /** Calculate centers of mass for a blocked index. */
121 gmx_calc_com_block(t_topology *top, rvec x[], t_block *block,
122 atom_id index[], rvec xout[]);
123 /** Calculate forces on centers of geometry for a blocked index. */
125 gmx_calc_cog_f_block(t_topology *top, rvec f[], t_block *block,
126 atom_id index[], rvec fout[]);
127 /** Calculate centers of mass/geometry for a blocked index. */
129 gmx_calc_comg_block(t_topology *top, rvec x[], t_block *block,
130 atom_id index[], gmx_bool bMass, rvec xout[]);
131 /** Calculate forces on centers of mass/geometry for a blocked index. */
133 gmx_calc_comg_f_block(t_topology *top, rvec f[], t_block *block,
134 atom_id index[], gmx_bool bMass, rvec fout[]);
135 /** Calculate centers of mass/geometry for a set of blocks; */
137 gmx_calc_comg_blocka(t_topology *top, rvec x[], t_blocka *block,
138 gmx_bool bMass, rvec xout[]);
139 /** Calculate forces on centers of mass/geometry for a set of blocks; */
141 gmx_calc_comg_f_blocka(t_topology *top, rvec x[], t_blocka *block,
142 gmx_bool bMass, rvec xout[]);
144 #ifdef __cplusplus
146 #endif
148 #endif