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 }
26 directory="doesnt_exist____for_sure"
33 lx="0"; ly="-100"; lz="100";
35 bx0=""; by0=""; bz0="";
36 bx1=""; by1=""; bz1="";
41 -d) directory=$2; shift 2;;
42 -w) width=$2; shift 2;;
43 -h) height=$2; shift 2;;
44 -r) radius=$2; shift 2;;
45 -nll) x0=$2; y0=$3; z0=$4; shift 4;;
46 -fur) x1=$2; y1=$3; z1=$4; shift 4;;
47 -c) cx=$2; cy=$3; cz=$4; shift 4;;
48 -l) lx=$2; ly=$3; lz=$4; shift 4;;
49 -o) ortographic=1; shift 1;;
50 -b) bx0=$2; by0=$3; bz0=$4;
51 bx1=$5; by1=$6; bz1=$7; shift 7;;
56 echo "directory to progress:"
57 echo " -d <directory> (mandatory)"
63 echo " -B <bond cylinder radius>"
64 echo "visualization volume:"
65 echo " -nll <x> <y> <z> (near lower left)"
66 echo " -fur <x> <y> <z> (far upper right)"
67 echo " -o (ortographic)"
69 echo " -b <x0> <y0> <z0> <x1> <y1> <z1>"
71 echo " -c <x> <y> <z> (camera position)"
72 echo " -l <x> <y> <z> (light source)"
77 if [ ! -d $directory ] ; then
78 echo "no valid directory"
82 POVRAY="povray -W${width} -H${height} -d"
84 for file in $directory/atomic_conf_*.xyz; do
88 #include "textures.inc"
97 count=`grep '# \[P\]' $file | awk '{ print $3 }'`
98 time=`grep '# \[P\]' $file | awk '{ print $4 }'`
99 camloc=`grep '# \[P\]' $file | awk '{ print $5 }'`
100 [ -n "$cx" -a -n "$cy" -a -n "$cz" ] && camloc="<$cx,$cz,$cy>"
103 if [ -n "$x0" ]; then
104 export x0 y0 z0 x1 y1 z1 radius
105 cat $file | grep -v '#' | awk '\
107 x0=ENVIRON["x0"]; y0=ENVIRON["y0"]; z0=ENVIRON["z0"];
108 x1=ENVIRON["x1"]; y1=ENVIRON["y1"]; z1=ENVIRON["z1"];
109 radius=ENVIRON["radius"];
112 if(($2>=x0)&&($3>=y0)&&($4>=z0)&&\
113 ($2<=x1)&&($3<=y1)&&($4<=z1)) {
114 print "sphere { <"$2","$4","$3">, "radius" ";
115 print "texture { pigment { color "$5" } ";
116 print "finish { phong 1 metallic } } }";
120 cat $file | grep -v '#' | while read name x y z color temp; do
121 cat >> temp.pov <<-EOF
123 <$x, $z, $y>, $radius
125 pigment { color $color }
137 if [ -z "$bx0" ]; then
139 if [ -z "$x0" ]; then
141 cat $file | grep '# \[D\]' | while read foo bar x1 y1 z1 x2 y2 z2 ; do
142 draw_cyl $x1 $z1 $y1 $x2 $z2 $y2 0.05
146 # manually drawing the 3x4 boundaries ...
147 draw_cyl $x0 $y0 $z0 $x1 $y0 $z0
148 draw_cyl $x0 $y0 $z0 $x0 $y1 $z0
149 draw_cyl $x1 $y1 $z0 $x1 $y0 $z0
150 draw_cyl $x0 $y1 $z0 $x1 $y1 $z0
152 draw_cyl $x0 $y0 $z1 $x1 $y0 $z1
153 draw_cyl $x0 $y0 $z1 $x0 $y1 $z1
154 draw_cyl $x1 $y1 $z1 $x1 $y0 $z1
155 draw_cyl $x0 $y1 $z1 $x1 $y1 $z1
157 draw_cyl $x0 $y0 $z1 $x0 $y0 $z0
158 draw_cyl $x0 $y1 $z1 $x0 $y1 $z0
159 draw_cyl $x1 $y0 $z1 $x1 $y0 $z0
160 draw_cyl $x1 $y1 $z1 $x1 $y1 $z0
165 # manually drawing the 3x4 boundaries specified by argv ...
166 draw_cyl $bx0 $by0 $bz0 $bx1 $by0 $bz0
167 draw_cyl $bx0 $by0 $bz0 $bx0 $by1 $bz0
168 draw_cyl $bx1 $by1 $bz0 $bx1 $by0 $bz0
169 draw_cyl $bx0 $by1 $bz0 $bx1 $by1 $bz0
171 draw_cyl $bx0 $by0 $bz1 $bx1 $by0 $bz1
172 draw_cyl $bx0 $by0 $bz1 $bx0 $by1 $bz1
173 draw_cyl $bx1 $by1 $bz1 $bx1 $by0 $bz1
174 draw_cyl $bx0 $by1 $bz1 $bx1 $by1 $bz1
176 draw_cyl $bx0 $by0 $bz1 $bx0 $by0 $bz0
177 draw_cyl $bx0 $by1 $bz1 $bx0 $by1 $bz0
178 draw_cyl $bx1 $by0 $bz1 $bx1 $by0 $bz0
179 draw_cyl $bx1 $by1 $bz1 $bx1 $by1 $bz0
184 if [ -n "$bcr" ]; then
186 if [ -z "$x0" ]; then
188 cat $file | grep '# \[B\]' | while read foo bar x1 y1 z1 x2 y2 z2 ; do
189 draw_bond $x1 $z1 $y1 $x2 $z2 $y2 $bcr
194 export x0 y0 z0 x1 y1 z1 bcr
195 cat $file | grep '# \[B\]' | awk '\
197 x0=ENVIRON["x0"]; y0=ENVIRON["y0"]; z0=ENVIRON["z0"];
198 x1=ENVIRON["x1"]; y1=ENVIRON["y1"]; z1=ENVIRON["z1"];
202 if(($3>=x0)&&($4>=y0)&&($5>=z0)&&\
203 ($3<=x1)&&($4<=y1)&&($5<=z1)) {
205 print "<"$3","$5","$4">,";
206 print "<"$6","$8","$7">, "bcr;
207 print "pigment { color Blue }";
215 # add camera and light source
216 cat >> temp.pov <<-EOF
219 if [ -n "$ortographic" ]; then cat >> temp.pov <<-EOF
223 cat >> temp.pov <<-EOF
227 light_source { <0,100,-100> color White shadowless }
231 $POVRAY temp.pov > /dev/null 2>&1
232 mv temp.png `echo $file | sed 's/\.xyz/\.png/'`