X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=diff_calc_script;fp=diff_calc_script;h=272c7bd0a4a19b56d651cfc9190d46fcc59e7930;hb=30fafe0cb366808315649bd07bfaa7133ca0ecd2;hp=0000000000000000000000000000000000000000;hpb=c9a72c380c3677f3aeb044f7dde7fc56009622d3;p=physik%2Fposic.git diff --git a/diff_calc_script b/diff_calc_script new file mode 100755 index 0000000..272c7bd --- /dev/null +++ b/diff_calc_script @@ -0,0 +1,74 @@ +#!/bin/sh + +# +# calculate diffusion coefficient within a certain time period +# frank.zirkelbach@physik.uni-augsburg.de +# + +do_it() { + echo "$3 `./diffusion_calc $1 | grep coefficients | \ + awk '{ print $3 " " $4 " " $5 }'`" >> $2 +} + +if [ -d $1 ]; then + rm -f $1/diff_coeff.txt + echo "processing $1 ..." + for file in $1/*.save; do + time="`basename $file | awk -F- '{ print $2 }' | \ + sed 's/\.save//'`" + if [ ! -z "$3" ]; then + [ "$time" -gt "$4" -o "$time" -lt "$3" ] && continue + fi + do_it $file $1/diff_coeff.txt $time + done +else + echo "not a valid directory -> $1" + exit +fi + +# gnuplot + +ddir=$1 +dfile=$ddir/diff_coeff.scr + +cat > $dfile <<-EOF +set autoscale +unset log +unset label +set xtic auto +set ytic auto +set title 'Diffusion coefficients' +set xlabel 't [fs]' +set ylabel 'D [cm cm / s]' +set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 +set output '$ddir/diff_coeff.eps' +EOF + +echo -en "plot " >> $dfile + +komma=0 + +if [ ! -z `echo $2 | grep a` ]; then + [ "$komma" = "1" ] && + echo -en ", " >> $dfile + echo -en "\"$1/diff_coeff.txt\" u 1:2 w l t \"a\"" >> $dfile + komma=1 +fi + +if [ ! -z `echo $2 | grep b` ]; then + [ "$komma" = "1" ] && + echo -en ", " >> $dfile + echo -en "\"$1/diff_coeff.txt\" u 1:3 w l t \"b\"" >> $dfile + komma=1 +fi + +if [ ! -z `echo $2 | grep t` ]; then + [ "$komma" = "1" ] && + echo -en ", " >> $dfile + echo -en "\"$1/diff_coeff.txt\" u 1:4 w l t \"t\"" >> $dfile +fi + +echo -en "\n" >> $dfile + +gnuplot $dfile +