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 |
|
|
44 |
|
namespace oopse { |
45 |
|
|
46 |
< |
/**@todo still a lot left to improve*/ |
47 |
< |
void Bend::calcForce() { |
46 |
> |
/**@todo still a lot left to improve*/ |
47 |
> |
void Bend::calcForce(double& angle) { |
48 |
|
Vector3d pos1 = atom1_->getPos(); |
49 |
|
Vector3d pos2 = atom2_->getPos(); |
50 |
|
Vector3d pos3 = atom3_->getPos(); |
63 |
|
|
64 |
|
//check roundoff |
65 |
|
if (cosTheta > 1.0) { |
66 |
< |
cosTheta = 1.0; |
66 |
> |
cosTheta = 1.0; |
67 |
|
} else if (cosTheta < -1.0) { |
68 |
< |
cosTheta = -1.0; |
68 |
> |
cosTheta = -1.0; |
69 |
|
} |
70 |
|
|
71 |
|
double theta = acos(cosTheta); |
73 |
|
double dVdTheta; |
74 |
|
|
75 |
|
bendType_->calcForce(theta, potential_, dVdTheta); |
76 |
+ |
//std::cout << atom1_->getType() << "\t" << atom2_->getType() << "\t" << atom3_->getType() << "\t"; |
77 |
+ |
//std::cout << "theta = " << theta/M_PI * 180.0 <<", potential = " << potential_ << std::endl; |
78 |
|
|
79 |
|
double sinTheta = sqrt(1.0 - cosTheta * cosTheta); |
80 |
|
|
81 |
|
if (fabs(sinTheta) < 1.0E-6) { |
82 |
< |
sinTheta = 1.0E-6; |
82 |
> |
sinTheta = 1.0E-6; |
83 |
|
} |
84 |
|
|
85 |
|
double commonFactor1 = dVdTheta / sinTheta * d21inv; |
95 |
|
atom1_->addFrc(force1); |
96 |
|
atom2_->addFrc(force2); |
97 |
|
atom3_->addFrc(force3); |
96 |
– |
} |
98 |
|
|
99 |
+ |
angle = theta /M_PI * 180.0; |
100 |
+ |
} |
101 |
+ |
|
102 |
|
} //end namespace oopse |