From fa5f117694951f0fc6f32cdf5a2382a9df61ee9a Mon Sep 17 00:00:00 2001 From: hackbard Date: Fri, 7 Sep 2007 14:30:31 +0200 Subject: [PATCH] added povconv tool to convert fron moldyn to parcs/rasmol output --- povconv | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 povconv diff --git a/povconv b/povconv new file mode 100755 index 0000000..122b3e8 --- /dev/null +++ b/povconv @@ -0,0 +1,49 @@ +#!/bin/sh + +# +# convert moldyn output to parcas/rasmol output +# frank.zirkelbach@physik.uni-augsburg.de +# + +if [ ! -d $1 ]; then + echo "no valid directory" + exit 1 +fi + +TRG=$1/md.movie + +rm -f $TRG + +((frame=1)) + +for file in $1/atomic_conf_*.xyz; do + + count=`grep '# \[P\]' $file | awk '{ print $3 }'` + time=`grep '# \[P\]' $file | awk '{ print $4 }'` + x0=`grep '# \[D\]' $file | head -n 1 | awk '{ print $3 '}` + y0=`grep '# \[D\]' $file | head -n 1 | awk '{ print $4 '}` + z0=`grep '# \[D\]' $file | head -n 1 | awk '{ print $5 '}` + x1=`grep '# \[D\]' $file | tail -n 1 | awk '{ print $3 '}` + y1=`grep '# \[D\]' $file | tail -n 1 | awk '{ print $4 '}` + z1=`grep '# \[D\]' $file | tail -n 1 | awk '{ print $5 '}` + dimx=`echo $x0 $x1 | awk '{ print $2-$1 }'` + dimy=`echo $y0 $y1 | awk '{ print $2-$1 }'` + dimz=`echo $z0 $z1 | awk '{ print $2-$1 }'` + + echo " $count" >> $TRG + echo " Frame number $frame $time fs boxsize $dimx $dimy $dimz" >> $TRG + + ((ac=1)) + + cat $file | grep -v '^#' | while read name x y z color temp; do + # well, i only use Si and C + [ "$name" = "Si" ] && type=1 + [ "$name" = "C" ] && type=2 + echo "$name $x $y $z $type ${ac}" >> $TRG + ((ac+=1)) + done + + ((frame+=1)) +done + + -- 2.39.2