3 * This source code is part of
7 * 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-2004, 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
33 * GRoups of Organic Molecules in ACtion for Science
39 /* Dont remove this instance of HAVE_CONFIG_H!!!
41 * We dont _require_ config.h here, but IF one is
42 * available it might contain valuable information about simple types
43 * that helps us automate things better and avoid bailing out.
45 * Note that this does not have to be the gromacs config.h - several
46 * package setups define these simple types.
52 /* Information about integer data type sizes */
54 #define __STDC_LIMIT_MACROS
57 #define __STDC_FORMAT_MACROS
69 #define XX 0 /* Defines for indexing in */
70 #define YY 1 /* vectors */
72 #define DIM 3 /* Dimension of vectors */
73 #define XXXX 0 /* defines to index matrices */
83 /* There is no standard size for 'bool' in C++, so when
84 * we previously defined it to int for C code the data types
85 * (and structs) would have different size depending on your compiler,
86 * both at gromacs build time and when you use the library.
87 * The only way around this is to NOT assume anything about the C++ type,
88 * so we cannot use the name 'bool' in our C code anymore.
102 typedef int atom_id; /* To indicate an atoms id */
103 #define NO_ATID (atom_id)(~0) /* Use this to indicate invalid atid */
105 /*! \brief Double precision accuracy */
106 #define GMX_DOUBLE_EPS 1.11022302E-16
108 /*! \brief Maximum double precision value - reduced 1 unit in last digit for MSVC */
109 #define GMX_DOUBLE_MAX 1.79769312E+308
111 /*! \brief Minimum double precision value */
112 #define GMX_DOUBLE_MIN 2.22507386E-308
114 /*! \brief Single precision accuracy */
115 #define GMX_FLOAT_EPS 5.96046448E-08
117 /*! \brief Maximum single precision value - reduced 1 unit in last digit for MSVC */
118 #define GMX_FLOAT_MAX 3.40282346E+38
120 /*! \brief Minimum single precision value */
121 #define GMX_FLOAT_MIN 1.17549435E-38
124 /* Check whether we already have a real type! */
132 #define GMX_MPI_REAL MPI_DOUBLE
133 #define GMX_REAL_EPS GMX_DOUBLE_EPS
134 #define GMX_REAL_MIN GMX_DOUBLE_MIN
135 #define GMX_REAL_MAX GMX_DOUBLE_MAX
136 #define gmx_real_fullprecision_pfmt "%21.14e"
144 #define GMX_MPI_REAL MPI_FLOAT
145 #define GMX_REAL_EPS GMX_FLOAT_EPS
146 #define GMX_REAL_MIN GMX_FLOAT_MIN
147 #define GMX_REAL_MAX GMX_FLOAT_MAX
148 #define gmx_real_fullprecision_pfmt "%14.7e"
151 typedef real rvec[DIM];
153 typedef double dvec[DIM];
155 typedef real matrix[DIM][DIM];
157 typedef real tensor[DIM][DIM];
159 typedef int ivec[DIM];
161 typedef int imatrix[DIM][DIM];
164 typedef __int32 gmx_int32_t;
165 #define GMX_PRId32 "I32d"
166 #define GMX_SCNd32 "I32d"
168 typedef __int64 gmx_int64_t;
169 #define GMX_PRId64 "I64d"
170 #define GMX_SCNd64 "I64d"
172 typedef unsigned __int32 gmx_uint32_t;
173 #define GMX_PRIu32 "U32d"
174 #define GMX_SCNu32 "U32d"
176 typedef unsigned __int64 gmx_uint64_t;
177 #define GMX_PRIu64 "U64d"
178 #define GMX_SCNu64 "U64d"
180 typedef int32_t gmx_int32_t;
181 #define GMX_PRId32 PRId32
182 #define GMX_SCNd32 SCNd32
184 typedef int64_t gmx_int64_t;
185 #define GMX_PRId64 PRId64
186 #define GMX_SCNd64 SCNd64
188 typedef uint32_t gmx_uint32_t;
189 #define GMX_PRIu32 PRIu32
190 #define GMX_SCNu32 SCNu32
192 typedef uint64_t gmx_uint64_t;
193 #define GMX_PRIu64 PRIu64
194 #define GMX_SCNu64 SCNu64
197 #define GMX_INT32_MAX INT32_MAX
198 #define GMX_INT32_MIN INT32_MIN
200 #define GMX_INT64_MAX INT64_MAX
201 #define GMX_INT64_MIN INT64_MIN
203 #define GMX_UINT32_MAX UINT32_MAX
204 #define GMX_UINT32_MIN UINT32_MIN
206 #define GMX_UINT64_MAX UINT64_MAX
207 #define GMX_UINT64_MIN UINT64_MIN
210 /* config.h tests for inline definitions and should work on a much wider range
211 * of compilers, but does not work with installed headers. These compiler checks
212 * still enable a real inline keyword for the most common compilers.
215 /* Try to define suitable inline keyword for gmx_inline.
216 * Set it to empty if we cannot find one (and dont complain to the user)
222 # define gmx_inline __inline__
223 #elif (defined(__INTEL_COMPILER) || defined(__ECC)) && defined(__ia64__)
225 # define gmx_inline __inline__
226 #elif defined(__PATHSCALE__)
228 # define gmx_inline __inline__
229 #elif defined(__PGIC__)
231 # define gmx_inline __inline
232 #elif defined _MSC_VER
234 # define gmx_inline __inline
235 #elif defined(__xlC__)
237 # define gmx_inline __inline
244 # define gmx_inline inline
247 #endif /* ifndef gmx_inline */
250 /* Restrict keywords. Note that this has to be done for C++ too, unless
251 * it was set from the more general checks if we had config.h (gmx internal)
257 # define gmx_restrict __restrict__
258 #elif (defined(__INTEL_COMPILER) || defined(__ECC)) && defined(__ia64__)
260 # define gmx_restrict __restrict__
261 #elif defined(__PATHSCALE__)
263 # define gmx_restrict __restrict
264 #elif defined(__PGIC__)
266 # define gmx_restrict __restrict
267 #elif defined _MSC_VER
269 # define gmx_restrict __restrict
270 #elif defined(__xlC__)
272 # define gmx_restrict __restrict
274 # define gmx_restrict
280 * These attributes suppress compiler warnings about unused function arguments
281 * by marking them as possibly unused. Some arguments are unused but
282 * have to be retained to preserve a function signature
283 * that must match that of another function.
284 * Some arguments are only used in *some* code paths (e.g. MPI)
289 /* GCC, clang, and some ICC pretending to be GCC */
290 # define gmx_unused __attribute__ ((unused))
291 #elif (defined(__INTEL_COMPILER) || defined(__ECC)) && !defined(_MSC_VER)
293 # define gmx_unused __attribute__ ((unused))
294 #elif defined _MSC_VER
296 # define gmx_unused /*@unused@*/
297 #elif defined(__xlC__)
299 # define gmx_unused __attribute__ ((unused))
305 /* Standard sizes for char* string buffers */
307 #define BIG_STRLEN 1048576