33 |
|
|
34 |
|
} |
35 |
|
else{ |
36 |
+ |
|
37 |
|
indexOfAllZConsMols = index->getIndexData(); |
38 |
+ |
|
39 |
+ |
//the maximum value of index is the last one(we sorted the index data in SimSetup.cpp) |
40 |
+ |
int maxIndex; |
41 |
+ |
int totalNumMol; |
42 |
+ |
|
43 |
+ |
maxIndex = indexOfAllZConsMols[indexOfAllZConsMols.size() - 1]; |
44 |
+ |
|
45 |
+ |
#ifndef IS_MPI |
46 |
+ |
totalNumMol = nMols; |
47 |
+ |
#else |
48 |
+ |
totalNumMol = mpiSim->getTotNmol(); |
49 |
+ |
#endif |
50 |
+ |
|
51 |
+ |
if(maxIndex > totalNumMol - 1){ |
52 |
+ |
sprintf( painCave.errMsg, |
53 |
+ |
"ZConstraint error: index is out of range\n"); |
54 |
+ |
painCave.isFatal = 1; |
55 |
+ |
simError(); |
56 |
+ |
|
57 |
+ |
} |
58 |
+ |
|
59 |
|
} |
60 |
|
|
61 |
|
} |
525 |
|
#endif |
526 |
|
|
527 |
|
zsys = (totalMZOfZCons + totalMZOfUncons) /totalMassOfUncons; |
528 |
< |
|
507 |
< |
cout << "current time: " << info->getTime() <<endl; |
528 |
> |
|
529 |
|
for(int i = 0; i < zconsMols.size(); i++){ |
530 |
|
|
531 |
|
zconsMols[i]->getCOM(COM); |
532 |
|
|
512 |
– |
cout << "global index: " << zconsMols[i]->getGlobalIndex() << "\tZ: " << COM[2] << "\t"; |
533 |
|
deltaZ = zsys + refZ[i] - COM[2]; |
514 |
– |
cout << "\tdistance: " << COM[2] +deltaZ - zsys; |
534 |
|
//update z coordinate |
535 |
|
zconsAtoms = zconsMols[i]->getMyAtoms(); |
536 |
|
for(int j =0; j < zconsMols[i]->getNAtoms(); j++){ |
540 |
|
//calculate z constrain force |
541 |
|
fz[i] = massOfZConsMols[i]* deltaZ / dt2; |
542 |
|
|
524 |
– |
cout << "\tforce: " << fz[i] << endl; |
543 |
|
} |
544 |
|
|
545 |
|
|