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

Comparing trunk/src/primitives/GhostTorsion.cpp (file contents):
Revision 1443 by gezelter, Thu May 27 14:17:39 2010 UTC vs.
Revision 1446 by gezelter, Thu Jun 17 14:48:02 2010 UTC

# Line 63 | Line 63 | namespace OpenMD {
63      RealType rA = A.length();
64      Vector3d B = cross(r32, r43);
65      RealType rB = B.length();
66 <    Vector3d C = cross(r32, A);
67 <    RealType rC = C.length();
66 >
67 >    /*
68 >       If either of the two cross product vectors is tiny, that means
69 >       the three atoms involved are colinear, and the torsion angle is
70 >       going to be undefined.  The easiest check for this problem is
71 >       to use the product of the two lengths.
72 >    */
73 >    if (rA * rB < OpenMD::epsilon) return;
74      
75      A.normalize();
76      B.normalize();
71    C.normalize();
77      
78      //  Calculate the sin and cos
79      RealType cos_phi = dot(A, B) ;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines