#!/bin/sh # # uses gather_results with known files if [ -z "$1" ];then echo "Usage: $0 " echo "where is one directory in the defaults-dir, containing pcp.*${suf} files." exit 1 fi elementliste="H C O Si" . suffix for mol in $@; do DDir="${configdir}/$mol" SDir=$PWD TEX="$mol.tex" DVI="$mol.dvi" PS="$mol.ps" # start TeX-File echo "\documentclass[11pt, a4paper]{article}" >${DDir}/$TEX echo "\usepackage{rotating}" >>${DDir}/$TEX echo "\usepackage{graphicx}" >>${DDir}/$TEX echo "\usepackage{latexsym}" >>${DDir}/$TEX echo "\usepackage{amsfonts}" >>${DDir}/$TEX echo "\usepackage{amssymb}" >>${DDir}/$TEX echo "\begin{document}" >>${DDir}/$TEX # gather susceptibility, copy plot file, call gnuplot echo "Gathering susceptibility ..." ./gather_result ${DDir}/ chi echo "\include{results-chi}" >>${DDir}/$TEX echo "\include{results-chi_iso}" >>${DDir}/$TEX sed -e "s#results#results-chi#g" ${pcpdir}/util/plot-chi.plt >${DDir}/plot-chi.plt cd ${DDir} gnuplot plot-chi.plt sed -i -e "s#^ \(.*\) \(.*\) i#\1\t\2#" results-chi_iso${suf} sed -i -e "s#figure#sidewayfigure#g" results-chi.tex cd ${SDir} # build ecut list and search for first Ht i=1 firstecut="" while [ "$i" -lt 128 ]; do if [ -e "$DDir/${i}Ht/pcp.spread.all" ]; then ecuts="$ecuts $i" # Mark the first if [ -z "$firstecut" ]; then firstecut="$i" fi fi let i=$i+1 done # go through all different sigmas for type in $elementliste; do ion=0 while [ -e "$DDir/${firstecut}Ht/pcp.sigma_i${ion}_${type}${suf}" ]; do echo "Gathering shielding tensor for ion ${ion} of type ${type} ..." ./gather_result ${DDir}/ "sigma_i${ion}_${type}" sed -e "s#sigma#sigma-i${ion}-${type}#g" -e "s#results#results-sigma_i${ion}_${type}#" ${pcpdir}/util/plot-sigma.plt >${DDir}/plot-sigma_i${ion}_${type}.plt cd ${DDir} gnuplot "plot-sigma_i${ion}_${type}.plt" sed -i -e "s#^ \(.*\) \(.*\) i#\1\t\2#" results-sigma_i${ion}_${type}_iso${suf} sed -i -e "s#figure#sidewayfigure#g" results-sigma_i${ion}_${type}.tex cd ${SDir} echo "\include{results-sigma_i${ion}_${type}}" >>${DDir}/$TEX echo "\include{results-sigma_i${ion}_${type}_iso}" >>${DDir}/$TEX # step on to next ion, if exists. If not, go to next type and zeroth ion let ion=$ion+1 done if [ -e "$DDir/${firstecut}Ht/pcp.sigma_i0_${type}${suf}" ]; then echo "Collecting shielding tensor, averaging and error estimation ..." # ./average_result [SUFFIX] ./average_result ${DDir}/ "sigma" ${type} 9 "${DDir}/results-sigma_${type}_avg${suf}" ./average_result ${DDir}/ "sigma" ${type} 1 "${DDir}/results-sigma_${type}_iso_avg${suf}" _iso fi ion=0 while [ -e "$DDir/${firstecut}Ht/pcp.sigma_i${ion}_${type}_rezi${suf}" ]; do echo "Gathering reciprocal shielding tensor for ion ${ion} of type ${type} ..." ./gather_result ${DDir}/ "sigma_i${ion}_${type}_rezi" sed -e "s#sigma#sigma-i${ion}-${type}_rezi#g" -e "s#results#results-sigma_i${ion}_${type}_rezi#" ${pcpdir}/util/plot-sigma.plt >${DDir}/plot-sigma_i${ion}_${type}_rezi.plt cd ${DDir} gnuplot "plot-sigma_i${ion}_${type}_rezi.plt" sed -i -e "s#^ \(.*\) \(.*\) i#\1\t\2#" results-sigma_i${ion}_${type}_rezi_iso${suf} sed -i -e "s#figure#sidewayfigure#g" results-sigma_i${ion}_${type}_rezi.tex cd ${SDir} echo "\include{results-sigma_i${ion}_${type}_rezi}" >>${DDir}/$TEX echo "\include{results-sigma_i${ion}_${type}_rezi_iso}" >>${DDir}/$TEX # step on to next ion, if exists. If not, go to next type and zeroth ion let ion=$ion+1 done if [ -e "$DDir/${firstecut}Ht/pcp.sigma_i0_${type}_rezi${suf}" ]; then echo "Collecting reciprocal shielding tensor, averaging and error estimation ..." ./average_result ${DDir}/ "sigma" ${type} 9 "${DDir}/results-sigma_${type}_rezi_avg${suf}" "_rezi" ./average_result ${DDir}/ "sigma" ${type} 1 "${DDir}/results-sigma_${type}_rezi_iso_avg${suf}" "_rezi_iso" fi done # 2D-Vektorplots der verschiedenen Prozess zusammenfuehren RES="$DDir/pcp.current${suf}" DATE="`date`" echo "# Results of 2d current vector plot of molecule ${mol}, gathered on $date" >$RES index=0 axis=-1 node=-1 for i in $ecuts; do cpu=0 while [ -e "$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" ]; do # Give each block a header and grep info therefrom if [ "$cpu" == "0" ]; then echo "# Result of ${i} Hartree calculations" >>$RES axis=`head -n 1 "$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" | awk -F"_" {'print $2'} | awk -F" " {'print $1'}` grid=`head -n 1 "$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" | awk -F"node " {'print $2'} | awk -F"," {'print $1'}` fi cat <"$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" >>$RES let cpu=$cpu+1 done # Put some blank lines in between for gnuplot index to work if [ "$cpu" != "0" ]; then echo -e -n "\n\n\n" >>$RES PLOT="$DDir/pcp.current_${i}Ht.plt" echo "#!/usr/local/bin/gnuplot" >$PLOT echo "# set terminal postscript landscape noenhanced monochrome " >>$PLOT echo "# dashed defaultplex "Helvetica" 14" >>$PLOT echo "# set output 'output.ps'" >>$PLOT #echo "set terminal pslatex auxfile" >>$PLOT #echo "set output \"${type}_current_${i}Ht.tex\"" >>$PLOT echo "set terminal postscript enhanced color" >>$PLOT echo "set output \"${mol}_current_${i}Ht.eps\"" >>$PLOT echo "set mxtics 5.000000" >>$PLOT echo "set mytics 5.000000" >>$PLOT echo "set xtics border mirror norotate 1" >>$PLOT echo "set ytics border mirror norotate 0.5" >>$PLOT echo "plot '$RES' index ${index} using 1:2:3:4 with vectors title 'Stromflu\"s ${mol}, Schnittachse ${axis} bei Punkt ${grid}'" >>$PLOT echo "set terminal x11" >>$PLOT echo "replot" >>$PLOT echo "# EOF" >>$PLOT let index=$index+1 fi done # End TeX-File and call with latex echo "\end{document}" >>${DDir}/$TEX cd ${DDir} latex $TEX dvips -o $PS $DVI cd ${SDir} done echo "all done." exit 0