changes to pair correlation calc code
[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 set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 
43 set output '$pdir/pair_corr.eps' 
44 EOF
45
46 echo -en "plot [1.5:3.0] " >> $pfile
47
48 komma=0
49
50 for i in $pdir/pair_corr-*; do
51
52         time=`basename $i | awk -F- '{print $2}'`
53
54         if [ ! -z `echo $4 | grep a` ]; then
55                 [ "$komma" = "1" ] &&
56                         echo -en ", " >> $pfile
57                 echo -en "\"$i\" u 1:2 w l t \"ab $time\"" >> $pfile
58                 komma=1
59         fi
60
61         if [ ! -z `echo $4 | grep b` ]; then
62                 [ "$komma" = "1" ] &&
63                         echo -en ", " >> $pfile
64                 echo -en "\"$i\" u 1:3 w l t \"ab $time\"" >> $pfile
65                 komma=1
66         fi
67
68         if [ ! -z `echo $4 | grep c` ]; then
69                 [ "$komma" = "1" ] &&
70                         echo -en ", " >> $pfile
71                 echo -en "\"$i\" u 1:4 w l t \"ab $time\"" >> $pfile
72                 komma=1
73         fi
74
75 done
76
77 echo -en "\n" >> $pfile
78
79 gnuplot $pfile
80
81 fi