--- trunk/OOPSE/libmdtools/Integrator.cpp 2003/09/17 14:22:15 768 +++ trunk/OOPSE/libmdtools/Integrator.cpp 2003/09/19 20:00:27 778 @@ -290,8 +290,6 @@ template void Integrator::moveA(void){ int i, j; DirectionalAtom* dAtom; double Tb[3], ji[3]; - double A[3][3], I[3][3]; - double angle; double vel[3], pos[3], frc[3]; double mass; @@ -326,35 +324,10 @@ template void Integrator::moveA(void){ for (j = 0; j < 3; j++) ji[j] += (dt2 * Tb[j]) * eConvert; - - // use the angular velocities to propagate the rotation matrix a - // full time step - - dAtom->getA(A); - dAtom->getI(I); - - // 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]; - 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); + this->rotationPropagation( dAtom, ji ); dAtom->setJ(ji); - dAtom->setA(A); } } @@ -666,6 +639,41 @@ template void Integrator::constrainB(vo painCave.isFatal = 1; simError(); } +} + +template void Integrator::rotationPropagation +( DirectionalAtom* dAtom, double ji[3] ){ + + double angle; + double A[3][3], I[3][3]; + + // use the angular velocities to propagate the rotation matrix a + // full time step + + dAtom->getA(A); + dAtom->getI(I); + + // 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]; + 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 ); + + dAtom->setA( A ); } template void Integrator::rotate(int axes1, int axes2,