/*ParseAgn parse parameters for the AGN continuum shape command */ #include #include "cddefines.h" #include "incidspec.h" #include "ffmtread.h" #include "sexp.h" #include "parse.h" void ParseAgn(char *chCard) { int lgEOL; long int i; double BigBump, Ratio, XRays, xnu; # ifdef DEBUG_FUN fputs( "<+>ParseAgn()\n", debug_fp ); # endif /* first parameter is temperature of big bump * second parameter is alpha ox */ /* power law with cutoff */ IncidSpec.nspec += 1; if( IncidSpec.nspec > LIMSPC ) { fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" ); puts( "[Stop in ParseAgn]" ); exit(1); } strcpy( spnorm.chSpType[IncidSpec.nspec-1], "AGN " ); i = 5; /* slope is first parameter is really temperature of bump */ IncidSpec.slope[IncidSpec.nspec-1] = (float)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { fprintf( ioQQQ, " The big bump temperature should have been on this line. Sorry.\n" ); puts( "[Stop in ParseAgn]" ); exit(1); } if( IncidSpec.slope[IncidSpec.nspec-1] <= 0. ) { fprintf( ioQQQ, " Non positive temperature not allowed. Sorry.\n" ); puts( "[Stop in ParseAgn]" ); exit(1); } /* temps are log if first le 10 */ if( IncidSpec.slope[IncidSpec.nspec-1] <= 10. ) IncidSpec.slope[IncidSpec.nspec-1] = (float)pow(10.,IncidSpec.slope[IncidSpec.nspec-1]); /* want cutoff in ryd not kelvin */ IncidSpec.slope[IncidSpec.nspec-1] /= 1.5789e5; /* cutoff is second parameter is really alpha ox */ IncidSpec.cutoff[0][IncidSpec.nspec-1] = (float)FFmtRead(chCard,&i,76, &lgEOL); if( lgEOL ) { fprintf( ioQQQ, " alpha ox should have been on this line. Sorry.\n" ); puts( "[Stop in ParseAgn]" ); exit(1); } if( IncidSpec.cutoff[0][IncidSpec.nspec-1] > 3. || IncidSpec.cutoff[0][IncidSpec.nspec-1] < -3. ) { fprintf( ioQQQ, " An alpha ox of%10.2e looks funny to me. Check Hazy to make sure its ok.\n", IncidSpec.cutoff[0][IncidSpec.nspec-1] ); } if( IncidSpec.cutoff[0][IncidSpec.nspec-1] >= 0. ) { fprintf( ioQQQ, " The sign of alpha ox is almost certainly incorrect. Check Hazy.\n" ); } /* bb slope is third parameter */ IncidSpec.cutoff[1][IncidSpec.nspec-1] = (float)FFmtRead(chCard,&i,76, &lgEOL); if( lgEOL ) IncidSpec.cutoff[1][IncidSpec.nspec-1] = -0.5f; /* slope of X-Ray component is last parameter */ IncidSpec.cutoff[2][IncidSpec.nspec-1] = (float)FFmtRead(chCard,&i,76, &lgEOL); if( lgEOL ) IncidSpec.cutoff[2][IncidSpec.nspec-1] = -1.0f; /* 403.3 is ratio of energies where alpha ox defined, * assumed to be 2500A and 2keV */ Ratio = pow(403.3,IncidSpec.cutoff[0][IncidSpec.nspec-1] - 1.); /* following code must be kept parallel with ffun1 */ xnu = 0.3645; BigBump = pow(xnu,-1. + IncidSpec.cutoff[1][IncidSpec.nspec-1])* sexp(xnu/IncidSpec.slope[IncidSpec.nspec-1]); xnu = 147.; /* XRays = xnu**(-2.) */ XRays = pow(xnu,IncidSpec.cutoff[2][IncidSpec.nspec-1] - 1.); if( BigBump <= 0. ) { fprintf( ioQQQ, " Big Bump had zero flux at .3645 Ryd.\n" ); puts( "[Stop in ParseAgn]" ); exit(1); } IncidSpec.cutoff[0][IncidSpec.nspec-1] = (float)(Ratio/(XRays/BigBump)); # ifdef DEBUG_FUN fputs( " <->ParseAgn()\n", debug_fp ); # endif return; }