--- trunk/OOPSE/libmdtools/Integrator.cpp 2004/05/22 18:16:18 1187 +++ trunk/OOPSE/libmdtools/Integrator.cpp 2004/06/21 18:52:21 1284 @@ -1,7 +1,8 @@ #include #include #include - +#include "Rattle.hpp" +#include "Roll.hpp" #ifdef IS_MPI #include "mpiSimulation.hpp" #include @@ -32,7 +33,17 @@ template Integrator::Integrator(SimInfo nAtoms = info->n_atoms; integrableObjects = info->integrableObjects; - + + consFramework = new RattleFramework(info); + + if(consFramework == NULL){ + sprintf(painCave.errMsg, + "Integrator::Intergrator() Error: Memory allocation error for RattleFramework" ); + painCave.isFatal = 1; + simError(); + } + +/* // check for constraints constrainedA = NULL; @@ -45,10 +56,13 @@ template Integrator::Integrator(SimInfo nConstrained = 0; checkConstraints(); - +*/ } template Integrator::~Integrator(){ + if (consFramework != NULL) + delete consFramework; +/* if (nConstrained){ delete[] constrainedA; delete[] constrainedB; @@ -57,8 +71,10 @@ template Integrator::~Integrator(){ delete[] moved; delete[] oldPos; } +*/ } +/* template void Integrator::checkConstraints(void){ isConstrained = 0; @@ -93,7 +109,7 @@ template void Integrator::checkConstrai if (constrained){ dummy_plug = theArray[j]->get_constraint(); temp_con[nConstrained].set_a(dummy_plug->get_a()); - temp_con[nConstrained].set_b(dummy_plug->get_b()); + temp_con[nConstrained].set_b(Dummy_plug->get_b()); temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); nConstrained++; @@ -151,8 +167,8 @@ template void Integrator::checkConstrai delete[] temp_con; } +*/ - template void Integrator::integrate(void){ double runTime = info->run_time; @@ -185,20 +201,19 @@ template void Integrator::integrate(voi tStats->removeCOMdrift(); // initialize the retraints if necessary - if (info->useThermInt) { + if (info->useSolidThermInt && !info->useLiquidThermInt) { myFF->initRestraints(); } // initialize the forces before the first step calcForce(1, 1); - - if (nConstrained){ - preMove(); - constrainA(); - calcForce(1, 1); - constrainB(); - } + + //execute constraint algorithm to make sure at the very beginning the system is constrained + //consFramework->doPreConstraint(); + //consFramework->doConstrainA(); + //calcForce(1, 1); + //consFramework->doConstrainB(); if (info->setTemp){ thermalize(); @@ -255,7 +270,6 @@ template void Integrator::integrate(voi if (info->getTime() >= currStatus){ statOut->writeStat(info->getTime()); - statOut->writeRaw(info->getTime()); calcPot = 0; calcStress = 0; currStatus += statusTime; @@ -279,7 +293,7 @@ template void Integrator::integrate(voi } // dump out a file containing the omega values for the final configuration - if (info->useThermInt) + if (info->useSolidThermInt && !info->useLiquidThermInt) myFF->dumpzAngle(); @@ -295,7 +309,8 @@ template void Integrator::integrateStep startProfile(pro3); #endif //profile - preMove(); + //save old state (position, velocity etc) + consFramework->doPreConstraint(); #ifdef PROFILE endProfile(pro3); @@ -391,9 +406,7 @@ template void Integrator::moveA(void){ } } - if (nConstrained){ - constrainA(); - } + consFramework->doConstrainA(); } @@ -434,11 +447,10 @@ template void Integrator::moveB(void){ } } - if (nConstrained){ - constrainB(); - } + consFramework->doConstrainB(); } +/* template void Integrator::preMove(void){ int i, j; double pos[3]; @@ -697,7 +709,7 @@ template void Integrator::constrainB(vo simError(); } } - +*/ template void Integrator::rotationPropagation ( StuntDouble* sd, double ji[3] ){