added some helper tools for vasp usage
[physik/posic.git] / vasp_tools / outcar2moldyn
diff --git a/vasp_tools/outcar2moldyn b/vasp_tools/outcar2moldyn
new file mode 100755 (executable)
index 0000000..780dd93
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+rm -rf video
+mkdir -p video
+
+sicnt=`grep 'ions per' OUTCAR | awk '{ print $5 }'`
+ccnt=`grep 'ions per' OUTCAR | awk '{ print $6 }'`
+
+((total=sicnt+ccnt))
+
+echo "parsing OUTCAR file ..."
+echo "  Si: $sicnt, C: $ccnt, total: $total"
+
+cnt=0
+tcnt=0
+
+cx=1.0
+cy=1.0
+cz=0.8
+
+sed -n -e '/POSITION/,/total/p' OUTCAR | \
+       grep -v POS | grep -v total | grep -v -- ^\ - | \
+       while read x y z fx fy fz; do
+
+       time=`printf "%05d" $tcnt`
+       echo -en "$tcnt/$cnt "
+       [ "$cnt" = "0" ] && \
+               echo "# P $total $time <$cx,$cy,$cz>" > \
+                       video/atomic_conf_$time.xyz
+
+       type="Si"
+       color="Yellow"
+       force=`echo "sqrt($fx*$fx+$fy*$fy+$fz*$fz)" | bc`
+       if [ $cnt -ge $sicnt ]; then
+               type="C"
+               color="Gray"
+       fi
+       echo "$type $x $y $z $color $force" >> \
+               video/atomic_conf_$time.xyz
+       
+       ((cnt+=1))
+       if [ $cnt -eq $total ]; then
+               cnt=0
+               ((tcnt+=1))
+               echo
+       fi
+done
+
+echo
+