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 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1446 by gezelter, Thu Jun 17 14:48:02 2010 UTC

# Line 56 | Line 56 | namespace OpenMD {
56      
57      Vector3d r21 = pos1 - pos2;
58      Vector3d r32 = pos2 - pos3;
59 <    Vector3d r43 = ghostAtom->getElectroFrame().getColumn(2);
59 >    Vector3d r43 = ghostAtom->getA().getColumn(2);
60      
61      //  Calculate the cross products and distances
62      Vector3d A = cross(r21, r32);
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) ;

Comparing trunk/src/primitives/GhostTorsion.cpp (property svn:keywords):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1446 by gezelter, Thu Jun 17 14:48:02 2010 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines