| 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) ; |