# Talk:Dihedral angle

WikiProject Mathematics (Rated Start-class, Low-importance)
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
 Start Class
 Low Importance
Field: Geometry
WikiProject Molecular and Cellular Biology (Rated Start-class, Low-importance)
Start  This article has been rated as Start-Class on the project's quality scale.
Low  This article has been rated as Low-importance on the project's importance scale.

The red arrows in the figures on this page are misleading. As vectors, the arrows should be on the opposite end. -- JackSnoeyink 04:00, 18 April 2007 (UTC)

## §Problems with first algorithm

As well as being longer and more complex than the method given below it the algorithm can fail with a divide by zero error, if the 'arbitrary vector' is such that either Va or Vb is zero. The way to avoid that is put the whole thing in a while loop until the product of their magnitudes is non-zero, but that would make it even less clear. And even if not exactly zero it can be very inaccurate for vectors close to zero, due rounding errors. I.e. it's a generally poor algorithm.

Any objections to removing it and tidying up the cross product approach ?--JohnBlackburnewordsdeeds 10:54, 6 March 2010 (UTC)

This seems to be the sort of thing that would be better explained in plain words (preferably with a picture) than with code. At any rate, it is distilled in the observation that in order to find a normal vector, one can take a basis of tangent vectors to the plane, and apply Gram-Schmidt to any extension of this basis to a basis of the Euclidean space. The relevant implementation details would be in the Gram-Schmidt algorithm itself, and the selection of the vector that completes the bases. This has the advantage over the cross product approach because it works in any dimension. The pseudocode itself is so problematic that it should be removed immediately. I was going to comment more about this, but I think the issues are sufficiently obvious and numerous that they will not escape detection. Sławomir Biały (talk) 12:19, 7 March 2010 (UTC)
I've gone ahead and taken a shot at writing out the more serious problems with the section. Please feel free to expand on this! Sławomir Biały (talk) 12:59, 7 March 2010 (UTC)

## §Problem with the Figure 4: The backbone dihedral angles of proteins.

Looks like the Phi dihedral angle is drawn incorrectly (it should be counted in the opposite direction). — Preceding unsigned comment added by 147.173.212.105 (talk) 10:30, 1 February 2013 (UTC)

## §atan2 formula does not give the correct sign in some cases

The formula

$\varphi = \operatorname{atan2} \left( |[\mathbf{b}_1 \times \mathbf{b}_2]\times [\mathbf{b}_2 \times \mathbf{b}_3]|, [\mathbf{b}_1 \times \mathbf{b}_2] \cdot [\mathbf{b}_2 \times \mathbf{b}_3] \right),$


does not give correct results because the first argument is always positive. Using this formula, $\varphi$ is always positive. I believe that the correct formula is

$\varphi = \operatorname{atan2} \left( \left([\mathbf{b}_1 \times \mathbf{b}_2]\times [\mathbf{b}_2 \times \mathbf{b}_3]\right) \cdot \frac{\mathbf{b}_2}{|\mathbf{b}_2|}, [\mathbf{b}_1 \times \mathbf{b}_2] \cdot [\mathbf{b}_2 \times \mathbf{b}_3] \right).$


As a citation, I propose formulae (3) and (4) in Blondel and Karplus, 1995 (DOI: 10.1002/(SICI)1096-987X(19960715)17:9<1132::AID-JCC5>3.0.CO;2-T). The above formula is a slight manipulation of the sin and cos formulae cited. — Preceding unsigned comment added by John Jumper (talkcontribs) 03:52, 1 November 2013 (UTC)

I'm not sure. A dihedral angle, defined as the angle between two planes should be between 0 and 180 degrees, so atan2(abs(y),x) should work fine. I don't know under what conditions you want the answer as >180. Perhaps the intro should say the angle is between 0 and 180? Tom Ruen (talk) 06:56, 2 November 2013 (UTC)
If you define the dihedral angle between two planes as the angle you need to rotate the first plane so the normals are parallel and unidirectional, then the angle might be more than 180 (or, more elegantly, between -180 and 180). This is exactly the definition used in biochemistry to report covalent bond torsion angles. --RasF (talk) 12:02, 8 November 2013 (UTC)
I apologize for the late reply. As used in biochemistry, dihedral angle really refers to the angle between the vectors r2->r1 and r3->r4, after both vectors have been projected onto the plane whose normal is given by the vector r2->r3. Since this angle is in the plane, it is defined on [-180,180]. As an example of the use of this definition, see Ramachandran plot, noting that both axes on the figures are on [-180,180]. From a more mathematical perspective, the dihedral angle defined on (-180,180) is a continuous function of the 4 points, so long as 3 consecutive points are not collinear. Reversing the order of the points negates the dihedral angle. At the very least, I would note the difference in convention (I started this edit because I copied this formula into a piece of code where I expected the biochemistry definition and wasted an hour tracking down the bug). That the biochemist follow the signed dihedral convention is documented by the Blondel and Karplus paper from 1995. John Jumper (talk) 08:56, 20 November 2013 (UTC)
I also just implemented a small script with a Computational Chemistry background for which I needed the dihedral angle. And I can confirm that the current atan2()-formula did not work the way I needed. The replacement suggested here worked fine. (Tobias) 10:05, 25 November 2013 (UTC) — Preceding unsigned comment added by 134.100.209.49 (talk)

## §Dihedral angles of the regular polytopes

3D:

• {3,3}: 70°32′ = arcsec(3)
• {3,4}: 109°28′ = π − arcsec(3)
• {4,3}: 90° = π/2
• {3,5}: 138°11′ = π − arcsin(2/3)
• {5,3): 116°34′ = π − arctan(2)
• {5/2,5}: 116°34′ = π − arctan(2)
• {5,5/2}: 63°26′ = arctan(2)
• {5/2,3}: 63°26′ = arctan(2)
• {3,5/2}: 41°49′ = arcsin(2/3)

4D:

• {3,3,3}: 75°31′ = arcsec(4)
• {3,3,4}: 120° = 2π/3
• {4,3,3}: 90° = π/2
• {3,4,3}: 120° = 2π/3
• {3,3,5}: 164°29′ = 4π/3 − arcsec(4)
• {5,3,3}: 144° = 4π/5
• {5/2,5,3}: 144° = 4π/5
• {3,5,5/2}: 120° = 2π/3
• {5,5/2,5}: 144° = 4π/5
• {5/2,3,5}: 144° = 4π/5
• {5,3,5/2}: 72° = 2π/5
• {5/2,5,5/2}: 72° = 2π/5
• {3,5/2,5}: 120° = 2π/3
• {5,5/2,3}: 72° = 2π/5
• {5/2,3,3}: 72° = 2π/5
• {3,3,5/2}: 44°29′ = 2π/3 − arcsec(4)

nD:

• αn (n-simplex): arcsec(n)
• βn (n-orthoplex): π − 2 arccsc(√n)
• γn (n-cube): 90° = π/2

Ref: Coxeter, Regular Polytopes (3rd ed.), pp.292–5. Double sharp (talk) 20:49, 16 March 2015 (UTC)