| 287 |
|
Vector3d vel; |
| 288 |
|
std::list<ZconstraintMol>::iterator i; |
| 289 |
|
Molecule* mol; |
| 290 |
< |
StuntDouble* integrableObject; |
| 290 |
> |
StuntDouble* sd; |
| 291 |
|
Molecule::IntegrableObjectIterator ii; |
| 292 |
|
|
| 293 |
|
//zero out the velocities of center of mass of fixed z-constrained molecules |
| 294 |
|
for(i = fixedZMols_.begin(); i != fixedZMols_.end(); ++i) { |
| 295 |
+ |
|
| 296 |
|
mol = i->mol; |
| 297 |
|
comVel = mol->getComVel(); |
| 298 |
< |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 299 |
< |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 300 |
< |
vel = integrableObject->getVel(); |
| 298 |
> |
|
| 299 |
> |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 300 |
> |
sd = mol->nextIntegrableObject(ii)) { |
| 301 |
> |
|
| 302 |
> |
vel = sd->getVel(); |
| 303 |
|
vel[whichDirection] -= comVel[whichDirection]; |
| 304 |
< |
integrableObject->setVel(vel); |
| 304 |
> |
sd->setVel(vel); |
| 305 |
|
} |
| 306 |
|
} |
| 307 |
|
|
| 334 |
|
|
| 335 |
|
//modify the velocities of moving z-constrained molecuels |
| 336 |
|
for ( i = movingZMols_.begin(); i != movingZMols_.end(); ++i) { |
| 337 |
+ |
|
| 338 |
|
mol = i->mol; |
| 339 |
< |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 340 |
< |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 339 |
> |
|
| 340 |
> |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 341 |
> |
sd = mol->nextIntegrableObject(ii)) { |
| 342 |
|
|
| 343 |
< |
vel = integrableObject->getVel(); |
| 343 |
> |
vel = sd->getVel(); |
| 344 |
|
vel[whichDirection] -= vzMovingMols; |
| 345 |
< |
integrableObject->setVel(vel); |
| 345 |
> |
sd->setVel(vel); |
| 346 |
|
} |
| 347 |
|
} |
| 348 |
|
|
| 349 |
|
//modify the velocites of unconstrained molecules |
| 350 |
|
for ( j = unzconsMols_.begin(); j != unzconsMols_.end(); ++j) { |
| 351 |
< |
mol =*j; |
| 352 |
< |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 348 |
< |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 351 |
> |
|
| 352 |
> |
mol =*j; |
| 353 |
|
|
| 354 |
< |
vel = integrableObject->getVel(); |
| 354 |
> |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 355 |
> |
sd = mol->nextIntegrableObject(ii)) { |
| 356 |
> |
|
| 357 |
> |
vel = sd->getVel(); |
| 358 |
|
vel[whichDirection] -= vzMovingMols; |
| 359 |
< |
integrableObject->setVel(vel); |
| 359 |
> |
sd->setVel(vel); |
| 360 |
|
} |
| 361 |
|
} |
| 362 |
|
|
| 378 |
|
//calculate the total z-contrained force of fixed z-contrained molecules |
| 379 |
|
std::list<ZconstraintMol>::iterator i; |
| 380 |
|
Molecule* mol; |
| 381 |
< |
StuntDouble* integrableObject; |
| 381 |
> |
StuntDouble* sd; |
| 382 |
|
Molecule::IntegrableObjectIterator ii; |
| 383 |
|
|
| 384 |
|
for ( i = fixedZMols_.begin(); i != fixedZMols_.end(); ++i) { |
| 385 |
+ |
|
| 386 |
|
mol = i->mol; |
| 387 |
|
i->fz = 0.0; |
| 380 |
– |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 381 |
– |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 388 |
|
|
| 389 |
< |
force = integrableObject->getFrc(); |
| 389 |
> |
for( sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 390 |
> |
sd = mol->nextIntegrableObject(ii)) { |
| 391 |
> |
|
| 392 |
> |
force = sd->getFrc(); |
| 393 |
|
i->fz += force[whichDirection]; |
| 394 |
|
} |
| 395 |
|
totalFZ_local += i->fz; |
| 405 |
|
|
| 406 |
|
// apply negative to fixed z-constrained molecues; |
| 407 |
|
for ( i = fixedZMols_.begin(); i != fixedZMols_.end(); ++i) { |
| 399 |
– |
mol = i->mol; |
| 400 |
– |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 401 |
– |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 408 |
|
|
| 409 |
< |
force[whichDirection] = -getZFOfFixedZMols(mol, integrableObject, i->fz); |
| 410 |
< |
integrableObject->addFrc(force); |
| 409 |
> |
mol = i->mol; |
| 410 |
> |
|
| 411 |
> |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 412 |
> |
sd = mol->nextIntegrableObject(ii)) { |
| 413 |
> |
|
| 414 |
> |
force[whichDirection] = -getZFOfFixedZMols(mol, sd, i->fz); |
| 415 |
> |
sd->addFrc(force); |
| 416 |
|
} |
| 417 |
|
} |
| 418 |
|
|
| 419 |
|
//modify the forces of moving z-constrained molecules |
| 420 |
|
for ( i = movingZMols_.begin(); i != movingZMols_.end(); ++i) { |
| 421 |
+ |
|
| 422 |
|
mol = i->mol; |
| 411 |
– |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 412 |
– |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 423 |
|
|
| 424 |
+ |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 425 |
+ |
sd = mol->nextIntegrableObject(ii)) { |
| 426 |
+ |
|
| 427 |
|
force[whichDirection] = -getZFOfMovingMols(mol,totalFZ); |
| 428 |
< |
integrableObject->addFrc(force); |
| 428 |
> |
sd->addFrc(force); |
| 429 |
|
} |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
//modify the forces of unconstrained molecules |
| 433 |
|
std::vector<Molecule*>::iterator j; |
| 434 |
|
for ( j = unzconsMols_.begin(); j != unzconsMols_.end(); ++j) { |
| 435 |
+ |
|
| 436 |
|
mol =*j; |
| 423 |
– |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 424 |
– |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 437 |
|
|
| 438 |
+ |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 439 |
+ |
sd = mol->nextIntegrableObject(ii)) { |
| 440 |
+ |
|
| 441 |
|
force[whichDirection] = -getZFOfMovingMols(mol, totalFZ); |
| 442 |
< |
integrableObject->addFrc(force); |
| 442 |
> |
sd->addFrc(force); |
| 443 |
|
} |
| 444 |
|
} |
| 445 |
|
|
| 453 |
|
RealType totalFZ_local = 0; |
| 454 |
|
RealType lrPot; |
| 455 |
|
std::list<ZconstraintMol>::iterator i; |
| 456 |
< |
StuntDouble* integrableObject; |
| 456 |
> |
StuntDouble* sd; |
| 457 |
|
Molecule::IntegrableObjectIterator ii; |
| 458 |
|
Molecule* mol; |
| 459 |
|
for ( i = movingZMols_.begin(); i != movingZMols_.end(); ++i) { |
| 469 |
|
totalFZ_local += harmonicF; |
| 470 |
|
|
| 471 |
|
//adjust force |
| 472 |
< |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 473 |
< |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 472 |
> |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 473 |
> |
sd = mol->nextIntegrableObject(ii)) { |
| 474 |
|
|
| 475 |
< |
force[whichDirection] = getHFOfFixedZMols(mol, integrableObject, harmonicF); |
| 476 |
< |
integrableObject->addFrc(force); |
| 475 |
> |
force[whichDirection] = getHFOfFixedZMols(mol, sd, harmonicF); |
| 476 |
> |
sd->addFrc(force); |
| 477 |
|
} |
| 478 |
|
} |
| 479 |
|
|
| 486 |
|
//modify the forces of unconstrained molecules |
| 487 |
|
std::vector<Molecule*>::iterator j; |
| 488 |
|
for ( j = unzconsMols_.begin(); j != unzconsMols_.end(); ++j) { |
| 489 |
+ |
|
| 490 |
|
mol = *j; |
| 475 |
– |
for(integrableObject = mol->beginIntegrableObject(ii); integrableObject != NULL; |
| 476 |
– |
integrableObject = mol->nextIntegrableObject(ii)) { |
| 491 |
|
|
| 492 |
+ |
for(sd = mol->beginIntegrableObject(ii); sd != NULL; |
| 493 |
+ |
sd = mol->nextIntegrableObject(ii)) { |
| 494 |
+ |
|
| 495 |
|
force[whichDirection] = getHFOfUnconsMols(mol, totalFZ); |
| 496 |
< |
integrableObject->addFrc(force); |
| 496 |
> |
sd->addFrc(force); |
| 497 |
|
} |
| 498 |
|
} |
| 499 |
|
|