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