#!/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