--- trunk/OOPSE/libmdtools/ZConstraint.cpp 2003/08/20 14:50:32 702 +++ trunk/OOPSE/libmdtools/ZConstraint.cpp 2003/08/26 20:12:51 723 @@ -276,8 +276,8 @@ template ZConstraint::ZConstraint(SimIn massOfZConsMols.push_back(molecules[i].getTotalMass()); zPos.push_back((*parameters)[searchResult].zPos); - cout << "index: "<< (*parameters)[searchResult].zconsIndex - <<"\tzPos = " << (*parameters)[searchResult].zPos << endl; +// cout << "index: "<< (*parameters)[searchResult].zconsIndex +// <<"\tzPos = " << (*parameters)[searchResult].zPos << endl; kz.push_back((*parameters)[searchResult]. kRatio * zForceConst); molecules[i].getCOM(COM); @@ -509,6 +509,8 @@ template void ZConstraint::integrate(){ //zero out the velocities of center of mass of unconstrained molecules //and the velocities of center of mass of every single z-constrained molecueles zeroOutVel(); + + curZconsTime = zconsTime + info->getTime(); T::integrate(); @@ -530,19 +532,44 @@ template void ZConstraint::calcForce(in T::calcForce(calcPot, calcStress); if (checkZConsState()){ + +#ifdef IS_MPI + if(worldRank == 0){ +#endif +// std::cerr << "\n" +// << "*******************************************\n" +// << " about to call zeroOutVel()\n" +// << "*******************************************\n" +// << "\n"; +#ifdef IS_MPI + } +#endif zeroOutVel(); - forcePolicy->update(); - } +#ifdef IS_MPI + if(worldRank == 0){ +#endif +// std::cerr << "\n" +// << "*******************************************\n" +// << " finished zeroOutVel()\n" +// << "*******************************************\n" +// << "\n"; +#ifdef IS_MPI + } +#endif + + forcePolicy->update(); + } + zsys = calcZSys(); zSysCOMVel = calcSysCOMVel(); #ifdef IS_MPI if(worldRank == 0){ #endif - cout << "---------------------------------------------------------------------" <getTime() << endl; - cout << "center of mass at z: " << zsys << endl; - cout << "before calcForce, the COMVel of system is " << zSysCOMVel <getTime() << endl; +// cout << "center of mass at z: " << zsys << endl; +// cout << "before calcForce, the COMVel of system is " << zSysCOMVel < void ZConstraint::calcForce(in #ifdef IS_MPI if(worldRank == 0){ #endif - cout << "after calcForce, the COMVel of system is " << zSysCOMVel < void ZConstraint::zeroOutVel() #ifdef IS_MPI if(worldRank == 0){ #endif - cout << "before resetting the COMVel of sytem is " << zSysCOMVel << endl; +// cout << "before resetting the COMVel of sytem is " << zSysCOMVel << endl; #ifdef IS_MPI } #endif @@ -755,7 +782,7 @@ template void ZConstraint::zeroOutVel() #ifdef IS_MPI if(worldRank == 0){ #endif - cout << "after resetting the COMVel of moving molecules is " << zSysCOMVel << endl; +// cout << "after resetting the COMVel of moving molecules is " << zSysCOMVel << endl; #ifdef IS_MPI } #endif @@ -798,9 +825,9 @@ template void ZConstraint::doZconstrain } totalFZ_local += fz[i]; - cout << "Fixed Molecule\tindex: " << indexOfZConsMols[i] - <<"\tcurrent zpos: " << COM[whichDirection] - << "\tcurrent fz: " < void ZConstraint::doZconstrain } - //cout << "after zero out z-constraint force on fixed z-constraint molecuels " - // << "total force is " << calcTotalForce() << endl; +// cout << "after zero out z-constraint force on fixed z-constraint molecuels " +// << "total force is " << calcTotalForce() << endl; //calculate the number of atoms of moving z-constrained molecules int nMovingZAtoms_local; @@ -915,7 +942,8 @@ template void ZConstraint::doHarmonic() if (states[i] == zcsMoving){ zconsMols[i]->getCOM(COM); - cout << "Moving Molecule\tindex: " << indexOfZConsMols[i] <<"\tcurrent zpos: " << COM[whichDirection] << endl; +// cout << "Moving Molecule\tindex: " << indexOfZConsMols[i] +// << "\tcurrent zpos: " << COM[whichDirection] << endl; diff = COM[whichDirection] -zPos[i]; @@ -995,8 +1023,8 @@ template bool ZConstraint::checkZConsSt #else MPI_Allreduce(&changed_local, &changed, 1, MPI_INT,MPI_SUM, MPI_COMM_WORLD); #endif - - return changed > 0 ? true : false; + + return (changed > 0); } template bool ZConstraint::haveFixedZMols(){ @@ -1175,6 +1203,18 @@ template void ZConstraint::PolicyByNumb nMovingZAtoms = nMovingZAtoms_local; #endif totNumOfMovingAtoms = nMovingZAtoms + zconsIntegrator->totNumOfUnconsAtoms; + +#ifdef IS_MPI + if(worldRank == 0){ +#endif + // std::cerr << "\n" +// << "*******************************************\n" +// << " fiished Policy by numbr()\n" +// << "*******************************************\n" +// << "\n"; +#ifdef IS_MPI + } +#endif } templatedouble ZConstraint::PolicyByNumber::getZFOfFixedZMols(Molecule* mol, Atom* atom, double totalForce){