| 578 | 
  | 
  //do zconstraint force;  | 
| 579 | 
  | 
  if (haveFixedZMols()) | 
| 580 | 
  | 
    this->doZconstraintForce(); | 
| 581 | 
< | 
      | 
| 581 | 
> | 
 | 
| 582 | 
  | 
  //use harmonical poteintial to move the molecules to the specified positions | 
| 583 | 
  | 
  if (haveMovingZMols()) | 
| 584 | 
  | 
    this->doHarmonic(); | 
| 612 | 
  | 
#ifdef IS_MPI | 
| 613 | 
  | 
  } | 
| 614 | 
  | 
#endif | 
| 615 | 
– | 
 | 
| 615 | 
  | 
} | 
| 616 | 
  | 
 | 
| 617 | 
  | 
 | 
| 800 | 
  | 
  double COMvel[3];    | 
| 801 | 
  | 
  double COM[3]; | 
| 802 | 
  | 
  double force[3]; | 
| 804 | 
– | 
 | 
| 805 | 
– | 
 | 
| 803 | 
  | 
 | 
| 804 | 
  | 
  //constrain the molecules which do not reach the specified positions   | 
| 805 | 
  | 
     | 
| 864 | 
  | 
//   cout << "after zero out z-constraint force on fixed z-constraint molecuels " | 
| 865 | 
  | 
//        << "total force is " << calcTotalForce() << endl; | 
| 866 | 
  | 
 | 
| 870 | 
– | 
  //calculate the number of atoms of moving z-constrained molecules | 
| 871 | 
– | 
  int nMovingZAtoms_local; | 
| 872 | 
– | 
  int nMovingZAtoms; | 
| 873 | 
– | 
   | 
| 874 | 
– | 
  nMovingZAtoms_local = 0; | 
| 875 | 
– | 
  for(int i = 0; i < zconsMols.size(); i++) | 
| 876 | 
– | 
    if(states[i] == zcsMoving) | 
| 877 | 
– | 
     nMovingZAtoms_local += zconsMols[i]->getNAtoms(); | 
| 878 | 
– | 
   | 
| 879 | 
– | 
#ifdef IS_MPI | 
| 880 | 
– | 
  MPI_Allreduce(&nMovingZAtoms_local, &nMovingZAtoms, 1,  | 
| 881 | 
– | 
                      MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); | 
| 882 | 
– | 
#else | 
| 883 | 
– | 
  nMovingZAtoms = nMovingZAtoms_local; | 
| 884 | 
– | 
#endif | 
| 885 | 
– | 
 | 
| 867 | 
  | 
  force[0]= 0; | 
| 868 | 
  | 
  force[1]= 0; | 
| 869 | 
  | 
  force[2]= 0; |