/*ParseHydrogen parse information from the hydrogen command line */ #include #include "cddefines.h" #include "taulines.h" #include "hydrogenic.h" #include "dampon.h" #include "physok.h" #include "redis.h" #include "bounds.h" #include "htopoff.h" #include "thlo.h" #include "ffmtread.h" #include "lgmatch.h" #include "nonumb.h" #include "parse.h" void ParseHydrogen(char *chCard ) { int lgEOL; long int i; # ifdef DEBUG_FUN fputs( "<+>ParseHydrogen()\n", debug_fp ); # endif if( lgMatch("COLL",chCard) ) { /* option to turn hydrogen collisions off, all are * set to 1 in zero. command can accept only one option at a time */ if( lgMatch("EXCI",chCard) ) { /* turn off collisional excitation */ hydro.HColExcOn = 0.; physok.lgPhysOK = FALSE; } else if( lgMatch("IONI",chCard) ) { /* turn off collisional ionization */ hydro.HColIonOn = 0.; physok.lgPhysOK = FALSE; } else if( lgMatch("2S2P",chCard) || lgMatch("2P2S",chCard) ) { /* turn off 2s - 2p collisions */ hydro.lgC2psOn = FALSE; physok.lgPhysOK = FALSE; } else { /* turn everything off, since no keyword given */ hydro.HColExcOn = 0.; hydro.HColIonOn = 0.; hydro.lgC2psOn = FALSE; physok.lgPhysOK = FALSE; } } else if( lgMatch("DAMP",chCard) ) { /* turn off absorption due to lyalpha damping wings */ dampon.DampOnFac = 0.; } else if( lgMatch("EMIS",chCard) ) { /* hydrogenic emission lines will be emissivity not intensity or luminosity */ hydro.lgHydEmiss = TRUE; } else if( lgMatch("LEVE",chCard) ) { /* this is FALSE at start of calculation, set true when space * allocated for the hydrogen lines. Once done ignore all * future changes in number of levels */ if( lgHydroMalloc ) { /* effect of this is to trick code into thinking that we * scanned off the original number. all following tests will * be passed since there were passed the first time */ lgEOL = FALSE; } else { i = 5; /* number of levels for hydrogen at, 2s is this plus one */ nhlevel = (long int)FFmtRead(chCard,&i,76,&lgEOL); } if( lgEOL ) { /* must be a number, or a key, either large (or limit) or small * if no number but LARGER or SMALL then set to preset number */ if( lgMatch("LARG",chCard) ) { /* there is no real limit, but this seems pretty big */ nhlevel = 50; } /* this is small or compact keyword */ else if( lgMatch("SMAL",chCard) || lgMatch("COMP",chCard) ) /* a small atom is the same as c84 */ nhlevel = 10; /* this is limit keyword, sets to largest possible value */ else if( lgMatch("LIMI",chCard) ) nhlevel = NHYDRO_MAX_LEVEL-1; else { /* punch out if no number */ NoNumb(chCard); } } if( nhlevel < 4 ) { fprintf( ioQQQ, " This would be too few levels.\n" ); puts( "[Stop in ParseHydrogen]" ); exit(1); } if( nhlevel < HTopOff.nHTopOff ) { fprintf( ioQQQ, " Not possible to set nhlvl to less than top off=%4li\n", HTopOff.nHTopOff ); fprintf( ioQQQ, " change nHTopOff first with HYDROGEN TOPOFF command\n"); puts( "[Stop in ParseHydrogen]" ); exit(1); } if( nhlevel > NHYDRO_MAX_LEVEL-1 ) { fprintf( ioQQQ, " Not possible to set nhlvl to >NHYDRO_MAX_LEVEL %li\n", NHYDRO_MAX_LEVEL ); fprintf( ioQQQ, " change NHYDRO_MAX_LEVEL\n"); puts( "[Stop in ParseHydrogen]" ); exit(1); } /* this is check that alpha transition of highest level is within energy * bounds of continuum */ if( 2. / POW3((double)nhlevel) < bounds.emm ) { fprintf( ioQQQ, " Not possible to set nhlevel to such a high value, since " "alpha transition not within energy bounds of code\n"); fprintf( ioQQQ, " lowest energy is %e and corresponding highest level is %li\n" , bounds.emm, (long)pow(2./bounds.emm, 0.3333) ); puts( "[Stop in ParseHydrogen]" ); exit(1); } } else if( lgMatch("LOWE",chCard) ) { /* set lowest temp for departure coef, default is 1000 */ i = 5; thlo.HydTempLimit = (float)FFmtRead(chCard,&i,76,&lgEOL); if( thlo.HydTempLimit <= 10. ) thlo.HydTempLimit = (float)pow(10.,thlo.HydTempLimit); } else if( lgMatch("REDI",chCard) ) { /* set redistribution function either wind, incompl (default), or compl */ if( lgMatch(" COM",chCard) ) { /* complete redistribution for la and all others */ strcpy( redis.chRedis, "COMP" ); } else if( lgMatch("INCO",chCard) ) { /* incomplete redistribution for all resonance lines */ strcpy( redis.chRedis, "INCO" ); } else { fprintf( ioQQQ, " MUST be either COMPLETE or INCOMPL\n" ); puts( "[Stop in ParseHydrogen]" ); exit(1); } } else if( lgMatch("TOPO",chCard) ) { /* set lowest level for hydrogen atom top off */ i = 5; HTopOff.nHTopOff = (long int)FFmtRead(chCard,&i,76,&lgEOL); if( HTopOff.nHTopOff > nhlevel ) { fprintf( ioQQQ, " Not possible to set nHTopOff to more than nhlvl=%4ld\n", nhlevel ); fprintf( ioQQQ, " change nhlvl first with HYDROGEN LEVELS command\n"); puts( "[Stop in ParseHydrogen]" ); exit(1); } if( lgEOL ) { NoNumb(chCard); } if( lgMatch(" ADD",chCard) ) { /* add extra part */ strcpy( HTopOff.chHTopType, " add" ); } else if( lgMatch("SCAL",chCard) ) { /* use scale factors */ strcpy( HTopOff.chHTopType, "scal" ); } else { /* this is the default */ strcpy( HTopOff.chHTopType, "scal" ); } } else { fprintf( ioQQQ, " There should have been a keyword - Stop in ParseHydrogen\n" ); puts( "[Stop in ParseHydrogen]" ); exit(1); } # ifdef DEBUG_FUN fputs( " <->ParseHydrogen()\n", debug_fp ); # endif return; }