Merge branch 'leadoff'
[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 $2 $1
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 if [ -d $1 ]; then
31         pdir=$1
32 else
33         pdir=`dirname $1`
34 fi
35 pfile=$pdir/pair_corr.scr
36
37 cat > $pfile <<-EOF
38 set autoscale 
39 unset log 
40 unset label 
41 set xtic auto 
42 set ytic auto 
43 set title 'Pair correlation function' 
44 set xlabel 'r [A]' 
45 set ylabel 'g(r) [a.u.]' 
46 unset ytics
47 set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 
48 set output '$pdir/pair_corr.eps' 
49 EOF
50
51 echo -en "plot [1.0:6.0] " >> $pfile
52
53 komma=0
54
55 for i in $pdir/pair_corr-*; do
56
57         time=`basename $i | awk -F- '{print $2}'`
58
59         if [ ! -z `echo $4 | grep a` ]; then
60                 [ "$komma" = "1" ] &&
61                         echo -en ", " >> $pfile
62                 echo -en "\"$i\" u 1:2 w l t \"ab $time\"" >> $pfile
63                 komma=1
64         fi
65
66         if [ ! -z `echo $4 | grep b` ]; then
67                 [ "$komma" = "1" ] &&
68                         echo -en ", " >> $pfile
69                 echo -en "\"$i\" u 1:3 w l t \"aa $time\"" >> $pfile
70                 komma=1
71         fi
72
73         if [ ! -z `echo $4 | grep c` ]; then
74                 [ "$komma" = "1" ] &&
75                         echo -en ", " >> $pfile
76                 echo -en "\"$i\" u 1:4 w l t \"bb $time\"" >> $pfile
77                 komma=1
78         fi
79
80 done
81
82 echo -en "\n" >> $pfile
83
84 gnuplot $pfile
85
86 fi