60 H2_SaveLine[(*Hi).n()][(*Hi).v()][(*Hi).J()][(*Lo).n()][(*Lo).v()][(*Lo).J()] = 0.;
64 H2_SaveLine[(*Hi).n()][(*Hi).v()][(*Hi).J()][(*Lo).n()][(*Lo).v()][(*Lo).J()] +=
74 ostringstream &chHeader)
91 "H2 vibration state",0.0);
95 "H2 rotation state",0.0);
102 sncatf( chHeader,
"#vib\trot\tcolumn density\n" );
109 "#vib\trot\tEner(K)\tcolden\tcolden/stat wght\tLTE colden\tLTE colden/stat wght\n" );
118 "#Temp\tLTE cooling per molecule\tNet cooling per molecule\n" );
121 else if( p.
nMatch(
"COOL") )
126 "#H2 depth\tTemp\ttot cool\tTH Sol\tBig Sol\tTH pht dis\tpht dis\tTH Xcool\tXcool\tNet cool per H2\n" );
129 else if( p.
nMatch(
"CREA") )
132 fprintf(
ioQQQ,
" This command has been superseded by the \"creation\" option of the \"save chemistry rates\" command.\n" );
136 else if( p.
nMatch(
"DEST") )
139 fprintf(
ioQQQ,
" This command has been superseded by the \"destruction\" option of the \"save chemistry rates\" command.\n" );
144 else if( p.
nMatch(
"HEAT") )
149 "#H2 depth\ttot Heat\tHeat(big)\tHeat(TH85)\tDissoc(Big)\tDissoc(TH85) \n" );
152 else if( p.
nMatch(
"LEVE") )
157 "#H2 v\tJ\tenergy(wn)\tstat wght\tSum As" );
167 else if( p.
nMatch(
"LINE") )
172 "#H2 line\tEhi\tVhi\tJhi\tElo\tVlo\tJlo\twl(mic)\twl(lab)\tlog L or I\tI/Inorm\tExcit(hi, K)\tg_u h nu * Aul\n" );
179 "faintest line to save",1e-4);
194 else if( p.
nMatch(
"GROU") )
202 "electronic levels for output",1.0);
207 else if( p.
nMatch(
" PDR") )
211 sncatf( chHeader,
"#depth\tn(o-H2)\tn(p-H2)\tSolomon rate TH85\tSolomon rate BD96\tSolomon rate H2 model\n" );
213 else if( p.
nMatch(
"POPU") )
223 "highest H2 save vibration state",0.0);
227 "highest H2 save rotation state",0.0);
234 "#depth\torth\tpar\te=1 rel pop\te=2 rel pop\tv,J rel pops\n" );
245 sncatf( chHeader,
"#vib\trot\tpops\n" );
252 "#vib\trot\ts\tenergy(wn)\tpops/H2\told/H2\tpops/g/H2\tdep coef\tFin(Col)\tFout(col)\tRCout\tRRout\tRCin\tRRin\n" );
257 else if( p.
nMatch(
"RATE") )
262 "#depth\tN(H2)\tN(H2)/u(H2)\tA_V(star)\tn(Eval)"
263 "\tH2/Htot\trenorm\tfrm grn\tfrmH-\tdstTH85\tBD96\tELWERT\tBigH2\telec->H2g\telec->H2s"
264 "\tG(TH85)\tG(DB96)\tCR\tEleclife\tShield(BD96)\tShield(H2)\tBigh2/G0(spc)\ttot dest"
265 "\tHeatH2Dish_TH85\tHeatH2Dexc_TH85\tHeatDish_BigH2\tHeatDexc_BigH2\thtot\n" );
267 else if( p.
nMatch(
"SOLO") )
272 "#depth\tSol tot\tpump/dissoc\tpump/dissoc BigH2\tavH2g\tavH2s\tH2g chem/big H2\tH2s chem/big H2\tfrac H2g BigH2\tfrac H2s BigH2\teHi\tvHi\tJHi\tvLo\tJLo\tfrac\twl(A)\n" );
274 else if( p.
nMatch(
"SPEC") )
279 "#depth\tspecial\n" );
281 else if( p.
nMatch(
"TEMP") )
286 "#depth\tH2/H\tn(1/0)\tn(ortho/para)\tT(1/0)\tT(2/0)\tT(3/0)\tT(3/1)\tT(4/0)\tT(kin)\tT(21cm)\tT_sum(1/0)\tT_sum(2/0)\tT_sum(3/0)\tT_sum(3/1)\tT_sum(4/0) \n");
288 else if( p.
nMatch(
"THER") )
293 "#depth\tH2/H\tn(1/0)\tn(ortho/para)\tT(1/0)\tT(2/0)\tT(3/0)\tT(3/1)\tT(4/0)\tT(kin)\tT(21cm)\tT_sum(1/0)\tT_sum(2/0)\tT_sum(3/0)\tT_sum(3/1)\tT_sum(4/0) \n");
298 " There must be a second key; they are RATE, LINE, COOL, COLUMN, _PDR, SOLOmon, TEMP, and POPUlations\n" );
348 for(
long iVib=0; iVib<=
nVib_hi[iElec]; ++iVib )
350 for(
long iRot=0; iRot<
Jlowest[iElec]; ++iRot )
352 for(
long iRot=Jlowest[iElec]; iRot<=
nRot_hi[iElec][iVib]; ++iRot )
382 fprintf( ioMEAN,
" H2 total ");
385 fprintf( ioMEAN,
" H2 ortho ");
405 const char* cdDATAFILE[
N_ELEC] =
409 "transprob_C_plus.dat",
410 "transprob_C_minus.dat",
411 "transprob_B_primed.dat",
412 "transprob_D_plus.dat",
413 "transprob_D_minus.dat"
417 long int i, n1, n2, n3;
418 long int iVibHi , iVibLo , iRotHi , iRotLo , iElecHi , iElecLo;
425 strcpy( chPath,
path.c_str() );
427 strcat( chPath, cdDATAFILE[nelec] );
433 fprintf(
ioQQQ,
" H2_ReadTransprob could not read first line of %s\n", cdDATAFILE[nelec]);
444 if( ( n1 != 2 ) || ( n2 != 4 ) || ( n3 != 29 ) )
447 " H2_ReadTransprob: the version of %s is not the current version.\n", cdDATAFILE[nelec] );
449 " I expected to find the number 2 4 29 and got %li %li %li instead.\n" ,
451 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
455 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
460 if( chLine[0]==
'\n' || chLine[0]==
'\0' || chLine[0]==
' ' )
464 if( sscanf(chLine,
"%li\t%li\t%li\t%li\t%li\t%li\t%le",
465 &iElecHi , &iVibHi ,&iRotHi , &iElecLo , &iVibLo , &iRotLo , &Aul ) != 7 )
467 fprintf(
ioQQQ,
"failed to read correct number of data values from %s\n", chPath );
470 ASSERT( iElecHi == nelec );
475 if( iVibHi <=
nVib_hi[iElecHi] &&
477 iRotHi <=
nRot_hi[iElecHi][iVibHi] &&
478 iRotLo <=
nRot_hi[iElecLo][iVibLo])
482 double ener =
states[ipHi].energy().WN() -
states[ipLo].energy().WN();
488 ASSERT( trns[lineIndex].hasEmis() );
494 trns[lineIndex].AddLine2Stack();
504 fprintf(
ioQQQ,
"negative energy H2 transition\t%li\t%li\t%li\t%li\t%.2e\t%.2e\n",
505 iVibHi,iVibLo,iRotHi,iRotLo,Aul,ener);
518 void H2_Read_Cosmicray_distribution(
void)
525 long int i, n1, n2, n3, iVib , iRot;
533 strcpy( chPath, path.c_str() );
535 strcat( chPath,
"H2_CosmicRay_collision.dat" );
541 fprintf(
ioQQQ,
" H2_Read_Cosmicray_distribution could not read first line of %s\n",
"H2_Cosmic_collision.dat");
553 if( ( n1 != 1 ) || ( n2 != 21 ) || ( n3 != 3 ) )
556 " H2_Read_Cosmicray_distribution: the version of %s is not the current version.\n",
"H2_Cosmic_collision.dat" );
558 " I expected to find the number 1 21 3 and got %li %li %li instead.\n" ,
560 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
568 while( chLine[0]==
'#' )
582 sscanf(chLine,
"%li\t%li\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
583 &iVib ,&j_minus_ji , &a[0],&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7],&a[8],&a[9]
592 ASSERT( j_minus_ji == -2 || j_minus_ji == +2 || j_minus_ji == 0 );
593 ASSERT( neut_frac < CR_X );
596 j_minus_ji = 1 + j_minus_ji/2;
597 ASSERT( j_minus_ji>=0 && j_minus_ji<=2 );
600 for( iRot=0; iRot<CR_J; ++iRot )
602 cr_rate[neut_frac][iVib][iRot][j_minus_ji] = (
realnum)a[iRot];
604 if( lgH2_NOISECOSMIC )
609 for( iRot=0; iRot<CR_J; ++iRot )
611 cr_rate[neut_frac][iVib][iRot][j_minus_ji] *= (
realnum)
exp10((
double)r);
618 for( iRot=0; iRot<CR_J; ++iRot )
620 fprintf(
ioQQQ,
"\t%.3e", cr_rate[neut_frac][iVib][iRot][j_minus_ji] );
628 while( chLine[0]==
'#' )
669 levels.resize( n.size() );
670 ASSERT( levels.size() > 0 );
671 for(
unsigned i = 0; i < n.size(); ++i )
676 levels[i].eWN = eWN[i];
680 sort( levels.begin(), levels.end() );
684 for( vector<level_tmp>::iterator lev = levels.begin(); lev != levels.end(); ++lev )
691 states[i].energy().set( lev->eWN,
"cm^-1" );
698 oss <<
"n=" << lev->n <<
',' <<
"v=" << lev->v <<
',' <<
"J=" << lev->J;
699 states[i].chConfig() = oss.str();
717 nRot_hi[ (*st).n() ][ (*st).v() ] =
MAX2(
nRot_hi[ (*st).n() ][ (*st).v() ], (*st).J() );
726 const char* cdDATAFILE[
N_ELEC] =
731 "energy_C_minus.dat",
732 "energy_B_primed.dat",
738 strcpy( chPath,
path.c_str() );
740 strcat( chPath, cdDATAFILE[nelec] );
744 long int i, n1, n2, n3;
750 fprintf(
ioQQQ,
" H2_ReadEnergies could not read first line of %s\n", cdDATAFILE[nelec]);
755 n1 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
756 n2 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
757 n3 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
761 if( ( n1 != 2 ) || ( n2 != 4 ) || ( n3 != 29 ) )
764 " H2_ReadEnergies: the version of %s is not the current version.\n", cdDATAFILE[nelec] );
766 " I expected to find the number 2 4 29 and got %li %li %li instead.\n" ,
768 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
777 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
782 if( chLine[0]==
'\n' || chLine[0]==
'\0' || chLine[0]==
' ' )
786 if( sscanf(chLine,
"%li\t%li\t%le", &iVib, &iRot, &energyWN ) != 3 )
788 fprintf(
ioQQQ,
"failed to read correct number of data values from %s\n", chPath );
793 ASSERT( energyWN > 0. || (nelec==0 && iVib==0 && iRot==0 ) );
795 n.push_back( nelec );
798 eWN.push_back( energyWN );
820 const char* cdDATAFILE =
"energy_dissoc.dat";
823 long int i, n1, n2, n3;
830 strcpy( chPath,
path.c_str() );
832 strcat( chPath, cdDATAFILE );
838 fprintf(
ioQQQ,
" H2_ReadDissocEnergies could not read first line of %s\n", cdDATAFILE );
843 n1 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
844 n2 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
845 n3 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
849 if( ( n1 != 2 ) || ( n2 != 4 ) || ( n3 != 29 ) )
852 " H2_ReadDissocEnergies: the version of %s is not the current version.\n", cdDATAFILE );
854 " I expected to find the number 2 4 29 and got %li %li %li instead.\n" ,
856 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
860 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
865 if( chLine[0]==
'\n' || chLine[0]==
'\0' || chLine[0]==
' ' )
869 if( sscanf(chLine,
"%li\t%le", &iElec, &energyWN ) != 2 )
871 fprintf(
ioQQQ,
"failed to read correct number of data values from %s\n", chPath );
887 const char* cdDATAFILE[
N_ELEC] =
891 "dissprob_C_plus.dat",
892 "dissprob_C_minus.dat",
893 "dissprob_B_primed.dat",
894 "dissprob_D_plus.dat",
895 "dissprob_D_minus.dat"
906 strcpy( chPath,
path.c_str() );
908 strcat( chPath, cdDATAFILE[nelec] );
914 fprintf(
ioQQQ,
" H2_ReadDissprob could not read first line of %s\n", cdDATAFILE[nelec]);
919 long n1 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
920 long n2 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
921 long n3 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
925 if( ( n1 != 3 ) || ( n2 != 2 ) || ( n3 != 11 ) )
928 " H2_ReadDissprob: the version of %s is not the current version.\n", cdDATAFILE[nelec] );
930 " I expected to find the number 3 2 11 and got %li %li %li instead.\n" ,
932 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
936 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
941 if( chLine[0]==
'\n' || chLine[0]==
'\0' || chLine[0]==
' ' )
947 sscanf(chLine,
"%li\t%li\t%le\t%le",
962 ( iRot >
nRot_hi[nelec][iVib] ) )
980 long int i, n1, n2, n3, iVib , iRot;
984 const bool lgH2HMINUS_PRT =
false;
990 strcpy( chPath,
path.c_str() );
992 strcat( chPath,
"hminus_deposit.dat" );
998 fprintf(
ioQQQ,
" H2_Read_hminus_distribution could not read first line of %s\n", chPath );
1004 n1 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
1005 n2 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
1006 n3 = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
1010 if( ( n1 != 2 ) || ( n2 != 10 ) || ( n3 != 17 ) )
1013 " H2_Read_hminus_distribution: the version of %s is not the current version.\n", chPath );
1015 " I expected to find the number 2 10 17 and got %li %li %li instead.\n" ,
1017 fprintf(
ioQQQ,
"Here is the line image:\n==%s==\n", chLine );
1022 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) == NULL )
1025 while( chLine[0]==
'#' )
1027 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) == NULL )
1038 sscanf(chLine,
"%li\t%li\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf",
1039 &iVib ,&iRot , &ener, &a[0],&a[1],&a[2] , &a[3],&a[4],&a[5] ,&a[6]
1049 if( lgH2HMINUS_PRT )
1055 if( lgH2HMINUS_PRT )
1058 if( lgH2HMINUS_PRT )
1061 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) == NULL )
1063 while( chLine[0]==
'#' )
1065 if(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) == NULL )
1071 if( lgH2HMINUS_PRT )
1084 for( iVib=0; iVib<=
nVib_hi[0]; ++iVib )
1095 if( lgH2HMINUS_PRT )
1099 for( iVib=0; iVib<=
nVib_hi[0]; ++iVib )
1131 " H2_Punch_line_data ALL option not implemented in H2_Punch_line_data yet 1\n" );
1136 fprintf( ioPUN,
"#Eu\tVu\tJu\tEl\tVl\tJl\tWL\tgl\tgu\tgf\tA\tCS\tn(crt)\n" );
1140 if( (*tr).ipCont() <= 0 )
1142 (*tr).Coll().col_str() = 0.;
1146 fprintf(ioPUN,
"%2li\t%2li\t%2li\t%2li\t%2li\t%2li\t",
1147 (*Hi).n(), (*Hi).v(), (*Hi).J(),
1148 (*Lo).n(), (*Lo).v(), (*Lo).J() );
1168 if( (*tr).ipCont() <= 0 )
1181 char chBranch[5] = {
'O',
'P',
'Q',
'R',
'S'};
1183 int ip = 2 + (iRotHi - iRotLo);
1186 fprintf(
ioQQQ,
" chMolBranch called with insane iRotHi=%li iRotLo=%li ip=%i\n",
1187 iRotHi , iRotLo , ip );
1191 return( chBranch[ip] );
1201 fprintf( io,
"%s model is not enabled. This save command is therefore disabled.\n",
label.c_str() );
1210 if( (strcmp( chJOB ,
"H2po" ) == 0) && (strcmp(chTime,
"LAST") == 0) &&
1219 long LimVib, LimRot;
1234 fprintf(io,
"%i\t%i\t%.3e\tortho\n",
1238 fprintf(io,
"%i\t%i\t%.3e\tpara\n",
1242 fprintf(io,
"%i\t%i\t%.3e\ttotal\n",
1248 for( iVibHi=0; iVibHi<=LimVib; ++iVibHi )
1253 LimRot = (long)
MIN2(
1258 LimRot =
nRot_hi[iElecHi][iVibHi];
1268 for( i=0; i<=LimRot; ++i )
1275 for( iRotHi=
Jlowest[iElecHi]; iRotHi<=LimRot; ++iRotHi )
1285 for( iRotHi=
Jlowest[iElecHi]; iRotHi<=LimRot; ++iRotHi )
1290 const char chlgPara[2]={
'P',
'O'};
1291 const long ipHi =
ipEnergySort[iElecHi][iVibHi][iRotHi];
1294 fprintf(io,
"%li\t%li\t%c\t%.1f\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
1298 chlgPara[
H2_lgOrtho[iElecHi][iVibHi][iRotHi]],
1330 else if( (strcmp( chJOB ,
"H2po" ) == 0) && (strcmp(chTime,
"LAST") != 0) &&
1343 long LimVib, LimRot;
1351 LimVib =
nRot_hi[iElecHi][iVibHi];
1361 LimRot =
nRot_hi[iElecHi][iVibHi];
1363 for( iVibHi = 0; iVibHi<=LimVib; ++iVibHi )
1366 long int LimRotVib =
MIN2( LimRot ,
nRot_hi[iElecHi][iVibHi] );
1367 for(
long iRotHi=
Jlowest[iElecHi]; iRotHi<=LimRotVib; ++iRotHi )
1378 else if( (strcmp( chJOB ,
"H2cl" ) == 0) && (strcmp(chTime,
"LAST") == 0) )
1383 long LimVib, LimRot;
1398 fprintf(io,
"%i\t%i\t%.3e\tortho\n",
1402 fprintf(io,
"%i\t%i\t%.3e\tpara\n",
1407 fprintf(io,
"%i\t%i\t%.3e\ttotal\n",
1413 for( iVibHi=0; iVibHi<=LimVib; ++iVibHi )
1424 LimRot =
nRot_hi[iElecHi][iVibHi];
1434 for( i=0; i<=LimRot; ++i )
1441 for( iRotHi=
Jlowest[iElecHi]; iRotHi<=LimRot; ++iRotHi )
1451 for( iRotHi=
Jlowest[iElecHi]; iRotHi<=LimRot; ++iRotHi )
1453 fprintf(io,
"%li\t%li\t%.1f\t%.3e\t%.3e\t%.3e\t%.3e\n",
1469 else if( (strcmp(chJOB ,
"H2pd" ) == 0) && (strcmp(chTime,
"LAST") != 0) )
1473 fprintf(io,
"%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
1486 else if( (strcmp(chJOB ,
"H2cm" ) == 0) && (strcmp(chTime,
"LAST") != 0) )
1489 fprintf(io,
"%.5e\t%.5e\t%.5e\n",
1499 else if( (strcmp(chJOB ,
"H2co" ) == 0) && (strcmp(chTime,
"LAST") != 0) )
1502 fprintf(io,
"%.5e\t%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.5e\n",
1525 else if( (strcmp(chJOB ,
"H2le" ) == 0) && (strcmp(chTime,
"LAST") == 0) )
1537 for(
long int ipLo=0; ipLo<ipHi; ++ipLo )
1548 Csum[nColl] += H2cr[nColl];
1552 fprintf(io,
"%li\t%li\t%.2f\t%li\t%.3e",
1559 fprintf(io,
"\t%.3e",Csum[nColl]);
1564 else if( (strcmp(chJOB ,
"H2ra" ) == 0) && (strcmp(chTime,
"LAST") != 0) )
1567 double sumpop = 0. , sumlife = 0.;
1576 if( (*Lo).n() > 0 || (*Lo).v() > 0 )
1578 sumlife += (*tr).Emis().pump() * (*(*tr).Lo()).Pop();
1579 sumpop += (*(*tr).Lo()).Pop();
1587 "%.5e\t%.3e\t%.3e\t%.3e\t%li",
1600 "\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e",
1623 "\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e",
1630 sumlife/
SDIV( sumpop ) ,
1636 "\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
1644 else if( (strcmp(chJOB ,
"H2so" ) == 0) && (strcmp(chTime,
"LAST") != 0) )
1647 const int nSOL = 100;
1649 long int jlosave[nSOL] , ivlosave[nSOL],
1650 iehisave[nSOL] ,jhisave[nSOL] , ivhisave[nSOL],
1654 realnum fsave[nSOL], wlsave[nSOL];
1671 sum += (*(*tr).Lo()).Pop() * (*tr).Emis().pump();
1678 const double frac = 0.01;
1685 one = (*(*tr).Lo()).Pop() * (*tr).Emis().pump();
1686 if( one/sum > frac && nsave<nSOL)
1689 fsave[nsave] = (
realnum)(one/sum);
1690 jlosave[nsave] = (*Lo).J();
1691 ivlosave[nsave] = (*Lo).v();
1692 jhisave[nsave] = (*Hi).J();
1693 ivhisave[nsave] = (*Hi).v();
1694 iehisave[nsave] = (*Hi).n();
1695 wlsave[nsave] = (*tr).WLAng();
1718 fprintf(io,
"\t%.3f\t%.3f\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e",
1729 for(
long i=0; i<nsave; ++i )
1731 long ip = ipOrdered[i];
1733 fprintf(io,
"\t%li\t%li\t%li\t%li\t%li\t%.3f\t%.3f",
1734 iehisave[ip],ivhisave[ip],jhisave[ip],ivlosave[ip] , jlosave[ip] , fsave[ip] , wlsave[ip] );
1741 else if( (strcmp(chJOB ,
"H2te" ) == 0) && (strcmp(chTime,
"LAST") != 0) )
1744 double pop_ratio10,pop_ratio20,pop_ratio30,pop_ratio31,pop_ratio40;
1745 double T10,T20,T30,T31,T40;
1747 double T10_sum,T20_sum,T30_sum,T31_sum,T40_sum;
1748 double pop_ratio20_sum,pop_ratio30_sum,pop_ratio31_sum,pop_ratio40_sum;
1751 double pop0 =
states[0].Pop();
1752 double pop1 =
states[1].Pop();
1753 double pop2 =
states[2].Pop();
1754 double pop3 =
states[3].Pop();
1755 double pop4 =
states[4].Pop();
1757 double energyK =
states[1].energy().K() -
states[0].energy().K();
1759 pop_ratio10 = pop1/
SDIV(pop0);
1765 energyK =
states[2].energy().K() -
states[0].energy().K();
1766 pop_ratio20 = pop2/
SDIV(pop0);
1770 T20_sum = -energyK/log(
SDIV(pop_ratio20_sum) *
states[0].g()/
states[2].g());
1772 energyK =
states[3].energy().K() -
states[0].energy().K();
1773 pop_ratio30 = pop3/
SDIV(pop0);
1777 T30_sum = -energyK/log(
SDIV(pop_ratio30_sum) *
states[0].g()/
states[3].g());
1779 energyK =
states[3].energy().K() -
states[1].energy().K();
1780 pop_ratio31 = pop3/
SDIV(pop1);
1784 T31_sum = -energyK/log(
SDIV(pop_ratio31_sum) *
states[1].g()/
states[3].g());
1786 energyK =
states[4].energy().K() -
states[0].energy().K();
1787 pop_ratio40 = pop4/
SDIV(pop0);
1791 T40_sum = -energyK/log(
SDIV(pop_ratio40_sum) *
states[0].g()/
states[4].g());
1810 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n" ,
1819 T10,T20,T30,T31,T40,
1823 else if( (strcmp(chJOB ,
"H2ln" ) == 0) && (strcmp(chTime,
"LAST") == 0) )
1856 long iElecHi = (*Hi).n();
1857 long iVibHi = (*Hi).v();
1858 long iRotHi = (*Hi).J();
1859 long iElecLo = (*Lo).n();
1860 long iVibLo = (*Lo).v();
1861 long iRotLo = (*Lo).J();
1864 if(
H2_SaveLine[iElecHi][iVibHi][iRotHi][iElecLo][iVibLo][iRotLo] > thresh )
1868 double wl = (*tr).WLAng()/1e4;
1869 fprintf(io,
"%li-%li %c(%li)", iVibHi, iVibLo,
chMolBranch( iRotHi, iRotLo ), iRotLo );
1870 fprintf( io,
"\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld", iElecHi , iVibHi , iRotHi , iElecLo , iVibLo , iRotLo);
1872 fprintf( io,
"\t%.7f\t", wl );
1874 prt_wl( io , (*tr).WLAng() );
1878 H2_SaveLine[iElecHi][iVibHi][iRotHi][iElecLo][iVibLo][iRotLo]*renorm );
1880 fprintf( io,
"\t%.3f", (*Hi).energy().K() );
1882 fprintf( io,
"\t%.3e", (*tr).Emis().Aul() * (*tr).EnergyErg() * (*(*tr).Hi()).g() );
1888 else if( (strcmp(chJOB ,
"H2sp" ) == 0) )
1890 fprintf( io,
"PUT SOMETHING HERE!\n" );
1914 return h2.
getLine( iElecHi, iVibHi, iRotHi, iElecLo, iVibLo, iRotLo, relint, absint );
1917 long int diatomics::getLine(
long iElecHi,
long iVibHi,
long iRotHi,
long iElecLo,
long iVibLo,
long iRotLo,
double *relint,
double *absint )
1927 if( iElecHi!=0 || iElecLo!=0 )
1957 *relint =
H2_SaveLine[iElecHi][iVibHi][iRotHi][iElecLo][iVibLo][iRotLo]/
1966 if(
H2_SaveLine[iElecHi][iVibHi][iRotHi][iElecLo][iVibLo][iRotLo] > 0. )
1968 *absint =
H2_SaveLine[iElecHi][iVibHi][iRotHi][iElecLo][iVibLo][iRotLo] *
1988 const char *cdDATAFILE =
"lte_cooling.dat";
1995 strcpy( chPath,
path.c_str() );
1997 strcat( chPath, cdDATAFILE );
1998 FILE * ioDATA =
open_data( chPath ,
"r" );
2004 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
2007 if( chLine[0]==
'#' )
2009 if( chLine[0]==
'\n' || chLine[0]==
'\0' || chLine[0]==
' ' )
2013 if( sscanf(chLine,
"%lf\t%le", &temp, &cool) != 2 )
2027 enum { DEBUG_LOC =
false };
2030 for(
int i = 0; i < nlines; i++ )
2032 fprintf(stdout,
"%i\t %f\t %e\n",
multi_arr< double, 2 > H2_rad_rate_in
char chH2ColliderLabels[N_X_COLLIDER][chN_X_COLLIDER]
static realnum thresh_punline_h2
iterator begin(size_type i1)
multi_arr< double, 2 > H2_col_rate_out
bool nMatch(const char *chKey) const
multi_arr< realnum, 3 > H2_dissprob
realnum punarg[LIMPUN][3]
void prt_wl(FILE *ioOUT, realnum wl)
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
double H2_DissocEnergies[N_ELEC]
void H2_Punch_line_data(FILE *ioPUN, bool lgDoAll)
const int FILENAME_PATH_LENGTH_2
NORETURN void TotalInsanity(void)
vector< double > LTE_cool
size_t sncatf(char *buf, size_t bufSize, const char *fmt,...)
void H2_ParseSave(Parser &p, ostringstream &chHeader)
multi_arr< double, 2 > pops_per_vib
void Save1LineData(const TransitionProxy &t, FILE *io, bool lgCS_2)
valarray< long > ipVib_H2_energy_sort
double H2_Solomon_dissoc_rate_TH85_H2s
void H2_Prt_column_density(FILE *ioMEAN)
vector< double > LTE_Temp
double H2_Solomon_dissoc_rate_BD96_H2g
multi_arr< realnum, 3 >::const_iterator mr3ci
molezone * findspecieslocal(const char buf[])
void H2_Read_hminus_distribution(void)
double H2_Solomon_dissoc_rate_BD96_H2s
double H2_Solomon_dissoc_rate_TH85_H2g
double Solomon_dissoc_rate_g
multi_arr< realnum, 3 > CollRateCoeff
const double *const dense_total
multi_arr< long int, 3 > ipEnergySort
multi_arr< double, 3 > H2_old_populations
double LTE_Cooling_per_H2()
multi_arr< realnum, 3 > H2_disske
bool operator<(const level_tmp &second) const
multi_arr< realnum, 3 > H2_X_hminus_formation_distribution
double energy(const genericState &gs)
long int nLevels_per_elec[N_ELEC]
long int cdH2_Line(long int iElecHi, long int iVibHi, long int iRotHi, long int iElecLo, long int iVibLo, long int iRotLo, double *relint, double *absint)
multi_arr< double, 3 > H2_populations_LTE
valarray< class molezone > species
multi_arr< realnum, 2 > H2_X_colden_LTE
multi_arr< bool, 2 > lgH2_radiative
void H2_PrtDepartCoef(void)
multi_arr< realnum, 6 > H2_SaveLine
multi_arr< double, 3 > H2_rad_rate_out
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
realnum GetDopplerWidth(realnum massAMU)
double column(const genericState &gs)
double RandGauss(double xMean, double s)
realnum gas_phase[LIMELM]
realnum UV_Cont_rel2_Draine_DB96_depth
realnum AtomicWeight[LIMELM]
void PutLine(const TransitionProxy &t, const char *chComment, const char *chLabelTemp, const ExtraInten &extra)
double levels(const genericState &gs)
void H2_ReadTransprob(long int nelec, TransitionList &trans)
STATIC char chMolBranch(long iRotHi, long int iRotLo)
long int getLine(long iElecHi, long iVibHi, long iRotHi, long iElecLo, long iVibLo, long iRotLo, double *relint, double *absint)
void H2_PunchLineStuff(FILE *io, realnum xLimit, long index)
#define DEBUG_ENTRY(funcname)
realnum UV_Cont_rel2_Habing_spec_depth
void H2_Read_LTE_cooling_per_H2()
double Solomon_dissoc_rate_s
multi_arr< long int, 2 > ipTransitionSort
void H2_PunchDo(FILE *io, char chJOB[], const char chTime[], long int ipPun)
diatomics * whichDiatomToPrint[LIMPUN]
double getNumberDefault(const char *chDesc, double fdef)
double Solomon_elec_decay_g
realnum UV_Cont_rel2_Habing_TH85_depth
TransitionList::iterator rad_end
int fprintf(const Output &stream, const char *format,...)
void H2_ReadDissocEnergies(void)
valarray< long > nRot_hi[N_ELEC]
double pops_per_elec[N_ELEC]
double Solomon_elec_decay_s
sys_float SDIV(sys_float x)
double H2_renorm_chemistry
valarray< long > ipRot_H2_energy_sort
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
t_secondaries secondaries
void set_numLevelsMatrix(long numLevels)
double H2_Solomon_dissoc_rate_ELWERT_H2g
void H2_ReadDissprob(long int nelec)
double getNumberDefaultNegImplLog(const char *chDesc, double fdef)
NORETURN void BadRead(void)
multi_arr< double, 2 > H2_col_rate_in
double rate_h2_form_grains_used_total
void init(const char *label, size_t i)
multi_arr< realnum, 2 > H2_X_colden
void spsort(realnum x[], long int n, long int iperm[], int kflag, int *ier)
void Save1Line(const TransitionProxy &t, FILE *io, realnum xLimit, long index, realnum DopplerWidth)
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
multi_arr< bool, 3 > H2_lgOrtho