00001
00002
00003
00004 #include "cddefines.h"
00005 #include "hmi.h"
00006 #include "mole.h"
00007 #include "h2.h"
00008 #include "h2_priv.h"
00009 #include "parser.h"
00010 #include "thirdparty.h"
00011
00012
00013 void ParseAtomH2(Parser &p )
00014 {
00015 long int j;
00016
00017 DEBUG_ENTRY( "ParseAtomH2()" );
00018
00019
00020
00021
00022 j = (long int)p.FFmtRead();
00023 if( j != 2 )
00024 {
00025 fprintf( ioQQQ, " Something is wrong with the order of the numbers on this line.\n" );
00026 fprintf( ioQQQ, " The first number I encounter should be a 2.\n Sorry.\n" );
00027 cdEXIT(EXIT_FAILURE);
00028 }
00029
00030
00031 h2.lgH2ON = true;
00032
00033 if( p.nMatch("LEVE") )
00034 {
00035
00036
00037
00038
00039
00040 if( !lgH2_READ_DATA )
00041 {
00042 mole.n_h2_elec_states = (long int)p.FFmtRead();
00043 if( p.lgEOL() )
00044 {
00045 if( p.nMatch("LARG") )
00046 {
00047
00048 mole.n_h2_elec_states = N_H2_ELEC;
00049 }
00050 else
00051 {
00052 p.NoNumb("number of electronic levels");
00053 }
00054 }
00055
00056
00057 if( mole.n_h2_elec_states < 3 )
00058 {
00059 fprintf( ioQQQ, " This would be too few electronic levels - resetting to 3.\n" );
00060 mole.n_h2_elec_states = 3;
00061 }
00062
00063 else if( mole.n_h2_elec_states > N_H2_ELEC )
00064 {
00065 fprintf( ioQQQ,
00066 " This would be too many levels, the limit is %i.\n" ,
00067 N_H2_ELEC);
00068 cdEXIT(EXIT_FAILURE);
00069 }
00070 }
00071 }
00072
00073 else if( p.nMatch("LIMI") )
00074 {
00075
00076
00077 mole.H2_to_H_limit = p.FFmtRead();
00078 if( p.lgEOL() )
00079 {
00080
00081 if( p.nMatch( " OFF" ) )
00082 {
00083
00084 mole.H2_to_H_limit = -1.;
00085 }
00086 else
00087 {
00088 p.NoNumb( "limit to the H2 / Htot ratio" );
00089 }
00090 }
00091 else
00092 {
00093
00094
00095 if( mole.H2_to_H_limit <= 0. )
00096 mole.H2_to_H_limit = pow(10., mole.H2_to_H_limit);
00097 }
00098 }
00099 else if( p.nMatch("GBAR" ) )
00100 {
00101
00102
00103 if( p.nMatch(" OFF" ) )
00104 {
00105 mole.lgColl_gbar = false;
00106 }
00107 else if( p.nMatch(" ON " ) )
00108 {
00109 mole.lgColl_gbar = true;
00110 }
00111 else
00112 {
00113 fprintf( ioQQQ,
00114 " The gbar approximation must be off (\" OFF\") or on (\" ON \").\n");
00115 cdEXIT(EXIT_FAILURE);
00116 }
00117 }
00118
00119 else if( p.nMatch("COLL" ) )
00120 {
00121
00122 if( p.nMatch("DISS" ) )
00123 {
00124
00125 if( p.nMatch(" ON " ) )
00126 {
00127
00128 mole.lgColl_dissoc_coll = true;
00129 }
00130 else
00131 {
00132
00133 mole.lgColl_dissoc_coll = false;
00134 }
00135 }
00136
00137
00138
00139
00140 else if( p.nMatch("ORTH" ) && p.nMatch("PARA" ) )
00141 {
00142
00143 if( p.nMatch(" ON " ) )
00144 {
00145
00146 mole.lgH2_ortho_para_coll_on = true;
00147 }
00148 else
00149 {
00150
00151
00152 mole.lgH2_ortho_para_coll_on = false;
00153 }
00154 }
00155
00156
00157 else if( p.nMatch("GRAI" ) )
00158 {
00159
00160 if( p.nMatch(" ON" ) )
00161 {
00162
00163 mole.lgH2_grain_deexcitation = true;
00164 }
00165 else
00166 {
00167
00168 mole.lgH2_grain_deexcitation = false;
00169 }
00170 }
00171 else if( p.nMatch(" HE " ) )
00172 {
00173
00174
00175
00176 if( p.nMatch(" NEW" ) || p.nMatch("ORNL" ) )
00177 {
00178
00179 mole.lgH2_He_ORNL = true;
00180 }
00181 else if( p.nMatch(" OLD" ) || p.nMatch("BOUR" ) )
00182 {
00183
00184
00185
00186 mole.lgH2_He_ORNL = false;
00187 }
00188 else
00189 {
00190 fprintf( ioQQQ,
00191 " I did not find a keyword on this ATOM H2 HE command - I know about the keys ORNL and Le BOURlot\n");
00192 cdEXIT(EXIT_FAILURE);
00193 }
00194 }
00195
00196
00197 else if( p.nMatch("ORH2" ) )
00198 {
00199
00200
00201
00202 if( p.nMatch("ORNL" ) )
00203 {
00204
00205 mole.lgH2_ORH2_ORNL = true;
00206 }
00207 else if( p.nMatch("BOUR" ) )
00208 {
00209
00210
00211
00212 mole.lgH2_ORH2_ORNL = false;
00213 }
00214 else
00215 {
00216 fprintf( ioQQQ,
00217 " I did not find a keyword on this ATOM H2 ohH2 command - I know about the keys ORNL and Le BOURlot\n");
00218 cdEXIT(EXIT_FAILURE);
00219 }
00220 }
00221
00222 else if( p.nMatch("PAH2" ) )
00223 {
00224
00225
00226
00227 if( p.nMatch("ORNL" ) )
00228 {
00229
00230 mole.lgH2_PAH2_ORNL = true;
00231 }
00232 else if( p.nMatch("BOUR" ) )
00233 {
00234
00235
00236
00237 mole.lgH2_PAH2_ORNL = false;
00238 }
00239 else
00240 {
00241 fprintf( ioQQQ,
00242 " I did not find a keyword on this ATOM H2 paH2 command - I know about the keys ORNL and Le BOURlot\n");
00243 cdEXIT(EXIT_FAILURE);
00244 }
00245 }
00246
00247 else
00248 {
00249
00250 if( p.nMatch(" ON " ) )
00251 {
00252
00253 mole.lgColl_deexec_Calc = true;
00254 }
00255 else
00256 {
00257
00258 mole.lgColl_deexec_Calc = false;
00259 }
00260 }
00261 }
00262
00263
00264 else if( p.nMatch("MATR" ) && !p.nMatch("TRAC" ) )
00265 {
00266
00267
00268 nXLevelsMatrix = (long)p.FFmtRead();
00269 if( p.nMatch(" ALL") )
00270 {
00271
00272
00273
00274
00275 nXLevelsMatrix = -1;
00276 }
00277 else if( p.lgEOL() && !(p.nMatch(" OFF") || p.nMatch("NONE") ) )
00278 {
00279
00280 fprintf( ioQQQ,
00281 " The total number of levels used in the matrix solver must be entered, or keywords ALL or NONE entered.\n Sorry.\n");
00282 cdEXIT(EXIT_FAILURE);
00283 }
00284
00285
00286
00287 }
00288 else if( p.nMatch(" LTE" ) )
00289 {
00290
00291 mole.lgH2_LTE = true;
00292 }
00293
00294 else if( p.nMatch("TRAC" ) )
00295 {
00296
00297
00298
00299
00300
00301
00302
00303 if( p.nMatch("FINA" ) )
00304 {
00305
00306 mole.nH2_TRACE = mole.nH2_trace_final;
00307 }
00308 else if( p.nMatch("ITER" ) )
00309 {
00310
00311 mole.nH2_TRACE = mole.nH2_trace_iterations;
00312 }
00313 else if( p.nMatch("FULL" ) )
00314 {
00315
00316 mole.nH2_TRACE = mole.nH2_trace_full;
00317 }
00318 else if( p.nMatch("MATR" ) )
00319 {
00320
00321 mole.nH2_TRACE = mole.nH2_trace_matrix;
00322 }
00323 else
00324 {
00325
00326 mole.nH2_TRACE = mole.nH2_trace_full;
00327 }
00328 }
00329 else if( p.nMatch("NOIS" ) )
00330 {
00331 unsigned int iseed;
00332
00333 mole.lgH2_NOISE = true;
00334 mole.lgH2_NOISECOSMIC = true;
00335
00336
00337 mole.xMeanNoise = p.FFmtRead();
00338 if( p.lgEOL() )
00339 mole.xMeanNoise = 0.;
00340
00341
00342 mole.xSTDNoise = p.FFmtRead();
00343 if( p.lgEOL() )
00344 mole.xSTDNoise = 0.5;
00345
00346
00347
00348 iseed = (unsigned int)p.FFmtRead();
00349
00350 if( iseed > 0 )
00351 {
00352
00353 init_genrand( iseed );
00354 }
00355 else
00356 {
00357 init_genrand( (unsigned)time( NULL ) );
00358 }
00359 }
00360
00361 else if( p.nMatch("THER" ) )
00362 {
00363
00364
00365 if( p.nMatch("SIMP" ) )
00366 {
00367 hmi.lgH2_Thermal_BigH2 = false;
00368 }
00369 else if( p.nMatch("FULL" ) )
00370 {
00371
00372 hmi.lgH2_Thermal_BigH2 = true;
00373 }
00374 }
00375
00376 else if( p.nMatch("CHEM" ) )
00377 {
00378
00379
00380
00381 if( p.nMatch("SIMP" ) )
00382 {
00383 hmi.lgH2_Chemistry_BigH2 = false;
00384 }
00385 else if( p.nMatch("FULL" ) )
00386 {
00387
00388 hmi.lgH2_Chemistry_BigH2 = true;
00389 }
00390 }
00391
00392
00393
00394 return;
00395 }