CKSNUM CKSNUM CKSNUM CKSNUM CKSNUM CKSNUM CKSNUM ********************************************** ************************** ****** SUBROUTINE CKSNUM (LINE, NEXP, LOUT, KRAY, NN, KNUM, NVAL, RVAL, KERR) Search a character string, LINE, for (1) a character substring which may also appear in an array of character substrings KRAY, and (2) some number of character substrings representing numbers. In the case of (1), if the character substring appears in KRAY, KNUM is its index position. In the case of (2), the character substrings are converted to NVAL real numbers and stored in RVAL, until NEXP are converted. This allows format-free input of combined alpha-numeric data. For example, the subroutine might be called to find a Chemkin species index and convert the other substrings to real values: input: LINE = "N2 1.2" NEXP = 1, the number of values expected LOUT = 6, a logical unit number on which to write diagnostic messages. KRAY(*) = "H2" "O2" "N2" "H" "O" "N" "OH" "H2O" "NO" NN = 9, the number of entries in KRAY(*) output: KNUM = 3, the index number of the substring in KRAY(*) which corresponds to the first substring in LINE NVAL = 1, the number of values found in LINE following the first substring RVAL(*) = 1.200E+00, the substring converted to a number KERR = .FALSE. INPUT LINE - Character string; length depends on calling routine. NEXP - Integer scalar, number of values to be found in LINE. If NEXP < 0, then IABS(NEXP) values are expected, but it is not an error condition if less values are found. LOUT - Integer scalar, formatted output file unit. KRAY(*) - Character string array. NN - Integer scalar, total number of character strings in KRAY. OUTPUT KNUM - Integer scalar, index of character string in KRAY which corresponds to the first substring in LINE. NVAL - Integer scalar, count of real values found in LINE. RVAL(*) - Real array, real values found in LINE; dimension at least NEXP. KERR - Logical, syntax or dimensioning error flag; corresponding string not found, or total of values found is not the number of values expected, will result in KERR = .TRUE.