| 47 | 
  | 
                   TorsionType *tt) : | 
| 48 | 
  | 
    atom1_(atom1), atom2_(atom2), atom3_(atom3), atom4_(atom4), torsionType_(tt) { } | 
| 49 | 
  | 
 | 
| 50 | 
< | 
  void Torsion::calcForce(double& angle) { | 
| 50 | 
> | 
  void Torsion::calcForce(RealType& angle) { | 
| 51 | 
  | 
 | 
| 52 | 
  | 
    Vector3d pos1 = atom1_->getPos(); | 
| 53 | 
  | 
    Vector3d pos2 = atom2_->getPos(); | 
| 60 | 
  | 
 | 
| 61 | 
  | 
    //  Calculate the cross products and distances | 
| 62 | 
  | 
    Vector3d A = cross(r21, r32); | 
| 63 | 
< | 
    double rA = A.length(); | 
| 63 | 
> | 
    RealType rA = A.length(); | 
| 64 | 
  | 
    Vector3d B = cross(r32, r43); | 
| 65 | 
< | 
    double rB = B.length(); | 
| 65 | 
> | 
    RealType rB = B.length(); | 
| 66 | 
  | 
    Vector3d C = cross(r32, A); | 
| 67 | 
< | 
    double rC = C.length(); | 
| 67 | 
> | 
    RealType rC = C.length(); | 
| 68 | 
  | 
 | 
| 69 | 
  | 
    A.normalize(); | 
| 70 | 
  | 
    B.normalize(); | 
| 71 | 
  | 
    C.normalize(); | 
| 72 | 
  | 
     | 
| 73 | 
  | 
    //  Calculate the sin and cos | 
| 74 | 
< | 
    double cos_phi = dot(A, B) ; | 
| 74 | 
> | 
    RealType cos_phi = dot(A, B) ; | 
| 75 | 
  | 
    if (cos_phi > 1.0) cos_phi = 1.0; | 
| 76 | 
  | 
    if (cos_phi < -1.0) cos_phi = -1.0;  | 
| 77 | 
  | 
 | 
| 78 | 
< | 
    double dVdcosPhi; | 
| 78 | 
> | 
    RealType dVdcosPhi; | 
| 79 | 
  | 
    torsionType_->calcForce(cos_phi, potential_, dVdcosPhi); | 
| 80 | 
  | 
    Vector3d f1; | 
| 81 | 
  | 
    Vector3d f2; |