/*ParseMetal parse parameters on metal command */ #include #include "cddefines.h" #include "input.h" #include "dmetal.h" #include "varypar.h" #include "grmetl.h" #include "called.h" #include "deplon.h" #include "ffmtread.h" #include "lgmatch.h" #include "parse.h" void ParseMetal(char *chCard ) { int lgEOL, lgGrains, lgLogOn; long int i; double dmlog; # ifdef DEBUG_FUN fputs( "<+>ParseMetal()\n", debug_fp ); # endif /* parse the metals command */ /* metal depletion factor, if negative then it is the log */ i = 5; dmetal.ScaleMetals = (float)FFmtRead(chCard,&i,76,&lgEOL); if( lgEOL ) { if( lgMatch("DEPL",chCard) ) { /* this option - no numbers on line but keyword depletion is * deplete by set of scale factors */ deplon.lgDepln = TRUE; for( i=0; i < LIMELM; i++ ) { deplon.depset[i] = deplon.Depletion[i]; } dmetal.ScaleMetals = 1.; # ifdef DEBUG_FUN fputs( " <->ParseMetal()\n", debug_fp ); # endif return; } else { /* no number, so keyword, punch out */ if( !called.lgTalk ) { fprintf( ioQQQ, " %80.80s\n", chCard ); } fprintf( ioQQQ, " There must be a number on this line. Sorry.\n" ); puts( "[Stop in ParseMetal]" ); exit(1); } } /* sort out whether log */ lgLogOn = FALSE; if( lgMatch(" LOG",chCard) ) { lgLogOn = TRUE; } else if( lgMatch("LINE",chCard) ) { lgLogOn = FALSE; } if( dmetal.ScaleMetals <= 0. || lgLogOn ) { dmlog = dmetal.ScaleMetals; dmetal.ScaleMetals = (float)pow(10.,dmetal.ScaleMetals); } else { dmlog = log10(dmetal.ScaleMetals); } /* option to vary grain abundance as well */ if( lgMatch("GRAI",chCard) ) { lgGrains = TRUE; grmetl.GrainMetal = dmetal.ScaleMetals; } else { lgGrains = FALSE; grmetl.GrainMetal = 1.; } /* vary option */ if( VaryPar.lgVarOn ) { if( lgGrains ) { strcpy( chVaryPar.chVarFmt[VaryPar.nparm], "METALS LOG=%f GRAINS" ); } else { strcpy( chVaryPar.chVarFmt[VaryPar.nparm], "METALS LOG=%f" ); } /* pointer to where to write */ VaryPar.nvfpnt[VaryPar.nparm] = input.nRead; VaryPar.vparm[0][VaryPar.nparm] = (float)dmlog; VaryPar.vincr[VaryPar.nparm] = 0.5; VaryPar.nvarxt[VaryPar.nparm] = 1; ++VaryPar.nparm; } # ifdef DEBUG_FUN fputs( " <->ParseMetal()\n", debug_fp ); # endif return; }