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";
155 printf (
"Malo pameti!\n");
160 sprintf( nazev,
"Aqueous_species" );
164 strcpy(P_lat[j].nazev,
"");
168 strcpy(buffer,
OptGetStr(nazev,
"dGf",
"<NeplatnyNazev>"));
169 pom_buf = strtok( buffer, separators );
170 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
176 if ( pom_buf == NULL )
178 printf(
"\nChybi dGf %d. latky ve fazi!", j+1);
181 P_lat[j].
dGf = atof(pom_buf);
182 printf(
"\n P_lat[%d].dGf %f\n",j,P_lat[j].dGf);
183 pom_buf = strtok( NULL, separators );
185 if ( pom_buf != NULL )
187 printf(
"\nPrilis mnoho dGf pro latky ve fazi!");
191 strcpy(buffer,
OptGetStr(nazev,
"dHf",
"<NeplatnyNazev>"));
192 pom_buf = strtok( buffer, separators );
193 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
203 if ( pom_buf == NULL )
205 printf(
"\nChybi dHf %d. latky ve fazi!", j+1);
208 P_lat[j].
dHf = atof(pom_buf);
209 pom_buf = strtok( NULL, separators );
211 if ( pom_buf != NULL )
213 printf(
"\nPrilis mnoho dHf pro latky ve fazi!");
217 strcpy(buffer,
OptGetStr(nazev,
"Molar_mass",
"<NeplatnyNazev>"));
218 pom_buf = strtok( buffer, separators );
219 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
225 if ( pom_buf == NULL )
227 printf(
"\nChybi molarni hmotnost %d. latky ve fazi!", j+1);
230 P_lat[j].
M = atof(pom_buf);
231 pom_buf = strtok( NULL, separators );
233 if ( pom_buf != NULL )
235 printf(
"\nPrilis mnoho molarnich hmotnosti pro latky ve fazi!");
239 strcpy(buffer,
OptGetStr(nazev,
"El_charge",
"<NeplatnyNazev>"));
240 pom_buf = strtok( buffer, separators );
241 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
247 if ( pom_buf == NULL )
249 printf(
"\nChybi naboj %d. latky ve fazi!", j+1);
252 P_lat[j].
Q = atoi(pom_buf);
253 pom_buf = strtok( NULL, separators );
255 if ( pom_buf != NULL )
257 printf(
"\nPrilis mnoho naboju pro latky ve fazi!");
272 char nazev[30], *pom_buf;
273 const char* separators =
" ,\t";
280 sprintf( nazev,
"Further_species" );
281 strcpy(buffer,
OptGetStr(nazev,
"Specie_name",
"<NeplatnyNazev>"));
282 pom_buf = strtok( buffer, separators );
283 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
294 if ( pom_buf == NULL )
299 strcpy (P_lat[j].nazev, pom_buf);
300 pom_buf = strtok( NULL, separators );
302 if ( pom_buf != NULL )
304 printf(
"\nPrilis mnoho nazvu dalsich latek!");
309 strcpy(buffer,
OptGetStr(nazev,
"dGf",
"<NeplatnyNazev>"));
310 pom_buf = strtok( buffer, separators );
311 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
317 if ( pom_buf == NULL )
322 P_lat[j].
dGf = atof(pom_buf);
323 pom_buf = strtok( NULL, separators );
325 if ( pom_buf != NULL )
327 printf(
"\nPrilis mnoho dGf pro dalsi latky!");
331 strcpy(buffer,
OptGetStr(nazev,
"dHf",
"<NeplatnyNazev>"));
332 pom_buf = strtok( buffer, separators );
333 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
343 if ( pom_buf == NULL )
348 P_lat[j].
dHf = atof(pom_buf);
349 pom_buf = strtok( NULL, separators );
351 if ( pom_buf != NULL )
353 printf(
"\nPrilis mnoho dHf pro dalsi latky!");
357 strcpy(buffer,
OptGetStr(nazev,
"Molar_mass",
"<NeplatnyNazev>"));
358 pom_buf = strtok( buffer, separators );
359 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
365 if ( pom_buf == NULL )
370 P_lat[j].
M = atof(pom_buf);
371 pom_buf = strtok( NULL, separators );
373 if ( pom_buf != NULL )
375 printf(
"\nPrilis mnoho molarnich hmotnosti pro dalsi latky!");
379 strcpy(buffer,
OptGetStr(nazev,
"Activity",
"<NeplatnyNazev>"));
380 pom_buf = strtok( buffer, separators );
381 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
387 if ( pom_buf == NULL )
393 pom_buf = strtok( NULL, separators );
395 if ( pom_buf != NULL )
397 printf(
"\nPrilis mnoho aktivit pro dalsi latky!");
407 char nazev[30], *pom_buf;
408 const char* separators =
" ,\t";
410 double max_poloc_rozp;
415 sprintf( nazev,
"Reaction_%d", i );
416 strcpy(buffer,
OptGetStr(nazev,
"Reaction_type",
"<NeplatnyNazev>")); printf(
"probehlo zjisteni typu reakce %d: %s\n",i, buffer);
417 if ( strcmp( buffer,
"<NeplatnyNazev>" ) == 0 )
break;
422 printf(
"\nNeni definovana zadna reakce!");
429 printf (
"Malo pameti!\n");
436 max_poloc_rozp = 0.0;
439 sprintf( nazev,
"Reaction_%d", i+1 );
440 sprintf(P_che[i].nazev,
"Reaction_%d",i+1);
442 strcpy(buffer,
OptGetStr(nazev,
"Reaction_type",
"<NeplatnyTyp>"));
443 pom_buf = strtok( buffer, separators );
445 if ( strcmp( pom_buf,
"Radioactive_decay" ) == 0 ) P_che[i].
typ_reakce = 4;
446 if ( strcmp( pom_buf,
"radioactive_decay" ) == 0 ) P_che[i].
typ_reakce = 4;
447 if ( strcmp( pom_buf,
"Decay" ) == 0 ) P_che[i].
typ_reakce = 4;
448 if ( strcmp( pom_buf,
"decay" ) == 0 ) P_che[i].
typ_reakce = 4;
449 if ( strcmp( pom_buf,
"RD" ) == 0 ) P_che[i].
typ_reakce = 4;
450 if ( strcmp( pom_buf,
"rd" ) == 0 ) P_che[i].
typ_reakce = 4;
451 if ( strcmp( pom_buf,
"4" ) == 0 ) P_che[i].
typ_reakce = 4;
452 if ( strcmp( pom_buf,
"Slow_kinetics" ) == 0 ) P_che[i].
typ_reakce = 3;
453 if ( strcmp( pom_buf,
"slow_kinetics" ) == 0 ) P_che[i].
typ_reakce = 3;
454 if ( strcmp( pom_buf,
"3" ) == 0 ) P_che[i].
typ_reakce = 3;
455 if ( strcmp( pom_buf,
"Kinetics" ) == 0 ) P_che[i].
typ_reakce = 1;
456 if ( strcmp( pom_buf,
"kinetics" ) == 0 ) P_che[i].
typ_reakce = 1;
457 if ( strcmp( pom_buf,
"1" ) == 0 ) P_che[i].
typ_reakce = 1;
458 if ( strcmp( pom_buf,
"Equilibrium" ) == 0 ) P_che[i].
typ_reakce = 0;
459 if ( strcmp( pom_buf,
"equilibrium" ) == 0 ) P_che[i].
typ_reakce = 0;
460 if ( strcmp( pom_buf,
"0" ) == 0 ) P_che[i].
typ_reakce = 0;
463 printf(
"\nThe type of reaction nr. %d is not valid!", i);
484 strcpy(buffer,
OptGetStr(nazev,
"Stoichiometry",
""));
485 pom_buf = strtok( buffer, separators );
488 if ( pom_buf == NULL )
490 printf(
"\nChybi %d. stechometricky koeficient v %d. rovnici!", j+1, i+1);
494 printf(
"\nP_che[%d].stech_koef_p[%d]: %d",i,j,P_che[i].
stech_koef_p[j]);
495 pom_buf = strtok( NULL, separators );
497 if ( pom_buf != NULL )
499 printf(
"\nV %d. rovnici je prilis mnoho stechiometrickych koeficientu!", i+1);
505 P_che[i].
K =
OptGetDbl(nazev,
"Kinetic_constant",
"0.0");
506 if(P_che[i].
typ_reakce==1)printf(
"\nKineticka konstanta v %d. rovnici ma hodnotu %f", i+1, P_che[i].
K);
507 if ( P_che[i].K <= 0.0 )
509 printf(
"\nKineticka konstanta v %d. rovnici neni kladna!", i+1);
513 strcpy(buffer,
OptGetStr(nazev,
"Order_of_reaction",
""));
514 pom_buf = strtok( buffer, separators );
519 if( pom_buf == NULL )
521 printf(
"\nChybi %d. mocnina pro kinetiku %d. rovnice!", j+1, i+1);
524 P_che[i].
exponent[j] = atof( pom_buf );
525 printf(
"\nP_che[%d].exponent[%d]: %f",i,j,P_che[i].
exponent[j]);
526 pom_buf = strtok( NULL, separators );
529 if ( pom_buf != NULL )
531 printf(
"\nV %d. rovnici je prilis mnoho exponentu pro kinetiku!", i+1);
538 P_che[i].
K =
OptGetDbl(nazev,
"Equilibrium_constant",
"-1.0");
551 P_che[i] = P_che[i+1];
552 P_che[i+1] = pom_che;
563 ctiich_obecne(); printf(
"probehla funkce ctiich_obecne()\n");
566 ctiich_reakce(); printf(
"probehla funkce ctiich_reakce()\n");
int pocet_reakci_pro_matici
void ctiich_latkyvefazi(void)
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.