small fx and new features
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Thu, 4 Mar 2010 12:03:35 +0000 (13:03 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Thu, 4 Mar 2010 12:03:35 +0000 (13:03 +0100)
vasp_tools/visualize_contcar

index f25d155..611ed6d 100755 (executable)
@@ -227,13 +227,19 @@ EOF
        if [ "$checktsd" = "Transformed" ]; then
                ((offset=9))
                echo "tsd: yes, offset = $offset"
+               # but maybe not
+               checkmore=`sed -n 8p $file | awk '{ print $1 }'`
+               if [ "$checkmore" = "Direct" ]; then
+                       ((offset=8))
+                       echo "tsd: yes, but anyways using offset $offset"
+               fi
        else
                ((offset=8))
                echo "tsd: no, offset = $offset"
        fi
        while [ "1" ]; do
 
-       echo -en "$count "
+               [ $count -gt $ntot ] && break
 
                if [ $count -le $nsi ]; then
                        color="Yellow"
@@ -248,7 +254,7 @@ EOF
                y=`echo $line | awk '{ print $2 }'`
                z=`echo $line | awk '{ print $3 }'`
 
-               echo $x $y $z | awk '\
+               echo $x $y $z $count | awk '\
                BEGIN {
                        x0=ENVIRON["x0"]; y0=ENVIRON["y0"]; z0=ENVIRON["z0"];
                        x1=ENVIRON["x1"]; y1=ENVIRON["y1"]; z1=ENVIRON["z1"];
@@ -278,6 +284,7 @@ EOF
 
                        if((xt>=x0)&&(yt>=y0)&&(zt>=z0)&&\
                           (xt<=x1)&&(yt<=y1)&&(zt<=z1)) {
+                               print "// atom " $4;
                                print "sphere { <"xt","zt","yt">, "radius" ";
                                print "texture { pigment { color " color " } ";
                                print "finish { phong 1 metallic } } }";
@@ -290,6 +297,7 @@ EOF
 
                # see, whether there are bonds to draw
                if [ "$ab" = "0" ]; then
+                       echo -en "$count "
                        ((count+=1))
                        continue
                fi
@@ -304,9 +312,12 @@ EOF
                        ((cnt+=1))
                done
                if [ "$ab" = "-1" ]; then
-                       dobond=yes
+                       if [ -n "`grep \/\/\ atom\ $count temp.pov`" ]; then
+                               dobond=yes
+                       fi
                fi
                if [ "$dobond" = "no" ]; then
+                       echo -en "$count "
                        ((count+=1))
                        continue;
                fi
@@ -354,6 +365,9 @@ EOF
                                yt*=scale;
                                zt*=scale;
 
+                               if((xt>=x0)&&(yt>=y0)&&(zt>=z0)&&\
+                                  (xt<=x1)&&(yt<=y1)&&(zt<=z1)) {
+
                                inx=$4+ii; iny=$5+ij; inz=$6+ik;
                                ixt=inx*X1+iny*Y1+inz*Z1;
                                iyt=inx*X2+iny*Y2+inz*Z2;
@@ -364,8 +378,8 @@ EOF
 
                                dist=sqrt((xt-ixt)^2+(yt-iyt)^2+(zt-izt)^2);
 
-                               if((xt>=x0)&&(yt>=y0)&&(zt>=z0)&&\
-                                  (xt<=x1)&&(yt<=y1)&&(zt<=z1)) {
+                               #if((xt>=x0)&&(yt>=y0)&&(zt>=z0)&&\
+                               #   (xt<=x1)&&(yt<=y1)&&(zt<=z1)) {
                                        if(dist<=$7) {
                                                print "cylinder {";
                                                print "<"xt","zt","yt">,";
@@ -373,6 +387,8 @@ EOF
                                                print "pigment { color Blue }";
                                                print "}";
                                        }
+                               #}
+
                                }
        
                                                }
@@ -388,6 +404,7 @@ EOF
 
                done
 
+               echo -en "[$count] "
                ((count+=1))
                [ $count -gt $ntot ] && break;
 
@@ -396,6 +413,7 @@ EOF
        echo
 
        # manually drawing the 3x4 boundaries specified by argv ...
+       if [ -n "$bx0" ]; then
        draw_cyl $bx0 $by0 $bz0 $bx1 $by0 $bz0
        draw_cyl $bx0 $by0 $bz0 $bx0 $by1 $bz0
        draw_cyl $bx1 $by1 $bz0 $bx1 $by0 $bz0
@@ -410,6 +428,7 @@ EOF
        draw_cyl $bx0 $by1 $bz1 $bx0 $by1 $bz0
        draw_cyl $bx1 $by0 $bz1 $bx1 $by0 $bz0
        draw_cyl $bx1 $by1 $bz1 $bx1 $by1 $bz0
+       fi
 
        # add camera and light source
        cat >> temp.pov <<-EOF