X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fposic.git;a=blobdiff_plain;f=vasp_tools%2Foutcar2moldyn;fp=vasp_tools%2Foutcar2moldyn;h=6950453cfaed873a0c43c4ba4c4adc6a26f83d62;hp=0000000000000000000000000000000000000000;hb=6e6d7126ea9a845f11637d8e1b8eb2b570ac4dc9;hpb=97dc63eb6a519b8e1f4fbfaa9760dd94539436b0 diff --git a/vasp_tools/outcar2moldyn b/vasp_tools/outcar2moldyn new file mode 100755 index 0000000..6950453 --- /dev/null +++ b/vasp_tools/outcar2moldyn @@ -0,0 +1,64 @@ +#!/bin/bash + +for i in OUTCAR*; do + app=`echo $i | awk -F. '{ print $2 }'` + [ ! -z $app ] && app=".$app" + +if [ "$1" = "renew" ]; then + rm -rf video$app +fi + +if [ -d video$app ]; then + echo "skipping $app ... (use $0 renew to force rebuild)" + continue +fi + +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/,/total/p' $i | \ + 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$app/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$app/atomic_conf_$time.xyz + + ((cnt+=1)) + if [ $cnt -eq $total ]; then + cnt=0 + ((tcnt+=1)) + echo -en "$tcnt " + fi +done + +echo + +done +