From apodtele@kgi.edu Wed Dec 7 11:53:10 2005 Date: Thu, 4 Aug 2005 22:42:48 -0700 From: Alexei Podtelezhnikov To: ccp4@ccp4.ac.uk Subject: [ccp4]: tiny impovement to dihedral algorithm [ The following text is in the "Windows-1252" character set. ] [ Your display is set for the "US-ASCII" character set. ] [ Some characters may be displayed incorrectly. ] Hi, This small patch brings ccp4's dihedral angle code even closer to perfection: --- geomcalc.f 2005-08-04 22:26:17.000000000 -0700 +++ geomcalc.f 2005-08-04 22:31:12.000000000 -0700 @@ -1494,9 +1494,7 @@ call vdif(v3, x4, x3) call cross(q, v1,v2) call cross(t, v2, v3) - call cross(v1, q, t) - tangle = atan2(sqrt(dot(v1,v1)), dot(q,t))*rtod - if (dot(v1,v2) .lt. 0.0) tangle = -tangle + tangle = atan2(dot(q,v3)*sqrt(dot(v2,v2)), dot(q,t))*rtod return end c So we can drop if-check and a cross-product in favor of a dot-product, atan2 does the rest of the job. The patch is also attached. Alexei [ Part 2, "geomcalc.patch" Text/X-PATCH (Name: "geomcalc.patch") 8 ] [ lines. ] [ Unable to print this part. ]