Exemplo n.º 1
0
void DCFreeHedron::SetBondLengthOld(TrialMol& oldMol)
{
  for(uint i = 0; i < hed.NumBond(); ++i) {
    bondLengthOld[i] = sqrt(oldMol.OldDistSq(hed.Focus(), hed.Bonded(i)));
  }
  anchorBondOld = sqrt(oldMol.OldDistSq(hed.Focus(), hed.Prev()));
}
Exemplo n.º 2
0
void DCHedron::IncorporateOld(TrialMol& oldMol, uint molIndex)
{
  bendEnergy = 0.0;
  oneThree = 0.0;
  const Forcefield& ff = data->ff;
  for (uint b = 0; b < nBonds; ++b) {

    oldMol.OldThetaAndPhi(bonded[b], focus, theta[b], phi[b]);
    double thetaEnergy = data->ff.angles->Calc(angleKinds[b][b], theta[b]);
    double distSq = oldMol.OldDistSq(prev, bonded[b]);
    double nonbondedEn =
      data->calc.IntraEnergy_1_3(distSq, prev, bonded[b], molIndex);

    thetaWeight[b] += exp(-1 * data->ff.beta * (thetaEnergy + nonbondedEn));
    bendEnergy += thetaEnergy;
    oneThree += nonbondedEn;

    if (b != 0) {
      double phiEnergy = 0.0;
      nonbondedEn = 0.0;
      phiWeight[b] = 0.0;
      for (uint c = 0; c < b; ++c) {
        double cosTerm = cos(theta[b]) * cos(theta[c]);
        double sinTerm = sin(theta[b]) * sin(theta[c]);
        double bfcTheta = acos(sinTerm * cos(phi[b] - phi[c]) +
                               cosTerm);

        double distSq = oldMol.OldDistSq(bonded[c], bonded[b]);
        nonbondedEn +=  data->calc.IntraEnergy_1_3(distSq, bonded[c],
                        bonded[b], molIndex);

        phiEnergy += ff.angles->Calc(angleKinds[b][c], bfcTheta);

      }
      phiWeight[b] = exp(-ff.beta * (phiEnergy + nonbondedEn));
      bendEnergy += phiEnergy;
      oneThree += nonbondedEn;
    }
  }
}