# | Line 525 | Line 525 | template<typename T> void ZConstraint<T>::calcForce(in | |
---|---|---|
525 | double zsys; | |
526 | double COM[3]; | |
527 | double force[3]; | |
528 | + | double zSysCOMVel; |
529 | ||
530 | T::calcForce(calcPot, calcStress); | |
531 | ||
# | Line 532 | Line 533 | template<typename T> void ZConstraint<T>::calcForce(in | |
533 | zeroOutVel(); | |
534 | forcePolicy->update(); | |
535 | } | |
536 | + | |
537 | zsys = calcZSys(); | |
538 | < | cout << "---------------------------------------------------------------------" <<endl; |
539 | < | cout << "current time: " << info->getTime() << endl; |
540 | < | cout << "center of mass at z: " << zsys << endl; |
541 | < | //cout << "before calcForce, the COMVel of moving molecules is " << calcMovingMolsCOMVel() <<endl; |
542 | < | cout << "before calcForce, the COMVel of system is " << calcSysCOMVel() <<endl; |
538 | > | zSysCOMVel = calcSysCOMVel(); |
539 | > | #ifdef IS_MPI |
540 | > | if(worldRank == 0){ |
541 | > | #endif |
542 | > | cout << "---------------------------------------------------------------------" <<endl; |
543 | > | cout << "current time: " << info->getTime() << endl; |
544 | > | cout << "center of mass at z: " << zsys << endl; |
545 | > | cout << "before calcForce, the COMVel of system is " << zSysCOMVel <<endl; |
546 | ||
547 | < | //cout << "before doZConstraintForce, totalForce is " << calcTotalForce() << endl; |
547 | > | #ifdef IS_MPI |
548 | > | } |
549 | > | #endif |
550 | ||
551 | //do zconstraint force; | |
552 | if (haveFixedZMols()) | |
# | Line 549 | Line 556 | template<typename T> void ZConstraint<T>::calcForce(in | |
556 | if (haveMovingZMols()) | |
557 | this->doHarmonic(); | |
558 | ||
552 | – | //cout << "after doHarmonic, totalForce is " << calcTotalForce() << endl; |
553 | – | |
559 | //write out forces and current positions of z-constraint molecules | |
560 | if(info->getTime() >= curZconsTime){ | |
561 | for(int i = 0; i < zconsMols.size(); i++){ | |
# | Line 571 | Line 576 | template<typename T> void ZConstraint<T>::calcForce(in | |
576 | fzOut->writeFZ(info->getTime(), zconsMols.size(), indexOfZConsMols, fz, curZPos); | |
577 | curZconsTime += zconsTime; | |
578 | } | |
579 | < | |
580 | < | //cout << "after calcForce, the COMVel of moving molecules is " << calcMovingMolsCOMVel() <<endl; |
581 | < | cout << "after calcForce, the COMVel of system is " << calcSysCOMVel() <<endl; |
579 | > | |
580 | > | zSysCOMVel = calcSysCOMVel(); |
581 | > | #ifdef IS_MPI |
582 | > | if(worldRank == 0){ |
583 | > | #endif |
584 | > | cout << "after calcForce, the COMVel of system is " << zSysCOMVel <<endl; |
585 | > | #ifdef IS_MPI |
586 | > | } |
587 | > | #endif |
588 | > | |
589 | } | |
590 | ||
591 | ||
# | Line 786 | Line 798 | template<typename T> void ZConstraint<T>::doZconstrain | |
798 | } | |
799 | totalFZ_local += fz[i]; | |
800 | ||
801 | < | cout << "Fixed Molecule --\tindex: " << indexOfZConsMols[i] |
801 | > | cout << "Fixed Molecule\tindex: " << indexOfZConsMols[i] |
802 | <<"\tcurrent zpos: " << COM[whichDirection] | |
803 | << "\tcurrent fz: " <<fz[i] << endl; | |
804 | ||
# | Line 903 | Line 915 | template<typename T> void ZConstraint<T>::doHarmonic() | |
915 | ||
916 | if (states[i] == zcsMoving){ | |
917 | zconsMols[i]->getCOM(COM); | |
918 | < | cout << "Moving Molecule --\tindex: " << indexOfZConsMols[i] <<"\tcurrent zpos: " << COM[whichDirection] << endl; |
918 | > | cout << "Moving Molecule\tindex: " << indexOfZConsMols[i] <<"\tcurrent zpos: " << COM[whichDirection] << endl; |
919 | ||
920 | diff = COM[whichDirection] -zPos[i]; | |
921 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |