Update copyright statements and change license to LGPL
[alexxy/gromacs.git] / src / mdlib / nbnxn_atomdata.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2012, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012, 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.
11  *
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.
16  *
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.
21  *
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.
26  *
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.
34  *
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.
37  */
38
39 #ifndef _nbnxn_atomdata_h
40 #define _nsnxn_atomdata_h
41
42 #include "typedefs.h"
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48
49 /* Default nbnxn allocation routine, allocates 32 byte aligned,
50  * which works for plain C and aligned SSE and AVX loads/stores.
51  */
52 void nbnxn_alloc_aligned(void **ptr,size_t nbytes);
53
54 /* Free function for memory allocated with nbnxn_alloc_aligned */
55 void nbnxn_free_aligned(void *ptr);
56
57 /* Reallocation wrapper function for nbnxn data structures */
58 void nbnxn_realloc_void(void **ptr,
59                         int nbytes_copy,int nbytes_new,
60                         nbnxn_alloc_t *ma,
61                         nbnxn_free_t  *mf);
62
63 /* Reallocate the nbnxn_atomdata_t for a size of n atoms */
64 void nbnxn_atomdata_realloc(nbnxn_atomdata_t *nbat,int n);
65
66 /* Copy na rvec elements from x to xnb using nbatFormat, start dest a0,
67  * and fills up to na_round using cx,cy,cz.
68  */
69 void copy_rvec_to_nbat_real(const int *a,int na,int na_round,
70                             rvec *x,int nbatFormat,real *xnb,int a0,
71                             int cx,int cy,int cz);
72
73 /* Initialize the non-bonded atom data structure.
74  * The enum for nbatXFormat is in the file defining nbnxn_atomdata_t.
75  * Copy the ntypes*ntypes*2 sized nbfp non-bonded parameter list
76  * to the atom data structure.
77  */
78 void nbnxn_atomdata_init(FILE *fp,
79                          nbnxn_atomdata_t *nbat,
80                          int nb_kernel_type,
81                          int ntype,const real *nbfp,
82                          int n_energygroups,
83                          int nout,
84                          nbnxn_alloc_t *alloc,
85                          nbnxn_free_t  *free);
86
87 /* Copy the atom data to the non-bonded atom data structure */
88 void nbnxn_atomdata_set(nbnxn_atomdata_t *nbat,
89                          int locality,
90                          const nbnxn_search_t nbs,
91                          const t_mdatoms *mdatoms,
92                          const int *atinfo);
93
94 /* Copy the shift vectors to nbat */
95 void nbnxn_atomdata_copy_shiftvec(gmx_bool dynamic_box,
96                                    rvec *shift_vec,
97                                    nbnxn_atomdata_t *nbat);
98
99 /* Copy x to nbat->x.
100  * FillLocal tells if the local filler particle coordinates should be zeroed.
101  */
102 void nbnxn_atomdata_copy_x_to_nbat_x(const nbnxn_search_t nbs,
103                                       int locality,
104                                       gmx_bool FillLocal,
105                                       rvec *x,
106                                       nbnxn_atomdata_t *nbat);
107
108 /* Add the forces stored in nbat to f, zeros the forces in nbat */
109 void nbnxn_atomdata_add_nbat_f_to_f(const nbnxn_search_t nbs,
110                                      int locality,
111                                      const nbnxn_atomdata_t *nbat,
112                                      rvec *f);
113
114 /* Add the fshift force stored in nbat to fshift */
115 void nbnxn_atomdata_add_nbat_fshift_to_fshift(const nbnxn_atomdata_t *nbat,
116                                                rvec *fshift);
117
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #endif