22 int nMolLevs = -10000;
23 long int intlnct,intrtct,intgrtct;
27 realnum fstatwt,fenergyK,fenergyWN,fenergy,feinsteina;
33 const int MAX_NUM_LEVELS = 70;
40 printf(
"The name of the %li species is %s \n",intNS+1,
dBaseSpecies[intNS].chLabel);
44 fprintf(
ioQQQ,
" moldat_readin opening %s:",chEFilename);
46 ioLevData =
open_data( chEFilename,
"r" );
55 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
57 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
62 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
64 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
70 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
72 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
77 ASSERT( chLine[0] ==
'!' );
80 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
82 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
85 nMolLevs = atoi(chLine);
87 long HighestIndexInFile = nMolLevs;
89 nMolLevs =
MIN2( nMolLevs, MAX_NUM_LEVELS );
93 fprintf(
ioQQQ,
"The number of energy levels is non-positive in datafile %s.\n", chEFilename );
94 fprintf(
ioQQQ,
"The file must be corrupted.\n" );
105 for(
long ipHi = 1; ipHi < nMolLevs; ipHi++)
113 for(
long ipHi = 1; ipHi < nMolLevs; ipHi++)
115 for(
long ipLo = 0; ipLo < ipHi; ipLo++)
125 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
127 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
132 ASSERT( chLine[0] ==
'!' );
134 for(
long ipLev=0; ipLev<HighestIndexInFile; ipLev++)
136 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
138 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
143 if( ipLev >= nMolLevs )
152 strcpy(
dBaseStates[intNS][ipLev].chLabel(),
"13CO");
161 else if(
dBaseStates[intNS][ipLev].chLabel()[3]==
'\0' )
170 index = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
174 ASSERT( index == ipLev + 1 );
175 dBaseStates[intNS][ipLev].energy().set(fenergy,
"cm^-1");
186 fprintf(
ioQQQ,
" The energy levels are not in order in species %s at index %li.\n",
193 printf(
"The converted energy is %f \n",
dBaseStates[intNS][ipLev].energy().WN());
194 printf(
"The value of g is %f \n",
dBaseStates[intNS][ipLev].
g());
202 int ipHi = (*tr).ipHi();
203 int ipLo = (*tr).ipLo();
208 (*tr).EnergyWN() = fenergyWN;
216 (*tr).WLAng() = 1e30f;
219 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
221 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
226 fprintf(
ioQQQ,
" The number of energy levels in file %s is not correct, expected to find line starting with!.\n",chEFilename);
227 fprintf(
ioQQQ ,
"%s\n", chLine );
230 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
232 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
235 intgrtct = atoi(chLine);
239 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
244 printf(
"The number of radiative transitions is %li \n",intgrtct);
246 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
248 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
252 for( intrtct=0; intrtct<intgrtct; intrtct++)
254 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
256 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
262 long index, ipHi, ipLo;
264 index = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
265 ipHi = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL ) - 1;
266 ipLo = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL ) - 1;
270 ASSERT( index == intrtct + 1 );
273 if( ipLo >= nMolLevs || ipHi >= nMolLevs )
278 FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
285 (*tr).AddLine2Stack();
286 (*tr).Emis().Aul() = feinsteina;
289 (*tr).EnergyWN() = fenergyWN;
292 (*tr).Emis().gf() = (
realnum)
GetGF((*tr).Emis().Aul(),(*tr).EnergyWN(), (*(*tr).Hi()).g());
296 printf(
"The upper level is %ld \n",ipHi+1);
297 printf(
"The lower level is %ld \n",ipLo+1);
298 printf(
"The Einstein A is %E \n",(*tr).Emis().Aul());
299 printf(
"The Energy of the transition is %E \n",(*tr).EnergyK());
303 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
305 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
311 fprintf(
ioQQQ,
" The number of radiative transitions in file %s is not correct.\n",chEFilename);
315 long nCollPartners = -1;
317 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
319 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
324 nCollPartners = atoi(chLine);
331 fprintf(
ioQQQ,
" The number of colliders is greater than what is expected in file %s.\n", chEFilename );
337 for(
long ipPartner = 0; ipPartner < nCollPartners; ++ ipPartner )
339 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
341 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
345 ASSERT( chLine[0] ==
'!' );
347 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
349 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
358 char *chCollName = strtok(chLine,
" ");
360 int intLColliderIndex = atoi(chCollName);
361 int intCollIndex = -1;
365 if(intLColliderIndex == 1)
369 else if(intLColliderIndex == 2)
373 else if(intLColliderIndex == 3)
377 else if(intLColliderIndex == 4)
381 else if(intLColliderIndex == 5)
385 else if(intLColliderIndex == 6)
398 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
400 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
404 ASSERT( chLine[0] ==
'!' );
406 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
408 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
412 long nCollTrans = atoi(chLine);
414 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
416 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
420 ASSERT( chLine[0] ==
'!' );
422 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioLevData ) == NULL )
424 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
428 long intCollTemp = atoi(chLine);
432 ioLevData, func, nMolLevs, intCollTemp, nCollTrans );