--- trunk/OOPSE/libmdtools/Integrator.hpp 2004/05/27 00:48:12 1198 +++ trunk/OOPSE/libmdtools/Integrator.hpp 2004/08/23 15:11:36 1452 @@ -14,6 +14,8 @@ #include "ReadWrite.hpp" #include "ZConsWriter.hpp" #include "Restraints.hpp" +#include "Quaternion.hpp" +#include "Mat4x4d.hpp" using namespace std; const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K @@ -22,6 +24,7 @@ template class Integrator const int maxIteration = 300; const double tol = 1.0e-6; +class VelVerletConsFramework; template class Integrator : public T { public: @@ -34,11 +37,11 @@ template class Integrator protected: virtual void integrateStep( int calcPot, int calcStress ); - virtual void preMove( void ); + //virtual void preMove( void ); virtual void moveA( void ); virtual void moveB( void ); - virtual void constrainA( void ); - virtual void constrainB( void ); + //virtual void constrainA( void ); + //virtual void constrainB( void ); virtual int readyCheck( void ) { return 1; } virtual void resetIntegrator( void ) { } @@ -50,10 +53,13 @@ template class Integrator virtual void rotationPropagation( StuntDouble* sd, double ji[3] ); - void checkConstraints( void ); + //void checkConstraints( void ); void rotate( int axes1, int axes2, double angle, double j[3], double A[3][3] ); + void printQuaternion(StuntDouble* sd); + Mat4x4d getS(const Quaternion& q); + ForceFields* myFF; SimInfo *info; // all the info we'll ever need @@ -64,16 +70,17 @@ template class Integrator Molecule* molecules; int nMols; - int isConstrained; // boolean to know whether the systems contains - // constraints. - int nConstrained; // counter for number of constraints - int *constrainedA; // the i of a constraint pair - int *constrainedB; // the j of a constraint pair - double *constrainedDsqr; // the square of the constraint distance + VelVerletConsFramework* consFramework; - int* moving; // tells whether we are moving atom i - int* moved; // tells whether we have moved atom i - double* oldPos; // pre constrained positions + //int isConstrained; // boolean to know whether the systems contains constraints. + //int nConstrained; // counter for number of constraints + //int *constrainedA; // the i of a constraint pair + //int *constrainedB; // the j of a constraint pair + //double *constrainedDsqr; // the square of the constraint distance + + //int* moving; // tells whether we are moving atom i + //int* moved; // tells whether we have moved atom i + //double* oldPos; // pre constrained positions short isFirst; /*boolean for the first time integrate is called */ @@ -89,8 +96,9 @@ template class Integrator; typedef Integrator RealIntegrator; // ansi instantiation -template class Integrator; +// template class Integrator; + template class NVE : public T { public: @@ -490,4 +498,28 @@ template class ZConstraint : public T { (p }; + +//Sympletic quaternion Scheme Integrator +//Reference: +// T.F. Miller, M. Eleftheriou, P. Pattnaik, A. Ndirango, D. Newns and G.J. Martyna +//Symplectic quaternion Scheme for biophysical molecular dynamics +//116(20), 8649, J. Chem. Phys. (2002) +template class SQSIntegrator : public T{ + public: + SQSIntegrator( SimInfo *theInfo, ForceFields* the_ff ); + virtual void moveA(); + virtual void moveB(); + protected: + void freeRotor(double dt, Quaternion& q, Vector4d& qdot, Vector3d& I); + void rotate(int k, double dt, Quaternion& q, Vector4d& qdot, double Ik); + private: + Quaternion getPk(int i, const Vector4d& q); + Mat4x4d getS(const Quaternion& q); + vector q; + vector p_qua; + vector I0; + + Vector4d p2j(const Vector4d& p, Mat4x4d& m); + Vector4d j2p(const Vector4d& j, Mat4x4d& m); +}; #endif