| 1 | #!/bin/sh | 
|---|
| 2 | # | 
|---|
| 3 | # uses gather_results with known files | 
|---|
| 4 |  | 
|---|
| 5 | if [ -z "$1" ];then | 
|---|
| 6 | echo "Usage: $0 <mol>" | 
|---|
| 7 | echo "where <mol> is one directory in the defaults-dir, containing pcp.*${suf} files." | 
|---|
| 8 | exit 1 | 
|---|
| 9 | fi | 
|---|
| 10 |  | 
|---|
| 11 | elementliste="H C O Si" | 
|---|
| 12 | . suffix | 
|---|
| 13 |  | 
|---|
| 14 |  | 
|---|
| 15 | for mol in $@; do | 
|---|
| 16 | DDir="${configdir}/$mol" | 
|---|
| 17 | SDir=$PWD | 
|---|
| 18 | TEX="$mol.tex" | 
|---|
| 19 | DVI="$mol.dvi" | 
|---|
| 20 | PS="$mol.ps" | 
|---|
| 21 |  | 
|---|
| 22 | # start TeX-File | 
|---|
| 23 | echo "\documentclass[11pt, a4paper]{article}" >${DDir}/$TEX | 
|---|
| 24 | echo "\usepackage{rotating}" >>${DDir}/$TEX | 
|---|
| 25 | echo "\usepackage{graphicx}" >>${DDir}/$TEX | 
|---|
| 26 | echo "\usepackage{latexsym}" >>${DDir}/$TEX | 
|---|
| 27 | echo "\usepackage{amsfonts}" >>${DDir}/$TEX | 
|---|
| 28 | echo "\usepackage{amssymb}" >>${DDir}/$TEX | 
|---|
| 29 | echo "\begin{document}" >>${DDir}/$TEX | 
|---|
| 30 |  | 
|---|
| 31 | # gather susceptibility, copy plot file, call gnuplot | 
|---|
| 32 | echo "Gathering susceptibility ..." | 
|---|
| 33 | ./gather_result ${DDir}/ chi | 
|---|
| 34 | echo "\include{results-chi}" >>${DDir}/$TEX | 
|---|
| 35 | echo "\include{results-chi_iso}" >>${DDir}/$TEX | 
|---|
| 36 | sed -e "s#results#results-chi#g" ${pcpdir}/util/plot-chi.plt >${DDir}/plot-chi.plt | 
|---|
| 37 | cd ${DDir} | 
|---|
| 38 | gnuplot plot-chi.plt | 
|---|
| 39 | sed -i -e "s#^ \(.*\) \(.*\) i#\1\t\2#" results-chi_iso${suf} | 
|---|
| 40 | sed -i -e "s#figure#sidewayfigure#g" results-chi.tex | 
|---|
| 41 | cd ${SDir} | 
|---|
| 42 |  | 
|---|
| 43 | # build ecut list and search for first Ht | 
|---|
| 44 | i=1 | 
|---|
| 45 | firstecut="" | 
|---|
| 46 | while   [ "$i" -lt 128 ]; do | 
|---|
| 47 | if [ -e "$DDir/${i}Ht/pcp.spread.all" ]; then | 
|---|
| 48 | ecuts="$ecuts $i" | 
|---|
| 49 | # Mark the first | 
|---|
| 50 | if [ -z "$firstecut" ]; then | 
|---|
| 51 | firstecut="$i" | 
|---|
| 52 | fi | 
|---|
| 53 | fi | 
|---|
| 54 | let i=$i+1 | 
|---|
| 55 | done | 
|---|
| 56 |  | 
|---|
| 57 | # go through all different sigmas | 
|---|
| 58 | for type in $elementliste; do | 
|---|
| 59 | ion=0 | 
|---|
| 60 | while [ -e "$DDir/${firstecut}Ht/pcp.sigma_i${ion}_${type}${suf}" ]; do | 
|---|
| 61 | echo "Gathering shielding tensor for ion ${ion} of type ${type} ..." | 
|---|
| 62 | ./gather_result ${DDir}/ "sigma_i${ion}_${type}" | 
|---|
| 63 | 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 | 
|---|
| 64 | cd ${DDir} | 
|---|
| 65 | gnuplot "plot-sigma_i${ion}_${type}.plt" | 
|---|
| 66 | sed -i -e "s#^ \(.*\) \(.*\) i#\1\t\2#" results-sigma_i${ion}_${type}_iso${suf} | 
|---|
| 67 | sed -i -e "s#figure#sidewayfigure#g" results-sigma_i${ion}_${type}.tex | 
|---|
| 68 | cd ${SDir} | 
|---|
| 69 | echo "\include{results-sigma_i${ion}_${type}}" >>${DDir}/$TEX | 
|---|
| 70 | echo "\include{results-sigma_i${ion}_${type}_iso}" >>${DDir}/$TEX | 
|---|
| 71 | # step on to next ion, if exists. If not, go to next type and zeroth ion | 
|---|
| 72 | let ion=$ion+1 | 
|---|
| 73 | done | 
|---|
| 74 | if [ -e "$DDir/${firstecut}Ht/pcp.sigma_i0_${type}${suf}" ]; then | 
|---|
| 75 | echo "Collecting shielding tensor, averaging and error estimation ..." | 
|---|
| 76 | # ./average_result <molecule dir> <variable> <element> <columns> <destfile> [SUFFIX] | 
|---|
| 77 | ./average_result ${DDir}/ "sigma" ${type} 9 "${DDir}/results-sigma_${type}_avg${suf}" | 
|---|
| 78 | ./average_result ${DDir}/ "sigma" ${type} 1 "${DDir}/results-sigma_${type}_iso_avg${suf}" _iso | 
|---|
| 79 | fi | 
|---|
| 80 |  | 
|---|
| 81 | ion=0 | 
|---|
| 82 | while [ -e "$DDir/${firstecut}Ht/pcp.sigma_i${ion}_${type}_rezi${suf}" ]; do | 
|---|
| 83 | echo "Gathering reciprocal shielding tensor for ion ${ion} of type ${type} ..." | 
|---|
| 84 | ./gather_result ${DDir}/ "sigma_i${ion}_${type}_rezi" | 
|---|
| 85 | 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 | 
|---|
| 86 | cd ${DDir} | 
|---|
| 87 | gnuplot "plot-sigma_i${ion}_${type}_rezi.plt" | 
|---|
| 88 | sed -i -e "s#^ \(.*\) \(.*\) i#\1\t\2#" results-sigma_i${ion}_${type}_rezi_iso${suf} | 
|---|
| 89 | sed -i -e "s#figure#sidewayfigure#g" results-sigma_i${ion}_${type}_rezi.tex | 
|---|
| 90 | cd ${SDir} | 
|---|
| 91 | echo "\include{results-sigma_i${ion}_${type}_rezi}" >>${DDir}/$TEX | 
|---|
| 92 | echo "\include{results-sigma_i${ion}_${type}_rezi_iso}" >>${DDir}/$TEX | 
|---|
| 93 | # step on to next ion, if exists. If not, go to next type and zeroth ion | 
|---|
| 94 | let ion=$ion+1 | 
|---|
| 95 | done | 
|---|
| 96 | if [ -e "$DDir/${firstecut}Ht/pcp.sigma_i0_${type}_rezi${suf}" ]; then | 
|---|
| 97 | echo "Collecting reciprocal shielding tensor, averaging and error estimation ..." | 
|---|
| 98 | ./average_result ${DDir}/ "sigma" ${type} 9 "${DDir}/results-sigma_${type}_rezi_avg${suf}" "_rezi" | 
|---|
| 99 | ./average_result ${DDir}/ "sigma" ${type} 1 "${DDir}/results-sigma_${type}_rezi_iso_avg${suf}" "_rezi_iso" | 
|---|
| 100 | fi | 
|---|
| 101 | done | 
|---|
| 102 |  | 
|---|
| 103 | # 2D-Vektorplots der verschiedenen Prozess zusammenfuehren | 
|---|
| 104 | RES="$DDir/pcp.current${suf}" | 
|---|
| 105 | DATE="`date`" | 
|---|
| 106 | echo "# Results of 2d current vector plot of molecule ${mol}, gathered on $date" >$RES | 
|---|
| 107 |  | 
|---|
| 108 | index=0 | 
|---|
| 109 | axis=-1 | 
|---|
| 110 | node=-1 | 
|---|
| 111 | for i in $ecuts; do | 
|---|
| 112 | cpu=0 | 
|---|
| 113 | while [ -e "$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" ]; do | 
|---|
| 114 | # Give each block a header and grep info therefrom | 
|---|
| 115 | if [ "$cpu" == "0" ]; then | 
|---|
| 116 | echo "# Result of ${i} Hartree calculations" >>$RES | 
|---|
| 117 | axis=`head -n 1 "$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" | awk -F"_" {'print $2'} | awk -F" " {'print $1'}` | 
|---|
| 118 | grid=`head -n 1 "$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" | awk -F"node " {'print $2'} | awk -F"," {'print $1'}` | 
|---|
| 119 | fi | 
|---|
| 120 | cat <"$DDir/${i}Ht/pcp.current_proc${cpu}${suf}" >>$RES | 
|---|
| 121 | let cpu=$cpu+1 | 
|---|
| 122 | done | 
|---|
| 123 | # Put some blank lines in between for gnuplot index to work | 
|---|
| 124 | if [ "$cpu" != "0" ]; then | 
|---|
| 125 | echo -e -n "\n\n\n" >>$RES | 
|---|
| 126 | PLOT="$DDir/pcp.current_${i}Ht.plt" | 
|---|
| 127 | echo "#!/usr/local/bin/gnuplot" >$PLOT | 
|---|
| 128 | echo "# set terminal postscript landscape noenhanced monochrome " >>$PLOT | 
|---|
| 129 | echo "#              dashed defaultplex "Helvetica" 14" >>$PLOT | 
|---|
| 130 | echo "# set output 'output.ps'" >>$PLOT | 
|---|
| 131 | #echo "set terminal pslatex auxfile" >>$PLOT | 
|---|
| 132 | #echo "set output \"${type}_current_${i}Ht.tex\"" >>$PLOT | 
|---|
| 133 | echo "set terminal postscript enhanced color" >>$PLOT | 
|---|
| 134 | echo "set output \"${mol}_current_${i}Ht.eps\"" >>$PLOT | 
|---|
| 135 | echo "set mxtics 5.000000" >>$PLOT | 
|---|
| 136 | echo "set mytics 5.000000" >>$PLOT | 
|---|
| 137 | echo "set xtics border mirror norotate 1" >>$PLOT | 
|---|
| 138 | echo "set ytics border mirror norotate 0.5" >>$PLOT | 
|---|
| 139 | echo "plot '$RES' index ${index} using 1:2:3:4 with vectors title 'Stromflu\"s ${mol}, Schnittachse ${axis} bei Punkt ${grid}'" >>$PLOT | 
|---|
| 140 | echo "set terminal x11" >>$PLOT | 
|---|
| 141 | echo "replot" >>$PLOT | 
|---|
| 142 | echo "# EOF" >>$PLOT | 
|---|
| 143 | let index=$index+1 | 
|---|
| 144 | fi | 
|---|
| 145 | done | 
|---|
| 146 |  | 
|---|
| 147 | # End TeX-File and call with latex | 
|---|
| 148 | echo "\end{document}" >>${DDir}/$TEX | 
|---|
| 149 | cd ${DDir} | 
|---|
| 150 | latex $TEX | 
|---|
| 151 | dvips -o $PS $DVI | 
|---|
| 152 | cd ${SDir} | 
|---|
| 153 | done | 
|---|
| 154 |  | 
|---|
| 155 | echo "all done." | 
|---|
| 156 |  | 
|---|
| 157 | exit 0 | 
|---|