--- trunk/OOPSE/libmdtools/Integrator.cpp 2004/06/21 18:52:21 1284 +++ trunk/OOPSE/libmdtools/Integrator.cpp 2004/08/23 15:11:36 1452 @@ -34,7 +34,7 @@ template Integrator::Integrator(SimInfo nAtoms = info->n_atoms; integrableObjects = info->integrableObjects; - consFramework = new RattleFramework(info); + consFramework = new RollFramework(info); if(consFramework == NULL){ sprintf(painCave.errMsg, @@ -199,7 +199,8 @@ template void Integrator::integrate(voi // remove center of mass drift velocity (in case we passed in a configuration // that was drifting tStats->removeCOMdrift(); - + //tStats->removeAngularMomentum(); + // initialize the retraints if necessary if (info->useSolidThermInt && !info->useLiquidThermInt) { myFF->initRestraints(); @@ -346,6 +347,8 @@ template void Integrator::integrateStep startProfile( pro6 ); #endif //profile + consFramework->doPreConstraint(); + // finish the velocity half step moveB(); @@ -403,6 +406,7 @@ template void Integrator::moveA(void){ this->rotationPropagation( integrableObjects[i], ji ); integrableObjects[i]->setJ(ji); + } } @@ -445,6 +449,7 @@ template void Integrator::moveB(void){ integrableObjects[i]->setJ(ji); } + } consFramework->doConstrainB(); @@ -862,4 +867,83 @@ template string Integrator::getAddition //The reason we use string instead of char* is that if we use char*, we will //return a pointer point to local variable which might cause problem return string(); +} + + +template void Integrator::printQuaternion(StuntDouble* sd){ + Mat4x4d S; + double I[3][3]; + Vector4d j4; + Vector3d j; + Vector3d tempJ; + Vector4d qdot; + Vector4d omega4; + Mat4x4d I4; + Quaternion q; + double I0; + Vector4d p_qua; + + if (sd->isDirectional()){ + sd->getQ(q.vec); + sd->getI(I); + sd->getJ(j.vec); + + //omega4[0] = 0.0; + //omega4[1] = j[0]/I[0][0]; + //omega4[2] = j[1]/I[1][1]; + //omega4[3] = j[2]/I[2][2]; + + //S = getS(q); + //qdot = 0.5 * S * omega4; + + //I0 = (qdot[1] * q[1] * I[0][0] + qdot[2] * q[2] * I[1][1] + qdot[3] * q[3] * I[2][2])/(qdot[1] * q[1]+ qdot[2] * q[2] + qdot[3] * q[3]); + + //I4.element[0][0] = I0; + //I4.element[1][1] = I[0][0]; + //I4.element[2][2] = I[1][1]; + //I4.element[3][3] = I[2][2]; + + S = getS(q); + j4[0] = 0.0; + j4[1] = j[0]; + j4[2] = j[1]; + j4[3] = j[2]; + + p_qua = 2 * S * j4; + + j4 = 0.5 * S.transpose() * p_qua; + //cout << "q0^2 + q1^2 + q2^2 + q3^2 = " << q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3] << endl; + //cout << "q0*q0dot + q1*q1dot + q2 *q2dot + q3*q3dot = " <