From: hackbard Date: Mon, 5 Oct 2009 15:08:32 +0000 (+0200) Subject: bugfix + should be correct now (go on to do this for viaualize and pc calc too!) X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=44bbd223e2e50c7a8dda708444add246bc796b75;p=physik%2Fposic.git bugfix + should be correct now (go on to do this for viaualize and pc calc too!) --- diff --git a/vasp_tools/search_bonds b/vasp_tools/search_bonds index 9b08543..88051ee 100755 --- a/vasp_tools/search_bonds +++ b/vasp_tools/search_bonds @@ -40,6 +40,11 @@ nc=`sed -n 6p $file | awk '{ print $2 }'` ((count=1)) echo "found $nt atoms: Si = $nsi / C = $nc" +echo "scale: $scale" +echo "X: $X1 $X2 $X3" +echo "Y: $Y1 $Y2 $Y3" +echo "Z: $Z1 $Z2 $Z3" +echo while [ "1" ]; do @@ -81,30 +86,41 @@ while [ "1" ]; do yb=`echo $tmpb | awk '{ print $2 }'` zb=`echo $tmpb | awk '{ print $3 }'` - echo "$xa $ya $za $xa $yb $zb $scale $len $delta" | \ + echo "$xa $ya $za $xb $yb $zb $scale $len $delta" | \ awk ' \ BEGIN { - xa=0; xb=0; + dxt=0; dyt=0; dzt=0 dx=0; dy=0; dz=0; dist=0 X1=ENVIRON["X1"]; X2=ENVIRON["X2"]; X3=ENVIRON["X3"] Y1=ENVIRON["Y1"]; Y2=ENVIRON["Y2"]; Y3=ENVIRON["Y3"] Z1=ENVIRON["Z1"]; Z2=ENVIRON["Z2"]; Z3=ENVIRON["Z3"] } { - xa=$1*X1+$2*Y1+$3*Z1 - ya=$1*X2+$2*Y2+$3*Z2 - za=$1*X3+$2*Y3+$3*Z3 - xb=$4*X1+$5*Y1+$6*Z1 - yb=$4*X2+$5*Y2+$6*Z2 - zb=$4*X3+$5*Y3+$6*Z3 - dx=xa-xb - dy=ya-yb - dz=za-zb - dist=sqrt(dx^2+dy^2+dz^2) + dx=$1-$4 + dy=$2-$5 + dz=$3-$6 + if(dx>1/2) + dx-=1 + if(dx<-1/2) + dx+=1 + if(dy>1/2) + dy-=1 + if(dy<-1/2) + dy+=1 + if(dz>1/2) + dz-=1 + if(dz<-1/2) + dz+=1 + dxt=dx*X1+dy*Y1+dz*Z1 + dyt=dx*X2+dy*Y2+dz*Z2 + dzt=dx*X3+dy*Y3+dz*Z3 + dist=sqrt(dxt^2+dyt^2+dzt^2) dist*=$7 if((dist>=($8-$9))&&(dist<=($8+$9))) { + print "\n" print $1 " " $2 " " $3 - print $4 " " $5 " " $6 " (" dist ")" + print $4 " " $5 " " $6 " (" dist " - " $8 ")" + print dx " " dy " " dz " " dxt " " dyt " " dzt } }' fi