5 # author: frank.zirkelbach@physik.uni-augsburg.de
10 cat >> temp.pov <<-EOF
12 <$1, $3, $2>, <$4, $6, $5>, 0.05
13 pigment { color White }
18 cat >> temp.pov <<-EOF
20 <$1, $3, $2>, <$4, $6, $5>, $7
21 pigment { color Blue }
29 directory="doesnt_exist____for_sure"
33 x0="-0.6"; y0="-0.6"; z0="-0.6";
34 x1="0.6"; y1="0.6"; z1="0.6";
36 lx="0"; ly="-100"; lz="100";
38 bx0=""; by0=""; bz0="";
39 bx1=""; by1=""; bz1="";
41 clx="0"; cly="0"; clz="0";
47 -d) directory=$2; shift 2;;
48 -w) width=$2; shift 2;;
49 -h) height=$2; shift 2;;
50 -r) radius=$2; shift 2;;
51 -nll) x0=$2; y0=$3; z0=$4; shift 4;;
52 -fur) x1=$2; y1=$3; z1=$4; shift 4;;
53 -c) cx=$2; cy=$3; cz=$4; shift 4;;
54 -L) clx=$2; cly=$3; clz=$4; shift 4;;
55 -l) lx=$2; ly=$3; lz=$4; shift 4;;
56 -o) ortographic=1; shift 1;;
57 -b) bx0=$2; by0=$3; bz0=$4;
58 bx1=$5; by1=$6; bz1=$7; shift 7;;
64 echo "directory to progress:"
65 echo " -d <directory> (mandatory)"
71 echo " -B <bond cylinder radius>"
73 echo " -C <lattice constant>"
74 echo "visualization volume:"
75 echo " -nll <x> <y> <z> (near lower left)"
76 echo " -fur <x> <y> <z> (far upper right)"
77 echo " -o (ortographic)"
79 echo " -b <x0> <y0> <z0> <x1> <y1> <z1>"
81 echo " -c <x> <y> <z> (camera position)"
82 echo " -L <x> <y> <z> (camera look)"
83 echo " -l <x> <y> <z> (light source)"
88 # calculation from lattic eunits to angstroms
90 [ "$lc" = "sic" ] && lc=4.359
91 [ "$lc" = "si" ] && lc=5.429
92 [ "$lc" = "c" ] && lc=3.566
94 offset=`echo 0.125 \* $lc | bc`
97 x0=`echo $x0 \* $lc + $offset | bc`
98 y0=`echo $y0 \* $lc + $offset | bc`
99 z0=`echo $z0 \* $lc + $offset | bc`
100 x1=`echo $x1 \* $lc + $offset | bc`
101 y1=`echo $y1 \* $lc + $offset | bc`
102 z1=`echo $z1 \* $lc + $offset | bc`
104 clx=`echo $clx \* $lc + $offset | bc`
105 cly=`echo $cly \* $lc + $offset | bc`
106 clz=`echo $clz \* $lc + $offset | bc`
108 if [ -n "$cx" -a -n "$cy" -a -n "$cz" ]; then
109 cx=`echo $cx \* $lc + $offset | bc`
110 cy=`echo $cy \* $lc + $offset | bc`
111 cz=`echo $cz \* $lc + $offset | bc`
114 if [ -n "$bx0" ]; then
115 bx0=`echo $bx0 \* $lc + $offset | bc`
116 by0=`echo $by0 \* $lc + $offset | bc`
117 bz0=`echo $bz0 \* $lc + $offset | bc`
118 bx1=`echo $bx1 \* $lc + $offset | bc`
119 by1=`echo $by1 \* $lc + $offset | bc`
120 bz1=`echo $bz1 \* $lc + $offset | bc`
125 POVRAY="povray -W${width} -H${height} -d"
129 if [ -d $directory ]; then
130 filesource=$directory/atomic_conf_*.xyz
133 if [ -f $directory ]; then
134 filesource=$directory
137 for file in $filesource; do
139 cat > temp.pov <<-EOF
140 #include "colors.inc"
141 #include "textures.inc"
142 #include "shapes.inc"
144 #include "metals.inc"
146 #include "stones.inc"
150 count=`grep '# \[P\]' $file | awk '{ print $3 }'`
151 time=`grep '# \[P\]' $file | awk '{ print $4 }'`
152 camloc=`grep '# \[P\]' $file | awk '{ print $5 }'`
153 [ -n "$cx" -a -n "$cy" -a -n "$cz" ] && camloc="<$cx,$cz,$cy>"
156 if [ -n "$x0" ]; then
157 export x0 y0 z0 x1 y1 z1 radius
158 cat $file | grep -v '#' | awk '\
160 x0=ENVIRON["x0"]; y0=ENVIRON["y0"]; z0=ENVIRON["z0"];
161 x1=ENVIRON["x1"]; y1=ENVIRON["y1"]; z1=ENVIRON["z1"];
162 radius=ENVIRON["radius"];
165 if(($2>=x0)&&($3>=y0)&&($4>=z0)&&\
166 ($2<=x1)&&($3<=y1)&&($4<=z1)) {
167 print "sphere { <"$2","$4","$3">, "radius" ";
168 print "texture { pigment { color "$5" } ";
169 print "finish { phong 1 metallic } } }";
173 cat $file | grep -v '#' | while read name x y z color temp; do
174 cat >> temp.pov <<-EOF
176 <$x, $z, $y>, $radius
178 pigment { color $color }
190 if [ -z "$bx0" ]; then
192 if [ -z "$x0" ]; then
194 cat $file | grep '# \[D\]' | while read foo bar x1 y1 z1 x2 y2 z2 ; do
195 draw_cyl $x1 $z1 $y1 $x2 $z2 $y2 0.05
199 # manually drawing the 3x4 boundaries ...
200 draw_cyl $x0 $y0 $z0 $x1 $y0 $z0
201 draw_cyl $x0 $y0 $z0 $x0 $y1 $z0
202 draw_cyl $x1 $y1 $z0 $x1 $y0 $z0
203 draw_cyl $x0 $y1 $z0 $x1 $y1 $z0
205 draw_cyl $x0 $y0 $z1 $x1 $y0 $z1
206 draw_cyl $x0 $y0 $z1 $x0 $y1 $z1
207 draw_cyl $x1 $y1 $z1 $x1 $y0 $z1
208 draw_cyl $x0 $y1 $z1 $x1 $y1 $z1
210 draw_cyl $x0 $y0 $z1 $x0 $y0 $z0
211 draw_cyl $x0 $y1 $z1 $x0 $y1 $z0
212 draw_cyl $x1 $y0 $z1 $x1 $y0 $z0
213 draw_cyl $x1 $y1 $z1 $x1 $y1 $z0
218 # manually drawing the 3x4 boundaries specified by argv ...
219 draw_cyl $bx0 $by0 $bz0 $bx1 $by0 $bz0
220 draw_cyl $bx0 $by0 $bz0 $bx0 $by1 $bz0
221 draw_cyl $bx1 $by1 $bz0 $bx1 $by0 $bz0
222 draw_cyl $bx0 $by1 $bz0 $bx1 $by1 $bz0
224 draw_cyl $bx0 $by0 $bz1 $bx1 $by0 $bz1
225 draw_cyl $bx0 $by0 $bz1 $bx0 $by1 $bz1
226 draw_cyl $bx1 $by1 $bz1 $bx1 $by0 $bz1
227 draw_cyl $bx0 $by1 $bz1 $bx1 $by1 $bz1
229 draw_cyl $bx0 $by0 $bz1 $bx0 $by0 $bz0
230 draw_cyl $bx0 $by1 $bz1 $bx0 $by1 $bz0
231 draw_cyl $bx1 $by0 $bz1 $bx1 $by0 $bz0
232 draw_cyl $bx1 $by1 $bz1 $bx1 $by1 $bz0
237 if [ -n "$bcr" ]; then
239 if [ -z "$x0" ]; then
241 cat $file | grep '# \[B\]' | while read foo bar x1 y1 z1 x2 y2 z2 ; do
242 draw_bond $x1 $z1 $y1 $x2 $z2 $y2 $bcr
247 export x0 y0 z0 x1 y1 z1 bcr
248 cat $file | grep '# \[B\]' | awk '\
250 x0=ENVIRON["x0"]; y0=ENVIRON["y0"]; z0=ENVIRON["z0"];
251 x1=ENVIRON["x1"]; y1=ENVIRON["y1"]; z1=ENVIRON["z1"];
255 if(($3>=x0)&&($4>=y0)&&($5>=z0)&&\
256 ($3<=x1)&&($4<=y1)&&($5<=z1)) {
258 print "<"$3","$5","$4">,";
259 print "<"$6","$8","$7">, "bcr;
260 print "pigment { color Blue }";
268 # add camera and light source
269 cat >> temp.pov <<-EOF
272 if [ -n "$ortographic" ]; then cat >> temp.pov <<-EOF
276 cat >> temp.pov <<-EOF
278 look_at <$clx,$clz,$clz>
280 light_source { <0,100,-100> color White shadowless }
284 $POVRAY temp.pov > /dev/null 2>&1
285 mv temp.png `echo $file | sed 's/\.xyz/\.png/'`