11 #define DEBUGSTATE false
18 int ngMolLevs = -10000,intCollIndex = -10000,intLColliderIndex = -10000;
20 long int i,j,nMolLevs,intlnct,intrtct,intgrtct,intCollPart,
21 intDCollPart,intCollTran,nCollTrans,intCollTemp,intcollindex,
25 realnum fstatwt,fenergyK,fenergyWN,fenergy,feinsteina;
29 *chColltemp,*chCollName;
35 printf(
"The name of the %li species is %s \n",intNS+1,
Species[intNS].chptrSpName);
36 strcpy( chEFilename ,
Species[intNS].chptrSpName );
37 strcat( chEFilename ,
".dat");
42 fprintf(
ioQQQ,
" moldat_readin opening %s:",chEFilename);
44 atmolLevDATA =
open_data( chEFilename,
"r" );
57 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
59 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
64 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
66 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
72 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
74 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
78 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
80 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
83 ngMolLevs = atoi(chLine);
87 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
94 printf(
"The number of energy levels is %li \n",
Species[intNS].numLevels_max);
102 for( ipHi = 1; ipHi < ngMolLevs; ipHi++)
105 for(ipLo = 0; ipLo < ipHi; ipLo++)
113 for( intcollindex = 0; intcollindex <
NUM_COLLIDERS; intcollindex++ )
119 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
121 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
125 for( nMolLevs=0; nMolLevs<ngMolLevs; nMolLevs++)
127 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
129 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
141 index = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
145 ASSERT( index == nMolLevs + 1 );
154 fprintf(
ioQQQ,
" The energy levels are not in order");
160 printf(
"The converted energy is %f \n",
atmolStates[intNS][nMolLevs].energy);
161 printf(
"The value of g is %f \n",
atmolStates[intNS][nMolLevs].g);
166 for( i=1; i<ngMolLevs; i++ )
183 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
185 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
190 fprintf(
ioQQQ,
" The number of energy levels in file %s is not correct.\n",chEFilename);
193 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
195 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
198 intgrtct = atoi(chLine);
202 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
207 printf(
"The number of radiative transitions is %li \n",intgrtct);
209 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
211 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
215 for( intrtct=0; intrtct<intgrtct; intrtct++)
217 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
219 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
227 index = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
228 ipHi = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL ) - 1;
229 ipLo = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL ) - 1;
232 FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
234 ASSERT( index == intrtct + 1 );
247 printf(
"The upper level is %ld \n",ipHi+1);
248 printf(
"The lower level is %ld \n",ipLo+1);
249 printf(
"The Einstein A is %E \n",
atmolTrans[intNS][ipHi][ipLo].Emis->Aul);
250 printf(
"The Energy of the transition is %E \n",
atmolTrans[intNS][ipHi][ipLo].EnergyK);
254 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
256 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
262 fprintf(
ioQQQ,
" The number of radiative transitions in file %s is not correct.\n",chEFilename);
267 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
269 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
274 intCollPart = atoi(chLine);
277 if(intCollPart > NUM_COLLIDERS-1)
279 fprintf(
ioQQQ,
" The number of colliders is greater than what is expected in file %s.\n", chEFilename );
283 intDCollPart = intCollPart;
284 while(intDCollPart > 0)
286 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
288 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
292 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
294 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
303 chCollName = strtok(chLine,
" ");
305 intLColliderIndex = atoi(chCollName);
309 if(intLColliderIndex == 1)
313 else if(intLColliderIndex == 2)
317 else if(intLColliderIndex == 3)
321 else if(intLColliderIndex == 4)
325 else if(intLColliderIndex == 5)
329 else if(intLColliderIndex == 6)
339 CollRatesArray[intNS][intCollIndex] = (
double**)
MALLOC((
unsigned long)(ngMolLevs) *
sizeof(
double*));
340 for( ipHi = 0; ipHi<ngMolLevs; ipHi++ )
342 CollRatesArray[intNS][intCollIndex][ipHi] = (
double*)
MALLOC((
unsigned long)(ngMolLevs) *
sizeof(
double));
343 for( ipLo = 0; ipLo<ngMolLevs; ipLo++ )
348 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
350 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
353 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
355 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
359 intCollTran = atoi(chLine);
361 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
363 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
366 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
368 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
372 intCollTemp = atoi(chLine);
377 (
double *)
MALLOC((
unsigned long)intCollTemp*
sizeof(double));
379 (
double***)
MALLOC((
unsigned long)(ngMolLevs)*
sizeof(
double**));
380 for( i=0; i<ngMolLevs; i++ )
383 (
double **)
MALLOC((
unsigned long)(ngMolLevs)*
sizeof(
double*));
384 for( j=0; j<ngMolLevs; j++ )
387 (
double *)
MALLOC((
unsigned long)(intCollTemp)*
sizeof(
double));
392 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
394 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
398 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
400 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
404 chColltemp =strtok(chLine,
" ");
406 for( i=1; i<intCollTemp; i++ )
408 chColltemp =strtok(NULL,
" ");
412 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
414 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
418 for( nCollTrans=0; nCollTrans<intCollTran; nCollTrans++ )
420 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , atmolLevDATA ) == NULL )
422 fprintf(
ioQQQ,
" The data file %s is corrupted .\n",chEFilename);
430 index = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
431 ipHi = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL ) - 1;
432 ipLo = (long)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL ) - 1;
437 ASSERT( ipLo == ngMolLevs - 1);
443 for(
long j=0; j<intCollTemp; j++ )
446 (double)
FFmtRead( chLine, &i,
sizeof(chLine), &lgEOL );
449 ASSERT( index == nCollTrans + 1 );
453 printf(
"The values of up and lo are %ld & %ld \n",ipHi,ipLo);
454 printf(
"The collision rates are");
455 for(i=0;i<intCollTemp;i++)
463 intDCollPart = intDCollPart -1;