Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

common.h

Go to the documentation of this file.
00001 
00007 /*
00008    common definitions for namd.
00009 */
00010 
00011 #ifndef COMMON_H
00012 #define COMMON_H
00013 
00014 #if !defined(WIN32) || defined(__CYGWIN__)
00015 #include <unistd.h>
00016 #endif
00017 #include <stdio.h>
00018 #include <limits.h>
00019 
00020 #if ( INT_MAX == 2147483647L )
00021 typedef int     int32;
00022 #elif ( SHRT_MAX == 2147483647L )
00023 typedef short   int32;
00024 #endif
00025 
00026 #ifdef _MSC_VER
00027 typedef __int64 int64;
00028 #else
00029 #if ( INT_MAX == 9223372036854775807LL )
00030 typedef int int64;
00031 #elif ( LONG_MAX == 9223372036854775807LL )
00032 typedef long int64;
00033 #else
00034 typedef long long int64;
00035 #endif
00036 #endif
00037 
00038 #if defined(PLACEMENT_NEW)
00039 void * ::operator new (size_t, void *p) { return p; }
00040 #elif defined(PLACEMENT_NEW_GLOBAL)
00041 void * operator new (size_t, void *p) { return p; }
00042 #endif
00043 
00044 #define COULOMB 332.0636
00045 #define BOLTZMANN 0.001987191
00046 #define TIMEFACTOR 48.88821
00047 #define PRESSUREFACTOR 6.95E4
00048 #define PDBVELFACTOR 20.45482706
00049 #define PDBVELINVFACTOR (1.0/PDBVELFACTOR)
00050 #define PNPERKCALMOL 69.479
00051 
00052 /* Some plagtforms don't have nearbyint or round, so we'll define one */
00053 /* that works everywhere */
00054 #ifdef ARCH_POWERPC
00055 extern "builtin" double __tanint(double); //IEEE round
00056 #define mynearbyint(x)  __tanint(x)
00057 #else
00058 #define mynearbyint(x)  floor((x)+0.5)
00059 #endif
00060 
00061 #ifndef PI
00062 #define PI      3.141592653589793
00063 #endif
00064 
00065 #ifndef TWOPI
00066 #define TWOPI   2.0 * PI
00067 #endif
00068 
00069 #ifndef ONE
00070 #define ONE     1.000000000000000
00071 #endif
00072 
00073 #ifndef ZERO
00074 #define ZERO    0.000000000000000
00075 #endif
00076 
00077 #ifndef SMALLRAD
00078 #define SMALLRAD      0.0005
00079 #endif
00080 
00081 #ifndef SMALLRAD2
00082 #define SMALLRAD2     SMALLRAD*SMALLRAD
00083 #endif
00084 
00085 /* Define the size for Real and BigReal.  Real is usually mapped to float */
00086 /* and BigReal to double.  To get BigReal mapped to float, use the        */
00087 /* -DSHORTREALS compile time option                                       */
00088 typedef float   Real;
00089 
00090 #ifdef SHORTREALS
00091 typedef float   BigReal;
00092 #else
00093 typedef double  BigReal;
00094 #endif
00095 
00096 #ifndef FALSE
00097 #define FALSE 0
00098 #define TRUE 1
00099 #endif
00100 
00101 #ifndef NO
00102 #define NO 0
00103 #define YES 1
00104 #endif
00105 
00106 #ifndef STRINGNULL
00107 #define STRINGNULL '\0'
00108 #endif
00109 
00110 #define MAX_NEIGHBORS 27
00111 
00112 typedef int Bool;
00113 
00114 class Communicate;
00115 
00116 // global functions
00117 void NAMD_quit(const char *);
00118 void NAMD_die(const char *);
00119 void NAMD_err(const char *);  // also prints strerror(errno)
00120 void NAMD_bug(const char *);
00121 void NAMD_backup_file(const char *filename, const char *extension = 0);
00122 void NAMD_write(int fd, const void *buf, size_t count); // NAMD_die on error
00123 char *NAMD_stringdup(const char *);
00124 FILE *Fopen(const char *filename, const char *mode);
00125 int  Fclose(FILE *fout);
00126 
00127 // message tags
00128 #define SIMPARAMSTAG    100     //  Tag for SimParameters class
00129 #define STATICPARAMSTAG 101     //  Tag for Parameters class
00130 #define MOLECULETAG     102     //  Tag for Molecule class
00131 #define FULLTAG 104
00132 #define FULLFORCETAG 105
00133 #define DPMTATAG 106
00134 #define GRIDFORCEGRIDTAG 107
00135 
00136 #define CYCLE_BARRIER   0
00137 #define PME_BARRIER     0
00138 #define STEP_BARRIER    0
00139 
00140 #define USE_BARRIER   (CYCLE_BARRIER || PME_BARRIER || STEP_BARRIER)
00141 
00142 
00143 // DMK - Atom Separation (water vs. non-water)
00144 //   Setting this define to a non-zero value will cause the
00145 //   HomePatches to separate the hydrogen groups in their
00146 //   HomePatch::atom lists (all water molecules first, in arbitrary
00147 //   order, followed by all non-waters, in arbitrary order).
00148 #define NAMD_SeparateWaters    0
00149 
00150 // DMK - Atom Sort
00151 //   Setting this define to a non-zero value will cause the nonbonded compute
00152 //   objects (pairs, not selfs) to sort the atoms along a line connecting the
00153 //   center of masses of the two patches.  This is only done during timesteps
00154 //   where the pairlists are being generated.  As the pairlist is being
00155 //   generated, once an atom that is far enough away along the line is found,
00156 //   the remaining atoms are automatically skipped (avoiding a distance
00157 //   calculation/check for them).
00158 // NOTE: The "less branches" flag toggles between two versions of merge sort.
00159 //   When it is non-zero, a version that has fewer branches (but more integer
00160 //   math) is used.  This version may or may not be faster or some architectures.
00161 #define NAMD_ComputeNonbonded_SortAtoms                   1
00162   #define NAMD_ComputeNonbonded_SortAtoms_LessBranches    1
00163 
00164 // plf -- alternate water models
00165 #define WAT_TIP3 0
00166 #define WAT_TIP4 1
00167 #define WAT_SWM4 2  /* Drude model (5 charge sites) */
00168 
00169 
00170 #include "converse.h"
00171 
00172 #endif
00173 

Generated on Sun Feb 12 04:07:53 2012 for NAMD by  doxygen 1.3.9.1