示例#1
0
文件: pr_08_1.c 项目: qnu/mdoch
void SetParams ()
{
  sitesMol = 4;
  VSCopy (region, 1. / pow (density, 1./3.), initUcell);
  nMol = VProd (initUcell);
  velMag = sqrt (NDIM * (1. - 1. / nMol) * temperature);
}
示例#2
0
文件: pr_02_1.c 项目: juannnesss/MC
void SetParams ()
{
    rCut = pow (2., 1./6.);
    VSCopy (region, 1. / sqrt (density), initUcell);
    nMol = VProd (initUcell);
    velMag = sqrt (NDIM * (1. - 1. / nMol) * temperature);
}
示例#3
0
文件: pr_13_1.c 项目: qnu/mdoch
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]);
    }
  }
}
示例#4
0
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 {