Fixing copyright issues and code contributors
[alexxy/gromacs.git] / src / mdlib / nbnxn_consts.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,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.
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_consts_h
40 #define _nbnxn_consts_h
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46
47 /* The number of pair-search sub-cells per super-cell, used for GPU */
48 #define GPU_NSUBCELL_Z 2
49 #define GPU_NSUBCELL_Y 2
50 #define GPU_NSUBCELL_X 2
51 #define GPU_NSUBCELL   (GPU_NSUBCELL_Z*GPU_NSUBCELL_Y*GPU_NSUBCELL_X)
52 /* In the non-bonded GPU kernel we operate on cluster-pairs, not cells.
53  * The number of cluster in a super-cluster matches the number of sub-cells
54  * in a pair-search cell, so we introduce a new name for the same value.
55  */
56 #define NBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER  GPU_NSUBCELL
57
58 /* With CPU kernels the i-cluster size is always 4 atoms.
59  * With x86 SIMD the j-cluster size can be 2, 4 or 8, otherwise 4.
60  */
61 #define NBNXN_CPU_CLUSTER_I_SIZE       4
62
63 #define NBNXN_CPU_CLUSTER_I_SIZE_2LOG  2
64
65 /* With GPU kernels the cluster size is 8 atoms */
66 #define NBNXN_GPU_CLUSTER_SIZE         8
67
68 /* With GPU kernels we group cluster pairs in 4 to optimize memory usage.
69  * To change this, also change nbnxn_cj4_t in include/types/nbnxn_pairlist.h.
70  */
71 #define NBNXN_GPU_JGROUP_SIZE       4
72 #define NBNXN_GPU_JGROUP_SIZE_2LOG  2
73
74 /* To avoid NaN when excluded atoms are at zero distance, we add a small
75  * number to r^2. NBNXN_AVOID_SING_R2_INC^-3 should fit in real.
76  */
77 #ifndef GMX_DOUBLE
78 #define NBNXN_AVOID_SING_R2_INC  1.0e-12f
79 #else
80 /* The double prec. x86 SIMD kernels use a single prec. invsqrt, so > 1e-38 */
81 #define NBNXN_AVOID_SING_R2_INC  1.0e-36
82 #endif
83
84 /* Coulomb force table size chosen such that it fits along the non-bonded
85    parameters in the texture cache. */
86 #define GPU_EWALD_COULOMB_FORCE_TABLE_SIZE 1536
87
88
89 /* Strides for x/f with xyz and xyzq coordinate (and charge) storage */
90 #define STRIDE_XYZ   3
91 #define STRIDE_XYZQ  4
92 /* Size of packs of x, y or z with SSE/AVX packed coords/forces */
93 #define PACK_X4      4
94 #define PACK_X8      8
95 /* Strides for a pack of 4 and 8 coordinates/forces */
96 #define STRIDE_P4    (DIM*PACK_X4)
97 #define STRIDE_P8    (DIM*PACK_X8)
98
99 /* Index of atom a into the SSE/AVX coordinate/force array */
100 #define X4_IND_A(a)  (STRIDE_P4*((a) >> 2) + ((a) & (PACK_X4 - 1)))
101 #define X8_IND_A(a)  (STRIDE_P8*((a) >> 3) + ((a) & (PACK_X8 - 1)))
102
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif