File: plot_dlog

package info (click to toggle)
espresso 6.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,068 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,503; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (66 lines) | stat: -rwxr-xr-x 1,856 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash

if ! which gnuplot >/dev/null 2>&1; then
   echo "You need gnuplot to use this script"
   exit 5
fi

if [ $# -lt 1 ]; then
   echo "Please specify date directory as argument #1"
   echo
   echo "You must have used ld1.x with prefix='\$1/ld1'"
   echo "for this script to work"
   exit 3 
fi

if [ ! -s $1/ld1.dlog ] ; then
   echo "Wrong prefix: directory \"$1\" does not contain dlog files!"
   echo "Syntax: $0 Xy"
   echo
   echo "you must have used ld1.x with prefix='$1/ld1'"
   echo "for this script to work"
   exit 4
fi

label[2]='s: l=0'
label[3]='p: l=1'
label[4]='d: l=2'
label[5]='f: l=3'
label[6]='g: l=4'

nld=`head -n1 $1/ld1ps.dlog|wc -w`
every=$[`cat $1/ld1ps.dlog|wc -l`/25]

plot='plot '
for i in `seq 2 $nld`;do
   s=$[$i-1]
   s2=$[$i+2]
   if [ $AEonly ] ; then
      plot="$plot""'$1/ld1.dlog' u 1:$i t '${label[$i]}' w l, "
   else
      #plot="$plot""'$1/ld1.dlog' u 1:$i every $every t 'AE - ${label[$i]}' w p, '$1/ld1ps.dlog' u 1:$i t 'PS - ${label[$i]}', "
      plot="$plot""'$1/ld1ps.dlog' u 1:$i t 'log deriv (pseudo) - ${label[$i]}' w l lw 2.5 lt $s, '$1/ld1.dlog' u 1:$i t 'log deriv (all elec) - ${label[$i]}' w l lt $s, " 
      plot="$plot""'$1/ld1.pwe' u 1:(\$$i*10) w l lw 1 lt $s2 t 'Plane-wave exp. - ${label[$i]}', "
      #plot="$plot""'$1/ld1.pwe' u 1:(log10(\$$i*100+1)) w l lw 1 lt $s2 t 'pwe - ${label[$i]}', "
   fi
   #plot="$plot""'$1/ld1.dlog' u 1:$i, '$1/ld1ps.dlog' u 1:$i, "
done
#plot="$plot 'zeros' w l, 'zeros2' w l"
plot="$plot x*0 w l lt 7 not, x*0+1 w l lt 7 t 'Plane Wave Expansion ~ 0.1%'"
#echo $plot

cat << EOF | gnuplot
set style data l
set yr [-10:10]
set xtics -10,1,10 font "serif,8"
set x2tics -10,1,10 font "serif,8"
unset ytics
set terminal postscript solid color
set output '$1-dlog.ps'
$plot
EOF

echo "graph saved to '$1-dlog.ps'"

#gv -antialias -scale 4 $1/dlog.eps