1 /* -*- c++ -*- ----------------------------------------------------------
2    LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
3    https://www.lammps.org/, Sandia National Laboratories
4    Steve Plimpton, sjplimp@sandia.gov
5 
6    Copyright (2003) Sandia Corporation.  Under the terms of Contract
7    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
8    certain rights in this software.  This software is distributed under
9    the GNU General Public License.
10 
11    See the README file in the top-level LAMMPS directory.
12 ------------------------------------------------------------------------- */
13 
14 #include <cmath>
15 #include <direct.h>
16 
17 // some symbols have different names in Windows
18 
19 #undef ATOBIGINT
20 #define ATOBIGINT _atoi64
21 
22 #define pclose _pclose
23 #define strdup _strdup
24 
25 // the following functions are defined to get rid of
26 // 'ambiguous call to overloaded function' error in VSS for mismatched type arguments
27 #if !defined(__MINGW32__)
pow(int i,int j)28 inline double pow(int i, int j)
29 {
30   return pow((double) i, j);
31 }
fabs(int i)32 inline double fabs(int i)
33 {
34   return fabs((double) i);
35 }
sqrt(int i)36 inline double sqrt(int i)
37 {
38   return sqrt((double) i);
39 }
40 #endif
41 
trunc(double x)42 inline double trunc(double x)
43 {
44   return x > 0 ? floor(x) : ceil(x);
45 }
46 
47 // Windows version of mkdir function does not have permission flags
48 #ifndef S_IRWXU
49 #define S_IRWXU 0
50 #endif
51 #ifndef S_IRGRP
52 #define S_IRGRP 0
53 #endif
54 #ifndef S_IXGRP
55 #define S_IXGRP 0
56 #endif
mkdir(const char * path,int)57 inline int mkdir(const char *path, int)
58 {
59   return _mkdir(path);
60 }
61