## VMD-L Mailing List

**From:** JT (*jtibbitt_at_odu.edu*)

**Date:** Sat Mar 14 2009 - 03:21:33 CDT

**Next message:**Thomas Evangelidis: "rlwrap bug in Ubuntu"**Previous message:**karthigeyan karthigeyantp: "how to find the sign of the dihedral angle (full message)."**In reply to:**karthigeyan karthigeyantp: "how to find the sign of the dihedral angle (full message)."**Next in thread:**Taufik Al-Sarraj: "Re:"**Reply:**Taufik Al-Sarraj: "Re:"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]

Hi. GIven 4 connected atoms:

1 4

\ /

2 ------- 3

To determine the sign of the dihedral angle going from atom 1 to atom

4, use the figure above and think of the following: Consider normal

vectors, n1 and n2, formed from atoms 123 and 234, respectively. So

n1 is the cross product of vector 12 and vector 23, and n2 is the

cross product of vector 23 and vector 34 (where vector 12 is the

vector starting at 1 and pointing towards 2). Using the right-hand-

rule, the thumb (normal vector) of both n1 and n2 point out of the

screen. They are both parallel to each other and the dihedral angle

is 0. If 4 travels back into the screen you get a positive dihedral

angle and if 4 travels out of the screen the angle is negative. One

way to calculate that is to calculate the cross product of n1 and n2.

If that vector points forward, the dihedral angle is positive and if

it points backwards, the angle is negative. You can justify that

pushing 4 back into the page makes the vector n1 x n2 point forward,

while pulling 4 out of the page switches the direction of n1 x n2

making it point backwards. In other words, if n1 x n2 points in the

same direction as 23, then the dihedral angle is positive, else

negative. So the sign of the dihedral angle is simply the same as the

sign of the dot product of n1 x n2 with 23. Note that this is

calculated with the following determinant:

| 23x 23y 23z |

| |

| n1x n1y n1z |

| |

| n2x n2y n2z |

There are two special cases : when n1 and n2 point in the same

direction, the dihedral angle is 0 and when they point in opposite

directions, it is 180. In both cases, n1 x n2 dotted with 23 is 0.

When this happens, check the sign of n1 dot n2. It is positive when

they face the same direction and negative when they face opposite

directions.

BTW, there is a post from Hwan Kyu Lee a few weeks ago where I placed

my script for doing backbone dihedrals. Your question here brought a

bug in that calc script to my attention. The bug is that In both of

the special cases the dihedral angle is set to 180. It would be

trivial to fix it.

Jeff Tibbitt

On Mar 14, 2009, at 1:23 AM, karthigeyan karthigeyantp wrote:

*> Hai Vmd,
*

*>
*

*> I am writting a program for calculating the dihedral angle. In the
*

*> calculation my numerical part is exactly has such in vmd but i am not
*

*> getting the sign properly. I am getting all the angles in positive
*

*> sign. can any one give the formula which is used in the vmd.
*

**Next message:**Thomas Evangelidis: "rlwrap bug in Ubuntu"**Previous message:**karthigeyan karthigeyantp: "how to find the sign of the dihedral angle (full message)."**In reply to:**karthigeyan karthigeyantp: "how to find the sign of the dihedral angle (full message)."**Next in thread:**Taufik Al-Sarraj: "Re:"**Reply:**Taufik Al-Sarraj: "Re:"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]