24 bool lgForceLog=
false, lgForceLinear=
false;
37 for(
long i=0; i<
NISO; ++i )
39 for( nelem=0; nelem<
LIMELM; ++nelem )
46 abund.lgAbnSolar =
false;
52 for(
long i=1; i <
LIMELM; i++ )
58 fprintf(
ioQQQ,
" Hit EOF while reading element list; use END to end list.\n" );
70 while( j <
LIMELM && !lgHIT )
85 fprintf(
ioQQQ,
" Sorry, but I did not recognize element name on this line.\n" );
86 fprintf(
ioQQQ,
" Here is the list of names I recognize.\n" );
87 fprintf(
ioQQQ,
" " );
89 for( k=2; k <=
LIMELM; k++ )
101 if( p.
strcmp(
"END") == 0 )
108 fprintf(
ioQQQ,
" Too many elements were entered.\n" );
109 fprintf(
ioQQQ,
" I only know about%3d elements.\n",
111 fprintf(
ioQQQ,
" Sorry.\n" );
120 bool lgElementSet =
false;
131 else if( p.
nMatch(
"LINE") )
132 lgForceLinear =
true;
141 fprintf(
ioQQQ,
" There must be a number on this line.\n" );
142 fprintf(
ioQQQ,
" Sorry.\n" );
151 " ParseElement did not find an element on the following line:\n" );
156 if( (lgForceLog || param <= 0.) && !lgForceLinear )
159 param = pow(10.,param);
165 else if( p.
nMatch(
"ABUN") )
172 fprintf(
ioQQQ,
" There must be a number on this line.\n" );
173 fprintf(
ioQQQ,
" Sorry.\n" );
182 " ParseElement did not find an element on the following line:\n" );
190 param = pow(10.,param);
194 if(
abund.solar[nelem] > 1. )
197 " Please check the abundance of this element. It seems high to me.\n" );
202 else if( p.
nMatch(
" OFF") )
213 fprintf(
ioQQQ,
" There must be an abundances on the ELEMENT OFF LIMIT command.\n" );
214 fprintf(
ioQQQ,
" Sorry.\n" );
224 " ParseElement did not find an element on the following line:\n" );
229 dense.lgElmtOn[nelem] =
false;
231 dense.IonHigh[nelem] = -1;
232 dense.lgSetIoniz[nelem] =
false;
244 fprintf(
ioQQQ,
" It is not possible to turn hydrogen off.\n" );
245 fprintf(
ioQQQ,
" Sorry.\n" );
252 else if( p.
nMatch(
"IONI") )
254 bool lgLogSet =
false;
262 " ParseElement did not find an element on the following line:\n" );
266 if( !
dense.lgElmtOn[nelem] )
268 fprintf(
ioQQQ,
"Sorry, you cannot set the ionization of %s since it has been turned off.\n" ,
274 dense.lgSetIoniz[nelem] =
true;
287 if(
dense.SetIoniz[nelem][ion] < 0. )
291 param =
dense.SetIoniz[nelem][0];
294 for(
long i=ion; i<nelem+2; ++i )
295 dense.SetIoniz[nelem][i] = 0.;
300 for(
long i=0; i<ion; ++i )
306 while(
dense.SetIoniz[nelem][low]==0 && low < nelem+1 )
309 while(
dense.SetIoniz[nelem][ihi]==0 && ihi > low )
312 if( ihi==low &&
dense.SetIoniz[nelem][ihi]==0 )
314 fprintf(
ioQQQ,
" element ionization command has all zero ionization fractions. This is not possible.\n Sorry\n");
318 for(
long i=low; i<=ihi; ++i )
320 if(
dense.SetIoniz[nelem][i]==0 )
322 fprintf(
ioQQQ,
" element abundance command has zero abundance between positive values. This is not possible.\n Sorry\n");
325 AbundSum +=
dense.SetIoniz[nelem][i];
329 for(
long i=low; i<=ihi; ++i )
330 dense.SetIoniz[nelem][i] /= AbundSum;
336 else if( p.
nMatch(
" ON ") )
342 " ParseElement did not find an element on the following line:\n" );
347 dense.lgElmtOn[nelem] =
true;
356 else if( p.
nMatch(
"TABL") )
362 " ParseElement did not find an element on the following line:\n" );
367 abund.lgAbunTabl[nelem] =
true;
370 abund.lgAbTaON =
true;
375 abund.lgAbTaDepth[nelem] =
true;
377 abund.lgAbTaDepth[nelem] =
false;
382 fprintf(
ioQQQ,
" cannot change abundance of hydrogen.\n" );
383 fprintf(
ioQQQ,
" Sorry.\n" );
394 fprintf(
ioQQQ,
" no pairs entered - cannot interpolate\n" );
411 if( p.
strcmp(
"END") == 0 )
423 abund.nAbunTabl += 1;
427 abund.nAbunTabl -= 1;
430 for(
long i=1; i <
abund.nAbunTabl; i++ )
433 if(
abund.AbTabRad[i][nelem] <=
abund.AbTabRad[i-1][nelem] )
435 fprintf(
ioQQQ,
"ParseElement: TABLE ELEMENT TABLE radii "
436 "must be in increasing order\n" );
444 fprintf(
ioQQQ,
"ParseElement: ELEMENT command - there must be "
445 "a keyword on this line.\n" );
446 fprintf(
ioQQQ,
" The keys I know about are TABLE, SCALE, _OFF, "
447 "_ON_, IONIZATION, and ABUNDANCE.\n" );
448 fprintf(
ioQQQ,
" Sorry.\n" );
462 else if( p.
nMatch(
"ABUN") )
465 sprintf(
optimize.chVarFmt[
optimize.nparm],
"ELEMENT %4.4s ABUNDANCE %%f LOG",