ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/primitives/Torsion.cpp
(Generate patch)

Comparing trunk/src/primitives/Torsion.cpp (file contents):
Revision 749 by tim, Wed Nov 16 23:10:02 2005 UTC vs.
Revision 1290 by cli2, Wed Sep 10 19:51:45 2008 UTC

# Line 47 | Line 47 | namespace oopse {
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();
# Line 60 | Line 60 | namespace oopse {
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;
82 <    Vector3d f3;
80 >    Vector3d f1 ;
81 >    Vector3d f2 ;
82 >    Vector3d f3 ;
83  
84      Vector3d dcosdA = (cos_phi * A - B) /rA;
85      Vector3d dcosdB = (cos_phi * B - A) /rB;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines