/*CreateData read in some data files, but only if this is very first call */ /*#include */ #include #include #include "cddefines.h" #include "taulines.h" #include "mewecoef.h" #include "nsshells.h" #include "yield.h" #include "path.h" #include "ffmtread.h" #include "trace.h" #include "outer.h" #include "makelevlines.h" #include "hsrate.h" #include "elementnames.h" #include "emlinejunk.h" #include "createdata.h" /* */ /* this was needed to get array to crash out of bounds if not set. * std limits on limits.h did not work with visual studio! */ #define INTBIG 2000000000 /* these are the individual pointers to the level 1 lines, they are set to * very large negative. * NB NB NB!! * these occur two times in the code!! * They are declared in taulines.h, and defined here */ long ipTauDummy=INTBIG,ipT1656=INTBIG, ipT9830=INTBIG, ipH21cm=INTBIG, ipHe3cm=INTBIG, ipT8727=INTBIG, ipT2326=INTBIG, ipT1335=INTBIG, ipT1909=INTBIG, ipT977=INTBIG, ipT1550=INTBIG, ipT1548=INTBIG, ipT386=INTBIG, ipT310=INTBIG, ipc31175=INTBIG, ipT291=INTBIG, ipT280=INTBIG, ipT274=INTBIG, ipT270=INTBIG, ipT312=INTBIG, ipT610=INTBIG, ipT370=INTBIG, ipT157=INTBIG, ipT1085=INTBIG, ipT1750=INTBIG, ipT990=INTBIG, ipT1486=INTBIG, ipT765=INTBIG, ipT1243=INTBIG, ipT1239=INTBIG, ipT374g=INTBIG, ipT374x=INTBIG, ipT1200=INTBIG, ipT2140=INTBIG, ipT671=INTBIG, ipT315=INTBIG, ipT324=INTBIG, ipT333=INTBIG, ipT209=INTBIG, ipT122=INTBIG, ipT205=INTBIG, ipT57=INTBIG, ipT6300=INTBIG, ipT6363=INTBIG, ipT5577=INTBIG, ipT834=INTBIG, ipT1661=INTBIG, ipT1666=INTBIG, ipT835=INTBIG, ipT1402=INTBIG, ipT789=INTBIG, ipT630=INTBIG, ipT1304=INTBIG, ipT1039=INTBIG, ipT8446=INTBIG, ipT4368=INTBIG, ipTOI13=INTBIG, ipTOI11=INTBIG, ipTOI29=INTBIG, ipTOI46=INTBIG, ipTO1025=INTBIG, ipT304=INTBIG, ipT1214=INTBIG, ipT150=INTBIG, ipT146=INTBIG, ipT63=INTBIG, ipTO88=INTBIG, ipT52=INTBIG, ipT26=INTBIG, ipT1032=INTBIG, ipT1037=INTBIG, ipF0229=INTBIG, ipF0267=INTBIG, ipF444=INTBIG, ipF425=INTBIG, ipT770=INTBIG, ipT780=INTBIG, ipxNe0676=INTBIG, ipT895=INTBIG, ipT88=INTBIG, ipTNe13=INTBIG, ipTNe36=INTBIG, ipTNe16=INTBIG, ipTNe14=INTBIG, ipTNe24=INTBIG, ipT5895=INTBIG, ipfsNa373=INTBIG,ipfsNa490=INTBIG, ipfsNa421=INTBIG, ipxNa6143=INTBIG, ipxNa6862=INTBIG,ipxNa0746=INTBIG, ipMgI2853=INTBIG, ipMgI2026=INTBIG, ipT2796=INTBIG, ipT2804=INTBIG, ipT705=INTBIG, ipT4561=INTBIG, ipxMg51325=INTBIG, ipxMg52417=INTBIG, ipxMg52855=INTBIG,ipxMg71190=INTBIG, ipxMg72261=INTBIG, ipxMg72569=INTBIG,ipxMg08303=INTBIG, ipTMg610=INTBIG, ipTMg625=INTBIG, ipT58=INTBIG, ipTMg4=INTBIG, ipTMg14=INTBIG, ipTMg6=INTBIG, ipfsMg790=INTBIG, ipfsMg755=INTBIG, ipAlI3957=INTBIG, ipAlI3090=INTBIG, ipT1855=INTBIG, ipT1863=INTBIG, ipT2670=INTBIG, ipAl529=INTBIG, ipAl6366=INTBIG, ipAl6912=INTBIG, ipAl8575=INTBIG, ipAl8370=INTBIG, ipAl09204=INTBIG, ipT639=INTBIG, ipTAl550=INTBIG, ipTAl568=INTBIG, ipTAl48=INTBIG, ipSii2518=INTBIG, ipSii2215=INTBIG, ipT2335=INTBIG, ipT1808=INTBIG, ipT1207=INTBIG, ipT1895=INTBIG, ipT1394=INTBIG, ipT1403=INTBIG, ipT1527=INTBIG, ipT1305=INTBIG, ipT1260=INTBIG, ipSi619=INTBIG, ipSi10143=INTBIG, ipTSi499=INTBIG, ipTSi521=INTBIG, ipTSi41=INTBIG, ipTSi35=INTBIG, ipTSi25=INTBIG, ipTSi65=INTBIG, ipTSi3=INTBIG, ipTSi4=INTBIG, ipP0260=INTBIG, ipP0233=INTBIG, ipP0318=INTBIG, ipP713=INTBIG, ipP848=INTBIG, ipP817=INTBIG, ipP1027=INTBIG, ipP1018=INTBIG, ipT1256=INTBIG, ipT1194=INTBIG, ipTS1720=INTBIG, ipT1406=INTBIG, ipT1198=INTBIG, ipT786=INTBIG, ipT933=INTBIG, ipT944=INTBIG, ipfsS810=INTBIG, ipfsS912=INTBIG, ipfsS938=INTBIG, ipfsS1119=INTBIG, ipfsS1114=INTBIG, ipfsS1207=INTBIG, ipTSu418=INTBIG, ipTSu446=INTBIG, ipTSu30=INTBIG, ipTS19=INTBIG, ipTS34=INTBIG, ipTS11=INTBIG, ipfsCl214=INTBIG, ipfsCl233=INTBIG, ipCl04203=INTBIG, ipCl04117=INTBIG, ipCl973=INTBIG, ipCl1030=INTBIG, ipCl1092=INTBIG, ipT354=INTBIG, ipT389=INTBIG, ipT25=INTBIG, ipTAr7=INTBIG, ipTAr9=INTBIG, ipTAr22=INTBIG, ipTAr13=INTBIG, ipTAr8=INTBIG, ipAr06453=INTBIG, ipAr1055=INTBIG, ipAr1126=INTBIG, ipAr1178=INTBIG, ipKI7745=INTBIG, ipxK03462=INTBIG, ipxK04598=INTBIG, ipxK04154=INTBIG, ipxK06882=INTBIG, ipxK06557=INTBIG, ipxK07319=INTBIG, ipxK11425=INTBIG, ipCaI4228=INTBIG, ipT3934=INTBIG, ipT3969=INTBIG, ipT8498=INTBIG, ipT8542=INTBIG, ipT8662=INTBIG, ipT7291=INTBIG, ipT7324=INTBIG, ipTCa302=INTBIG, ipTCa345=INTBIG, ipTCa19=INTBIG, ipTCa3=INTBIG, ipTCa12=INTBIG, ipTCa4=INTBIG, ipCa0741=INTBIG, ipCa0761=INTBIG, ipCa08232=INTBIG, ipCa12333=INTBIG, ipSc05231=INTBIG, ipSc13264=INTBIG, ipTi06172=INTBIG, ipTi14212=INTBIG, ipVa07130=INTBIG, ipVa15172=INTBIG, ipCr08101=INTBIG, ipCr16141=INTBIG, ipxMn0979=INTBIG, ipxMn1712=INTBIG, ipFeI3884=INTBIG, ipFeI3729=INTBIG, ipFeI3457=INTBIG, ipFeI3021=INTBIG, ipFeI2966=INTBIG, ipTuv3=INTBIG, ipTr48=INTBIG, ipTFe16=INTBIG, ipTFe26=INTBIG, ipTFe34=INTBIG, ipTFe35=INTBIG, ipTFe46=INTBIG, ipTFe56=INTBIG, ipT1122=INTBIG, ipFe0795=INTBIG, ipFe0778=INTBIG, ipT245=INTBIG, ipT352=INTBIG, ipFe106375=INTBIG,ipT353=INTBIG, ipFe1310=INTBIG, ipFe1311=INTBIG, ipT347=INTBIG, ipT192=INTBIG, ipT255=INTBIG, ipT11=INTBIG, ipT191=INTBIG, ipTFe07=INTBIG, ipTFe61=INTBIG, ipFe18975=INTBIG, ipTFe23=INTBIG, ipTFe13=INTBIG, ipCo11527=INTBIG, ipxNi1242=INTBIG ; /* definition for whether level 2 lines are enabled, will be set to -1 * with no level2 command */ /*long nWindLine = NWINDDIM;*/ /*float TauLine2[NWINDDIM][NTA];*/ /*float **TauLine2;*/ #include "pop371.h" void CreateData(void) { long int i, ipDens , ipTemp , j, ig0, ig1, imax, nelem, nelec, nion, ns , magic1, magic2; char cha; char chS2[3]; long ipZ; int lgEOL; float temp[14]; FILE *ioDATA ; char chLine[132] , chFilename[134] ; static int lgFirstCall = TRUE; # ifdef DEBUG_FUN fputs( "<+>CreateData()\n", debug_fp ); # endif /* do nothing if not first call */ if( !lgFirstCall ) { # ifdef DEBUG_FUN fputs( " <->CreateData()\n", debug_fp ); # endif return; } lgFirstCall = FALSE; /* do not reevaluate again */ /************************************************************* * * * get the level 1 lines, with real collision data set * * * *************************************************************/ /* level1 level 1 tau lines */ #if 0 { /* this dumps out the level 1 lines and was used to create the original file */ FILE * ioBLOCK ; if( (ioBLOCK = fopen("d:\\projects\\cloudy\\ccloudy\\data\\level1b.dat","w"))==NULL) { fprintf(ioQQQ,"could not create level1b.dat\n"); exit(1); } for( i=1; i <= nLevel1; i++ ) { fprintf(ioBLOCK,"%2s%2i %9f %11.2f %2i %2i %10g %10g %2i\n", chElementSym[ TauLines[i].nelem-1], TauLines[i].IonStg, TauLines[i].WLAng, TauLines[i].EnergyWN, (int)TauLines[i].gLo , (int)TauLines[i].gHi , TauLines[i].gf , TauLines[i].Aul , TauLines[i].iRedisFun); } fclose(ioBLOCK); exit(1); } # endif /* get the line data for the level 1 lines */ /* check on path is file not here and path set */ /* path was parsed in getset */ if( lgDataPathSet == TRUE ) { /*path set, so look only there */ strcpy( chFilename , chDataPath ); strcat( chFilename , "level1.dat" ); } else { /* path not set, check local space only */ strcpy( chFilename , "level1.dat" ); } if( trace.lgTrace ) fprintf( ioQQQ," CreateData opening level1.dat:"); if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) { fprintf( ioQQQ, " CreateData could not open level1.dat\n" ); if( lgDataPathSet == TRUE ) fprintf( ioQQQ, " even tried path\n" ); if( lgDataPathSet == TRUE ) { fprintf( ioQQQ, " CreateData could not open level1.dat\n"); fprintf( ioQQQ, " path is ==%s==\n",chDataPath ); fprintf( ioQQQ, " final path is ==%s==\n",chFilename ); } puts( "[Stop in CreateData]" ); exit(-1); } /* first line is a version number and does not count */ if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " CreateData could not read first line of level1.dat.\n"); puts( "[Stop in FeIIData]" ); exit(-1); } /* count how many lines are in the file, ignoring all lines * starting with '#' */ nLevel1 = 0; while( fgets( chLine , sizeof(chLine) , ioDATA ) != NULL ) { /* we want to count the lines that do not start with # * since these contain data */ if( chLine[0] != '#') ++nLevel1; } /* malloc the float TauLine2[nWindLine][NTA] array */ /*if( (TauLine2 = ((float **)malloc(nWindLine*sizeof(float *)))) == NULL )*/ /*if( (TauLine2 = ((EmLine *)malloc( (size_t)nWindLine*sizeof(EmLine *)))) == NULL )*/ if( (TauLines = ((EmLine *)malloc( (size_t)(nLevel1+1)*sizeof(EmLine )))) == NULL ) { fprintf(ioQQQ," CreateData could not malloc TauLines\n"); puts( "[Stop in CreateData]" ); exit(1); } /* now rewind the file so we can read it a second time*/ if( fseek( ioDATA , 0 , SEEK_SET ) != 0 ) { fprintf( ioQQQ, " CreateData could not rewind level1.dat.\n"); puts( "[Stop in CreateData]" ); exit(-1); } /* check that magic number is ok */ if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " CreateData could not read first line of level1.dat.\n"); puts( "[Stop in CreateData]" ); exit(-1); } i = 1; nelem = (long)FFmtRead(chLine,&i,76,&lgEOL); nelec = (long)FFmtRead(chLine,&i,76,&lgEOL); nion = (long)FFmtRead(chLine,&i,76,&lgEOL); if( ( nelem != 99 ) || ( nelec != 12 ) || ( nion != 1 ) ) { fprintf( ioQQQ, " CreateData: the version of level1.dat is not the current version.\n" ); fprintf( ioQQQ, " I expected to find the number 99 12 1 and got %li %li %li instead.\n" , nelem , nelec , nion ); fprintf( ioQQQ, "Here is the line image:\n==%s==\n", chLine ); puts( "[Stop in CreateData]" ); exit(1); } /* level 1 lines extend from 1 through nLevel1+1 of this array * the dummy line is in the 0th position */ /* this starts at 1 not 0 since zero is reserved for the * dummy line */ i = 1; while( fgets( chLine , sizeof(chLine) , ioDATA ) != NULL ) { /* only look at lines without '#' in first col */ if( chLine[0] != '#') { /*sscanf( chLine , "%2s%2li%9li %11f %2li %2li %10g %10g %2li\n", chS2,&i2,&i3,&f1,&i4,&i5,&f2,&f3,&i6 );*/ /* first two cols of line has chem element symbol, * try to match it with the list of names * there are no H lines in the level 1 set so zero * is an invalid result */ /* copy first two char into chS2 and null terminate */ strncpy( chS2 , chLine , 2); chS2[2] = 0; ipZ = 0; for( j=0; j 0 ) { /* begin level2 level 2 wind block */ /* open file with level 2 line data */ /* malloc the float TauLine2[nWindLine][NTA] array */ /*if( (TauLine2 = ((float **)malloc(nWindLine*sizeof(float *)))) == NULL )*/ /*if( (TauLine2 = ((EmLine *)malloc( (size_t)nWindLine*sizeof(EmLine *)))) == NULL )*/ if( (TauLine2 = ((EmLine *)malloc( (size_t)nWindLine*sizeof(EmLine )))) == NULL ) { fprintf(ioQQQ," CreateData could not malloc 1 TauLine2\n"); puts( "[Stop in CreateData]" ); exit(1); } #if 0 /* no longer need this loop */ for (i=0; i < nWindLine; i++) { /*if( (TauLine2[i] = (float *)malloc(NTA*sizeof(float ))) == NULL )*/ if( (TauLine2[i] = (EmLine *)malloc(sizeof(EmLine ))) == NULL ) { fprintf(ioQQQ," CreateData could not malloc 2 TauLine2\n"); puts( "[Stop in CreateData]" ); exit(1); } } #endif /* first initialize entire array to dangerously large negative numbers */ for( i=0; i< nWindLine; ++i ) { /*for( j=0 ; j>chng 99 jul 16, from setting all t[] to flt_max, to call for * following, each member of structure set to own type of impossible value */ /*TauLine2[i]. t[j] = -FLT_MAX;*/ EmLineJunk( &TauLine2[i] ); /*}*/ } /* check on path if file not here and path set */ /* path was parsed in getset */ if( lgDataPathSet == TRUE ) { /*path set, so look only there */ strcpy( chFilename , chDataPath ); strcat( chFilename , "level2.dat" ); } else { /* path not set, check local space only */ strcpy( chFilename , "level2.dat" ); } if( trace.lgTrace ) fprintf( ioQQQ," CreateData opening level2.dat:"); if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) { fprintf( ioQQQ, " CreateData could not open level2.dat\n" ); if( lgDataPathSet == TRUE ) { fprintf( ioQQQ, " CreateData could not open level2.dat, even tried path.\n"); fprintf( ioQQQ, " path is *%s*\n",chDataPath ); fprintf( ioQQQ, " final path is *%s*\n",chFilename ); } puts( "[Stop in CreateData]" ); exit(-1); } /* get magic number off first line */ if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " level2.dat error getting magic number\n" ); puts( "[Stop in CreateData]" ); exit(-1); } sscanf( chLine , "%ld" , &magic1 ); if( magic1 != 9101 ) { fprintf( ioQQQ, " level2.dat starts with wrong magic number=%ld \n", magic1 ); puts( "[Stop in CreateData]" ); exit(-1); } /* now get the actual data */ for( i=0; i < nWindLine; i++ ) { float tt[7]; if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " level2.dat error getting line %li\n", i ); puts( "[Stop in CreateData]" ); exit(-1); } /*printf("string is %s\n",chLine ) ;*/ sscanf( chLine , "%f %f %f %f %f %f %f " , &tt[0] , &tt[1] , &tt[2] , &tt[3] , &tt[4] , &tt[5] , &tt[6] ); /* these are readjusted into their final form in the structure * in routine MakeLevLines*/ TauLine2[i].nelem = (long)tt[0]; TauLine2[i].IonStg = (long)tt[1]; TauLine2[i].gLo = tt[2]; TauLine2[i].gHi = tt[3]; TauLine2[i].gf = tt[4]; TauLine2[i].EnergyWN = tt[5]; TauLine2[i].cs1 = tt[6]; } /* get magic number off last line */ if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " level2.dat error getting last magic number\n" ); puts( "[Stop in CreateData]" ); exit(-1); } sscanf( chLine , "%ld" , &magic2 ); if( magic1 != magic2 ) { fprintf( ioQQQ, " level2.dat ends will wrong magic number=%ld \n", magic2 ); puts( "[Stop in CreateData]" ); exit(-1); } fclose( ioDATA ); if( trace.lgTrace ) fprintf( ioQQQ," OK \n"); /* end of level2 block*/ } /* initialize the large blcok of level 1 real lines, and OP level 2 lines */ MakeLevLines(); /************************************************************* * * * get the Auger electron yield data set * * * *************************************************************/ /* mewecoef.dat mewecoef.dat mewecoef.dat mewecoef.dat mewecoef.dat mewecoef.dat ========*/ /* open file with Mewe coefficients */ if( lgDataPathSet == TRUE ) { /*path set, so look only there */ strcpy( chFilename , chDataPath ); strcat( chFilename , "mewecoef.dat" ); } else { /* path not set, check local space only */ strcpy( chFilename , "mewecoef.dat" ); } if( trace.lgTrace ) fprintf( ioQQQ," CreateData opening mewecoef.dat:"); if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) { fprintf( ioQQQ, " could not open mewecoef.dat\n" ); if( lgDataPathSet == TRUE ) { fprintf( ioQQQ, " CreateData could not open mewecoef.dat, even tried path.\n"); fprintf( ioQQQ, " path is *%s*\n",chDataPath ); fprintf( ioQQQ, " final path is *%s*\n",chFilename ); } puts( "[Stop in CreateData]" ); exit(-1); } /* get magic number off first line */ if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " mewecoef.dat error getting magic number\n" ); puts( "[Stop in CreateData]" ); exit(-1); } /* check the number */ sscanf( chLine , "%ld" , &magic1 ); if( magic1 != 9101 ) { fprintf( ioQQQ, " mewecoef.dat starts with wrong magic number=%ld \n", magic1 ); puts( "[Stop in CreateData]" ); exit(-1); } /* now get the actual data, indices are correct for c, in Fort went from 2 to 210 */ for( i=1; i < 210; i++ ) { if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " mewecoef.dat error getting line %li\n", i ); puts( "[Stop in CreateData]" ); exit(-1); } /*printf("%s\n",chLine);*/ sscanf( chLine , "%f %f %f %f " , &MeweCoef.g[i][0] , &MeweCoef.g[i][1] , &MeweCoef.g[i][2] , &MeweCoef.g[i][3] ); } /* get magic number off last line */ if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " mewecoef.dat error getting last magic number\n" ); puts( "[Stop in CreateData]" ); exit(-1); } sscanf( chLine , "%ld" , &magic2 ); if( magic1 != magic2 ) { fprintf( ioQQQ, " mewecoef.dat ends will wrong magic number=%ld \n", magic2 ); puts( "[Stop in CreateData]" ); exit(-1); } fclose( ioDATA ); if( trace.lgTrace ) fprintf( ioQQQ," OK \n"); /* preset two arrays that will hold auger data * set to very large values so that code will blow * if not set properly below */ for( nelem=0; nelem < LIMELM; nelem++ ) { for( nion=0; nion < LIMELM; nion++ ) { nsShellsCom.nsShells[nion][nelem] = 100000000; for( ns=0; ns < 7; ns++ ) { yield.nyield[ns][nion][nelem] = 1000000000; for( nelec=0; nelec < 10; nelec++ ) { yield.vyield[nelec][ns][nion][nelem] = FLT_MAX; } } } } /* hydrogen and helium will not be done below, so set yields here*/ yield.nyield[0][0][0] = 1; yield.nyield[0][0][1] = 1; yield.nyield[0][1][1] = 1; yield.vyield[0][0][0][0] = 1; yield.vyield[0][0][0][1] = 1; yield.vyield[0][0][1][1] = 1; /* open file auger.dat */ /* check on path is file not here and path set */ if( lgDataPathSet == TRUE ) { /*path set, so look only there */ strcpy( chFilename , chDataPath ); strcat( chFilename , "auger.dat" ); } else { /* path not set, check local space only */ strcpy( chFilename , "auger.dat" ); } if( trace.lgTrace ) fprintf( ioQQQ," CreateData opening auger.dat:"); /* open the file */ if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) { fprintf( ioQQQ, " could not open auger.dat\n" ); if( lgDataPathSet == TRUE ) { fprintf( ioQQQ, " CreateData could not open auger.dat, even on path..\n"); fprintf( ioQQQ, " path is *%s*\n",chDataPath ); fprintf( ioQQQ, " final path is *%s*\n",chFilename ); } puts( "[Stop in CreateData]" ); exit(-1); } /* read in two comment lines */ for( i=0; i<2 ; i++ ) { if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " auger.dat error reading 2 lines \n" ); puts( "[Stop in CreateData]" ); exit(-1); } } /* now read in all auger yields */ /* will do elements from li on up */ for( nelem=2; nelem < LIMELM; nelem++ ) { /* nelem is on the shifted C scale, so 2 is Li */ for( nion=0; nion <= nelem; nion++ ) { /* number of bound electrons, = atomic number for neutral */ nelec = nelem - nion + 1; /* one of dima's routines to determine the number of electrons * for this species, nelem +1 to shift to physical number */ /* subroutine outer(iz,in,imax,ig0,ig1) * iz - atomic number from 1 to 30 (integer) * in - number of electrons from 1 to iz (integer) * Output: imax - number of the outer shell */ outer(nelem+1,nelec,&imax,&ig0,&ig1); /* loop over all the electrons */ /* nsShells(nelem,ion) is outer shell number for ion with nelec electrons */ nsShellsCom.nsShells[nion][nelem] = imax; for( ns=0; ns < imax; ns++ ) { if( fgets( chLine , sizeof(chLine) , ioDATA ) == NULL ) { fprintf( ioQQQ, " level2.dat error getting line %li\n", ns ); puts( "[Stop in CreateData]" ); exit(-1); } /*printf("string is %s\n",chLine ) ;*/ sscanf( chLine , "%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f" , &temp[0] ,&temp[1] ,&temp[2] ,&temp[3] ,&temp[4] , &temp[5] ,&temp[6] ,&temp[7] ,&temp[8] ,&temp[9] , &temp[10] ,&temp[11] ,&temp[12] ,&temp[13] ,&temp[14] ); yield.nyield[ns][nion][nelem] = (long int)temp[3]; /* can pop off up to 10 auger electrons, these are the probabilities*/ for( j=0; j<10; j++) { yield.vyield[j][ns][nion][nelem] = temp[j+4]; } } } } fclose( ioDATA ); /* validate the data, this is a nested set of asserts that should be * optimized away in fast mode */ for( nelem=2; nelem < LIMELM; nelem++ ) { for( nion=0; nion <= nelem; nion++ ) { assert( nsShellsCom.nsShells[nion][nelem] > 0 ); assert( nsShellsCom.nsShells[nion][nelem] <= 10 ); for( ns=0; ns < nsShellsCom.nsShells[nion][nelem]; ns++ ) { assert( yield.nyield[ns][nion][nelem] >= 0 ); assert( yield.nyield[ns][nion][nelem] < 11 ); for( i=0; i < yield.nyield[ns][nion][nelem]; i++ ) { assert( yield.vyield[i][ns][nion][nelem] >= 0. ); } } } } if( trace.lgTrace ) fprintf( ioQQQ," OK \n"); /************************************************************* * * * get the Hummer and Storey model case B results, these are * * the two data files e1b.dat and e2b.dat, for H and He * * * *************************************************************/ /* now get Hummer and Storey case b data, loop over H, He */ for( ipZ=0; ipZ<2; ++ipZ ) { /* open file with case B data */ /* check on path is file not here and path set */ if( lgDataPathSet == TRUE ) { /*path set, so look only there */ strcpy( chFilename , chDataPath ); strcat( chFilename , "e" ); } else { /* path not set, check local space only */ strcpy( chFilename , "e" ); } /* create remainder of file name for this charge * first character after e is charge number for this element, * stuff this into temporary work array */ chLine[0] = (char)(ipZ + '1'); /* terminate it*/ chLine[1] = '\0' ; /* add it to end of file name */ strcat( chFilename , chLine ); /* add case b to end of name */ strcat( chFilename , "b" ); /* finally end the name with .dat*/ strcat( chFilename , ".dat") ; if( trace.lgTrace ) fprintf( ioQQQ," CreateData opening HS case b %s:",chFilename); /* open the file */ if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) { fprintf( ioQQQ, " could not open HS case b %s\n",chFilename); if( lgDataPathSet == TRUE ) { fprintf( ioQQQ, " CreateData could not open even on path..\n"); fprintf( ioQQQ, " path is *%s*\n",chDataPath ); fprintf( ioQQQ, " final path is *%s*\n",chFilename ); } puts( "[Stop in CreateData]" ); exit(-1); } if( trace.lgTrace ) { fprintf( ioQQQ," OK\n"); } /* read in the number of temperatures and densities*/ i = fscanf( ioDATA, "%li %li ", &CaseBHS.ntemp[ipZ], &CaseBHS.nDensity[ipZ] ); /* check that ntemp and nDensity are below NHSDIM, * set to 15 in HSRate.h */ assert (CaseBHS.ntemp[ipZ] >0 && CaseBHS.ntemp[ipZ] <= NHSDIM ); assert (CaseBHS.nDensity[ipZ] > 0 && CaseBHS.nDensity[ipZ] <= NHSDIM) ; /* loop reading in line emissivities for all temperatures*/ for( ipTemp=0; ipTemp < CaseBHS.ntemp[ipZ]; ipTemp++ ) { for( ipDens=0; ipDens < CaseBHS.nDensity[ipZ]; ipDens++ ) { long int junk, junk2 , ne; fscanf( ioDATA, " %lf %li %lf %c %li %ld ", &CaseBHS.Density[ipZ][ipDens], &junk , &CaseBHS.ElecTemp[ipZ][ipTemp], &cha , &junk2 , &CaseBHS.ncut[ipZ] ); ne = CaseBHS.ncut[ipZ]*(CaseBHS.ncut[ipZ] - 1)/2; assert( ne<=NLINEHS ); for( j=0; j < ne; j++ ) { fscanf( ioDATA, "%lf ", &CaseBHS.Emiss[ipZ][ipTemp][ipDens][j] ); } } } /*this is end of read-in loop */ fclose(ioDATA); #if 0 /* print list of densities and temperatures */ for( ipDens=0; ipDensCreateData()\n", debug_fp ); # endif return; }