--- trunk/OOPSE/libmdtools/Integrator.cpp 2004/04/15 16:18:26 1113 +++ trunk/OOPSE/libmdtools/Integrator.cpp 2004/05/27 20:06:38 1207 @@ -32,7 +32,7 @@ template Integrator::Integrator(SimInfo nAtoms = info->n_atoms; integrableObjects = info->integrableObjects; - + // check for constraints constrainedA = NULL; @@ -45,6 +45,7 @@ template Integrator::Integrator(SimInfo nConstrained = 0; checkConstraints(); + } template Integrator::~Integrator(){ @@ -160,7 +161,7 @@ template void Integrator::integrate(voi double thermalTime = info->thermalTime; double resetTime = info->resetTime; - + double difference; double currSample; double currThermal; double currStatus; @@ -178,6 +179,15 @@ template void Integrator::integrate(voi dt2 = 0.5 * dt; readyCheck(); + + // remove center of mass drift velocity (in case we passed in a configuration + // that was drifting + tStats->removeCOMdrift(); + + // initialize the retraints if necessary + if (info->useThermInt) { + myFF->initRestraints(); + } // initialize the forces before the first step @@ -211,7 +221,8 @@ template void Integrator::integrate(voi #endif // is_mpi while (info->getTime() < runTime && !stopIntegrator()){ - if ((info->getTime() + dt) >= currStatus){ + difference = info->getTime() + dt - currStatus; + if (difference > 0 || fabs(difference) < 1e-4 ){ calcPot = 1; calcStress = 1; } @@ -244,6 +255,8 @@ template void Integrator::integrate(voi if (info->getTime() >= currStatus){ statOut->writeStat(info->getTime()); + if (info->useThermInt) + statOut->writeRaw(info->getTime()); calcPot = 0; calcStress = 0; currStatus += statusTime; @@ -265,6 +278,11 @@ template void Integrator::integrate(voi MPIcheckPoint(); #endif // is_mpi } + + // dump out a file containing the omega values for the final configuration + if (info->useThermInt) + myFF->dumpzAngle(); + delete dumpOut; delete statOut; @@ -300,9 +318,7 @@ template void Integrator::integrateStep MPIcheckPoint(); #endif // is_mpi - // calc forces - calcForce(calcPot, calcStress); #ifdef IS_MPI @@ -337,6 +353,7 @@ template void Integrator::moveA(void){ double Tb[3], ji[3]; double vel[3], pos[3], frc[3]; double mass; + double omega; for (i = 0; i < integrableObjects.size() ; i++){ integrableObjects[i]->getVel(vel); @@ -687,6 +704,7 @@ template void Integrator::rotationPropa double angle; double A[3][3], I[3][3]; + int i, j, k; // use the angular velocities to propagate the rotation matrix a // full time step @@ -694,26 +712,43 @@ template void Integrator::rotationPropa sd->getA(A); sd->getI(I); - // rotate about the x-axis - angle = dt2 * ji[0] / I[0][0]; - this->rotate( 1, 2, angle, ji, A ); + if (sd->isLinear()) { + i = sd->linearAxis(); + j = (i+1)%3; + k = (i+2)%3; + + angle = dt2 * ji[j] / I[j][j]; + this->rotate( k, i, angle, ji, A ); - // rotate about the y-axis - angle = dt2 * ji[1] / I[1][1]; - this->rotate( 2, 0, angle, ji, A ); + angle = dt * ji[k] / I[k][k]; + this->rotate( i, j, angle, ji, A); - // rotate about the z-axis - angle = dt * ji[2] / I[2][2]; - this->rotate( 0, 1, angle, ji, A); + angle = dt2 * ji[j] / I[j][j]; + this->rotate( k, i, angle, ji, A ); - // rotate about the y-axis - angle = dt2 * ji[1] / I[1][1]; - this->rotate( 2, 0, angle, ji, A ); - - // rotate about the x-axis - angle = dt2 * ji[0] / I[0][0]; - this->rotate( 1, 2, angle, ji, A ); - + } else { + // rotate about the x-axis + angle = dt2 * ji[0] / I[0][0]; + this->rotate( 1, 2, angle, ji, A ); + + // rotate about the y-axis + angle = dt2 * ji[1] / I[1][1]; + this->rotate( 2, 0, angle, ji, A ); + + // rotate about the z-axis + angle = dt * ji[2] / I[2][2]; + sd->addZangle(angle); + this->rotate( 0, 1, angle, ji, A); + + // rotate about the y-axis + angle = dt2 * ji[1] / I[1][1]; + this->rotate( 2, 0, angle, ji, A ); + + // rotate about the x-axis + angle = dt2 * ji[0] / I[0][0]; + this->rotate( 1, 2, angle, ji, A ); + + } sd->setA( A ); }