mirror feature + new std vis
[physik/posic.git] / vasp_tools / visualize
index 74b352b..8d1e98f 100755 (executable)
@@ -41,6 +41,10 @@ bcr="";
 clx="0"; cly="0"; clz="0";
 extra=0
 displace=""
+mirror=0
+mx1=0; mx2=0; mx3=0;
+my1=0; my2=0; my3=0;
+mz1=0; mz2=0; mz3=0;
 
 # parse argv
 
@@ -62,6 +66,11 @@ while [ "$1" ]; do
                -C)             lc=$2;                  shift 2;;
                -e)             extra=1;                shift 1;;
                -D)             displace=$2;            shift 2;;
+               -m)             mx1=$2; mx2=$3; mx3=$4;
+                               my1=$5; my2=$6; my3=$7;
+                               mz1=$8; mz2=$9; mz3=${10};
+                               mirror=1;               shift 10;;
+
                *)
                                echo "options:"
                                echo "########"
@@ -75,6 +84,7 @@ while [ "$1" ]; do
                                echo "  -B <bond cylinder radius>"
                                echo "unit cell:"
                                echo "  -C <lattice constant>"
+                               echo "  -m <dimX> <dimY> <dimZ> (mirror atoms)"
                                echo "visualization volume:"
                                echo "  -nll <x> <y> <z> (near lower left)"
                                echo "  -fur <x> <y> <z> (far upper right)"
@@ -92,7 +102,7 @@ done
 # calculation from lattic eunits to angstroms
 
 [ "$lc" = "sic" ] && lc=4.359
-[ "$lc" = "si" ] && lc=5.429
+[ "$lc" = "si" ] && lc=5.480
 [ "$lc" = "c" ] && lc=3.566
 
 #offset=`echo 0.125 \* $lc | bc`
@@ -105,6 +115,16 @@ x1=`echo $x1 \* $lc + $offset | bc`
 y1=`echo $y1 \* $lc + $offset | bc`
 z1=`echo $z1 \* $lc + $offset | bc`
 
+mx1=`echo $mx1 \* $lc + $offset | bc`
+my1=`echo $my1 \* $lc + $offset | bc`
+mz1=`echo $mz1 \* $lc + $offset | bc`
+mx2=`echo $mx2 \* $lc + $offset | bc`
+my2=`echo $my2 \* $lc + $offset | bc`
+mz2=`echo $mz2 \* $lc + $offset | bc`
+mx3=`echo $mx3 \* $lc + $offset | bc`
+my3=`echo $my3 \* $lc + $offset | bc`
+mz3=`echo $mz3 \* $lc + $offset | bc`
+
 clx=`echo $clx \* $lc + $offset | bc`
 cly=`echo $cly \* $lc + $offset | bc`
 clz=`echo $clz \* $lc + $offset | bc`
@@ -165,25 +185,25 @@ EOF
 #echo "-----> $x0 $y0 $z0 $x1 $y1 $z1 <-----"
        if [ -n "$x0" ]; then
                export x0 y0 z0 x1 y1 z1 radius extra
+               export mx1 mx2 mx3
+               export my1 my2 my3
+               export mz1 mz2 mz3
+               export mirror
                cat $file | grep -v '#' | awk '\
                BEGIN {
                        x0=ENVIRON["x0"]; y0=ENVIRON["y0"]; z0=ENVIRON["z0"];
                        x1=ENVIRON["x1"]; y1=ENVIRON["y1"]; z1=ENVIRON["z1"];
+                       mx1=ENVIRON["mx1"]; my1=ENVIRON["my1"];
+                       mz1=ENVIRON["mz1"]; mx2=ENVIRON["mx2"];
+                       my2=ENVIRON["my2"]; mz2=ENVIRON["mz2"];
+                       mx3=ENVIRON["mx3"]; my3=ENVIRON["my3"];
+                       mz3=ENVIRON["mz3"]; mirror=ENVIRON["mirror"];
                        radius=ENVIRON["radius"]; extra=ENVIRON["extra"];
+                       nx=0; ny=0; nz=0;
                }
                {
-#                      print "----> " x0 " " y0 " " z0 " " $2 " " $3 " " $4
-#                      print "----> " x1 " " y1 " " z1 " " $2 " " $3 " " $4
-#if(($2>=x0)) print $2 " groesser " x0
-#if(($3>=y0)) print $3 " groesser " y0
-#if(($4>=z0)) print $4 " groesser " z0
-#if(($2<=x1)) print $2 " kleiner " x1
-#if(($3<=y1)) print $3 " kleiner " y1
-#if(($4<=z1)) print $4 " kleiner " z1
                        if(($2>=x0)&&($3>=y0)&&($4>=z0)&&\
                           ($2<=x1)&&($3<=y1)&&($4<=z1)) {
-#                      if(($2<=x0)&&($3<=y0)&&($4<=z0)&&\
-#                         ($2>=x1)&&($3>=y1)&&($4>=z1)) {
                                print "sphere { <"$2","$4","$3">, "radius" ";
                                if(extra)
                print "texture { pigment { color rgb<"$6/4.4",0,"1-$6/4.4"> } ";
@@ -191,6 +211,43 @@ EOF
                print "texture { pigment { color "$5" } ";
                                print "finish { phong 1 metallic } } }";
                        }
+
+                       if(mirror) {
+
+                       nx=$2-mx1; ny=$3-mx2; nz=$4-mx3;
+                       if((nx>=x0)&&(ny>=y0)&&(nz>=z0)&&\
+                          (nx<=x1)&&(ny<=y1)&&(nz<=z1)) {
+print "// translation: "$2/5.480" "$3/5.480" "$4/5.480" -> "nx/5.480" "ny/5.480" "nz/5.480" ...";
+                               print "sphere { <"nx","nz","ny">, "radius" ";
+                               if(extra)
+               print "texture { pigment { color rgb<"$6/4.4",0,"1-$6/4.4"> } ";
+                               else
+               print "texture { pigment { color "$5" } ";
+                               print "finish { phong 1 metallic } } }";
+                       }
+                       nx=$2-my1; ny=$3-my2; nz=$4-my3;
+                       if((nx>=x0)&&(ny>=y0)&&(nz>=z0)&&\
+                          (nx<=x1)&&(ny<=y1)&&(nz<=z1)) {
+                               print "sphere { <"nx","nz","ny">, "radius" ";
+                               if(extra)
+               print "texture { pigment { color rgb<"$6/4.4",0,"1-$6/4.4"> } ";
+                               else
+               print "texture { pigment { color "$5" } ";
+                               print "finish { phong 1 metallic } } }";
+                       }
+                       nx=$2-mz1; ny=$3-mz2; nz=$4-mz3;
+                       if((nx>=x0)&&(ny>=y0)&&(nz>=z0)&&\
+                          (nx<=x1)&&(ny<=y1)&&(nz<=z1)) {
+                               print "sphere { <"nx","nz","ny">, "radius" ";
+                               if(extra)
+               print "texture { pigment { color rgb<"$6/4.4",0,"1-$6/4.4"> } ";
+                               else
+               print "texture { pigment { color "$5" } ";
+                               print "finish { phong 1 metallic } } }";
+                       }
+
+                       }
+
                }' >> temp.pov
        else
                cat $file | grep -v '#' | while read name x y z color temp; do