00001 #define ABOUT "MOLECULAR DYNAMICS SIMULATOR BY A.V.SMIRNOV\nandrei.v.smirnov@gmail.com\n"
00002
00003 #define DOCTYPE "remody"
00004 #define REAL double
00005 #define TINY 1e-10
00006 #define SMALL 1e-30
00007 #define LARGE 1e30
00008 #define MAXLINLEN 510
00009 #define WORDLENGTH 64
00010 #define ESC 0x1B
00011 #define PI 3.14159265358979323846
00012 #define SQRTPIo8 0.62666 //sqrt(pi/8)
00013 #define ERROR(message) \
00014 { fprintf(stderr,"\nERROR: %s\n",message);exit(1);}
00015 #define TRUE 1
00016 #define FALSE 0
00017
00018
00019 #define OMP // comment this to use sequential mode (saves memory)
00020 #define WAIT for(int i=0;i<999999&&locked;i++)
00021 const int maxcounters=4;
00022
00023
00024 const REAL
00025 onethird=1.0/3.0,
00026 twothirds=2.0/3.0,
00027 Sqrt2=sqrt(2.0),
00028 Sqrt2Over2=0.5*Sqrt2,
00029 sqrt1p5=sqrt(1.5),
00030 sqrt1p25=sqrt(1.25),
00031 Sqrt3=sqrt(3.0),
00032 OneOverSqrt2=1.0/Sqrt2,
00033 OneOverSqrt3=1.0/Sqrt3,
00034 Sqrt3Over2=0.5*Sqrt3;
00035
00036
00037 #define LOCAL //LOCAL INTERACTION SCHEME
00038 #define COLLISIONTIME //ESTIMATE THE TIME STEP AS MINIMUM TIME TO COLLISION
00039
00040 #define RND (REAL)((double)rand()/RAND_MAX)
00041
00042 #define MAX(a,b) ((a)>(b)?a:b)
00043 #ifndef ZERO
00044 #define ZERO(n,x) for (int i=0; i<(n); i++)x[i]=0.0
00045 #endif
00046 #define ADD(n,x,y) for (int i=0; i<(n); i++) (x)[i] += (y)[i]
00047 #define SUB(n,x,y) for (int i=0; i<(n); i++) (x)[i] -= (y)[i]
00048 #define ADDC(n,x,y,d) for (int i=0; i<(n); i++) (x)[i] += (y)[i]*(d)
00049 #define SUBC(n,x,y,d) for (int i=0; i<(n); i++) (x)[i] -= (y)[i]*(d)
00050 #define MUL(n,x,y) for (int i=0; i<(n); i++) (x)[i] *= (y)[i]
00051 #define MULC(n,x,c) for (int i=0; i<(n); i++) (x)[i] *= (c)
00052 #define DIV(n,x,y) for (int i=0; i<(n); i++) (x)[i] /= (y)[i]
00053 #define MULVEC(x,s) for (int i=0; i<DIM; i++) (x)[i] *= (s)
00054 #define ADDVEC(x,y) for (int i=0; i<DIM; i++) (x)[i] += (y)[i]
00055 #define COPYVEC(x,y) for (int i=0; i<DIM; i++) (x)[i] = (y)[i]
00056 #define ZEROVEC(x) for (int i=0; i<DIM; i++) (x)[i] = 0.
00057 #define SCLP(A,B) (A[0]*B[0]+A[1]*B[1]+A[2]*B[2])
00058 #define VECP(A,B,C) A[0]=B[1]*C[2]-B[2]*C[1];\
00059 A[1]=B[2]*C[0]-B[0]*C[2];\
00060 A[2]=B[0]*C[1]-B[1]*C[0];
00061 #define LENGTH(A) sqrt(SCLP(A,A))
00062 #define VOIDSPECIE nspecies //void specie index is the max spicie
00063 #define GAUSS Run::gauss()
00064
00065
00066 #define DIM 3
00067 #define BoltzmannConstant 1.38066e-23
00068 #define AtomicMassUnit 1.66053886e-27
00069 #define AvogadroNumber 6.02214179e23
00070 //#define GasConstant 8.31457070 //[70] J/(K*mol): ideal gas constant = BoltzmanConstant*AvogadroNumber
00071 const REAL
00072 GasConstant=BoltzmannConstant*AvogadroNumber,
00073 GasConstantInv=1.0/GasConstant;
00074
00075 #define DOFK 3 // Kinetic degrees of freedom = 3
00076
00077 #define DOF(cp) MAX(2.0*((cp)*GasConstantInv-1.0),DOFK) //= 3 + (2(Cp/R-1)-3)/2 = 3 + Cp/R -1 - 1.5 = Cp/R + 1.5 - 1 = Cp/R + 0.5
00078 #define DOFI(dof) (dof-DOFK) //Internal DOF from total DOF where 3.0 is kinetic dof
00079