port lib suffixes to cmake
[gromacs/adressmacs.git] / include / types / simple.h
blobe0f2c59d55e22af87b0e889172457e3ae3063d16
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
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
32 * And Hey:
33 * GRoups of Organic Molecules in ACtion for Science
36 #ifndef _simple_h
37 #define _simple_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 #ifndef FALSE
48 #define FALSE 0
49 #endif
50 #ifndef TRUE
51 #define TRUE 1
52 #endif
53 #define BOOL_NR 2
55 #define XX 0 /* Defines for indexing in */
56 #define YY 1 /* vectors */
57 #define ZZ 2
58 #define DIM 3 /* Dimension of vectors */
59 #define XXXX 0 /* defines to index matrices */
60 #define XXYY 1
61 #define XXZZ 2
62 #define YYXX 3
63 #define YYYY 4
64 #define YYZZ 5
65 #define ZZXX 6
66 #define ZZYY 7
67 #define ZZZZ 8
68 #ifndef HAVE_BOOL
69 #define bool int
70 /* typedef int bool; */
71 #endif
74 typedef int atom_id; /* To indicate an atoms id */
75 #define NO_ATID (atom_id)(~0) /* Use this to indicate invalid atid */
77 /*! \brief Double precision accuracy */
78 #define GMX_DOUBLE_EPS 1.11022302E-16
80 /*! \brief Maximum double precision value - reduced 1 unit in last digit for MSVC */
81 #define GMX_DOUBLE_MAX 1.79769312E+308
83 /*! \brief Minimum double precision value */
84 #define GMX_DOUBLE_MIN 2.22507386E-308
86 /*! \brief Single precision accuracy */
87 #define GMX_FLOAT_EPS 5.96046448E-08
89 /*! \brief Maximum single precision value - reduced 1 unit in last digit for MSVC */
90 #define GMX_FLOAT_MAX 3.40282346E+38
92 /*! \brief Minimum single precision value */
93 #define GMX_FLOAT_MIN 1.17549435E-38
96 /* Check whether we already have a real type! */
97 #ifdef GMX_DOUBLE
98 #ifndef HAVE_REAL
99 typedef double real;
100 #define HAVE_REAL
101 #endif
102 #define GMX_MPI_REAL MPI_DOUBLE
103 #define GMX_REAL_EPS GMX_DOUBLE_EPS
104 #define GMX_REAL_MIN GMX_DOUBLE_MIN
105 #define GMX_REAL_MAX GMX_DOUBLE_MAX
106 #define gmx_real_fullprecision_pfmt "%21.14e"
107 #else
108 #ifndef HAVE_REAL
109 typedef float real;
110 #define HAVE_REAL
111 #endif
112 #define GMX_MPI_REAL MPI_FLOAT
113 #define GMX_REAL_EPS GMX_FLOAT_EPS
114 #define GMX_REAL_MIN GMX_FLOAT_MIN
115 #define GMX_REAL_MAX GMX_FLOAT_MAX
116 #define gmx_real_fullprecision_pfmt "%14.7e"
117 #endif
119 #ifndef VECTORIZATION_BUFLENGTH
120 #define VECTORIZATION_BUFLENGTH 1000
121 /* The total memory size of the vectorization buffers will
122 * be 5*sizeof(real)*VECTORIZATION_BUFLENGTH
124 #endif
125 typedef real rvec[DIM];
127 typedef double dvec[DIM];
129 typedef real matrix[DIM][DIM];
131 typedef real tensor[DIM][DIM];
133 typedef int ivec[DIM];
135 typedef int imatrix[DIM][DIM];
137 /* For the step count type gmx_large_int_t we aim for 8 bytes (64bit),
138 * but we might only be able to get 4 bytes (32bit).
140 * Avoid using "long int" if we can. This type is really dangerous,
141 * since the width frequently depends on compiler options, and they
142 * might not be set correctly when (buggy) Cmake is detecting things.
143 * Instead, start by looking for "long long", and just go down if we
144 * have to (rarely on new systems). /EL 20100810
146 #if (defined SIZEOF_LONG_LONG_INT && SIZEOF_LONG_LONG_INT==8)
148 typedef long long int gmx_large_int_t;
149 #define gmx_large_int_fmt "lld"
150 #define gmx_large_int_pfmt "%lld"
151 #define SIZEOF_LARGE_INT SIZEOF_LONG_LONG_INT
152 /* LLONG_MAX is not defined by the C-standard, so check for it */
153 #ifdef LLONG_MAX
154 #define LARGE_INT_MAX LLONG_MAX
155 #else
156 #define LARGE_INT_MAX 9223372036854775807LL
157 #endif
159 #elif (defined SIZEOF_LONG_INT && SIZEOF_LONG_INT==8)
161 typedef long int gmx_large_int_t;
162 #define gmx_large_int_fmt "ld"
163 #define gmx_large_int_pfmt "%ld"
164 #define SIZEOF_LARGE_INT SIZEOF_LONG_INT
165 #define LARGE_INT_MAX LONG_MAX
167 #else
169 typedef int gmx_large_int_t;
170 #define gmx_large_int_fmt "d"
171 #define gmx_large_int_pfmt "%d"
172 #define SIZEOF_LARGE_INT SIZEOF_INT
173 #define LARGE_INT_MAX INT_MAX
175 #endif
177 #ifdef __cplusplus
179 #endif
181 #endif