--- trunk/OOPSE/libmdtools/ZConstraint.cpp 2003/08/20 14:34:04 701 +++ trunk/OOPSE/libmdtools/ZConstraint.cpp 2003/08/22 20:04:39 711 @@ -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(); @@ -525,21 +527,53 @@ template void ZConstraint::calcForce(in double zsys; double COM[3]; double force[3]; + double zSysCOMVel; 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(); - cout << "---------------------------------------------------------------------" <getTime() << endl; - cout << "center of mass at z: " << zsys << endl; - //cout << "before calcForce, the COMVel of moving molecules is " << calcMovingMolsCOMVel() <getTime() << endl; + cout << "center of mass at z: " << zsys << endl; + cout << "before calcForce, the COMVel of system is " << zSysCOMVel < void ZConstraint::calcForce(in if (haveMovingZMols()) this->doHarmonic(); - //cout << "after doHarmonic, totalForce is " << calcTotalForce() << endl; - //write out forces and current positions of z-constraint molecules if(info->getTime() >= curZconsTime){ for(int i = 0; i < zconsMols.size(); i++){ @@ -571,9 +603,16 @@ template void ZConstraint::calcForce(in fzOut->writeFZ(info->getTime(), zconsMols.size(), indexOfZConsMols, fz, curZPos); curZconsTime += zconsTime; } - - //cout << "after calcForce, the COMVel of moving molecules is " << calcMovingMolsCOMVel() < 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; @@ -903,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]; @@ -983,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(){ @@ -1163,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){