]> hackdaworld.org Git - physik/posic.git/commitdiff
initial positions from outcar to moldyn format
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 13 Sep 2009 11:44:33 +0000 (13:44 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 13 Sep 2009 11:44:33 +0000 (13:44 +0200)
vasp_tools/o_init2moldyn [new file with mode: 0755]

diff --git a/vasp_tools/o_init2moldyn b/vasp_tools/o_init2moldyn
new file mode 100755 (executable)
index 0000000..837712e
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+for i in OUTCAR*; do
+       app=`echo $i | awk -F. '{ print $2 }'`
+       [ ! -z $app ] && app=".$app"
+
+rm -rf video$app
+mkdir -p video$app
+
+sicnt=`grep 'ions per' $i | awk '{ print $5 }'`
+ccnt=`grep 'ions per' $i | awk '{ print $6 }'`
+
+((total=sicnt+ccnt))
+
+echo "parsing file $PWD/$i ..."
+echo "  Si: $sicnt, C: $ccnt, total: $total"
+
+cnt=0
+tcnt=0
+
+cx=1.0
+cy=1.0
+cz=0.8
+
+sed -n -e '/ position of ions in cartesian/,/----/p' $i | \
+       grep -v POS | grep -v total | grep -v -- ^\ - | \
+       while read x y z; do
+
+       time=`printf "%05d" $tcnt`
+       #echo -en "$tcnt/$cnt "
+       [ "$cnt" = "0" ] && \
+               echo "# P $total $time <$cx,$cy,$cz>" > \
+                       video$app/atomic_conf_$time.xyz
+
+       type="Si"
+       color="Yellow"
+       force=0.0
+       if [ $cnt -ge $sicnt ]; then
+               type="C"
+               color="Gray"
+       fi
+       echo "$type $x $y $z $color $force" >> \
+               video$app/atomic_conf_$time.xyz
+       
+       ((cnt+=1))
+       if [ $cnt -eq $total ]; then
+               cnt=0
+               ((tcnt+=1))
+               echo -en "$tcnt "
+       fi
+done
+
+echo
+
+done
+