1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35     This file is from LAMMPS
36     LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
37     http://lammps.sandia.gov, Sandia National Laboratories
38     Steve Plimpton, sjplimp@sandia.gov
39 
40     Copyright (2003) Sandia Corporation.  Under the terms of Contract
41     DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
42     certain rights in this software.  This software is distributed under
43     the GNU General Public License.
44 ------------------------------------------------------------------------- */
45 
46 // define integer data types used by LAMMPS and associated size limits
47 
48 // smallint = variables for on-procesor system (nlocal, nmax, etc)
49 // tagint = variables for atom IDs (tag)
50 // bigint = variables for total system (natoms, ntimestep, etc)
51 
52 // smallint must be an int, as defined by C compiler
53 // tagint can be 32-bit or 64-bit int, must be >= smallint
54 // bigint can be 32-bit or 64-bit int, must be >= tagint
55 
56 // MPI_LMP_TAGINT = MPI data type corresponding to a tagint
57 // MPI_LMP_BIGINT = MPI data type corresponding to a bigint
58 
59 #ifndef LMP_LMPTYPE_H
60 #define LMP_LMPTYPE_H
61 
62 #ifndef __STDC_LIMIT_MACROS
63 #define __STDC_LIMIT_MACROS
64 #endif
65 
66 #ifndef __STDC_FORMAT_MACROS
67 #define __STDC_FORMAT_MACROS
68 #endif
69 
70 #include "limits.h"
71 #include <stdint.h>
72 #include "inttypes.h"
73 
74 // grrr - IBM Power6 does not provide this def in their system header files
75 
76 #ifndef PRId64
77 #define PRId64 "ld"
78 #endif
79 
80 namespace LAMMPS_NS {
81 
82 // reserve 2 hi bits in molecular system neigh list for special bonds flag
83 // max local + ghost atoms per processor = 2^30 - 1
84 
85 #define SBBITS 30
86 #define NEIGHMASK 0x3FFFFFFF
87 
88 // default to 32-bit smallint and tagint, 64-bit bigint
89 
90 #if !defined(LAMMPS_SMALLSMALL) && !defined(LAMMPS_BIGBIG) && !defined(LAMMPS_SMALLBIG)
91 #define LAMMPS_SMALLBIG
92 #endif
93 
94 // allow user override of LONGLONG to LONG, necessary for some machines/MPI
95 
96 #ifdef LAMMPS_LONGLONG_TO_LONG
97 #define MPI_LL MPI_LONG
98 #define ATOLL atoll
99 #else
100 #define MPI_LL MPI_LONG_LONG
101 #define ATOLL atol
102 #endif
103 
104 // for atomic problems that exceed 2 billion (2^31) atoms
105 // 32-bit smallint and tagint, 64-bit bigint
106 
107 #ifdef LAMMPS_SMALLBIG
108 
109 typedef int smallint;
110 typedef int imageint;
111 typedef int tagint;
112 typedef int64_t bigint;
113 
114 #define MAXSMALLINT INT_MAX
115 #define MAXTAGINT INT_MAX
116 #define MAXBIGINT INT64_MAX
117 
118 #define MPI_LMP_TAGINT MPI_INT
119 #define MPI_LMP_IMAGEINT MPI_INT
120 #define MPI_LMP_BIGINT MPI_LL
121 
122 #define TAGINT_FORMAT "%d"
123 #define BIGINT_FORMAT "%" PRId64
124 
125 #define ATOTAGINT atoi
126 #define ATOBIGINT ATOLL
127 
128 #define IMGMASK 1023
129 #define IMGMAX 512
130 #define IMGBITS 10
131 #define IMG2BITS 20
132 
133 #endif
134 
135 // for molecular problems that exceed 2 billion (2^31) atoms
136 // or problems where atoms wrap around the periodic box more than 512 times
137 // 32-bit smallint, 64-bit tagint and bigint
138 
139 #ifdef LAMMPS_BIGBIG
140 
141 typedef int smallint;
142 typedef int64_t imageint;
143 typedef int64_t tagint;
144 typedef int64_t bigint;
145 
146 #define MAXSMALLINT INT_MAX
147 #define MAXTAGINT INT64_MAX
148 #define MAXBIGINT INT64_MAX
149 
150 #define MPI_LMP_TAGINT MPI_LL
151 #define MPI_LMP_IMAGEINT MPI_LL
152 #define MPI_LMP_BIGINT MPI_LL
153 
154 #define TAGINT_FORMAT "%" PRId64
155 #define BIGINT_FORMAT "%" PRId64
156 
157 #define ATOTAGINT ATOLL
158 #define ATOBIGINT ATOLL
159 
160 #define IMGMASK 2097151
161 #define IMGMAX 1048576
162 #define IMGBITS 21
163 #define IMG2BITS 42
164 
165 #endif
166 
167 // for machines that do not support 64-bit ints
168 // 32-bit smallint and tagint and bigint
169 
170 #ifdef LAMMPS_SMALLSMALL
171 
172 typedef int smallint;
173 typedef int imageint;
174 typedef int tagint;
175 typedef int bigint;
176 
177 #define MAXSMALLINT INT_MAX
178 #define MAXTAGINT INT_MAX
179 #define MAXBIGINT INT_MAX
180 
181 #define MPI_LMP_TAGINT MPI_INT
182 #define MPI_LMP_IMAGEINT MPI_INT
183 #define MPI_LMP_BIGINT MPI_INT
184 
185 #define TAGINT_FORMAT "%d"
186 #define BIGINT_FORMAT "%d"
187 
188 #define ATOTAGINT atoi
189 #define ATOBIGINT atoi
190 
191 #define IMGMASK 1023
192 #define IMGMAX 512
193 #define IMGBITS 10
194 #define IMG2BITS 20
195 
196 #endif
197 
198 }
199 
200 // settings to enable LAMMPS to build under Windows
201 
202 #ifdef _WIN32
203 #include "lmpwindows.h"
204 #endif
205 
206 #endif
207