]> hackdaworld.org Git - physik/posic.git/blob - vasp_tools/outcar2moldyn
added sip and dist calc for vasp results
[physik/posic.git] / vasp_tools / outcar2moldyn
1 #!/bin/bash
2
3 for i in OUTCAR*; do
4         app=`echo $i | awk -F. '{ print $2 }'`
5         [ ! -z $app ] && app=".$app"
6
7 if [ "$1" = "renew" ]; then
8         rm -rf video$app
9 fi
10
11 if [ -d video$app ]; then
12         echo "skipping $app ... (use $0 renew to force rebuild)"
13         continue
14 fi
15
16 mkdir -p video$app
17
18 sicnt=`grep 'ions per' $i | awk '{ print $5 }'`
19 ccnt=`grep 'ions per' $i | awk '{ print $6 }'`
20
21 ((total=sicnt+ccnt))
22
23 echo "parsing file $PWD/$i ..."
24 echo "  Si: $sicnt, C: $ccnt, total: $total"
25
26 cnt=0
27 tcnt=0
28
29 cx=1.0
30 cy=1.0
31 cz=0.8
32
33 sed -n -e '/POSITION/,/total/p' $i | \
34         grep -v POS | grep -v total | grep -v -- ^\ - | \
35         while read x y z fx fy fz; do
36
37         time=`printf "%05d" $tcnt`
38         #echo -en "$tcnt/$cnt "
39         [ "$cnt" = "0" ] && \
40                 echo "# P $total $time <$cx,$cy,$cz>" > \
41                         video$app/atomic_conf_$time.xyz
42
43         type="Si"
44         color="Yellow"
45         force=`echo "sqrt($fx*$fx+$fy*$fy+$fz*$fz)" | bc`
46         if [ $cnt -ge $sicnt ]; then
47                 type="C"
48                 color="Gray"
49         fi
50         echo "$type $x $y $z $color $force" >> \
51                 video$app/atomic_conf_$time.xyz
52         
53         ((cnt+=1))
54         if [ $cnt -eq $total ]; then
55                 cnt=0
56                 ((tcnt+=1))
57                 echo -en "$tcnt "
58         fi
59 done
60
61 echo
62
63 done
64