ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Integrator.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Integrator.cpp (file contents):
Revision 1451 by tim, Mon Jun 21 18:52:21 2004 UTC vs.
Revision 1452 by tim, Mon Aug 23 15:11:36 2004 UTC

# Line 34 | Line 34 | template<typename T> Integrator<T>::Integrator(SimInfo
34    nAtoms = info->n_atoms;
35    integrableObjects = info->integrableObjects;
36  
37 <  consFramework = new RattleFramework(info);
37 >  consFramework = new RollFramework(info);
38  
39    if(consFramework == NULL){
40      sprintf(painCave.errMsg,
# Line 199 | Line 199 | template<typename T> void Integrator<T>::integrate(voi
199    // remove center of mass drift velocity (in case we passed in a configuration
200    // that was drifting
201    tStats->removeCOMdrift();
202 <
202 >  //tStats->removeAngularMomentum();
203 >  
204    // initialize the retraints if necessary
205    if (info->useSolidThermInt && !info->useLiquidThermInt) {
206      myFF->initRestraints();
# Line 346 | Line 347 | template<typename T> void Integrator<T>::integrateStep
347    startProfile( pro6 );
348   #endif //profile
349  
350 +  consFramework->doPreConstraint();
351 +
352    // finish the velocity  half step
353  
354    moveB();
# Line 403 | Line 406 | template<typename T> void Integrator<T>::moveA(void){
406        this->rotationPropagation( integrableObjects[i], ji );
407  
408        integrableObjects[i]->setJ(ji);
409 +
410      }
411    }
412  
# Line 445 | Line 449 | template<typename T> void Integrator<T>::moveB(void){
449  
450        integrableObjects[i]->setJ(ji);
451      }
452 +
453    }
454  
455    consFramework->doConstrainB();
# Line 862 | Line 867 | template<typename T> string Integrator<T>::getAddition
867    //The reason we use string instead of char* is that if we use char*, we will
868    //return a pointer point to local variable which might cause problem
869    return string();
870 + }
871 +
872 +
873 + template<typename T>  void Integrator<T>::printQuaternion(StuntDouble* sd){
874 +  Mat4x4d S;
875 +  double I[3][3];
876 +  Vector4d j4;
877 +  Vector3d j;
878 +  Vector3d tempJ;
879 +  Vector4d qdot;
880 +  Vector4d omega4;
881 +  Mat4x4d I4;
882 +  Quaternion q;
883 +  double I0;
884 +  Vector4d p_qua;
885 +  
886 +  if (sd->isDirectional()){
887 +    sd->getQ(q.vec);
888 +    sd->getI(I);
889 +    sd->getJ(j.vec);
890 +
891 +    //omega4[0] = 0.0;
892 +    //omega4[1] = j[0]/I[0][0];
893 +    //omega4[2] = j[1]/I[1][1];
894 +    //omega4[3] = j[2]/I[2][2];
895 +
896 +    //S = getS(q);
897 +    //qdot = 0.5 * S * omega4;
898 +
899 +    //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]);
900 +
901 +    //I4.element[0][0] = I0;
902 +    //I4.element[1][1] = I[0][0];
903 +    //I4.element[2][2] = I[1][1];
904 +    //I4.element[3][3] = I[2][2];
905 +
906 +    S = getS(q);
907 +    j4[0] = 0.0;
908 +    j4[1] = j[0];
909 +    j4[2] = j[1];
910 +    j4[3] = j[2];
911 +    
912 +    p_qua = 2 * S * j4;
913 +
914 +    j4 = 0.5 * S.transpose() * p_qua;
915 +    //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;
916 +    //cout << "q0*q0dot + q1*q1dot + q2 *q2dot + q3*q3dot = " <<q[0]*qdot[0] + q[1]*qdot[1] + q[2]*qdot[2] + q[3]*qdot[3] << endl;
917 +    //cout << "q1*q1dot* Ixx + q2*q2dot* Iyy + q3 *q3dot* Izz = " << qdot[1] * q[1] * I[0][0] + qdot[2] * q[2] * I[1][1] + qdot[3] * q[3] * I[2][2] << endl;
918 +    //cout << "q1*q1dot + q2 *q2dot + q3*q3dot = "  << qdot[1] * q[1]+ qdot[2] * q[2] + qdot[3] * q[3] << endl;
919 +    //cout << "I0 = " << I0 << endl;
920 +    cout << "p_qua[0] = " << p_qua[0] << endl;
921 +  }    
922   }
923 +
924 + template<typename T> Mat4x4d Integrator<T>::getS(const Quaternion& q){
925 +  Mat4x4d result;
926 +
927 +  result.element[0][0] = q.x;
928 +  result.element[0][1] = -q.y;
929 +  result.element[0][2] = -q.z;
930 +  result.element[0][3] = -q.w;
931 +
932 +  result.element[1][0] = q.y;
933 +  result.element[1][1] = q.x;
934 +  result.element[1][2] = -q.w;
935 +  result.element[1][3] = q.z;
936 +
937 +  result.element[2][0] = q.z;
938 +  result.element[2][1] = q.w;
939 +  result.element[2][2] = q.x;
940 +  result.element[2][3] = -q.y;
941 +
942 +  result.element[3][0] = q.w;
943 +  result.element[3][1] = -q.z;
944 +  result.element[3][2] = q.y;
945 +  result.element[3][3] = q.x;
946 +
947 +  return result;  
948 + }
949 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines