| 491 |
|
|
| 492 |
|
template<typename T> void ZConstraint<T>::resetZ() |
| 493 |
|
{ |
| 494 |
+ |
|
| 495 |
+ |
double pos[3]; |
| 496 |
|
double deltaZ; |
| 497 |
|
double mzOfZCons; //total sum of m*z of z-constrain molecules |
| 498 |
|
double mzOfUncons; //total sum of m*z of unconstrain molecuels; |
| 527 |
|
#endif |
| 528 |
|
|
| 529 |
|
zsys = (totalMZOfZCons + totalMZOfUncons) /totalMassOfUncons; |
| 530 |
< |
|
| 529 |
< |
cout << "current time: " << info->getTime() <<endl; |
| 530 |
> |
|
| 531 |
|
for(int i = 0; i < zconsMols.size(); i++){ |
| 532 |
|
|
| 533 |
|
zconsMols[i]->getCOM(COM); |
| 534 |
|
|
| 534 |
– |
cout << "global index: " << zconsMols[i]->getGlobalIndex() << "\tZ: " << COM[2] << "\t"; |
| 535 |
|
deltaZ = zsys + refZ[i] - COM[2]; |
| 536 |
– |
cout << "\tdistance: " << COM[2] +deltaZ - zsys; |
| 536 |
|
//update z coordinate |
| 537 |
|
zconsAtoms = zconsMols[i]->getMyAtoms(); |
| 538 |
|
for(int j =0; j < zconsMols[i]->getNAtoms(); j++){ |
| 539 |
< |
zconsAtoms[j]->setZ(zconsAtoms[j]->getZ() + deltaZ); |
| 539 |
> |
zconsAtoms[j]->getPos(pos); |
| 540 |
> |
pos[2] += deltaZ; |
| 541 |
> |
zconsAtoms[j]->setPos(pos); |
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
//calculate z constrain force |
| 545 |
|
fz[i] = massOfZConsMols[i]* deltaZ / dt2; |
| 546 |
|
|
| 546 |
– |
cout << "\tforce: " << fz[i] << endl; |
| 547 |
|
} |
| 548 |
|
|
| 549 |
|
|