#############################################################
# SPECT_GEN2.TCL: generate an x-ray spectrum
#############################################################
# Variable definition for spect_gen2.tcl
#
set target     74       ;#    Z: target atomic number
set angle      12       ;#angle: angle from surface,degrees
set waveform   2        ;# wave: applied waveform               \
                                   wave=1=constant potential    \
                                   wave=2=single phase          \
                                   wave=3=mono
set energy     120       ;#    E: kVp, peak kilovolts, or energy
set incr       1        ;# dkeV: energy increment for spectrum
#
set flags     "0 1 2 \n";# diag: 1=print diagnostics            \
                           char: 1= k en.,fract., wts from table\
                                 2= analytic k energy and fract.\
                                 3= 2 plus analytic atomic wts  \
                         output:  1=brems,2=both,3=char
set corr     "2.0 1.0\n";#brems: multiplicative brems correction\
                           char: mult. char. x-ray correction
set rough     "2
             .5 .0010
             .5 .0020\n" ;#nruf: No. of roughness regions       \
                           rufT: roughness thickness, gms/cm2   \
                         rufrac: fraction for each region
set mono    "50 1E+12 \n";# kev: energy if wave=3=mono          \
                                (must be aligned with spectra)  \
                            int: intensity if wave=3=mono       \
#
#	... execute spect_gen2
set in1 "$target $angle $waveform $energy $incr \n"
if {$waveform == "3       "} {
     set in "$in1 $mono"
} else {
     set in "$in1 $flags $corr $rough"
}
if [catch {exec $BIN/spect_gen2 << $in} result] {
        puts stderr "ERROR in SPECT_GEN2:\n $result"}
# 
