32 static bool load_gas_phases (FILE *temp_fp)
40 rv = fscanf (temp_fp,
"%s\t%d\n",
phase_keyword, &species_num);
44 printf (
"ERROR: load_db.c: load_gas_phases () load gas phase ");
45 printf (
"error (phase keyword and species number).\n");
64 printf (
"ERROR: load_db.c: load_gas_phases () load gas phase ");
65 printf (
"error (species symbol and species charge).\n");
72 char *cbuf = (
char*)malloc(32*
sizeof(
char));
76 while ((compi = fgetc (temp_fp)) !=
'\n')
78 if (compi !=
'\t' && compi !=
' ')
88 cbuf = (
char*)malloc(32*
sizeof(
char));
99 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
109 printf (
"ERROR: load_db.c: load_gas_phases () load gas phase ");
110 printf (
"error (species standard state thermodynamic parameters).\n");
117 printf (
"ERROR: load_db.c: load_gas_phases () load gas phase ");
118 printf (
"error (invalid gas phase keyword, valid keyword is 'GAS').\n");
127 static bool load_aqueous_phases (FILE *temp_fp)
135 rv = fscanf (temp_fp,
"%s\t%d\n",
phase_keyword, &species_num);
139 printf (
"ERROR: load_db.c: load_aqueous_phases () load aqueous phase ");
140 printf (
"error (phase keyword and species number).\n");
159 printf (
"ERROR: load_db.c: load_aqueous_phases () load aqueous phase ");
160 printf (
"error (species symbol and species charge).\n");
167 char *cbuf = (
char*)malloc(32*
sizeof(
char));
171 while ((compi = fgetc (temp_fp)) !=
'\n')
173 if (compi !=
'\t' && compi !=
' ')
183 cbuf = (
char*)malloc(32*
sizeof(
char));
194 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
204 printf (
"ERROR: load_db.c: load_aqueous_phases () load aqueous phase ");
205 printf (
"error (species standard state thermodynamic parameters).\n");
215 printf (
"ERROR: load_db.c: load_aqueous_phases () load aqueous phase error (cation-anion parameters).\n");
224 rv = fscanf (temp_fp,
"%s\t%s\t%lf\t%lf\n",
231 printf (
"Load Databank Error (cation-anion)!!!\n");
235 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
244 printf (
"Load Databank Error (cation-anion)!!!\n");
248 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
257 printf (
"Load Databank Error (cation-anion)!!!\n");
266 printf (
"Load Databank Error (neutral-neutral)!!!\n");
275 rv = fscanf (temp_fp,
"%s\t%s\n",
280 printf (
"Load Databank Error (neutral-neutral)!!!\n");
284 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
293 printf (
"Load Databank Error (neutral-neutral)!!!\n");
297 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
306 printf (
"Load Databank Error (neutral-neutral)!!!\n");
315 printf (
"Load Databank Error (neutral-cation-anion)!!!\n");
324 rv = fscanf (temp_fp,
"%s\t%s\t%s\n",
330 printf (
"Load Databank Error (neutral-cation-anion)!!!\n");
334 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
343 printf (
"Load Databank Error (neutral-cation-anion)!!!\n");
347 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
356 printf (
"Load Databank Error (neutral-cation-anion)!!!\n");
360 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
369 printf (
"Load Databank Error (neutral-cation-anion)!!!\n");
378 printf (
"Load Databank Error (cation-cation-anion or cation-anion-anion)!!!\n");
387 rv = fscanf (temp_fp,
"%s\t%s\t%s\n",
393 printf (
"Load Databank Error (cation-cation-anion or cation-anion-anion)!!!\n");
397 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
406 printf (
"Load Databank Error (cation-cation-anion or cation-anion-anion)!!!\n");
415 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
424 rv = fscanf (temp_fp,
"%s\t%s\t%s\t%s\n",
431 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
435 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
444 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
448 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
457 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
466 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
475 rv = fscanf (temp_fp,
"%s\t%s\t%s\t%s\n",
482 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
486 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
495 printf (
"Load Databank Error (neutral-cation-cation-anion or neutral-cation-anion-anion)!!!\n");
502 printf (
"load_db.c: load_aqueous_phases () load aqueous phase ");
503 printf (
"error (invalid aqueous phase keyword, valid keyword is 'LIQUID').\n");
511 static void load_solid_phases (FILE *temp_fp)
520 rv = fscanf (temp_fp,
"%s\t%d\n",
phase_keyword, &species_num);
524 printf (
"Load Databank Error!!!\n");
543 printf (
"Load Databank Error!!!\n");
550 char *cbuf = (
char*)malloc(32*
sizeof(
char));
554 while ((compi = fgetc (temp_fp)) !=
'\n')
556 if (compi !=
'\t' && compi !=
' ')
566 cbuf = (
char*)malloc(32*
sizeof(
char));
577 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
587 printf (
"Load Databank Error!!!\n");
595 printf (
"Invalid Keyword!!!\n");
602 static void load_solidsolution_phases (FILE *temp_fp)
611 rv = fscanf (temp_fp,
"%s\t%d\n",
phase_keyword, &species_num);
615 printf (
"Load Databank Error!!!\n");
635 printf (
"Load Databank Error!!!\n");
643 char *cbuf = (
char*)malloc(32*
sizeof(
char));
647 while ((compi = fgetc (temp_fp)) !=
'\n')
649 if (compi !=
'\t' && compi !=
' ')
659 cbuf = (
char*)malloc(32*
sizeof(
char));
670 rv = fscanf (temp_fp,
"%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",
680 printf (
"Load Databank Error!!!\n");
688 printf (
"Load Databank Error!!!\n");
697 rv = fscanf (temp_fp,
"%s\t%s\t%lf\t%lf\n",
704 printf (
"Load Databank Error!!!\n");
711 printf (
"Invalid Keyword!!!\n");
724 if ((temp_fp = fopen (temp,
"r")) == NULL)
726 printf (
"ERROR: load_db.c: load_db () open temporary file error.\n ");
738 printf (
"ERROR: load_db.c: load_db () load components block ");
739 printf (
"error (block keyword and total components number).\n");
752 rv = fscanf (temp_fp,
"%s\t%d\t%lf\n",
components[i].element_symbol,
758 printf (
"ERROR: load_db.c: load_db () load components block ");
759 printf (
"error (element symbol, element number and element mass).\n");
766 printf (
"ERROR: load_db.c: load_db () load components block ");
767 printf (
"error (invalid components block keyword, valid is 'COMPONENTS').\n");
777 &solidsolution_phase_num);
781 printf (
"ERROR: load_db.c: load_db () load phases block ");
782 printf (
"error (block keyword and gase, liquid, solid, solid solution phases number).\n");
798 printf (
"ERROR: load_db.c: load_db () load phases block ");
799 printf (
"error (invalid phase block keyword, valid is 'PHASES').\n");
804 load_gas_phases (temp_fp);
805 load_aqueous_phases (temp_fp);
806 load_solid_phases (temp_fp);
807 load_solidsolution_phases (temp_fp);
int solidsolution_phase_num
IIBINPARAM * ii_bin_params
SPECIES * aqueous_species
NNBINPARAM * nn_bin_params
char BLOCK_KEYWORDS[2][64]
NIITERPARAM * nii_ter_params
SOLIDSOLUTION_PHASE * solidsolution
bool load_db(char *input, char *temp)
char PHASE_KEYWORDS[4][64]
IIITERPARAM * iii_ter_params
NNIIQUAPARAM * nnii_qua_params
NIIIQUAPARAM * niii_qua_params
SPECIES * solidsolution_species