| 52 |
|
: Torsion(atom1, atom2, ghostAtom, ghostAtom, tt) {} |
| 53 |
|
|
| 54 |
|
void GhostTorsion::calcForce(RealType& angle, bool doParticlePot) { |
| 55 |
< |
DirectionalAtom* ghostAtom = static_cast<DirectionalAtom*>(atom3_); |
| 55 |
> |
DirectionalAtom* ghostAtom = static_cast<DirectionalAtom*>(atoms_[2]); |
| 56 |
|
|
| 57 |
< |
Vector3d pos1 = atom1_->getPos(); |
| 58 |
< |
Vector3d pos2 = atom2_->getPos(); |
| 57 |
> |
Vector3d pos1 = atoms_[0]->getPos(); |
| 58 |
> |
Vector3d pos2 = atoms_[1]->getPos(); |
| 59 |
|
Vector3d pos3 = ghostAtom->getPos(); |
| 60 |
|
|
| 61 |
|
Vector3d r21 = pos1 - pos2; |
| 92 |
|
Vector3d f2 = dVdcosPhi * ( cross(r43, dcosdB) - cross(r21, dcosdA)); |
| 93 |
|
Vector3d f3 = dVdcosPhi * cross(dcosdB, r32); |
| 94 |
|
|
| 95 |
< |
atom1_->addFrc(f1); |
| 96 |
< |
atom2_->addFrc(f2 - f1); |
| 95 |
> |
atoms_[0]->addFrc(f1); |
| 96 |
> |
atoms_[1]->addFrc(f2 - f1); |
| 97 |
|
|
| 98 |
|
ghostAtom->addFrc(-f2); |
| 99 |
|
|
| 101 |
|
ghostAtom->addTrq(cross(r43, f3)); |
| 102 |
|
|
| 103 |
|
if (doParticlePot) { |
| 104 |
< |
atom1_->addParticlePot(potential_); |
| 105 |
< |
atom2_->addParticlePot(potential_); |
| 104 |
> |
atoms_[0]->addParticlePot(potential_); |
| 105 |
> |
atoms_[1]->addParticlePot(potential_); |
| 106 |
|
ghostAtom->addParticlePot(potential_); |
| 107 |
|
} |
| 108 |
|
|