changed visualize script from angstrom to unit cell lengthes
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 19 Feb 2008 19:43:40 +0000 (20:43 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 19 Feb 2008 19:43:40 +0000 (20:43 +0100)
run
visualize

diff --git a/run b/run
index aabfa56..657e6fb 100755 (executable)
--- a/run
+++ b/run
@@ -13,9 +13,10 @@ if [ "$?" == "0" ]; then
 
                # center unit cell
                ./visualize -w 640 -h 480 -d $1 \
-                           -nll -2.4 -2.4 -2.4 -fur 3.8 3.8 3.8 \
-                           -b -2.03 -2.03 -2.03 3.39 3.39 3.39 \
-                           -r 0.6 -c -0.5 -11.0 2.5 -B 0.1
+                           -nll -0.56 -0.56 -0.56 -fur 0.56 0.56 0.56 \
+                           -b -0.5 -0.5 -0.5 0.5 0.5 0.5 \
+                           -c -0.2 -2.0 0.6 -L 0 0 -0.1 \
+                           -r 0.6 -B 0.1
 
                # old rasmol
                #rasmol -32 -nodisplay < $1/visualize.scr > /dev/null 2>&1
index 8f4e83a..7dc964e 100755 (executable)
--- a/visualize
+++ b/visualize
@@ -23,12 +23,15 @@ pigment { color Blue }
 EOF
 }
 
+# defaults
+
+lc=5.429
 directory="doesnt_exist____for_sure"
 width="640"
 height="480"
-radius="1.0"
-x0=""; y0=""; z0="";
-x1=""; y1=""; z1="";
+radius="0.6"
+x0="-0.6"; y0="-0.6"; z0="-0.6";
+x1="+0.6"; y1="+0.6"; z1="+0.6";
 cx=""; cy=""; cz="";
 lx="0"; ly="-100"; lz="100";
 ortographic=""
@@ -37,6 +40,8 @@ bx1=""; by1=""; bz1="";
 bcr="";
 clx="0"; cly="0"; clz="0";
 
+# parse argv
+
 while [ "$1" ]; do
        case "$1" in
                -d)             directory=$2;           shift 2;;
@@ -52,6 +57,7 @@ while [ "$1" ]; do
                -b)             bx0=$2; by0=$3; bz0=$4;
                                bx1=$5; by1=$6; bz1=$7; shift 7;;
                -B)             bcr=$2;                 shift 2;;
+               -C)             lc=$2;                  shift 2;;
                *)
                                echo "options:"
                                echo "########"
@@ -63,6 +69,8 @@ while [ "$1" ]; do
                                echo "atom size:"
                                echo "  -r <radius>"
                                echo "  -B <bond cylinder radius>"
+                               echo "unit cell:"
+                               echo "  -C <lattice constant>"
                                echo "visualization volume:"
                                echo "  -nll <x> <y> <z> (near lower left)"
                                echo "  -fur <x> <y> <z> (far upper right)"
@@ -77,8 +85,46 @@ while [ "$1" ]; do
        esac
 done
 
+# calculation from lattic eunits to angstroms
+
+[ "$lc" = "sic" ] && lc=4.359
+[ "$lc" = "si" ] && lc=5.429
+[ "$lc" = "c" ] && lc=3.566
+
+offset=`echo 0.125 \* $lc | bc`
+
+x0=`echo $x0 \* $lc + $offset | bc`
+y0=`echo $y0 \* $lc + $offset | bc`
+z0=`echo $z0 \* $lc + $offset | bc`
+x1=`echo $x1 \* $lc + $offset | bc`
+y1=`echo $y1 \* $lc + $offset | bc`
+z1=`echo $z1 \* $lc + $offset | bc`
+
+clx=`echo $clx \* $lc + $offset | bc`
+cly=`echo $cly \* $lc + $offset | bc`
+clz=`echo $clz \* $lc + $offset | bc`
+
+if [ -n "$cx" -a -n "$cy" -a -n "$cz" ]; then
+       cx=`echo $cx \* $lc + $offset | bc`
+       cy=`echo $cy \* $lc + $offset | bc`
+       cz=`echo $cz \* $lc + $offset | bc`
+fi
+
+if [ -n "$bx0" ]; then
+       bx0=`echo $bx0 \* $lc + $offset | bc`
+       by0=`echo $by0 \* $lc + $offset | bc`
+       bz0=`echo $bz0 \* $lc + $offset | bc`
+       bx1=`echo $bx1 \* $lc + $offset | bc`
+       by1=`echo $by1 \* $lc + $offset | bc`
+       bz1=`echo $bz1 \* $lc + $offset | bc`
+fi
+
+# povray command
+
 POVRAY="povray -W${width} -H${height} -d" 
 
+# do it ...
+
 if [ -d $directory ]; then
        filesource=$directory/atomic_conf_*.xyz
 fi