added normalization to pair correlation calc
[physik/posic.git] / pair_corr_calc_script
1 #!/bin/sh
2
3 #
4 # calculate pair correlation functions for a whole simulation output
5 # frank.zirkelbach@physik.uni-augsburg.de
6 #
7
8 do_it() {
9         echo "processing $1 ..."
10         ./pair_correlation_calc $1 $2
11         trg=`echo $1 | sed 's%s-%pair_corr-%' | sed 's%.save%%'`
12         mv pair_corr_func.txt $trg
13         echo "done"
14 }
15
16 if [ -d $1 ]; then
17         for file in $1/*.save; do
18                 do_it $file $2
19         done
20 fi
21
22 if [ -f $1 ]; then
23         do_it $1 $2
24 fi
25
26 # gnuplot
27
28 if [ "$3" = "g" ]; then
29
30 pdir=`dirname $1`
31 pfile=$pdir/pair_corr.scr
32
33 cat > $pfile <<-EOF
34 set autoscale 
35 unset log 
36 unset label 
37 set xtic auto 
38 set ytic auto 
39 set title 'Pair correlation function' 
40 set xlabel 'r [A]' 
41 set ylabel 'g(r) [a.u.]' 
42 unset ytics
43 set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 
44 set output '$pdir/pair_corr.eps' 
45 EOF
46
47 echo -en "plot [1.5:6.0] " >> $pfile
48
49 komma=0
50
51 for i in $pdir/pair_corr-*; do
52
53         time=`basename $i | awk -F- '{print $2}'`
54
55         if [ ! -z `echo $4 | grep a` ]; then
56                 [ "$komma" = "1" ] &&
57                         echo -en ", " >> $pfile
58                 echo -en "\"$i\" u 1:2 w l t \"ab $time\"" >> $pfile
59                 komma=1
60         fi
61
62         if [ ! -z `echo $4 | grep b` ]; then
63                 [ "$komma" = "1" ] &&
64                         echo -en ", " >> $pfile
65                 echo -en "\"$i\" u 1:3 w l t \"aa $time\"" >> $pfile
66                 komma=1
67         fi
68
69         if [ ! -z `echo $4 | grep c` ]; then
70                 [ "$komma" = "1" ] &&
71                         echo -en ", " >> $pfile
72                 echo -en "\"$i\" u 1:4 w l t \"bb $time\"" >> $pfile
73                 komma=1
74         fi
75
76 done
77
78 echo -en "\n" >> $pfile
79
80 gnuplot $pfile
81
82 fi