30 const char *section =
"Semchem_module";
36 printf(
"\nNumber of aqueous species must be higher then 1.");
43 printf(
"\nTeplota musi byt kladna!");
54 printf(
"\nTeplota pro zadani dGf musi byt kladna!");
61 printf(
"\nEpsilon musi byt kladne!");
65 pString = strcpy(buffer,
OptGetStr(section,
"Error_norm_type",
"Absolute"));
66 if ( pString == NULL )
68 printf(
"\nChybi typ normy!");
88 printf(
"\nTyp normy neni platny!");
93 pString = strcpy(buffer,
OptGetStr(section,
"Scaling",
"No"));
94 if ( pString == NULL )
96 printf(
"\nChybi definice skalovani!");
111 printf(
"\nSkalovani matice neni platne!");
118 printf(
"\nAfi musi byt nezaporne!");
125 printf(
"\nb musi byt kladne!");
132 printf(
"\nPocet casovych kroku musi byt kladny!");
138 i =
OptGetInt(section,
"Number_of_further_species",
"0");
141 printf(
"\nPocet dalsich latek nesmi byt zaporny!");
154 printf(
"\nPocet kroku pomale kinetiky musi byt kladny!");
165 char nazev[30], *pom_buf;
166 const char *separators =
" ,\t";
172 printf (
"Malo pameti!\n");
177 sprintf( nazev,
"Aqueous_species" );
181 strcpy(P_lat[j].nazev,
"");
185 strcpy(buffer,
OptGetStr(nazev,
"dGf",
"<NeplatnyNazev>"));
186 pom_buf = strtok( buffer, separators );
187 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
193 if ( pom_buf == NULL )
195 printf(
"\nChybi dGf %d. latky ve fazi!", j+1);
198 P_lat[j].
dGf = atof(pom_buf);
199 printf(
"\n P_lat[%d].dGf %f\n",j,P_lat[j].dGf);
200 pom_buf = strtok( NULL, separators );
202 if ( pom_buf != NULL )
204 printf(
"\nPrilis mnoho dGf pro latky ve fazi!");
208 strcpy(buffer,
OptGetStr(nazev,
"dHf",
"<NeplatnyNazev>"));
209 pom_buf = strtok( buffer, separators );
210 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
220 if ( pom_buf == NULL )
222 printf(
"\nChybi dHf %d. latky ve fazi!", j+1);
225 P_lat[j].
dHf = atof(pom_buf);
226 pom_buf = strtok( NULL, separators );
228 if ( pom_buf != NULL )
230 printf(
"\nPrilis mnoho dHf pro latky ve fazi!");
234 strcpy(buffer,
OptGetStr(nazev,
"Molar_mass",
"<NeplatnyNazev>"));
235 pom_buf = strtok( buffer, separators );
236 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
242 if ( pom_buf == NULL )
244 printf(
"\nChybi molarni hmotnost %d. latky ve fazi!", j+1);
247 P_lat[j].
M = atof(pom_buf);
248 pom_buf = strtok( NULL, separators );
250 if ( pom_buf != NULL )
252 printf(
"\nPrilis mnoho molarnich hmotnosti pro latky ve fazi!");
256 strcpy(buffer,
OptGetStr(nazev,
"El_charge",
"<NeplatnyNazev>"));
257 pom_buf = strtok( buffer, separators );
258 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
264 if ( pom_buf == NULL )
266 printf(
"\nChybi naboj %d. latky ve fazi!", j+1);
269 P_lat[j].
Q = atoi(pom_buf);
270 pom_buf = strtok( NULL, separators );
272 if ( pom_buf != NULL )
274 printf(
"\nPrilis mnoho naboju pro latky ve fazi!");
289 char nazev[30], *pom_buf;
290 const char* separators =
" ,\t";
297 sprintf( nazev,
"Further_species" );
298 strcpy(buffer,
OptGetStr(nazev,
"Specie_name",
"<NeplatnyNazev>"));
299 pom_buf = strtok( buffer, separators );
300 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
311 if ( pom_buf == NULL )
316 strcpy (P_lat[j].nazev, pom_buf);
317 pom_buf = strtok( NULL, separators );
319 if ( pom_buf != NULL )
321 printf(
"\nPrilis mnoho nazvu dalsich latek!");
326 strcpy(buffer,
OptGetStr(nazev,
"dGf",
"<NeplatnyNazev>"));
327 pom_buf = strtok( buffer, separators );
328 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
334 if ( pom_buf == NULL )
339 P_lat[j].
dGf = atof(pom_buf);
340 pom_buf = strtok( NULL, separators );
342 if ( pom_buf != NULL )
344 printf(
"\nPrilis mnoho dGf pro dalsi latky!");
348 strcpy(buffer,
OptGetStr(nazev,
"dHf",
"<NeplatnyNazev>"));
349 pom_buf = strtok( buffer, separators );
350 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
360 if ( pom_buf == NULL )
365 P_lat[j].
dHf = atof(pom_buf);
366 pom_buf = strtok( NULL, separators );
368 if ( pom_buf != NULL )
370 printf(
"\nPrilis mnoho dHf pro dalsi latky!");
374 strcpy(buffer,
OptGetStr(nazev,
"Molar_mass",
"<NeplatnyNazev>"));
375 pom_buf = strtok( buffer, separators );
376 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
382 if ( pom_buf == NULL )
387 P_lat[j].
M = atof(pom_buf);
388 pom_buf = strtok( NULL, separators );
390 if ( pom_buf != NULL )
392 printf(
"\nPrilis mnoho molarnich hmotnosti pro dalsi latky!");
396 strcpy(buffer,
OptGetStr(nazev,
"Activity",
"<NeplatnyNazev>"));
397 pom_buf = strtok( buffer, separators );
398 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
404 if ( pom_buf == NULL )
410 pom_buf = strtok( NULL, separators );
412 if ( pom_buf != NULL )
414 printf(
"\nPrilis mnoho aktivit pro dalsi latky!");
424 char nazev[30], *pom_buf;
425 const char* separators =
" ,\t";
427 double max_poloc_rozp;
432 sprintf( nazev,
"Reaction_%d", i );
433 strcpy(buffer,
OptGetStr(nazev,
"Reaction_type",
"<NeplatnyNazev>"));
printf(
"probehlo zjisteni typu reakce %d: %s\n",i, buffer);
434 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
break;
439 printf(
"\nNeni definovana zadna reakce!");
446 printf (
"Malo pameti!\n");
453 max_poloc_rozp = 0.0;
456 sprintf( nazev,
"Reaction_%d", i+1 );
457 sprintf(P_che[i].nazev,
"Reaction_%d",i+1);
459 strcpy(buffer,
OptGetStr(nazev,
"Reaction_type",
"<NeplatnyTyp>"));
460 pom_buf = strtok( buffer, separators );
462 if ( strcmp( pom_buf,
"Radioactive_decay" ) == 0 ) P_che[i].
typ_reakce = 4;
463 if ( strcmp( pom_buf,
"radioactive_decay" ) == 0 ) P_che[i].
typ_reakce = 4;
464 if ( strcmp( pom_buf,
"Decay" ) == 0 ) P_che[i].
typ_reakce = 4;
465 if ( strcmp( pom_buf,
"decay" ) == 0 ) P_che[i].
typ_reakce = 4;
466 if ( strcmp( pom_buf,
"RD" ) == 0 ) P_che[i].
typ_reakce = 4;
467 if ( strcmp( pom_buf,
"rd" ) == 0 ) P_che[i].
typ_reakce = 4;
468 if ( strcmp( pom_buf,
"4" ) == 0 ) P_che[i].
typ_reakce = 4;
469 if ( strcmp( pom_buf,
"Slow_kinetics" ) == 0 ) P_che[i].
typ_reakce = 3;
470 if ( strcmp( pom_buf,
"slow_kinetics" ) == 0 ) P_che[i].
typ_reakce = 3;
471 if ( strcmp( pom_buf,
"3" ) == 0 ) P_che[i].
typ_reakce = 3;
472 if ( strcmp( pom_buf,
"Kinetics" ) == 0 ) P_che[i].
typ_reakce = 1;
473 if ( strcmp( pom_buf,
"kinetics" ) == 0 ) P_che[i].
typ_reakce = 1;
474 if ( strcmp( pom_buf,
"1" ) == 0 ) P_che[i].
typ_reakce = 1;
475 if ( strcmp( pom_buf,
"Equilibrium" ) == 0 ) P_che[i].
typ_reakce = 0;
476 if ( strcmp( pom_buf,
"equilibrium" ) == 0 ) P_che[i].
typ_reakce = 0;
477 if ( strcmp( pom_buf,
"0" ) == 0 ) P_che[i].
typ_reakce = 0;
480 printf(
"\nThe type of reaction nr. %d is not valid!", i);
501 strcpy(buffer,
OptGetStr(nazev,
"Stoichiometry",
""));
502 pom_buf = strtok( buffer, separators );
505 if ( pom_buf == NULL )
507 printf(
"\nChybi %d. stechometricky koeficient v %d. rovnici!", j+1, i+1);
512 pom_buf = strtok( NULL, separators );
514 if ( pom_buf != NULL )
516 printf(
"\nV %d. rovnici je prilis mnoho stechiometrickych koeficientu!", i+1);
522 P_che[i].
K =
OptGetDbl(nazev,
"Kinetic_constant",
"0.0");
523 if(P_che[i].
typ_reakce==1)
printf(
"\nKineticka konstanta v %d. rovnici ma hodnotu %f", i+1, P_che[i].
K);
524 if ( P_che[i].K <= 0.0 )
526 printf(
"\nKineticka konstanta v %d. rovnici neni kladna!", i+1);
530 strcpy(buffer,
OptGetStr(nazev,
"Order_of_reaction",
""));
531 pom_buf = strtok( buffer, separators );
536 if( pom_buf == NULL )
538 printf(
"\nChybi %d. mocnina pro kinetiku %d. rovnice!", j+1, i+1);
541 P_che[i].
exponent[j] = atof( pom_buf );
543 pom_buf = strtok( NULL, separators );
546 if ( pom_buf != NULL )
548 printf(
"\nV %d. rovnici je prilis mnoho exponentu pro kinetiku!", i+1);
555 P_che[i].
K =
OptGetDbl(nazev,
"Equilibrium_constant",
"-1.0");
568 P_che[i] = P_che[i+1];
569 P_che[i+1] = pom_che;
int pocet_reakci_pro_matici
void ctiich_latkyvefazi(void)
std::string sprintf(CStringRef format, ArgList args)
double exponent[MAX_POC_LATEK]
long int OptGetInt(const char *section, const char *key, const char *defval)
double OptGetDbl(const char *section, const char *key, const char *defval)
float che_poradi(int typ_reakce, double max, double K)
int stech_koef_p[MAX_POC_LATEK]
void ctiich_dalsilatky(void)
char * OptGetStr(const char *section, const char *key, const char *defval)
Create new string from selected variable from ini file.
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)