]> hackdaworld.org Git - physik/posic.git/commitdiff
changes to pair correlation calc code
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 10 Feb 2008 17:42:44 +0000 (18:42 +0100)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Sun, 10 Feb 2008 17:42:44 +0000 (18:42 +0100)
pair_corr_calc_script
pair_correlation_calc.c

index 27dc0abd2b8eae3a0bae16123f039f9178500ee1..3913ca1b75c46f778f81c1c59182bb8f4e019154 100755 (executable)
@@ -8,12 +8,8 @@
 do_it() {
        echo "processing $1 ..."
        ./pair_correlation_calc $1 $2
-       trgab=`echo $1 | sed 's%s-%pair_corr_ab-%' | sed 's%.save%%'`
-       trgaa=`echo $1 | sed 's%s-%pair_corr_aa-%' | sed 's%.save%%'`
-       trgbb=`echo $1 | sed 's%s-%pair_corr_bb-%' | sed 's%.save%%'`
-       mv pair_corr_func_ab.txt $trgab
-       mv pair_corr_func_aa.txt $trgaa
-       mv pair_corr_func_bb.txt $trgbb
+       trg=`echo $1 | sed 's%s-%pair_corr-%' | sed 's%.save%%'`
+       mv pair_corr_func.txt $trg
        echo "done"
 }
 
@@ -27,3 +23,59 @@ if [ -f $1 ]; then
        do_it $1 $2
 fi
 
+# gnuplot
+
+if [ "$3" = "g" ]; then
+
+pdir=`dirname $1`
+pfile=$pdir/pair_corr.scr
+
+cat > $pfile <<-EOF
+set autoscale 
+unset log 
+unset label 
+set xtic auto 
+set ytic auto 
+set title 'Pair correlation function' 
+set xlabel 'r [A]' 
+set ylabel 'g(r) [a.u.]' 
+set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 
+set output '$pdir/pair_corr.eps' 
+EOF
+
+echo -en "plot [1.5:3.0] " >> $pfile
+
+komma=0
+
+for i in $pdir/pair_corr-*; do
+
+       time=`basename $i | awk -F- '{print $2}'`
+
+       if [ ! -z `echo $4 | grep a` ]; then
+               [ "$komma" = "1" ] &&
+                       echo -en ", " >> $pfile
+               echo -en "\"$i\" u 1:2 w l t \"ab $time\"" >> $pfile
+               komma=1
+       fi
+
+       if [ ! -z `echo $4 | grep b` ]; then
+               [ "$komma" = "1" ] &&
+                       echo -en ", " >> $pfile
+               echo -en "\"$i\" u 1:3 w l t \"ab $time\"" >> $pfile
+               komma=1
+       fi
+
+       if [ ! -z `echo $4 | grep c` ]; then
+               [ "$komma" = "1" ] &&
+                       echo -en ", " >> $pfile
+               echo -en "\"$i\" u 1:4 w l t \"ab $time\"" >> $pfile
+               komma=1
+       fi
+
+done
+
+echo -en "\n" >> $pfile
+
+gnuplot $pfile
+
+fi
index f6a256fc32eff3fdfae609c5c559a52ee3d50a8f..b3386c737f99b8cc687143f4aa9ac4c7967a1367 100644 (file)
@@ -65,27 +65,14 @@ int main(int argc,char **argv) {
 
        calculate_pair_correlation(&moldyn,dr,stat);
 
-       fd=open("pair_corr_func_ab.txt",
+       fd=open("pair_corr_func.txt",
                O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
-       dprintf(fd,"# type a - type b bonds\n");
+       dprintf(fd,"#r #ab #aa #bb\n");
        for(i=0;i<slots;i++)
-               dprintf(fd,"%f %f\n",i*dr,stat[i]);
+               dprintf(fd,"%f %f %f %f\n",
+                       i*dr,stat[i],stat[slots+i],stat[2*slots+i]);
        close(fd);
-               
-       fd=open("pair_corr_func_aa.txt",
-               O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
-       dprintf(fd,"# type a - type a bonds\n");
-       for(i=0;i<slots;i++)
-               dprintf(fd,"%f %f\n",i*dr,stat[slots+i]);
-       close(fd);
-               
-       fd=open("pair_corr_func_bb.txt",
-               O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
-       dprintf(fd,"# type a - type b bonds\n");
-       for(i=0;i<slots;i++)
-               dprintf(fd,"%f %f\n",i*dr,stat[2*slots+i]);
-       close(fd);
-               
+
        free(stat);
 
        return 0;