13 const char *section =
"Semchem_module";
19 printf(
"\nNumber of aqueous species must be higher then 1.");
26 printf(
"\nTeplota musi byt kladna!");
37 printf(
"\nTeplota pro zadani dGf musi byt kladna!");
44 printf(
"\nEpsilon musi byt kladne!");
48 pString = strcpy(buffer,
OptGetStr(section,
"Error_norm_type",
"Absolute"));
49 if ( pString == NULL )
51 printf(
"\nChybi typ normy!");
71 printf(
"\nTyp normy neni platny!");
76 pString = strcpy(buffer,
OptGetStr(section,
"Scaling",
"No"));
77 if ( pString == NULL )
79 printf(
"\nChybi definice skalovani!");
94 printf(
"\nSkalovani matice neni platne!");
101 printf(
"\nAfi musi byt nezaporne!");
108 printf(
"\nb musi byt kladne!");
115 printf(
"\nPocet casovych kroku musi byt kladny!");
121 i =
OptGetInt(section,
"Number_of_further_species",
"0");
124 printf(
"\nPocet dalsich latek nesmi byt zaporny!");
130 printf (
"Celkovy pocet latek muze byt maximalne %d!\n",
MAX_POC_LATEK);
137 printf(
"\nPocet kroku pomale kinetiky musi byt kladny!");
148 char nazev[30], *pom_buf;
149 const char *separators =
" ,\t";
156 printf (
"Malo pameti!\n");
161 sprintf( nazev,
"Aqueous_species" );
165 strcpy(P_lat[j].nazev,
"");
169 pString = strcpy(buffer,
OptGetStr(nazev,
"dGf",
"<NeplatnyNazev>"));
170 pom_buf = strtok( buffer, separators );
171 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
177 if ( pom_buf == NULL )
179 printf(
"\nChybi dGf %d. latky ve fazi!", j+1);
182 P_lat[j].
dGf = atof(pom_buf);
183 printf(
"\n P_lat[%d].dGf %f\n",j,P_lat[j].dGf);
184 pom_buf = strtok( NULL, separators );
186 if ( pom_buf != NULL )
188 printf(
"\nPrilis mnoho dGf pro latky ve fazi!");
192 pString = strcpy(buffer,
OptGetStr(nazev,
"dHf",
"<NeplatnyNazev>"));
193 pom_buf = strtok( buffer, separators );
194 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
204 if ( pom_buf == NULL )
206 printf(
"\nChybi dHf %d. latky ve fazi!", j+1);
209 P_lat[j].
dHf = atof(pom_buf);
210 pom_buf = strtok( NULL, separators );
212 if ( pom_buf != NULL )
214 printf(
"\nPrilis mnoho dHf pro latky ve fazi!");
218 pString = strcpy(buffer,
OptGetStr(nazev,
"Molar_mass",
"<NeplatnyNazev>"));
219 pom_buf = strtok( buffer, separators );
220 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
226 if ( pom_buf == NULL )
228 printf(
"\nChybi molarni hmotnost %d. latky ve fazi!", j+1);
231 P_lat[j].
M = atof(pom_buf);
232 pom_buf = strtok( NULL, separators );
234 if ( pom_buf != NULL )
236 printf(
"\nPrilis mnoho molarnich hmotnosti pro latky ve fazi!");
240 pString = strcpy(buffer,
OptGetStr(nazev,
"El_charge",
"<NeplatnyNazev>"));
241 pom_buf = strtok( buffer, separators );
242 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
248 if ( pom_buf == NULL )
250 printf(
"\nChybi naboj %d. latky ve fazi!", j+1);
253 P_lat[j].
Q = atoi(pom_buf);
254 pom_buf = strtok( NULL, separators );
256 if ( pom_buf != NULL )
258 printf(
"\nPrilis mnoho naboju pro latky ve fazi!");
273 char nazev[30], *pom_buf;
274 const char* separators =
" ,\t";
275 char *pString = NULL;
282 sprintf( nazev,
"Further_species" );
283 pString = strcpy(buffer,
OptGetStr(nazev,
"Specie_name",
"<NeplatnyNazev>"));
284 pom_buf = strtok( buffer, separators );
285 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
296 if ( pom_buf == NULL )
301 strcpy (P_lat[j].nazev, pom_buf);
302 pom_buf = strtok( NULL, separators );
304 if ( pom_buf != NULL )
306 printf(
"\nPrilis mnoho nazvu dalsich latek!");
311 pString = strcpy(buffer,
OptGetStr(nazev,
"dGf",
"<NeplatnyNazev>"));
312 pom_buf = strtok( buffer, separators );
313 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
319 if ( pom_buf == NULL )
324 P_lat[j].
dGf = atof(pom_buf);
325 pom_buf = strtok( NULL, separators );
327 if ( pom_buf != NULL )
329 printf(
"\nPrilis mnoho dGf pro dalsi latky!");
333 pString = strcpy(buffer,
OptGetStr(nazev,
"dHf",
"<NeplatnyNazev>"));
334 pom_buf = strtok( buffer, separators );
335 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
345 if ( pom_buf == NULL )
350 P_lat[j].
dHf = atof(pom_buf);
351 pom_buf = strtok( NULL, separators );
353 if ( pom_buf != NULL )
355 printf(
"\nPrilis mnoho dHf pro dalsi latky!");
359 pString = strcpy(buffer,
OptGetStr(nazev,
"Molar_mass",
"<NeplatnyNazev>"));
360 pom_buf = strtok( buffer, separators );
361 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
367 if ( pom_buf == NULL )
369 printf(
"\nChybi molarni hmotnost %d. dalsi latky!", j+1-
G_prm.
pocet_latek);
372 P_lat[j].
M = atof(pom_buf);
373 pom_buf = strtok( NULL, separators );
375 if ( pom_buf != NULL )
377 printf(
"\nPrilis mnoho molarnich hmotnosti pro dalsi latky!");
381 pString = strcpy(buffer,
OptGetStr(nazev,
"Activity",
"<NeplatnyNazev>"));
382 pom_buf = strtok( buffer, separators );
383 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
389 if ( pom_buf == NULL )
395 pom_buf = strtok( NULL, separators );
397 if ( pom_buf != NULL )
399 printf(
"\nPrilis mnoho aktivit pro dalsi latky!");
409 char nazev[30], *pom_buf;
410 const char* separators =
" ,\t";
412 double max_poloc_rozp;
417 sprintf( nazev,
"Reaction_%d", i );
418 strcpy(buffer,
OptGetStr(nazev,
"Reaction_type",
"<NeplatnyNazev>")); printf(
"probehlo zjisteni typu reakce %d: %s\n",i, buffer);
419 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
break;
424 printf(
"\nNeni definovana zadna reakce!");
431 printf (
"Malo pameti!\n");
438 max_poloc_rozp = 0.0;
441 sprintf( nazev,
"Reaction_%d", i+1 );
442 sprintf(P_che[i].nazev,
"Reaction_%d",i+1);
444 strcpy(buffer,
OptGetStr(nazev,
"Reaction_type",
"<NeplatnyTyp>"));
445 pom_buf = strtok( buffer, separators );
447 if ( strcmp( pom_buf,
"Radioactive_decay" ) == 0 ) P_che[i].
typ_reakce = 4;
448 if ( strcmp( pom_buf,
"radioactive_decay" ) == 0 ) P_che[i].
typ_reakce = 4;
449 if ( strcmp( pom_buf,
"Decay" ) == 0 ) P_che[i].
typ_reakce = 4;
450 if ( strcmp( pom_buf,
"decay" ) == 0 ) P_che[i].
typ_reakce = 4;
451 if ( strcmp( pom_buf,
"RD" ) == 0 ) P_che[i].
typ_reakce = 4;
452 if ( strcmp( pom_buf,
"rd" ) == 0 ) P_che[i].
typ_reakce = 4;
453 if ( strcmp( pom_buf,
"4" ) == 0 ) P_che[i].
typ_reakce = 4;
454 if ( strcmp( pom_buf,
"Slow_kinetics" ) == 0 ) P_che[i].
typ_reakce = 3;
455 if ( strcmp( pom_buf,
"slow_kinetics" ) == 0 ) P_che[i].
typ_reakce = 3;
456 if ( strcmp( pom_buf,
"3" ) == 0 ) P_che[i].
typ_reakce = 3;
457 if ( strcmp( pom_buf,
"Kinetics" ) == 0 ) P_che[i].
typ_reakce = 1;
458 if ( strcmp( pom_buf,
"kinetics" ) == 0 ) P_che[i].
typ_reakce = 1;
459 if ( strcmp( pom_buf,
"1" ) == 0 ) P_che[i].
typ_reakce = 1;
460 if ( strcmp( pom_buf,
"Equilibrium" ) == 0 ) P_che[i].
typ_reakce = 0;
461 if ( strcmp( pom_buf,
"equilibrium" ) == 0 ) P_che[i].
typ_reakce = 0;
462 if ( strcmp( pom_buf,
"0" ) == 0 ) P_che[i].
typ_reakce = 0;
465 printf(
"\nThe type of reaction nr. %d is not valid!", i);
486 strcpy(buffer,
OptGetStr(nazev,
"Stoichiometry",
""));
487 pom_buf = strtok( buffer, separators );
490 if ( pom_buf == NULL )
492 printf(
"\nChybi %d. stechometricky koeficient v %d. rovnici!", j+1, i+1);
496 printf(
"\nP_che[%d].stech_koef_p[%d]: %d",i,j,P_che[i].
stech_koef_p[j]);
497 pom_buf = strtok( NULL, separators );
499 if ( pom_buf != NULL )
501 printf(
"\nV %d. rovnici je prilis mnoho stechiometrickych koeficientu!", i+1);
507 P_che[i].
K =
OptGetDbl(nazev,
"Kinetic_constant",
"0.0");
508 if(P_che[i].
typ_reakce==1)printf(
"\nKineticka konstanta v %d. rovnici ma hodnotu %f", i+1, P_che[i].
K);
509 if ( P_che[i].K <= 0.0 )
511 printf(
"\nKineticka konstanta v %d. rovnici neni kladna!", i+1);
515 strcpy(buffer,
OptGetStr(nazev,
"Order_of_reaction",
""));
516 pom_buf = strtok( buffer, separators );
522 if( pom_buf == NULL )
524 printf(
"\nChybi %d. mocnina pro kinetiku %d. rovnice!", j+1, i+1);
527 P_che[i].
exponent[j] = atof( pom_buf );
528 printf(
"\nP_che[%d].exponent[%d]: %f",i,j,P_che[i].
exponent[j]);
529 pom_buf = strtok( NULL, separators );
532 if ( pom_buf != NULL )
534 printf(
"\nV %d. rovnici je prilis mnoho exponentu pro kinetiku!", i+1);
541 P_che[i].
K =
OptGetDbl(nazev,
"Equilibrium_constant",
"-1.0");
554 P_che[i] = P_che[i+1];
555 P_che[i+1] = pom_che;
566 ctiich_obecne(); printf(
"probehla funkce ctiich_obecne()\n");
569 ctiich_reakce(); printf(
"probehla funkce ctiich_reakce()\n");