void SetParams () { sitesMol = 4; VSCopy (region, 1. / pow (density, 1./3.), initUcell); nMol = VProd (initUcell); velMag = sqrt (NDIM * (1. - 1. / nMol) * temperature); }
void SetParams () { rCut = pow (2., 1./6.); VSCopy (region, 1. / sqrt (density), initUcell); nMol = VProd (initUcell); velMag = sqrt (NDIM * (1. - 1. / nMol) * temperature); }
void EvalSinCos () { VecR t, tt, u, w; int j, n; VSetAll (t, 2. * M_PI); VDiv (t, t, region); DO_MOL { VMul (tt, t, mol[n].r); VSetAll (tCos[0][n], 1.); VSetAll (tSin[0][n], 0.); VSet (tCos[1][n], cos (tt.x), cos (tt.y), cos (tt.z)); VSet (tSin[1][n], sin (tt.x), sin (tt.y), sin (tt.z)); VSCopy (u, 2., tCos[1][n]); VMul (tCos[2][n], u, tCos[1][n]); VMul (tSin[2][n], u, tSin[1][n]); VSetAll (tt, 1.); VVSub (tCos[2][n], tt); for (j = 3; j <= fSpaceLimit; j ++) { VMul (w, u, tCos[j - 1][n]); VSub (tCos[j][n], w, tCos[j - 2][n]); VMul (w, u, tSin[j - 1][n]); VSub (tSin[j][n], w, tSin[j - 2][n]); } } }
void LeapfrogStep (int part) { RMat mc, mt; VecR t; int n; if (part == 1) { DO_MOL { VVSAdd (mol[n].wv, 0.5 * deltaT, mol[n].wa); VVSAdd (mol[n].rv, 0.5 * deltaT, mol[n].ra); } DO_MOL { VSCopy (t, 0.5 * deltaT, mol[n].wv); BuildStepRmatT (&mc, &t); MulMat (mt.u, mc.u, mol[n].rMatT.u, 3); mol[n].rMatT = mt; } DO_MOL VVSAdd (mol[n].r, deltaT, mol[n].rv); } else {