From 40f91e7d7cb98fedd86bc4e3178021f687190550 Mon Sep 17 00:00:00 2001 From: hackbard Date: Tue, 23 Mar 2010 17:32:19 +0100 Subject: [PATCH] added acos to angle calc --- vasp_tools/acos.c | 11 +++++++++++ vasp_tools/angle_calc | 8 +++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 vasp_tools/acos.c diff --git a/vasp_tools/acos.c b/vasp_tools/acos.c new file mode 100644 index 0000000..609a6dc --- /dev/null +++ b/vasp_tools/acos.c @@ -0,0 +1,11 @@ +/* acos */ + +#include +#include +#include + +int main(int argc,char **argv) { + printf("%f\n",180.0/M_PI*acos(atof(argv[1]))); + return 0; +} + diff --git a/vasp_tools/angle_calc b/vasp_tools/angle_calc index da01dfb..b23d51d 100755 --- a/vasp_tools/angle_calc +++ b/vasp_tools/angle_calc @@ -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 -- 2.39.2