Clean up some mathematical constants
[gromacs.git] / src / mdlib / nbnxn_consts.h
blobfe863769edb2fc04301c3ccb485eec5d3a148e6c
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This source code is part of
6 * G R O M A C S
8 * GROningen MAchine for Chemical Simulations
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-2012, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
36 #ifndef _nbnxn_consts_h
37 #define _nbnxn_consts_h
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
44 /* The number of pair-search sub-cells per super-cell, used for GPU */
45 #define GPU_NSUBCELL_Z 2
46 #define GPU_NSUBCELL_Y 2
47 #define GPU_NSUBCELL_X 2
48 #define GPU_NSUBCELL (GPU_NSUBCELL_Z*GPU_NSUBCELL_Y*GPU_NSUBCELL_X)
49 /* In the non-bonded GPU kernel we operate on cluster-pairs, not cells.
50 * The number of cluster in a super-cluster matches the number of sub-cells
51 * in a pair-search cell, so we introduce a new name for the same value.
53 #define NBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER GPU_NSUBCELL
55 /* With CPU kernels the i-cluster size is always 4 atoms.
56 * With x86 SIMD the j-cluster size can be 2, 4 or 8, otherwise 4.
58 #define NBNXN_CPU_CLUSTER_I_SIZE 4
60 #define NBNXN_CPU_CLUSTER_I_SIZE_2LOG 2
62 /* With GPU kernels the cluster size is 8 atoms */
63 #define NBNXN_GPU_CLUSTER_SIZE 8
65 /* With GPU kernels we group cluster pairs in 4 to optimize memory usage */
66 #define NBNXN_GPU_JGROUP_SIZE 4
68 /* To avoid NaN when excluded atoms are at zero distance, we add a small
69 * number to r^2. NBNXN_AVOID_SING_R2_INC^-3 should fit in real.
71 #ifndef GMX_DOUBLE
72 #define NBNXN_AVOID_SING_R2_INC 1.0e-12f
73 #else
74 /* The double prec. x86 SIMD kernels use a single prec. invsqrt, so > 1e-38 */
75 #define NBNXN_AVOID_SING_R2_INC 1.0e-36
76 #endif
78 /* Coulomb force table size chosen such that it fits along the non-bonded
79 parameters in the texture cache. */
80 #define GPU_EWALD_COULOMB_FORCE_TABLE_SIZE 1536
83 /* Strides for x/f with xyz and xyzq coordinate (and charge) storage */
84 #define STRIDE_XYZ 3
85 #define STRIDE_XYZQ 4
86 /* Size of packs of x, y or z with SSE/AVX packed coords/forces */
87 #define PACK_X4 4
88 #define PACK_X8 8
89 /* Strides for a pack of 4 and 8 coordinates/forces */
90 #define STRIDE_P4 (DIM*PACK_X4)
91 #define STRIDE_P8 (DIM*PACK_X8)
93 /* Index of atom a into the SSE/AVX coordinate/force array */
94 #define X4_IND_A(a) (STRIDE_P4*((a) >> 2) + ((a) & (PACK_X4 - 1)))
95 #define X8_IND_A(a) (STRIDE_P8*((a) >> 3) + ((a) & (PACK_X8 - 1)))
98 #ifdef __cplusplus
100 #endif
102 #endif