70 #define MAX_HEADER_SIZE 2000
79 sprintf( chHeader,
"ArNdY38dZ9us4N4e12SEcuQ" );
85 "The limit to the number of PUNCH options is %ld. Increase "
86 "LIMPUN in punch.h if more are needed.\nSorry.\n",
93 static bool lgMustInit=
true;
139 if(
nMatch(
"LAST",chCard) )
151 if(
GetQuote( chLabel , chCard ,
true ) )
156 if( strcmp(chLabel ,
"opacity.opc") == 0 )
158 fprintf(
ioQQQ,
"ParsePunch will not allow punch file name %s, please choose another.\nSorry.\n",
162 else if( chLabel[0]==0 )
164 fprintf(
ioQQQ,
"ParsePunch found a null file name between double quotes, please check command line.\nSorry.\n");
171 strcat( chFilename , chLabel );
176 if(
GetQuote( chSecondFilename , chCard ,
false ) )
177 lgSecondFilename =
false;
179 lgSecondFilename =
true;
183 if(
nMatch(
"CLOB",chCard) )
185 if(
nMatch(
" NO ",chCard) )
213 if(
nMatch(
"O HA",chCard) )
217 if(
nMatch(
"OPAC",chCard) )
227 if(
nMatch(
"TOTA",chCard) )
233 "#nu\tTot opac\tAbs opac\tScat opac\tAlbedo\telem\n" );
236 else if(
nMatch(
"FIGU",chCard) )
241 "#nu, H, He, tot opac\n" );
244 else if(
nMatch(
"FINE",chCard) )
258 if(
nMatch(
"RANGE",chCard) )
265 fprintf(
ioQQQ,
"There must be two numbers, the lower and upper energy range in Ryd.\nSorry.\n");
270 fprintf(
ioQQQ,
"The two energies for the range must be in increasing order.\nSorry.\n");
290 fprintf(
ioQQQ,
"The number of fine opacities to skip must be > 0 \nSorry.\n");
295 else if(
nMatch(
"GRAI",chCard) )
301 "#grain\tnu\tabs+scat*(1-g)\tabs\tscat*(1-g)\tscat\tscat*(1-g)/[abs+scat*(1-g)]\n" );
304 else if(
nMatch(
"BREM",chCard) )
309 "#nu\tbrem opac\n" );
312 else if(
nMatch(
"SHEL",chCard) )
335 fprintf(
ioQQQ,
"There must be IO unit, atom weight, ion, shell\nSorry.\n" );
339 "#sub shell cross section\n" );
342 else if(
nMatch(
"ELEM",chCard) )
351 if( (nelem =
GetElem( chCard ) ) < 0 )
353 fprintf(
ioQQQ,
"There must be a second keyword on the opacity command. Sorry.\n" );
354 fprintf(
ioQQQ,
"Options are total, figure, grain, or element name.\n" );
363 fprintf(
ioQQQ,
" I did not recognize a keyword on this punch opacity command.\n" );
364 fprintf(
ioQQQ,
" Sorry.\n" );
370 else if(
nMatch(
" H2 ",chCard) )
377 else if(
nMatch(
"ABUN",chCard) && !
nMatch(
"GRAI",chCard) )
385 sprintf( chTemp,
"\t%s",
387 strcat( chHeader, chTemp );
389 strcat( chHeader,
"\n");
392 else if(
nMatch(
" AGE",chCard) )
397 "#ages depth\tt(cool)\tt(H2 dest)\tt(CO dest)\tt(OH dest)\tt(H rec)\n" );
400 else if(
nMatch(
" AGN",chCard) )
407 if(
nMatch(
"CHAR",chCard) )
411 "#charge exchange rate coefficnt\n" );
414 else if(
nMatch(
"RECO",chCard) )
419 "#Recom rates for AGN3 table\n" );
422 else if(
nMatch(
"OPAC",chCard) )
429 else if(
nMatch(
"HECS",chCard) )
437 else if(
nMatch(
"HEMI",chCard) )
446 else if(
nMatch(
"RECC",chCard) )
451 "#T\tbAS\tb1\tbB\n" );
455 fprintf(
ioQQQ,
" I did not recognize this option on the PUNCH HYDROGEN command.\n" );
456 fprintf(
ioQQQ,
" Sorry.\n" );
461 else if(
nMatch(
"ASSE",chCard) )
469 else if(
nMatch(
"AVER",chCard) )
483 else if(
nMatch(
"CHAR",chCard) &&
nMatch(
"TRAN",chCard) )
490 "#charge exchange rate coefficient\n" );
493 else if(
nMatch(
"CHEM",chCard) )
496 if(
nMatch(
"RATE" , chCard ) )
500 if(
nMatch(
" CO " , chCard ) )
505 "#Depth\tH2O_C3HP_CO_C2H3P\tC2H2_HCOP_CO_C2H3P\tC2H_HCOP_CO_C2H2P\tO_C3H_CO_C2H\t"
506 "O_C2H2_CO_CH2\tOH_C2H2_CO_CH3\tHCOP_C3_C3HP_CO\tO2_C3_CO_C2_O\tO_C3_CO_C2\t"
507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H_CH3\tOH_CH2_O_CH3\tOH_CH3_CH4_O\t"
541 "OH_CH3_H2O_CH2\tH2O_CH3_OH_CH4\tOH_CH4_H2O_CH3\tN_OH_O_NH\tN_OH_NO_H\tCH2_NO_HCN_OH\tNH_OH_NH2_O\tNH_OH_H2O_N\tNH_H2O_OH_NH2\tNH_NO_N2_OH\t"
542 "NH_NO2_N2O_OH\tO_NH2_OH_NH\tO_NH3_OH_NH2\tO_HCN_CN_OH\tO_HS_S_OH\tNH2_OH_NH3_O\tOH_NH3_H2O_NH2\tOH_CN_HCN_O\tOH_HCN_CN_H2O\tOH_NO_NO2_H\t"
543 "OH_N2O_HNO_NO\tOH_CS_OCS_H\tNO_HNO_N2O_OH\tO_C2H2_C2H_OH\tOH_C2H2_C2H_H2O\te_H2OP_OH_H\te_H3OP_OH_H_H\te_H3OP_OH_H2\te_SiOHP_Si_OH\tH_OH_O_H_H\t"
544 "H_H2O_OH_H_H\tH_OH_O_H2\tH_H2O_OH_H2\tH_OH_H2O_nu\tHminus_H3OP_OH_H2_H\tH_O_OH_nu\tH2_OH_H2O_H\tH2_O_OH_H\tH2_OH_O_H2_H\tH2_H2O_OH_H2_H\t"
545 "H2_O2_OH_OH\tH_O2_OH_O\tC_OH_CO_H\tOH_HCN_CO_NH2\tOH_C2H2_CO_CH3\tOH_C2H2_CO_CH3\n");
550 fprintf(
ioQQQ,
" The keyword CO or OH must appear on the PUNCH CHEMISTRY RATES command.\n");
551 fprintf(
ioQQQ,
" Sorry.\n" );
558 else if(
nMatch(
"COMP",chCard) )
563 "#nu, comup, comdn\n" );
566 else if(
nMatch(
"COOL",chCard) )
572 "#depth cm\tTemp K\tHtot erg/cm3/s\tCtot erg/cm3/s\tcool fracs\n" );
575 else if(
nMatch(
"DYNA",chCard) )
581 if(
nMatch(
"ADVE" , chCard ) )
586 "#advection depth\tHtot\tadCool\tadHeat\tdCoolHeatdT\t"
587 "Source[hyd][hyd]\tRate\tEnthalph\tadSpecEnthal\n" );
591 fprintf(
ioQQQ,
" I did not recognize a sub keyword on this PUNCH DYNAMICS command.\n" );
592 fprintf(
ioQQQ,
" Sorry.\n" );
597 else if(
nMatch(
"ENTH",chCard) )
602 "#depth\tTotal\tExcit\tIoniz\tBind\tKE\tther+PdV\tmag \n" );
605 else if(
nMatch(
"EXEC",chCard) &&
nMatch(
"TIME",chCard) )
610 "#zone\tdTime\tElapsed t\n" );
613 else if(
nMatch(
"FEII",chCard) ||
nMatch(
"FE II",chCard) )
624 "#FeII: energy\tstat wght\tcol den\n" );
628 else if(
nMatch(
"CONT",chCard) )
634 "#FeII: Wl(A)\tInt[erg cm-2 s-1]\n" );
637 else if(
nMatch(
"DEPA",chCard) )
641 "#FeII departure coefficient \n" );
643 if(
nMatch(
" ALL",chCard) )
655 else if(
nMatch(
"LEVE",chCard) )
659 "#FeII energy(wn)\tstat weight\n" );
663 else if(
nMatch(
"LINE",chCard) )
673 if(
nMatch(
"SHOR",chCard) )
725 "#FeII ipHi\tipLo\tWL(A)\tlog I\tI/Inorm\t\tTau\n" );
728 else if(
nMatch(
"OPTI",chCard) &&
nMatch(
"DEPT",chCard) )
732 "#FeII hi\tlow\twl(A)\ttau\n" );
736 else if(
nMatch(
"POPU",chCard) )
740 "#FeII level populations [cm^-3]\n" );
744 if(
nMatch(
"RELA",chCard) )
755 if(
nMatch(
" ALL",chCard) )
764 else if(
nMatch(
"RANG",chCard) )
777 fprintf(
ioQQQ,
"There must be two numbers on this punch FeII populations range command.\n" );
778 fprintf(
ioQQQ,
"These give the lower and upper levels for the range of FeII levels.\n" );
779 fprintf(
ioQQQ,
"The first must be less than the second and the second must be <= the number of FeII levels.\n" );
780 fprintf(
ioQQQ,
"Sorry.\n" );
793 fprintf(
ioQQQ,
"There must be a second keyword on this PUNCH FEII command.\n" );
794 fprintf(
ioQQQ,
"The ones I know about are COLUmn, CONTinuum, "
795 "DEPArture, LEVEls, LINE, OPTIcal DEPTh, and POPUlations.\n" );
796 fprintf(
ioQQQ,
"Sorry.\n" );
804 else if(
nMatch(
"CONT",chCard) && !
nMatch(
"XSPE",chCard) )
814 if(
nMatch(
"BINS",chCard) )
820 "#Continuum binning, enrOrg, Energy, width of cells\n" );
823 else if(
nMatch(
"DIFF",chCard) )
829 "#energy\t ConEmitLocal \n" );
832 else if(
nMatch(
"EMIT",chCard) )
838 "#Energy\treflec\toutward\ttotal\tline\tcont\n" );
841 else if(
nMatch(
"FINE" , chCard ) )
848 "#Energy\tTransmitted\n" );
852 if(
nMatch(
"RANGE",chCard) )
859 fprintf(
ioQQQ,
"There must be two numbers, the lower and upper energies in Ryd.\nSorry.\n");
864 fprintf(
ioQQQ,
"The two energies for the range must be in increasing order.\nSorry.\n");
884 fprintf(
ioQQQ,
"The number of fine opacities to skip must be > 0 \nSorry.\n");
889 else if(
nMatch(
"GRAI",chCard) )
895 "#energy\tgraphite\trest\ttotal\n" );
898 else if(
nMatch(
"INCI",chCard) )
904 "#Incident Continuum, Enr\tnFn \n" );
907 else if(
nMatch(
"INTE",chCard) )
913 "#Continuum interactions, inc, otslin. otscon, ConInterOut, outlin \n" );
920 else if(
nMatch(
"IONI",chCard) )
939 if(
nMatch(
"EVER", chCard ) )
954 "#cell(on C scale)\tnu\tflux\tflx*cs\tFinc\totsl\totsc\toutlin\toutcon\trate/tot\tintegral\tline\tcont\n" );
957 else if(
nMatch(
"OUTW",chCard) )
960 if(
nMatch(
"LOCA",chCard) )
964 "#Local Out ConInterOut+line SvOt*opc pass*opc\n" );
970 "#Out Con OutIncid OutConD OutLinD OutConS\n" );
974 else if(
nMatch(
"TRAN",chCard) )
980 "#ener\tTran Contin\ttrn coef\n" );
983 else if(
nMatch(
" TWO",chCard) )
989 "#energy\t n_nu\tnuF_nu \n" );
992 else if(
nMatch(
" RAW",chCard) )
998 "#Raw Con anu\tflux\totslin\totscon\tConRefIncid\tConEmitReflec\tConInterOut\toutlin\tConEmitOut\tline\tcont\tnLines\n" );
1001 else if(
nMatch(
"REFL",chCard) )
1007 "#Reflected\tcont\tline\ttotal\talbedo\tConID\n" );
1015 "#Cont nu\tincident\ttrans\tDiffOut\tnet trans\treflc\ttotal\tline\tcont\tnLine\n" );
1019 if(
nMatch(
"EVER", chCard ) )
1042 else if(
nMatch(
"CONV",chCard) )
1044 if(
nMatch(
"REAS",chCard) )
1052 else if(
nMatch(
"ERRO",chCard) )
1058 "#depth\tnPres2Ioniz\tP(cor)\tP(cur)\tP%%error\tNE(cor)\tNE(cur)\tNE%%error\tHeat\tCool\tHC%%error\n" );
1060 else if(
nMatch(
"BASE",chCard) )
1070 fprintf(
ioQQQ,
"There must be a second keyword on this command.\n" );
1071 fprintf(
ioQQQ,
"The ones I know about are REASON and ERROR.\n" );
1072 fprintf(
ioQQQ,
"Sorry.\n" );
1077 else if(
nMatch(
" DR ",chCard) )
1085 else if(
nMatch(
"ELEM",chCard) && !
nMatch(
"GAMMA" , chCard) )
1101 if(
nMatch(
"DENS",chCard) )
1105 sprintf( chHeader,
"#depth");
1108 for(i=0; i<=nelem+1;++i )
1112 strcat( chHeader, chTemp );
1120 sprintf( chTemp,
"\tH2");
1121 strcat( chHeader, chTemp );
1125 sprintf( chTemp,
"\tC1\tC1*\tC1**\tC2\tC2*\tCO");
1126 strcat( chHeader, chTemp );
1130 sprintf( chTemp,
"\tO1\tO1*\tO1**");
1131 strcat( chHeader, chTemp );
1135 strcat( chHeader,
"\n");
1138 else if(
nMatch(
"FITS",chCard) )
1142 fprintf(
ioQQQ,
"Punching FITS files is not currently supported in double precision.\n" );
1143 fprintf(
ioQQQ,
"Please recompile without the FLT_IS_DBL option.\n" );
1144 fprintf(
ioQQQ,
"Sorry.\n" );
1155 else if(
nMatch(
"FRED",chCard) )
1159 "#Radius\tDepth\tVelocity\thden\teden\tTemperature\tRadAccel line\tRadAccel con\t"
1160 "Force multiplier\t"
1161 "HI\tHII\tHeI\tHeII\tHeIII\tC2\tC3\tC4\tO1\t"
1162 "O2\tO3\tO4\tO5\tO6\tO7\tO8\t"
1163 "HI\tHII\tHeI\tHeII\tHeIII\tC2\tC3\tC4\tO1\t"
1164 "O2\tO3\tO4\tO5\tO6\tO7\tO8\tMg2\tMg2\n");
1168 else if(
nMatch(
"GAMM",chCard) )
1172 "#Photoionization rates \n" );
1173 if(
nMatch(
"ELEMENT" , chCard ) )
1192 fprintf(
ioQQQ,
"Bad ionization stage - please check Hazy.\nSorry.\n");
1203 else if(
nMatch(
"GRAI",chCard) )
1206 if(
nMatch(
"OPAC",chCard) )
1215 "#grain\tnu\tabs+scat*(1-g)\tabs\tscat*(1-g)\tscat\tscat*(1-g)/[abs+scat*(1-g)]\n" );
1217 else if(
nMatch(
"ABUN",chCard) )
1222 "#grain\tdepth\tabundance (g/cm^3)\n" );
1224 else if(
nMatch(
"D/G ",chCard) )
1229 "#grain\tdepth\tdust/gas mass ratio\n" );
1231 else if(
nMatch(
"PHYS",chCard) )
1236 "#grain\tdepth\tpotential\n" );
1238 else if(
nMatch(
" QS ",chCard) )
1242 "#grain\tnu\tQ_abs\tQ_scat\n" );
1244 else if(
nMatch(
"TEMP",chCard) )
1250 "#grain temperature\n" );
1252 else if(
nMatch(
"DRIF",chCard) )
1258 "#grain drift velocity\n" );
1260 else if(
nMatch(
"EXTI",chCard) )
1266 "#depth\tA_V(extended)\tA_V(point)\n" );
1268 else if(
nMatch(
"CHAR",chCard) )
1274 "#grain charge\n" );
1276 else if(
nMatch(
"HEAT",chCard) )
1282 "#grain heating\n" );
1284 else if(
nMatch(
"POTE",chCard) )
1290 "#grain\tdepth\tpotential\n" );
1292 else if(
nMatch(
"H2RA",chCard) )
1298 "#grain H2 formation rates\n" );
1302 fprintf(
ioQQQ,
"There must be a second key on this GRAIN command; The options I know about follow (required key in CAPS):\n");
1303 fprintf(
ioQQQ,
"OPACity, ABUNdance, D/G mass ratio, PHYSical conditions, QS , TEMPerature, DRIFt velocity, EXTInction, CHARge, HEATing, POTEntial, H2RAtes\nSorry.\n" );
1308 else if(
nMatch(
"GAUN",chCard) )
1312 "#Gaunt factors.\n" );
1314 else if(
nMatch(
"GRID",chCard) )
1320 else if(
nMatch(
"HIST" , chCard ) )
1323 if(
nMatch(
"PRES" , chCard ) )
1328 "#iter zon\tdensity\tpres cur\tpres corr\n" );
1331 else if(
nMatch(
"TEMP" , chCard ) )
1336 "#iter zon\ttemperature\theating\tcooling\n" );
1340 else if(
nMatch(
"HTWO",chCard) )
1342 fprintf(
ioQQQ,
" Sorry, this command has been replaced with the "
1343 "PUNCH H2 CREATION and PUNCH H2 DESTRUCTION commands.\n");
1348 else if(
nMatch(
"QHEA",chCard) )
1355 else if(
nMatch(
"HEAT",chCard) )
1361 "#depth cm\tTemp K\tHtot erg/cm3/s\tCtot erg/cm3/s\theat fracs\n" );
1364 else if(
nMatch(
"HELI",chCard) &&!(
nMatch(
"IONI",chCard)))
1372 "#wavelengths of lines from He-like ions\n" );
1376 fprintf(
ioQQQ,
"punch helium has options: LINE WAVElength.\nSorry.\n" );
1382 else if(
nMatch(
"HUMM",chCard) )
1386 "#input to DHs routine.\n" );
1389 else if(
nMatch(
"HYDR",chCard) )
1392 if(
nMatch(
"COND",chCard) )
1396 "#depth\tTe\tHDEN\tEDEN\tHI/H\tHII/H\tH2/H\tH2+/H\tH3+/H\tH-/H\n" );
1401 else if(
nMatch(
"21 CM",chCard) ||
nMatch(
"21CM",chCard))
1406 "#depth\tT(spin)\tT(kin)\tT(Lya/21cm)\tnLo\tnHi\tOccLya\ttau(21cm)"
1407 "\ttau(Lya)\topac(21 cm)\tn/Ts\ttau(21)\tTex(Lya)\tN(H0)/Tspin"
1408 "\tSum_F0\tSum_F1\tSum_T21\n" );
1411 else if(
nMatch(
"IONI",chCard) )
1416 "#hion\tzn\tgam1\tcoll ion1\tRecTot\tHRecCaB\thii/hi\tSim hii/hi"
1417 "\time_Hrecom_long(esc)\tdec2grd\texc pht\texc col\trec eff\tsec ion\n" );
1419 else if(
nMatch(
"POPU",chCard) )
1424 "#depth\tn(H0)\tn(H+)\tn(1s)\tn(2s)\tn(2p)\tetc\n" );
1426 else if(
nMatch(
"LINE",chCard) )
1432 "#nup\tnlo\tE(ryd)\ttau\n" );
1434 else if(
nMatch(
" LYA",chCard) )
1439 "#depth\tTauIn\tTauTot\tn(2p)/n(1s)\tTexc\tTe\tTex/T\tPesc\tPdes\tpump\topacity\talbedo\n" );
1443 fprintf(
ioQQQ,
"Punch hydrogen has options: CONDitions, 21 CM, LINE, POPUlations, and IONIzation.\nSorry.\n" );
1448 else if(
nMatch(
"IONI",chCard) )
1450 if(
nMatch(
"RATE",chCard) )
1453 if( (nelem =
GetElem( chCard ) ) < 0 )
1455 fprintf(
ioQQQ,
"There must be an element name on the ionization rates command. Sorry.\n" );
1461 "#%s depth\teden\tdynamics.Rate\tabund\tTotIonize\tTotRecom\tSource\t ... \n",
1469 "#Mean ionization distribution\n" );
1473 else if(
nMatch(
" IP ",chCard) )
1477 "#ionization potentials, valence shell\n" );
1480 else if(
nMatch(
"LEID",chCard) )
1482 if(
nMatch(
"LINE" , chCard ) )
1487 sprintf( chHeader,
"#ion\twl\tInt\trel int\n");
1496 "#Leid depth\tA_V(extentd)\tA_V(point)\tTe\tH0\tH2\tCo\tC+\tOo\tCO\tO2\tCH\tOH\te\tHe+\tH+\tH3+\t"
1498 "N(H0)\tN(H2)\tN(Co)\tN(C+)\tN(Oo)\tN(CO)\tN(O2)\tN(CH)\t(OH)\tN(e)\tN(He+)\tN(H+)\tN(H3+)\t"
1500 "H2(Sol)\tH2(FrmGrn)\t"
1502 "G0(DB96)\trate(CO)\trate(C)\theat\tcool\tGrnP\tGr-Gas-Cool\tGr-Gas-Heat\tCOds\tH2dH\tH2vH\tChaT\tCR H\tMgI\tSI\t"
1503 "Si\tFe\tNa\tAl\tC\tC610\tC370\tC157\tC63\tC146\n" );
1507 else if(
nMatch(
"LINE",chCard) &&
nMatch(
"LIST",chCard) )
1515 if( !lgSecondFilename )
1517 fprintf(
ioQQQ ,
"There must be a second file name between "
1518 "double quotes on the PUNCH LINE LIST command. This second"
1519 " file contains the input line list. I did not find it.\nSorry.\n");
1530 fprintf(
ioQQQ,
"DISASTER could not open PUNCH LINE LIST file %s \n",
1537 if(
nMatch(
"RATI",chCard) )
1543 fprintf(
ioQQQ ,
"There must be an even number of lines to"
1544 " take ratios of lines. There were %li, an odd number."
1560 if(
nMatch(
"ABSO",chCard) )
1570 sprintf( chHeader,
"#lineslist" );
1575 strcat( chHeader ,
"/" );
1577 strcat( chHeader ,
"\t" );
1579 strcat( chHeader, chTemp );
1581 strcat( chHeader, chTemp );
1583 strcat( chHeader,
"\n" );
1596 if(
nMatch(
"STRU",chCard) )
1598 fprintf(
ioQQQ,
" The PUNCH LINES STRUCTURE command is now PUNCH LINES "
1599 "EMISSIVITY.\n Sorry.\n\n");
1603 else if(
nMatch(
"EMIS",chCard) )
1610 "#Emission line structure:");
1613 strcat( chHeader, chTemp );
1616 else if(
nMatch(
" RT ", chCard ) )
1625 else if(
nMatch(
"CUMU",chCard) )
1631 if(
nMatch(
"RELA",chCard) )
1635 "#Cumulative emission line relative intensity.\n" );
1640 "#Cumulative emission line absolute intensity.\n" );
1645 strcat( chHeader, chTemp );
1648 else if(
nMatch(
"DATA",chCard) )
1653 "#Emission line data.\n" );
1656 else if(
nMatch(
"ARRA",chCard) )
1662 "#enr\tID\tI(intrinsic)\tI(emergent)\ttype\n" );
1665 else if(
nMatch(
"LABE",chCard) )
1670 "#index\tlabel\twavelength\tcomment\n" );
1674 if(
nMatch(
"LONG",chCard) )
1680 else if(
nMatch(
"OPTI",chCard) )
1685 "#species\tenergy\topt depth\tdamp\n" );
1694 if(
nMatch(
"UNIT",chCard) )
1707 else if(
nMatch(
"POPU",chCard) )
1714 "#population information\n" );
1724 if(
nMatch(
" OFF",chCard) )
1731 else if(
nMatch(
"INTE",chCard) )
1736 "#Emission line intensities per unit inner area\n" );
1737 if(
nMatch(
"COLU",chCard) )
1747 if(
nMatch(
"EVER",chCard) )
1755 "There must be a second number, the number of zones to print.\nSorry.\n" );
1768 "This option for PUNCH LINE is something that I do not understand. Sorry.\n" );
1773 else if(
nMatch(
" MAP",chCard) )
1777 "#te, heating, cooling.\n" );
1789 if(
nMatch(
"RANG",chCard) )
1809 fprintf(
ioQQQ,
"There must be a zone number, followed by two temperatures, on this line. Sorry.\n" );
1815 else if(
nMatch(
"MOLE",chCard) )
1820 "#molecular species will follow:\n");
1823 else if(
nMatch(
"OPTICAL",chCard) &&
nMatch(
"DEPTH",chCard) )
1828 if(
nMatch(
"FINE",chCard) )
1833 sprintf( chHeader,
"#energy\tTau tot\topacity\n" );
1836 if(
nMatch(
"RANGE",chCard) )
1843 fprintf(
ioQQQ,
"There must be two numbers, the lower and upper energy range in Ryd.\nSorry.\n");
1848 fprintf(
ioQQQ,
"The two energies for the range must be in increasing order.\nSorry.\n");
1866 fprintf(
ioQQQ,
"The number of fine opacities to skip must be > 0 \nSorry.\n");
1875 "#energy\ttotal\tabsorp\tscat\n" );
1879 else if(
nMatch(
" OTS",chCard) )
1883 "#otscon, lin, conOpac LinOpc\n" );
1886 else if(
nMatch(
"OVER",chCard) &&
nMatch(
" OVE",chCard) )
1891 "#depth\tTe\tHtot\thden\teden\t2H_2/H\tHI\tHII\tHeI\tHeII\tHeIII\tCO/C\tC1\tC2\tC3\tC4\tO1\tO2\tO3\tO4\tO5\tO6\tAV(point)\tAV(extend)\n" );
1894 else if(
nMatch(
" PDR",chCard) )
1898 "#depth\tH colden\tTe\tHI/HDEN\tH2/HDEN\tH2*/HDEN\tCI/C\tCO/C\tH2O/O\tG0\tAV(point)\tAV(extend)\tTauV(point)\n" );
1901 else if(
nMatch(
"PHYS",chCard) )
1906 "#PhyC depth\tTe\tn(H)\tn(e)\tHtot\taccel\tfillfac\n" );
1909 else if(
nMatch(
"POIN",chCard) )
1918 else if(
nMatch(
"PRES",chCard) )
1923 "#P depth\tPcorrect\tPcurrent\tPIn+Pinteg\tPgas(r0)\tPgas\tPram\tPrad(line)\tPinteg\tV(wind km/s)\tcad(wind km/s)\tP(mag)\tV(turb km/s)\tP(turb)\tconv?\n" );
1926 else if(
nMatch(
"RADI",chCard) )
1929 sprintf( chHeader,
"#NZONE\tradius\tdepth\tdr\n" );
1931 if(
nMatch(
"OUTE" , chCard ) )
1943 else if(
nMatch(
"RECO",chCard) )
1945 if(
nMatch(
"COEF",chCard) )
1956 else if(
nMatch(
"EFFI",chCard) )
1961 "#Recom effic H, Heo, He+\n" );
1966 fprintf(
ioQQQ,
"No option recognized on this punch recombination command\n" );
1967 fprintf(
ioQQQ,
"Valid options are COEFFICIENTS, AGN, and EFFICIENCY\nSorry.\n" );
1973 else if(
nMatch(
"RESU",chCard) )
1976 if(
nMatch(
"COLU",chCard) )
1989 "#results of calculation\n" );
1992 else if(
nMatch(
"SECO",chCard) )
1997 "#depth\tIon(H^0)\tDiss(H_2)\tExcit(Lya)\n" );
2000 else if(
nMatch(
"SOUR",chCard) )
2002 if(
nMatch(
"DEPT",chCard) )
2007 "#continuum source function vs depth\n" );
2009 else if(
nMatch(
"SPEC",chCard) )
2014 "#continuum source function\n" );
2018 fprintf(
ioQQQ,
"A second keyword must appear on this line.\n" );
2019 fprintf(
ioQQQ,
"They are DEPTH and SPECTRUM.\n" );
2020 fprintf(
ioQQQ,
"Sorry.\n" );
2038 "#Cont Enr\tincid nFn\ttrans\tdiff\tlines \n" );
2053 "The limit to the number of PUNCH options is %ld. Increase LIMPUN in punch.h if more are needed.\nSorry.\n",
2060 else if(
nMatch(
"SPEC",chCard) &&
nMatch(
"CIAL",chCard) )
2064 sprintf( chHeader,
"#Special.\n" );
2067 else if(
nMatch(
"TEGR",chCard) )
2072 "#zone, te, heat, cool.\n" );
2075 else if(
nMatch(
"TEMP",chCard) )
2080 "#depth\tTe\tcC/dT\tdt/dr\td^2T/dr^2\n" );
2083 else if(
nMatch(
"TIME",chCard) &&
nMatch(
"DEPE",chCard) )
2091 "#elapsed time\ttime step \tscale cont\tn(H)\t<T>\t<H+/H rad>\t<H0/H rad>\t<H2/H rad>\t<He+/H rad>\t<CO/H>\n" );
2094 else if(
nMatch(
"TPRE",chCard) )
2100 "#zone old temp, guess Tnew, new temp delta \n" );
2103 else if(
nMatch(
"WIND",chCard) )
2107 "#radius\tdepth\tvel [cm/s]\tTot accel [cm s-2]\tLin accel [cm s-2]"
2108 "\tCon accel [cm s-2]\tforce multiplier\ta_gravity\n" );
2109 if(
nMatch(
"TERM" , chCard ) )
2121 else if(
nMatch(
"XSPE",chCard) )
2132 if(
nMatch(
"ATAB",chCard) )
2135 if(
nMatch(
"INCI",chCard) )
2137 if(
nMatch(
"ATTE",chCard) )
2143 else if(
nMatch(
"REFL",chCard) )
2156 else if(
nMatch(
"DIFF",chCard) )
2158 if(
nMatch(
"REFL",chCard) )
2171 else if(
nMatch(
"LINE",chCard) )
2173 if(
nMatch(
"REFL",chCard) )
2186 else if(
nMatch(
"SPEC",chCard) )
2188 if(
nMatch(
"REFL",chCard) )
2208 else if(
nMatch(
"MTAB",chCard) )
2216 fprintf(
ioQQQ,
"Support only for xspec atable and xspec mtable.\n" );
2224 else if(
nMatch(
"COLU",chCard) &&
nMatch(
"DENS",chCard) )
2226 if(
nMatch(
"SOME" , chCard ))
2238 "#column densities\n" );
2244 "ParsePunch cannot find a recognized keyword on this PUNCH command line.\nSorry.\n" );
2263 strcat( chFilename, chIndex );
2284 if(
nMatch(
"NO BUFFER",chCard) )
2305 "# reason for continued iterations\n" );
2310 else if(
nMatch(
"CONV",chCard) &&
nMatch(
"BASE",chCard) )
2316 if(
nMatch(
"O HA",chCard) )
2321 static bool lgPrtHeader =
true;
2324 "#zone\theat\tcool\teden\n" );
2325 lgPrtHeader =
false;
2328 else if(
nMatch(
" DR ",chCard) )
2330 static bool lgPrtHeader =
true;
2333 if(
nMatch(
"O HA",chCard) )
2341 "#zone\tdepth\tdr\tdr 2 go\treason \n" );
2342 lgPrtHeader =
false;
2347 else if(
nMatch(
"QHEA",chCard) )
2353 "#Probability distributions from quantum heating routine.\n" );
2356 else if(
nMatch(
"POIN",chCard) )
2368 else if(
nMatch(
"RECO",chCard) &&
nMatch(
"COEF",chCard) )
2381 "#recombination coefficients cm3 s-1 for current density and temperature\n" );
2386 else if(
nMatch(
" MAP",chCard) )
2395 char *chEOL = strchr(chHeader ,
'\0' );
2402 fprintf(
ioQQQ,
"DISASTER chHeader has been overwritten "
2403 "with a line too long to be read.\n" );
2427 static bool lgFIRST =
true;
2438 bool lgNoClobberDefault =
false;
2442 lgNoClobberDefault =
true;
2445 for( i=0; i <
LIMPUN; i++ )
2460 for( i=0; i <
LIMPUN; i++ )
2540 if( file_size%2880 )
2542 fprintf(
ioQQQ,
" PROBLEM FITS file is wrong size!\n" );
2605 if(
nMatch(
"NITS",chCard) )
2607 if(
nMatch(
"MICR",chCard) )
2612 else if(
nMatch(
" KEV",chCard) )
2617 else if(
nMatch(
"CENT",chCard) ||
nMatch(
" CM ",chCard) )
2622 else if(
nMatch(
" EV ",chCard) )
2627 else if(
nMatch(
"ANGS",chCard) )
2632 else if(
nMatch(
"WAVE",chCard) )
2637 else if(
nMatch(
" MHZ",chCard) )
2642 else if(
nMatch(
" RYD",chCard) )
2650 fprintf(
ioQQQ,
"I did not recognize units on this line.\n" );
2651 fprintf(
ioQQQ,
"Units are keV, eV, Angstroms, Rydbergs, centimeters, and microns.\nSorry.\n" );