46 |
|
GhostTorsion::GhostTorsion(Atom *atom1, Atom *atom2, DirectionalAtom* ghostAtom, |
47 |
|
TorsionType *tt) : Torsion(atom1, atom2, ghostAtom, ghostAtom, tt) {} |
48 |
|
|
49 |
< |
void GhostTorsion::calcForce(double& angle) { |
49 |
> |
void GhostTorsion::calcForce(RealType& angle) { |
50 |
|
DirectionalAtom* ghostAtom = static_cast<DirectionalAtom*>(atom3_); |
51 |
|
|
52 |
|
Vector3d pos1 = atom1_->getPos(); |
59 |
|
|
60 |
|
// Calculate the cross products and distances |
61 |
|
Vector3d A = cross(r21, r32); |
62 |
< |
double rA = A.length(); |
62 |
> |
RealType rA = A.length(); |
63 |
|
Vector3d B = cross(r32, r43); |
64 |
< |
double rB = B.length(); |
64 |
> |
RealType rB = B.length(); |
65 |
|
Vector3d C = cross(r32, A); |
66 |
< |
double rC = C.length(); |
66 |
> |
RealType rC = C.length(); |
67 |
|
|
68 |
|
A.normalize(); |
69 |
|
B.normalize(); |
70 |
|
C.normalize(); |
71 |
|
|
72 |
|
// Calculate the sin and cos |
73 |
< |
double cos_phi = dot(A, B) ; |
73 |
> |
RealType cos_phi = dot(A, B) ; |
74 |
|
|
75 |
< |
double dVdcosPhi; |
75 |
> |
RealType dVdcosPhi; |
76 |
|
torsionType_->calcForce(cos_phi, potential_, dVdcosPhi); |
77 |
|
|
78 |
|
Vector3d dcosdA = (cos_phi * A - B) /rA; |