--- trunk/OOPSE/libmdtools/Integrator.cpp 2003/07/14 22:38:13 600 +++ trunk/OOPSE/libmdtools/Integrator.cpp 2003/08/11 19:41:36 677 @@ -11,7 +11,7 @@ Integrator::Integrator( SimInfo *theInfo, ForceFields* #include "simError.h" -Integrator::Integrator( SimInfo *theInfo, ForceFields* the_ff ){ +template Integrator::Integrator( SimInfo *theInfo, ForceFields* the_ff ) { info = theInfo; myFF = the_ff; @@ -27,8 +27,6 @@ Integrator::Integrator( SimInfo *theInfo, ForceFields* nAtoms = info->n_atoms; - std::cerr << "integ nAtoms = " << nAtoms << "\n"; - // check for constraints constrainedA = NULL; @@ -43,7 +41,7 @@ Integrator::~Integrator() { checkConstraints(); } -Integrator::~Integrator() { +template Integrator::~Integrator() { if( nConstrained ){ delete[] constrainedA; @@ -56,7 +54,7 @@ void Integrator::checkConstraints( void ){ } -void Integrator::checkConstraints( void ){ +template void Integrator::checkConstraints( void ){ isConstrained = 0; @@ -75,12 +73,7 @@ void Integrator::checkConstraints( void ){ constrained = theArray[j]->is_constrained(); - std::cerr << "Is the folowing bond constrained \n"; - theArray[j]->printMe(); - if(constrained){ - - std::cerr << "Yes\n"; dummy_plug = theArray[j]->get_constraint(); temp_con[nConstrained].set_a( dummy_plug->get_a() ); @@ -90,7 +83,6 @@ void Integrator::checkConstraints( void ){ nConstrained++; constrained = 0; } - else std::cerr << "No.\n"; } theArray = (SRI**) molecules[i].getMyBends(); @@ -163,7 +155,7 @@ void Integrator::integrate( void ){ } -void Integrator::integrate( void ){ +template void Integrator::integrate( void ){ int i, j; // loop counters @@ -175,7 +167,6 @@ void Integrator::integrate( void ){ double currSample; double currThermal; double currStatus; - double currTime; int calcPot, calcStress; int isError; @@ -192,23 +183,21 @@ void Integrator::integrate( void ){ // initialize the forces before the first step - myFF->doForces(1,1); + calcForce(1, 1); if( info->setTemp ){ - tStats->velocitize(); + thermalize(); } - dumpOut->writeDump( 0.0 ); - statOut->writeStat( 0.0 ); - calcPot = 0; calcStress = 0; currSample = sampleTime; currThermal = thermalTime; currStatus = statusTime; - currTime = 0.0;; + dumpOut->writeDump( info->getTime() ); + statOut->writeStat( info->getTime() ); readyCheck(); @@ -218,33 +207,31 @@ void Integrator::integrate( void ){ MPIcheckPoint(); #endif // is_mpi - while( currTime < runTime ){ + while( info->getTime() < runTime ){ - if( (currTime+dt) >= currStatus ){ + if( (info->getTime()+dt) >= currStatus ){ calcPot = 1; calcStress = 1; } - std::cerr << currTime << "\n"; - integrateStep( calcPot, calcStress ); - currTime += dt; + info->incrTime(dt); if( info->setTemp ){ - if( currTime >= currThermal ){ - tStats->velocitize(); + if( info->getTime() >= currThermal ){ + thermalize(); currThermal += thermalTime; } } - if( currTime >= currSample ){ - dumpOut->writeDump( currTime ); + if( info->getTime() >= currSample ){ + dumpOut->writeDump( info->getTime() ); currSample += sampleTime; } - if( currTime >= currStatus ){ - statOut->writeStat( currTime ); + if( info->getTime() >= currStatus ){ + statOut->writeStat( info->getTime() ); calcPot = 0; calcStress = 0; currStatus += statusTime; @@ -258,13 +245,13 @@ void Integrator::integrate( void ){ } - dumpOut->writeFinal(currTime); + dumpOut->writeFinal(info->getTime()); delete dumpOut; delete statOut; } -void Integrator::integrateStep( int calcPot, int calcStress ){ +template void Integrator::integrateStep( int calcPot, int calcStress ){ @@ -274,19 +261,38 @@ void Integrator::integrateStep( int calcPot, int calcS moveA(); if( nConstrained ) constrainA(); + +#ifdef IS_MPI + strcpy( checkPointMsg, "Succesful moveA\n" ); + MPIcheckPoint(); +#endif // is_mpi + + // calc forces - myFF->doForces(calcPot,calcStress); + calcForce(calcPot,calcStress); +#ifdef IS_MPI + strcpy( checkPointMsg, "Succesful doForces\n" ); + MPIcheckPoint(); +#endif // is_mpi + + // finish the velocity half step moveB(); if( nConstrained ) constrainB(); - + +#ifdef IS_MPI + strcpy( checkPointMsg, "Succesful moveB\n" ); + MPIcheckPoint(); +#endif // is_mpi + + } -void Integrator::moveA( void ){ +template void Integrator::moveA( void ){ int i, j; DirectionalAtom* dAtom; @@ -365,7 +371,7 @@ void Integrator::moveB( void ){ } -void Integrator::moveB( void ){ +template void Integrator::moveB( void ){ int i, j; DirectionalAtom* dAtom; double Tb[3], ji[3]; @@ -407,7 +413,7 @@ void Integrator::preMove( void ){ } } -void Integrator::preMove( void ){ +template void Integrator::preMove( void ){ int i, j; double pos[3]; @@ -425,7 +431,7 @@ void Integrator::constrainA(){ } } -void Integrator::constrainA(){ +template void Integrator::constrainA(){ int i,j,k; int done; @@ -576,7 +582,7 @@ void Integrator::constrainB( void ){ } -void Integrator::constrainB( void ){ +template void Integrator::constrainB( void ){ int i,j,k; int done; @@ -685,7 +691,7 @@ void Integrator::rotate( int axes1, int axes2, double } -void Integrator::rotate( int axes1, int axes2, double angle, double ji[3], +template void Integrator::rotate( int axes1, int axes2, double angle, double ji[3], double A[3][3] ){ int i,j,k; @@ -766,3 +772,12 @@ void Integrator::rotate( int axes1, int axes2, double } } } + +template void Integrator::calcForce( int calcPot, int calcStress ){ + myFF->doForces(calcPot,calcStress); + +} + +template void Integrator::thermalize(){ + tStats->velocitize(); +}