/*ParseRangeOption parse the range option on the luminosity command */ #include "cddefines.h" #include "physconst.h" #include "incidspec.h" #include "bounds.h" #include "ffmtread.h" #include "lgmatch.h" #include "parse.h" void ParseRangeOption(long int nqh, char *chCard) { int lgEOL; long int i; double p1, p2; # ifdef DEBUG_FUN fputs( "<+>ParseRangeOption()\n", debug_fp ); # endif if( lgMatch("TOTA",chCard) ) { IncidSpec.range[0][nqh-1] = bounds.emm; IncidSpec.range[1][nqh-1] = bounds.egamry; } else if( lgMatch("RANG",chCard) ) { i = 1; /* first call return the luminosity on the card, ignore it */ p1 = FFmtRead(chCard,&i,76,&lgEOL); /* this should be the lower limit */ p1 = FFmtRead(chCard,&i,76,&lgEOL); if( p1 == 0. ) p1 = bounds.emm; p2 = FFmtRead(chCard,&i,76,&lgEOL); /* no third numer on card then go all the way to gamma ray */ if( p2 == 0. ) p2 = bounds.egamry; /* option to enter log if first energy is neg */ if( p1 < 0. || lgMatch(" LOG",chCard) ) { p1 = pow(10.,p1); /* second number may not have been entered */ if( !lgEOL ) p2 = pow(10.,p2); } /* make sure that energies are within array bounds */ IncidSpec.range[0][nqh-1] = (float)MAX2(p1,bounds.emm); IncidSpec.range[1][nqh-1] = (float)MIN2(p2,bounds.egamry); if( IncidSpec.range[0][nqh-1] > IncidSpec.range[1][nqh-1] ) { fprintf( ioQQQ, " Range MUST be in increasing order - sorry.\n" ); puts( "[Stop in ParseRangeOption]" ); exit(1); } } else { /* range not specified, use default - total ionizing field * >>chng 96 dec 18, from 1.001 to 1 Ryd for H mass nuc */ IncidSpec.range[0][nqh-1] = (float)HIONPOT; IncidSpec.range[1][nqh-1] = bounds.egamry; } # ifdef DEBUG_FUN fputs( " <->ParseRangeOption()\n", debug_fp ); # endif return; }