]> www.hackdaworld.org Git - physik/posic.git/blob - vasp_tools/o_init2moldyn
save in src dir + app(endix)
[physik/posic.git] / vasp_tools / o_init2moldyn
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 rm -rf video$app
8 mkdir -p video$app
9
10 sicnt=`grep 'ions per' $i | awk '{ print $5 }'`
11 ccnt=`grep 'ions per' $i | awk '{ print $6 }'`
12
13 ((total=sicnt+ccnt))
14
15 echo "parsing file $PWD/$i ..."
16 echo "  Si: $sicnt, C: $ccnt, total: $total"
17
18 cnt=0
19 tcnt=0
20
21 cx=1.0
22 cy=1.0
23 cz=0.8
24
25 sed -n -e '/ position of ions in cartesian/,/----/p' $i | \
26         grep -v POS | grep -v total | grep -v -- ^\ - | \
27         while read x y z; do
28
29         time=`printf "%05d" $tcnt`
30         #echo -en "$tcnt/$cnt "
31         [ "$cnt" = "0" ] && \
32                 echo "# P $total $time <$cx,$cy,$cz>" > \
33                         video$app/atomic_conf_$time.xyz
34
35         type="Si"
36         color="Yellow"
37         force=0.0
38         if [ $cnt -ge $sicnt ]; then
39                 type="C"
40                 color="Gray"
41         fi
42         echo "$type $x $y $z $color $force" >> \
43                 video$app/atomic_conf_$time.xyz
44         
45         ((cnt+=1))
46         if [ $cnt -eq $total ]; then
47                 cnt=0
48                 ((tcnt+=1))
49                 echo -en "$tcnt "
50         fi
51 done
52
53 echo
54
55 done
56