]> hackdaworld.org Git - physik/posic.git/commitdiff
added acos to angle calc
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 23 Mar 2010 16:32:19 +0000 (17:32 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 23 Mar 2010 16:32:19 +0000 (17:32 +0100)
vasp_tools/acos.c [new file with mode: 0644]
vasp_tools/angle_calc

diff --git a/vasp_tools/acos.c b/vasp_tools/acos.c
new file mode 100644 (file)
index 0000000..609a6dc
--- /dev/null
@@ -0,0 +1,11 @@
+/* acos */
+
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+
+int main(int argc,char **argv) {
+       printf("%f\n",180.0/M_PI*acos(atof(argv[1])));
+       return 0;
+}
+
index da01dfbe3415cbfe1eb14038518f7bf29c212e68..b23d51dd327b5ccbb6edb064a661a6cf1dfa0c42 100755 (executable)
@@ -41,7 +41,7 @@ yc=`echo $temp | awk '{ print $2 }'`
 zc=`echo $temp | awk '{ print $3 }'`
 
 echo -en "angle: "
-echo "$xa $ya $za $xb $yb $zb $xc $yc $zc $scale" | \
+foo=`echo "$xa $ya $za $xb $yb $zb $xc $yc $zc $scale" | \
        awk ' \
        BEGIN {
                X1=ENVIRON["X1"]; X2=ENVIRON["X2"]; X3=ENVIRON["X3"]
@@ -92,8 +92,10 @@ echo "$xa $ya $za $xb $yb $zb $xc $yc $zc $scale" | \
                sp=dxt*Dxt+dyt*Dyt+dzt*Dzt
                d=sqrt(dxt^2+dyt^2+dzt^2)
                D=sqrt(Dxt^2+Dyt^2+Dzt^2)
-               print 180.0/pi*acos2(sp/(d*D))
-       }'
+               print sp/(d*D)
+       }'`
+
+./acos $foo
 
 echo