/* The permission is granted to use the software as is and redistribute it in its original and complete form. If you find this program useful and publish results obtained by it, please cite the program as: Michael Whitbeck, Desert Research Institute, 1991, "REACT - Program to solve kinetic equations for chemical systems". Version 1.00, this code is available from the authors or from Dr. Whitbeck. */ /* initial */ #include #include "rxn.h" extern int inlist(); void initial(s,t,tout,stop,step,atol,rtol) int s; double *t, *tout, *stop, *step, atol[], rtol[]; { int i,id; char line[80],word[20], *species; double first, last, interval, value, av, rv; for (i=1; i<=NS; i++) Y[i] = 0.00; if ((params = fopen(parameters,"r"))==NULL) bail("Could not open parameter file"); fscanf(params,"%lf%lf%lf%le\n", &first, &last, &interval, &value); *t = first; *tout = *step = interval; *stop = last; *tout += first; for (i=1; i<=NS; i++) {atol[i] = rtol[i] = value;} #ifdef DEBUG for (i=1; i<=NS; i++) printf("%15.4le %15.4le\n", atol[i],rtol[i]); #endif species = (char *)malloc(strlen(SPECIES)+1); strcpy(species,SPECIES); while (!feof(params)) { fscanf (params,"%s %le %le %le\n", word, &value, &av, &rv); if ((id = inlist(species,word))) { Y[id] = value; atol[id] = av; rtol[id] = rv; } else { sprintf(line,"The species >%s< is not in the mechanism", word); bail(line); } } #ifdef DEBUG for (i=1; i<=NS; i++) printf("%15.4e %15.4e %15.4e\n",Y[i], atol[i],rtol[i]); #endif free(species); fclose(params); }