/* 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. */ /* reaction parser */ #include #include "rxn.h" extern float atof(); extern char *strtok(); extern char *malloc(); extern int strcmp(); static char *ARROW="->"; extern int inlist(); char * geta(str) register char *str; { register int i; for(i=0;i MSPR) bail ("too many reactants + species"); switch (RP_FLAG){ case 0: R[NR].s[j++] = id; break; case 1: R[NR].s[j++] = id; break; case 2: RP_FLAG =1; R[NR].s[j++] = 0; default: break; } word=strtok(NULL,tokens); /* get next word */ } if ( j < 2) bail ("no reactants or products"); R[NR].n = j -1; } #ifdef DEBUG printf("list\n%s\n",SPECIES); #endif *numr = NR; *nums = NS; Y = (double *)malloc((unsigned)((NS+1)*sizeof(double))); if (Y == NULL) bail("insufficient memory"); DY = (double *)malloc((unsigned)((NS+1)*sizeof(double))); if (DY == NULL) bail("insufficient memory"); fclose(mech); }