| 1 |
< |
/* |
| 1 |
> |
/* |
| 2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
| 3 |
|
* |
| 4 |
|
* The University of Notre Dame grants you ("Licensee") a |
| 43 |
|
#include "primitives/DirectionalAtom.hpp" |
| 44 |
|
namespace oopse { |
| 45 |
|
|
| 46 |
< |
/**@todo still a lot left to improve*/ |
| 47 |
< |
void GhostBend::calcForce() { |
| 46 |
> |
/**@todo still a lot left to improve*/ |
| 47 |
> |
void GhostBend::calcForce() { |
| 48 |
|
DirectionalAtom* ghostAtom = static_cast<DirectionalAtom*>(atom2_); |
| 49 |
|
|
| 50 |
|
Vector3d pos1 = atom1_->getPos(); |
| 64 |
|
|
| 65 |
|
//check roundoff |
| 66 |
|
if (cosTheta > 1.0) { |
| 67 |
< |
cosTheta = 1.0; |
| 67 |
> |
cosTheta = 1.0; |
| 68 |
|
} else if (cosTheta < -1.0) { |
| 69 |
< |
cosTheta = -1.0; |
| 69 |
> |
cosTheta = -1.0; |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
double theta = acos(cosTheta); |
| 78 |
|
double sinTheta = sqrt(1.0 - cosTheta * cosTheta); |
| 79 |
|
|
| 80 |
|
if (fabs(sinTheta) < 1.0E-12) { |
| 81 |
< |
sinTheta = 1.0E-12; |
| 81 |
> |
sinTheta = 1.0E-12; |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
double commonFactor1 = -firstDerivative / sinTheta * d12inv; |
| 91 |
|
/**@todo test correctness */ |
| 92 |
|
ghostAtom->addTrq(cross(r32, force3) ); |
| 93 |
|
|
| 94 |
< |
} |
| 94 |
> |
} |
| 95 |
|
|
| 96 |
|
} //end namespace oopse |
| 97 |
|
|