|
发表于 2005-5-6 21:26:04
|
显示全部楼层
寻找chemkin2!
我在1998年,在美国UMass大学时使用的就是2版源码,
目前还在使用.
Have fun!:
PROGRAM CKINTP
IMPLICIT DOUBLE PRECISION (A-H,O-Z), INTEGER (I-N)
PARAMETER (MDIM=10, KDIM=155, MKDIM=MDIM*KDIM, IDIM=1030, LSYM=16,
1 NPAR=3, NPIDIM=IDIM*NPAR, NPC=5, NPCP2=NPC+2, MAXTP=3,
2 NTR=MAXTP-1, NKTDIM=NTR*NPCP2*KDIM, MAXSP=6, MAXTB=10,
3 NLAR=2, NSIDIM=MAXSP*IDIM, NTIDIM=MAXTB*IDIM,
4 NLIDIM=NLAR*IDIM, NFAR=8, NFIDIM=NFAR*IDIM,
5 NTDIM=KDIM*MAXTP, NIDIM=11*IDIM, LIN=15, LOUT=16,
6 LTHRM=17, LINC=25, CKMIN=1.0E-3, MAXORD=KDIM,
7 NOIDIM=MAXORD*IDIM)
C
CHARACTER KNAME(KDIM)*(LSYM), ENAME(MDIM)*(LSYM), SUB(80)*80,
1 KEY(5)*4, LINE*80, IUNITS*80, AUNITS*4, EUNITS*4,
2 UPCASE*4, VERS*(LSYM), PREC*(LSYM)
C
DIMENSION AWT(MDIM), KNCF(MDIM,KDIM), WTM(KDIM), KPHSE(KDIM),
1 KCHRG(KDIM), A(NPCP2,NTR,KDIM), T(MAXTP,KDIM), NT(KDIM),
2 NSPEC(IDIM), NREAC(IDIM), NU(MAXSP,IDIM),
3 NUNK(MAXSP,IDIM), PAR(NPAR,IDIM), IDUP(IDIM),IREV(IDIM),
4 RPAR(NPAR,IDIM), ILAN(IDIM), PLAN(NLAR,IDIM),
5 IRLT(IDIM), RLAN(NLAR,IDIM), IWL(IDIM), WL(IDIM),
6 IFAL(IDIM), IFOP(IDIM), KFAL(IDIM), PFAL(NFAR,IDIM),
7 ITHB(IDIM),NTBS(IDIM),AIK(MAXTB,IDIM),NKTB(MAXTB,IDIM),
8 IRNU(IDIM), RNU(MAXSP,IDIM), IORD(IDIM),
9 KORD(MAXORD,IDIM), RORD(MAXORD,IDIM)
DIMENSION value(5)
C
LOGICAL KERR, THERMO, ITHRM(KDIM)
C
PARAMETER (NJAR=9, NF1R=4, NJIDIM=NJAR*IDIM, NF1IDIM=NF1R*IDIM)
DIMENSION IEIM(IDIM), ITDEP(IDIM), IJAN(IDIM), PJAN(NJAR,IDIM),
1 IFT1(IDIM), PFT1(NF1R,IDIM), IEXC(IDIM), PEXC(IDIM)
DATA NEIM,NJAN,NFT1,NEXC/4*0/, IEIM/IDIM*0/, ITDEP/IDIM*0/,
1 IJAN/IDIM*0/, IFT1/IDIM*0/, PJAN/NJIDIM*0.0/,
2 PFT1/NF1IDIM*0.0/, PEXC/IDIM*0.0/
C
C Initialize variables
C
DATA KEY/';ELEM';,';SPEC';,';THER';,';REAC';,';END';/, KERR/.FALSE./,
1 ITASK,NCHRG,MM,KK,II,NLAN,NFAL,NTHB,NREV,NRLT,NWL,
* NRNU,NORD/13*0/,
2 ENAME,AWT/MDIM*'; ';,MDIM*0.0/, THERMO/.TRUE./,
3 T/NTDIM*-1.0/, KNAME,WTM,NT,KPHSE,KCHRG,ITHRM
4 /KDIM*'; ';, KDIM*0.0, KDIM*3, KDIM*0, KDIM*0, KDIM*.FALSE./,
5 WL,IFOP,NTBS,IDUP /IDIM*0.0, IDIM*-1, IDIM*0, IDIM*0/,
6 NSPEC,NREAC,IREV,ILAN,IRLT,IWL,IFAL,KFAL,ITHB,IRNU,IORD
7 /NIDIM*0/
C
DATA NUNK,NU/NSIDIM*0, NSIDIM*0/, NKTB,AIK/NTIDIM*0,NTIDIM*-1.0/
DATA RNU/NSIDIM*0.0/, KORD/NOIDIM*0/, RORD/NOIDIM*0.0/
DATA PAR,RPAR/NPIDIM*0.0, NPIDIM*0.0/
DATA PLAN,RLAN/NLIDIM*0.0, NLIDIM*0.0/
DATA PFAL/NFIDIM*0.0/, KNCF/MKDIM*0.0/, A/NKTDIM*0.0/
C----------------------------------------------------------------------C
C
OPEN (LOUT, form=';formATTED';, STATUS=';UNKNOWN';, FILE=';chem.out';)
C
VERS = ';3.9';
WRITE (LOUT, 15) VERS(:4)
15 formAT (/
1'; CHEMKIN INTERPRETER OUTPUT: CHEMKIN-II Version ';,A,'; Aug. 1994';
C*****precision > double
2/'; DOUBLE PRECISION';/)
PREC = ';DOUBLE';
OPEN (LIN, form=';formATTED';, STATUS=';OLD';, FILE=';chem.inp';,
1 ERR=11111)
READ (LIN,';(A)';,END=11111)
REWIND (LIN)
100 CONTINUE
LINE = '; ';
READ (LIN,';(A)';,END=5000) LINE
105 CONTINUE
ILEN = IPPLEN(LINE)
IF (ILEN .EQ. 0) GO TO 100
C
CALL CKISUB (LINE(:ILEN), SUB, NSUB)
C
C IS THERE A KEYWORD?
C
CALL CKCOMP ( UPCASE(SUB(1), 4) , KEY, 5, NKEY)
IF (NKEY .GT. 0) ITASK = 0
C
IF (NKEY.EQ.1 .OR. NKEY.EQ.2) THEN
C
C ELEMENT OR SPECIES DATA
C
ITASK = NKEY
IF (NSUB .EQ. 1) GO TO 100
C
DO 25 N = 2, NSUB
SUB(N-1) = '; ';
SUB(N-1) = SUB(N)
25 CONTINUE
NSUB = NSUB-1
C
ELSEIF (NKEY .EQ. 3) THEN
C
C THERMODYNAMIC DATA
C
IF (NSUB .GT. 1) THEN
IF ( UPCASE(SUB(2), 3) .EQ. ';ALL';) THEN
THERMO = .FALSE.
READ (LIN,';(A)';) LINE
CALL IPPARR (LINE, -1, 3, value, NVAL, IER, LOUT)
IF (NVAL .NE. 3 .OR. IER.NE.0) THEN
KERR = .TRUE.
WRITE (LOUT, 333)
ELSE
TLO = value(1)
TMID = value(2)
THI = value(3)
ENDIF
ENDIF
ELSE
C
C USE THERMODYNAMIC DATABASE FOR DEFAULT TLO,TMID,THI
OPEN (LTHRM, form=';formATTED';, STATUS=';OLD';,
1 FILE=';therm.dat';, ERR=22222)
C
311 CONTINUE
READ (LTHRM,';(A)';,END=22222) LINE
IF (IPPLEN(LINE).LE.0 .OR. INDEX(LINE,';THERMO';).GT.0
1 .OR. INDEX(LINE,';thermo';).GT.0) GO TO 311
C
CALL IPPARR (LINE, -1, 3, value, NVAL, IER, LOUT)
IF (NVAL .NE. 3 .OR. IER.NE.0) THEN
KERR = .TRUE.
WRITE (LOUT, 333)
ELSE
TLO = value(1)
TMID = value(2)
THI = value(3)
ENDIF
CLOSE (LTHRM)
ENDIF
C
CALL CKTHRM (LIN, MDIM, ENAME, MM, AWT, KNAME, KK, KNCF,
1 KPHSE, KCHRG, WTM, MAXTP, NT, NTR, TLO, TMID,
2 THI, T, NPCP2, A, ITHRM, KERR, LOUT, LINE)
C
IF (.NOT. THERMO)
1 CALL CKPRNT (MDIM, MAXTP, MM, ENAME, KK, KNAME, WTM, KPHSE,
2 KCHRG, NT, T, TLO, TMID, THI, KNCF, ITHRM,
3 LOUT, KERR)
I1 = IFIRCH(LINE)
IF (UPCASE(LINE(I1, 4) .EQ. ';REAC';) GO TO 105
C
ELSEIF (NKEY .EQ. 4) THEN
C
ITASK = 4
C START OF REACTIONS; ARE UNITS SPECIFIED?
CALL CKUNIT (LINE(:ILEN), AUNITS, EUNITS, IUNITS)
C
IF (THERMO) THEN
C
C THERMODYNAMIC DATA
OPEN (LTHRM, form=';formATTED';, STATUS=';OLD';,
1 FILE=';therm.dat';, ERR=22222)
312 CONTINUE
READ (LTHRM,';(A)';,END=22222) LINE
IF (IPPLEN(LINE).LE.0 .OR. INDEX(LINE,';THERM';).GT.0
1 .OR. INDEX(LINE,';therm';).GT.0) GO TO 312
C
CALL IPPARR (LINE, -1, 3, value, NVAL, IER, LOUT)
IF (NVAL .NE. 3 .OR. IER.NE.0) THEN
KERR = .TRUE.
WRITE (LOUT, 333)
ELSE
TLO = value(1)
TMID = value(2)
THI = value(3)
ENDIF
CALL CKTHRM (LTHRM, MDIM, ENAME, MM, AWT, KNAME, KK, KNCF,
1 KPHSE, KCHRG, WTM, MAXTP, NT, NTR, TLO, TMID,
2 THI, T, NPCP2, A, ITHRM, KERR, LOUT, LINE)
CALL CKPRNT (MDIM, MAXTP, MM, ENAME, KK, KNAME, WTM, KPHSE,
1 KCHRG, NT, T, TLO, TMID, THI, KNCF, ITHRM,
2 LOUT, KERR)
THERMO = .FALSE.
CLOSE (LTHRM)
ENDIF
C
WRITE (LOUT, 1800)
GO TO 100
ENDIF
C
IF (ITASK .EQ. 1) THEN
C
C ELEMENT DATA
C
IF (MM .EQ. 0) THEN
WRITE (LOUT, 200)
WRITE (LOUT, 300)
WRITE (LOUT, 200)
ENDIF
C
IF (NSUB .GT. 0) THEN
M1 = MM +1
CALL CKCHAR (SUB, NSUB, MDIM, ENAME, AWT, MM, KERR, LOUT)
DO 110 M = M1, MM
IF (AWT(M) .LE. 0) CALL CKAWTM (ENAME(M), AWT(M))
WRITE (LOUT, 400) M,ENAME(M)(:4),AWT(M)
IF (AWT(M) .LE. 0) THEN
KERR = .TRUE.
WRITE (LOUT, 1000) ENAME(M)
ENDIF
110 CONTINUE
ENDIF
C
ELSEIF (ITASK .EQ. 2) THEN
C
C PROCESS SPECIES DATA
C
IF (KK .EQ. 0) WRITE (LOUT, 200)
IF (NSUB .GT. 0)
1 CALL CKCHAR (SUB, NSUB, KDIM, KNAME, WTM, KK, KERR, LOUT)
C
ELSEIF (ITASK .EQ. 4) THEN
C
C PROCESS REACTION DATA
C
IND = 0
DO 120 N = 1, NSUB
IND = MAX(IND, INDEX(SUB(N),';/';))
IF (UPCASE(SUB(N), 3) .EQ. ';DUP';) IND = MAX(IND,1)
120 CONTINUE
IF (IND .GT. 0) THEN
C
C AUXILIARY REACTION DATA
C
CALL CKAUXL (SUB, NSUB, II, KK, KNAME, LOUT, MAXSP, NPAR,
1 NSPEC, NTHB, ITHB, NTBS, MAXTB, NKTB, AIK,
2 NFAL, IFAL, IDUP, NFAR, PFAL, IFOP, NLAN,
3 ILAN, NLAR, PLAN, NREV, IREV, RPAR, NRLT, IRLT,
4 RLAN, NWL, IWL, WL, KERR, NORD, IORD, MAXORD,
5 KORD, RORD, NUNK, NU, NRNU, IRNU, RNU,
6 NEIM, IEIM, ITDEP, NJAN, IJAN, NJAR, PJAN,
7 NFT1, IFT1, NF1R, PFT1, NEXC, IEXC, PEXC)
C
ELSE
C
C THIS IS A REACTION STRING
C
IF (II .LT. IDIM) THEN
C
IF (II .GT. 0)
C
C CHECK PREVIOUS REACTION FOR COMPLETENESS
C
1 CALL CPREAC (II, MAXSP, NSPEC, NPAR, PAR, RPAR,
2 AUNITS, EUNITS, NREAC, NUNK, NU, KCHRG,
3 MDIM, MM, KNCF, IDUP, NFAL, IFAL, KFAL,
4 NFAR, PFAL, IFOP, NREV, IREV, NTHB, ITHB,
5 NLAN, ILAN, NRLT, IRLT, KERR, LOUT, NRNU,
6 IRNU, RNU, CKMIN)
C
C NEW REACTION
C
II = II+1
CALL CKREAC (LINE(:ILEN), II, KK, KNAME, LOUT, MAXSP,
1 NSPEC, NREAC, NUNK, NU, NPAR, PAR,
2 NTHB, ITHB, NFAL, IFAL, KFAL, NWL,
3 IWL, WL, NRNU, IRNU, RNU, KERR)
C
ELSE
WRITE (LOUT, 1070)
KERR = .TRUE.
ENDIF
C
ENDIF
ENDIF
GO TO 100
C
5000 CONTINUE
IF (II .GT. 0) THEN
CALL CPREAC (II, MAXSP, NSPEC, NPAR, PAR, RPAR, AUNITS,
1 EUNITS, NREAC, NUNK, NU, KCHRG, MDIM, MM,
2 KNCF, IDUP, NFAL, IFAL, KFAL, NFAR, PFAL, IFOP,
3 NREV, IREV, NTHB, ITHB, NLAN, ILAN, NRLT,
4 IRLT, KERR, LOUT, NRNU, IRNU, RNU, CKMIN)
DO 500 I = 1, II
IF (IDUP(I) .LT. 0) THEN
KERR = .TRUE.
WRITE (LOUT, 1095) I
ENDIF
500 CONTINUE
C
WRITE (LOUT, ';(/1X,A)';) '; NOTE: ';//IUNITS(:ILASCH(IUNITS))
C
ELSEIF (THERMO) THEN
OPEN (LTHRM, form=';formATTED';, STATUS=';OLD';,
1 FILE=';therm.dat';, ERR=22222)
C
313 CONTINUE
READ (LTHRM,';(A)';,END=22222) LINE
IF (IPPLEN(LINE).LE.0 .OR. INDEX(LINE,';THERM';).GT.0
1 .OR. INDEX(LINE,';therm';).GT.0) GO TO 313
C
CALL IPPARR (LINE, -1, 3, value, NVAL, IER, LOUT)
IF (NVAL .NE. 3 .OR. IER.NE.0) THEN
KERR = .TRUE.
WRITE (LOUT, 333)
ELSE
TLO = value(1)
TMID = value(2)
THI = value(3)
ENDIF
CALL CKTHRM (LTHRM, MDIM, ENAME, MM, AWT, KNAME, KK, KNCF,
1 KPHSE, KCHRG, WTM, MAXTP, NT, NTR, TLO, TMID,
2 THI, T, NPCP2, A, ITHRM, KERR, LOUT, LINE)
CALL CKPRNT (MDIM, MAXTP, MM, ENAME, KK, KNAME, WTM, KPHSE,
1 KCHRG, NT, T, TLO, TMID, THI, KNCF, ITHRM,
2 LOUT, KERR)
CLOSE (LTHRM)
ENDIF
C
CLOSE (LIN)
OPEN (LINC, form=';UNformATTED';, STATUS=';UNKNOWN';,
1 FILE=';chem.bin';)
WRITE (LINC) VERS, PREC, KERR
C
IF (KERR) THEN
WRITE (LOUT, ';(//A)';)
1 '; WARNING...THERE IS AN ERROR IN THE LINKING FILE';
CLOSE (LINC)
CLOSE (LOUT)
STOP
ENDIF
C
DO 1150 K = 1, KK
IF (KCHRG(K) .NE. 0) NCHRG = NCHRG+1
1150 CONTINUE
C
LENICK = 1 + (3 + MM)*KK + (2 + 2*MAXSP)*II + NLAN + NRLT
1 + 3*NFAL + (2 + MAXTB)*NTHB + NREV + NWL + NRNU
2 + NORD*(1 + MAXORD) + 2*NEIM + NJAN + NFT1
3 + NEXC
C
LENCCK = MM + KK
C
LENRCK = 3 + MM + KK*(5 + MAXTP + NTR*NPCP2) + II*7 + NREV
1 + NPAR*(II + NREV) + NLAR*(NLAN + NRLT)
2 + NFAR*NFAL + MAXTB*NTHB + NWL + NRNU*MAXSP
3 + NORD*MAXORD + NJAR*NJAN + NF1R*NFT1 + NEXC
C
WRITE (LINC) LENICK, LENRCK, LENCCK, MM, KK, II, MAXSP,
1 MAXTB, MAXTP, NPC, NPAR, NLAR, NFAR, NREV, NFAL,
2 NTHB, NLAN, NRLT, NWL, NCHRG, NEIM, NJAR, NJAN,
3 NF1R, NFT1, NEXC, NRNU, NORD, MAXORD, CKMIN
WRITE (LINC) (ENAME(M), AWT(M), M = 1, MM)
WRITE (LINC) (KNAME(K), (KNCF(M,K),M=1,MM), KPHSE(K),
1 KCHRG(K), WTM(K), NT(K), (T(L,K),L=1,MAXTP),
2 ((A(M,L,K), M=1,NPCP2), L=1,NTR), K = 1, KK)
C
IF (II .GT. 0) THEN
C
WRITE (LINC) (NSPEC(I), NREAC(I), (PAR(N,I), N = 1, NPAR),
1 (NU(M,I), NUNK(M,I), M = 1, MAXSP), I = 1, II)
C
IF (NREV .GT. 0) WRITE (LINC)
1 (IREV(N),(RPAR(L,N),L=1,NPAR),N=1,NREV)
C
IF (NFAL .GT. 0) WRITE (LINC)
1 (IFAL(N),IFOP(N),KFAL(N),(PFAL(L,N),L=1,NFAR), N = 1, NFAL)
C
IF (NTHB .GT. 0) WRITE (LINC)
1 (ITHB(N),NTBS(N),(NKTB(M,N),AIK(M,N),M=1,MAXTB),N=1,NTHB)
C
IF (NLAN .GT. 0) WRITE (LINC)
1 (ILAN(N), (PLAN(L,N), L = 1, NLAR), N = 1, NLAN)
C
IF (NRLT .GT. 0) WRITE (LINC)
1 (IRLT(N), (RLAN(L,N), L = 1, NLAR), N=1,NRLT)
C
IF (NWL .GT. 0) WRITE (LINC) (IWL(N), WL(N), N = 1, NWL)
C
IF (NEIM .GT. 0) WRITE (LINC) (IEIM(N),ITDEP(N),N=1,NEIM)
C
IF (NJAN .GT. 0) WRITE (LINC)
1 (IJAN(N), (PJAN(L,N), L = 1, NJAR), N = 1, NJAN)
C
IF (NFT1 .GT. 0) WRITE (LINC)
1 (IFT1(N), (PFT1(L,N), L = 1, NF1R), N = 1, NFT1)
C
IF (NEXC .GT. 0) WRITE (LINC)
1 (IEXC(N), PEXC(N), N=1, NEXC)
IF (NRNU .GT. 0) WRITE (LINC)
1 (IRNU(N), (RNU(M,N), M = 1, MAXSP), N = 1, NRNU)
IF (NORD .GT. 0) WRITE (LINC)
1 (IORD(N), (KORD(L,N), RORD(L,N), L=1, MAXORD), N=1,NORD)
ELSE
WRITE (LOUT, ';(/A)';)
1 '; WARNING...NO REACTION INPUT FOUND; ';,
2 '; LINKING FILE HAS NO REACTION INformATION ON IT.';
ENDIF
C
WRITE (LOUT, ';(///A)';)
1 '; NO ERRORS FOUND ON INPUT...CHEMKIN LINKING FILE WRITTEN.';
C
WRITE (LOUT, ';(/A,3(/A,I6))';)
1 '; WORKING SPACE REQUIREMENTS ARE';,
2 '; INTEGER: ';,LENICK,
3 '; REAL: ';,LENRCK,
4 '; CHARACTER: ';,LENCCK
CLOSE (LINC)
CLOSE (LOUT)
STOP
11111 CONTINUE
WRITE (LOUT,*) '; Error...cannot read chem.inp...';
CLOSE (LIN)
STOP 2
22222 CONTINUE
WRITE (LOUT,*) '; Error...cannot read therm.dat...';
CLOSE (LTHRM)
STOP 2
END
C----------------------------------------------------------------------C
SUBROUTINE CKCHAR (SUB, NSUB, NDIM, STRAY, RAY, NN, KERR, LOUT)
IMPLICIT DOUBLE PRECISION (A-H,O-Z), INTEGER (I-N)
DIMENSION RAY(*), PAR(1)
CHARACTER*(*) SUB(*), STRAY(*)
CHARACTER ISTR*80, UPCASE*4
LOGICAL KERR
C
ILEN = LEN(STRAY(1))
C
DO 200 N = 1, NSUB
IF ( UPCASE(SUB(N), 3) .EQ. ';END';) RETURN
ISTR = '; ';
I1 = INDEX(SUB(N),';/';)
IF (I1 .EQ .1) THEN
KERR = .TRUE.
WRITE (LOUT, 130) SUB(N)(:ILASCH(SUB(N)))
ELSE
IF (I1 .LE. 0) THEN
ISTR = SUB(N)
ELSE
ISTR = SUB(N)(:I1-1)
ENDIF
CALL CKCOMP (ISTR, STRAY, NN, INUM)
C
IF (INUM .GT. 0) THEN
WRITE (LOUT, 100) SUB(N)(:ILASCH(SUB(N)))
ELSE
IF (NN .LT. NDIM) THEN
IF (ISTR(ILEN+1 .NE. '; ';) THEN
WRITE (LOUT, 120) SUB(N)(:ILASCH(SUB(N)))
KERR = .TRUE.
ELSE
NN = NN + 1
STRAY(NN) = '; ';
STRAY(NN) = ISTR(:ILEN)
IF (I1 .GT. 0) THEN
I2 = I1 + INDEX(SUB(N)(I1+1,';/';)
ISTR = '; ';
ISTR = SUB(N)(I1+1:I2-1)
CALL IPPARR (ISTR, 1, 1, PAR, NVAL, IER, LOUT)
KERR = KERR .OR. (IER.NE.0)
RAY(NN) = PAR(1)
ENDIF
ENDIF
ELSE
WRITE (LOUT, 110) SUB(N)(:ILASCH(SUB(N)))
KERR = .TRUE.
ENDIF
ENDIF
ENDIF
200 CONTINUE
END
C----------------------------------------------------------------------C
SUBROUTINE CKAWTM (ENAME, AWT)
IMPLICIT DOUBLE PRECISION (A-H,O-Z), INTEGER (I-N)
PARAMETER (NATOM = 102)
DIMENSION ATOM(NATOM)
CHARACTER*(*) ENAME
CHARACTER*2 IATOM(NATOM), UPCASE
C
DATA (IATOM(I),ATOM(I),I=1,40) /
*';H ';, 1.00797, ';HE';, 4.00260, ';LI';, 6.93900, ';BE';, 9.01220,
*';B ';, 10.81100, ';C ';, 12.01115, ';N ';, 14.00670, ';O ';, 15.99940,
*';F ';, 18.99840, ';NE';, 20.18300, ';NA';, 22.98980, ';MG';, 24.31200,
*';AL';, 26.98150, ';SI';, 28.08600, ' ';, 30.97380, ';S ';, 32.06400,
*';CL';, 35.45300, ';AR';, 39.94800, ';K ';, 39.10200, ';CA';, 40.08000,
*';SC';, 44.95600, ';TI';, 47.90000, ';V ';, 50.94200, ';CR';, 51.99600,
*';MN';, 54.93800, ';FE';, 55.84700, ';CO';, 58.93320, ';NI';, 58.71000,
*';CU';, 63.54000, ';ZN';, 65.37000, ';GA';, 69.72000, ';GE';, 72.59000,
*';AS';, 74.92160, ';SE';, 78.96000, ';BR';, 79.90090, ';KR';, 83.80000,
*';RB';, 85.47000, ';SR';, 87.62000, ';Y ';, 88.90500, ';ZR';, 91.22000/
C
DATA (IATOM(I),ATOM(I),I=41,80) /
*';NB';, 92.90600, ';MO';, 95.94000, ';TC';, 99.00000, ';RU';,101.07000,
*';RH';,102.90500, 'D';,106.40000, ';AG';,107.87000, ';CD';,112.40000,
*';IN';,114.82000, ';SN';,118.69000, ';SB';,121.75000, ';TE';,127.60000,
*';I ';,126.90440, ';XE';,131.30000, ';CS';,132.90500, ';BA';,137.34000,
*';LA';,138.91000, ';CE';,140.12000, 'R';,140.90700, ';ND';,144.24000,
*';PM';,145.00000, ';SM';,150.35000, ';EU';,151.96000, ';GD';,157.25000,
*';TB';,158.92400, ';DY';,162.50000, ';HO';,164.93000, ';ER';,167.26000,
*';TM';,168.93400, ';YB';,173.04000, ';LU';,174.99700, ';HF';,178.49000,
*';TA';,180.94800, ';W ';,183.85000, ';RE';,186.20000, ';OS';,190.20000,
*';IR';,192.20000, ';PT';,195.09000, ';AU';,196.96700, ';HG';,200.59000/
C
DATA (IATOM(I),ATOM(I),I=81,NATOM) /
*';TL';,204.37000, ';PB';,207.19000, ';BI';,208.98000, ';PO';,210.00000,
*';AT';,210.00000, ';RN';,222.00000, ';FR';,223.00000, ';RA';,226.00000,
*';AC';,227.00000, ';TH';,232.03800, ';PA';,231.00000, ';U ';,238.03000,
*';NP';,237.00000, ';PU';,242.00000, ';AM';,243.00000, ';CM';,247.00000,
*';BK';,249.00000, ';CF';,251.00000, ';ES';,254.00000, ';FM';,253.00000,
*';D ';,002.01410, ';E';,5.45E-4/
C
CALL CKCOMP ( UPCASE(ENAME, 2), IATOM, NATOM, L)
IF (L .GT. 0) AWT = ATOM(L)
RETURN
END
C----------------------------------------------------------------------C
SUBROUTINE CKTHRM (LUNIT, MDIM, ENAME, MM, AWT, KNAME, KK, KNCF,
1 KPHSE, KCHRG, WTM, MAXTP, NT, NTR, TLO, TMID,
2 THI, T, NPCP2, A, ITHRM, KERR, LOUT, ISTR)
DIMENSION WTM(*), NT(*), T(MAXTP,*), KPHSE(*), KNCF(MDIM,*),
1 KCHRG(*), A(NPCP2,NTR,*), AWT(*), value(5)
CHARACTER*(*) ENAME(*), KNAME(*)
CHARACTER*80 ISTR, SUB(80), LINE(4)
CHARACTER ELEM*16, UPCASE*4
LOGICAL KERR, ITHRM(*)
C
IF (MM.LE.0 .OR. KK.LE.0) WRITE (LOUT, 80)
C
GO TO 20
10 CONTINUE
ISTR = '; ';
READ (LUNIT,';(A)';,END=40) ISTR
20 CONTINUE
ILEN = IPPLEN(ISTR)
IF (ILEN .LE. 0) GO TO 10
C
CALL CKISUB (ISTR(:ILEN), SUB, NSUB)
IF (UPCASE(SUB(1), 3) .EQ. ';END'; .OR.
1 UPCASE(SUB(1), 4) .EQ. ';REAC';) RETURN
C
IF (ILEN.LT.80 .OR. ISTR(80:80).NE.';1';) GO TO 10
CALL CKCOMP (SUB(1), KNAME, KK, K)
C
IF (K.LE.0 .OR. ITHRM(K)) GO TO 10
ITHRM(K) = .TRUE.
LINE(1) = '; ';
LINE(1) = ISTR
L = 2
111 CONTINUE
READ (LUNIT,';(A)';,END=40) LINE(L)
IF (IPPLEN(LINE(L)) .GE. 80) THEN
IF (LINE(L)(80:80) .EQ. ';4';) THEN
GO TO 25
ELSEIF (LINE(L)(80:80).EQ.';2'; .OR.
1 LINE(L)(80:80).EQ.';3';) THEN
L = L + 1
ENDIF
ENDIF
GO TO 111
C
25 CONTINUE
C
ICOL = 20
DO 60 I = 1, 5
ICOL = ICOL + 5
IF (I .EQ. 5) ICOL = 74
ELEM = LINE(1)(ICOL:ICOL+1)
IELEM = 0
C
IF (LINE(1)(ICOL+2:ICOL+4) .NE. '; ';) THEN
CALL IPPARR
1 (LINE(1)(ICOL+2:ICOL+4), 0, 1, value, NVAL, IER, LOUT)
IELEM = value(1)
ENDIF
C
IF (ELEM.NE.'; '; .AND. IELEM.NE.0) THEN
IF (UPCASE(ELEM, 1) .EQ. ';E';)
1 KCHRG(K)=KCHRG(K)+IELEM*(-1)
CALL CKCOMP (ELEM, ENAME, MM, M)
IF (M .GT. 0) THEN
KNCF(M,K) = IELEM
WTM(K) = WTM(K) + AWT(M)*FLOAT(IELEM)
ELSE
WRITE (LOUT, 100) ELEM,KNAME(K)(:10)
KERR = .TRUE.
ENDIF
ENDIF
60 CONTINUE
C
IF (UPCASE(LINE(1)(45:),1) .EQ. ';L';) KPHSE(K)=1
IF (UPCASE(LINE(1)(45:),1) .EQ. ';S';) KPHSE(K)=-1
T(1,K) = TLO
IF (LINE(1)(46:55) .NE. '; ';) CALL IPPARR
1 (LINE(1)(46:55), 0, 1, T(1,K), NVAL, IER, LOUT)
C
T(2,K) = TMID
IF (LINE(1)(66:73) .NE. '; ';) CALL IPPARR
1 (LINE(1)(66:73), 0, 1, T(2,K), NVAL, IER, LOUT)
C
T(NT(K),K) = THI
IF (LINE(1)(56:65) .NE. '; ';) CALL IPPARR
1 (LINE(1)(56:65), 0, 1, T(NT(K),K), NVAL, IER, LOUT)
C
READ (LINE(2)(:75),';(5E15.8)';) (A(I,NTR,K),I=1,5)
READ (LINE(3)(:75),';(5E15.8)';)
1 (A(I,NTR,K),I=6,7),(A(I,1,K),I=1,3)
READ (LINE(4)(:60),';(4E15.8)';) (A(I,1,K),I=4,7)
GO TO 10
C
40 RETURN
END
C----------------------------------------------------------------------C
SUBROUTINE CKREAC (LINE, II, KK, KNAME, LOUT, MAXSP, NSPEC, NREAC,
1 NUNK, NU, NPAR, PAR, NTHB, ITHB,
2 NFAL, IFAL, KFAL, NWL, IWL, WL,
3 NRNU, IRNU, RNU, KERR)
IMPLICIT DOUBLE PRECISION (A-H,O-Z), INTEGER (I-N)
DIMENSION NSPEC(*), NREAC(*), NUNK(MAXSP,*), NU(MAXSP,*),
1 PAR(NPAR,*), IFAL(*), KFAL(*), ITHB(*), IWL(*), WL(*),
2 IRNU(*), RNU(MAXSP,*), IPLUS(20)
CHARACTER*(*) KNAME(*), LINE
CHARACTER CNUM(11)*1, UPCASE*4
CHARACTER*80 ISTR, IREAC, IPROD, ISPEC, INAME, ITEMP
LOGICAL KERR, LTHB, LWL, LRSTO
DATA CNUM/';.';,';0';,';1';,';2';,';3';,';4';,';5';,';6';,';7';,';8';,';9';/
C
LTHB = .FALSE.
LWL = .FALSE.
NSPEC(II) = 0
NREAC(II) = 0
CALL IPNPAR (LINE, NPAR, ISTR, ISTART)
CALL IPPARR (ISTR, 1, NPAR, PAR(1,II), NVAL, IER, LOUT)
KERR = KERR .OR. (IER.NE.0)
INAME = '; ';
ILEN = 0
DO 10 I = 1, ISTART-1
IF (LINE(I:I) .NE. '; ';) THEN
ILEN = ILEN+1
INAME(ILEN:ILEN) = LINE(I:I)
ENDIF
10 CONTINUE
I1 = 0
I2 = 0
DO 25 I = 1, ILEN
IF (I1 .LE. 0) THEN
IF (INAME(I:I+2) .EQ. ';<=>';) THEN
I1 = I
I2 = I+2
IR = 1
ELSEIF (INAME(I:I+1) .EQ. ';=>';) THEN
I1 = I
I2 = I+1
IR = -1
ELSEIF (I.GT.1 .AND. INAME(I:I).EQ.';=';
1 .AND. INAME(I-1:I-1).NE.';=';) THEN
I1 = I
I2 = I
IR = 1
ENDIF
ENDIF
25 CONTINUE
C
IF (ILASCH(INAME).GE.45 .AND. I1.GT.0) THEN
WRITE (LOUT, 1900) II,INAME(:I1-1),(PAR(N,II),N=1,NPAR)
WRITE (LOUT, 1920) INAME(I1:)
ELSE
WRITE (LOUT, 1900) II,INAME(:45),(PAR(N,II),N=1,NPAR)
ENDIF
C
IREAC = '; ';
IPROD = '; ';
IF (I1 .GT. 0) THEN
IREAC = INAME(:I1-1)
IPROD = INAME(I2+1:)
ELSE
WRITE (LOUT, 660)
KERR = .TRUE.
RETURN
ENDIF
C
LRSTO = ((INDEX(IREAC,';.';).GT.0) .OR. (INDEX(IPROD,';.';).GT.0))
IF (LRSTO) THEN
NRNU = NRNU + 1
IRNU(NRNU) = II
ENDIF
C
IF (INDEX(IREAC,';=>';).GT.0 .OR. INDEX(IPROD,';=>';).GT.0) THEN
WRITE (LOUT, 800)
KERR = .TRUE.
RETURN
ENDIF
IF (INDEX(IREAC,';(+';).GT.0 .OR. INDEX(IPROD,';(+';).GT.0) THEN
KRTB = 0
KPTB = 0
DO 300 J = 1, 2
ISTR = '; ';
KTB = 0
IF (J .EQ. 1) THEN
ISTR = IREAC
ELSE
ISTR = IPROD
ENDIF
C
DO 35 N = 1, ILASCH(ISTR)-1
IF (ISTR(N:N+1) .EQ. ';(+';) THEN
I1 = N+2
I2 = I1 + INDEX(ISTR(I1:),';)';)-1
IF (I2 .GT. I1) THEN
IF (ISTR(I1:I2-1).EQ.';M'; .OR.
1 ISTR(I1:I2-1).EQ.';m';) THEN
IF (KTB .NE. 0) THEN
WRITE (LOUT, 630)
KERR = .TRUE.
RETURN
ELSE
KTB = -1
ENDIF
ELSE
CALL CKCOMP (ISTR(I1:I2-1), KNAME, KK, KNUM)
IF (KNUM .GT. 0) THEN
IF (KTB .NE. 0) THEN
WRITE (LOUT, 630)
KERR = .TRUE.
RETURN
ELSE
KTB = KNUM
ENDIF
ENDIF
ENDIF
IF (KTB .NE. 0) THEN
ITEMP = '; ';
IF (I1 .EQ. 1) THEN
ITEMP = ISTR(I2+1:)
ELSE
ITEMP = ISTR(:I1-3)//ISTR(I2+1:)
ENDIF
IF (J .EQ. 1) THEN
IREAC = '; ';
IREAC = ITEMP
KRTB = KTB
ELSE
IPROD = '; ';
IPROD = ITEMP
KPTB = KTB
ENDIF
ENDIF
ENDIF
ENDIF
35 CONTINUE
300 CONTINUE
C
IF (KRTB.NE.0 .OR. KPTB.NE.0) THEN
IF (KRTB.LE.0 .AND. KPTB.LE.0) THEN
C
NFAL = NFAL + 1
IFAL(NFAL) = II
KFAL(NFAL) = 0
C
LTHB = .TRUE.
NTHB = NTHB + 1
ITHB(NTHB) = II
C
ELSEIF (KRTB .EQ. KPTB) THEN
NFAL = NFAL + 1
IFAL(NFAL) = II
KFAL(NFAL) = KRTB
C
ELSE
C
WRITE (LOUT, 640)
KERR = .TRUE.
RETURN
ENDIF
ENDIF
ENDIF
DO 600 J = 1, 2
ISTR = '; ';
LTHB = .FALSE.
IF (J .EQ. 1) THEN
ISTR = IREAC
NS = 0
ELSE
ISTR = IPROD
NS = 3
ENDIF
NPLUS = 1
IPLUS(NPLUS) = 0
DO 500 L = 2, ILASCH(ISTR)-1
IF (ISTR(L).EQ.';+';) THEN
NPLUS = NPLUS + 1
IPLUS(NPLUS) = L
ENDIF
500 CONTINUE
NPLUS = NPLUS + 1
IPLUS(NPLUS) = ILASCH(ISTR)+1
C
NSTART = 1
505 CONTINUE
N1 = NSTART
DO 510 N = NPLUS, N1, -1
ISPEC = '; ';
ISPEC = ISTR(IPLUS(N1)+1 : IPLUS(N)-1)
C
IF (UPCASE(ISPEC, 1).EQ.';M'; .AND.
1 (ISPEC(2:2).EQ.'; '; .OR. ISPEC(2:2).EQ.';+';)) THEN
IF (LTHB) THEN
WRITE (LOUT, 900)
KERR = .TRUE.
RETURN
ELSEIF (NFAL.GT.0 .AND. IFAL(NFAL).EQ.II) THEN
WRITE (LOUT, 640)
KERR = .TRUE.
RETURN
ELSE
LTHB = .TRUE.
IF (NTHB.EQ.0 .OR.
1 (NTHB.GT.0.AND.ITHB(NTHB).NE.II)) THEN
NTHB = NTHB + 1
ITHB(NTHB) = II
ENDIF
IF (N .EQ. NPLUS) GO TO 600
NSTART = N
GO TO 505
ENDIF
C
ELSEIF (UPCASE(ISPEC, 2) .EQ. ';HV';) THEN
IF (LWL) THEN
WRITE (LOUT, 670)
KERR = .TRUE.
RETURN
ELSE
LWL = .TRUE.
NWL = NWL + 1
IWL(NWL) = II
WL(NWL) = 1.0
IF (J .EQ. 1) WL(NWL) = -1.0
IF (N .EQ. NPLUS) GO TO 600
NSTART = N
GO TO 505
ENDIF
ENDIF
IND = 0
DO 334 L = 1, LEN(ISPEC)
NTEST = 0
DO 333 M = 1, 11
IF (ISPEC(L) .EQ. CNUM(M)) THEN
NTEST=M
IND = L
ENDIF
333 CONTINUE
IF (NTEST .EQ. 0) GO TO 335
334 CONTINUE
335 CONTINUE
C
RVAL = 1.0
IVAL = 1
IF (IND .GT. 0) THEN
IF (LRSTO) THEN
CALL IPPARR (ISPEC(:IND), 1, 1, RVAL, NVAL,
1 IER, LOUT)
ELSE
CALL IPPARI (ISPEC(:IND), 1, 1, IVAL, NVAL,
1 IER, LOUT)
ENDIF
IF (IER .EQ. 0) THEN
ITEMP = '; ';
ITEMP = ISPEC(IND+1:)
ISPEC = '; ';
ISPEC = ITEMP
ELSE
KERR = .TRUE.
RETURN
ENDIF
ENDIF
C
CALL CKCOMP (ISPEC, KNAME, KK, KNUM)
IF (KNUM .EQ. 0) THEN
IF ((N-N1) .GT. 1) GO TO 510
WRITE (LOUT, 680) ISPEC(:ILASCH(ISPEC))
KERR = .TRUE.
ELSE
IF (J .EQ. 1) THEN
IVAL = -IVAL
RVAL = -RVAL
ENDIF
NNUM = 0
IF (LRSTO) THEN
DO 110 K = 1, NS
IF (KNUM.EQ.NUNK(K,II) .AND.
1 RNU(K,NRNU)/RVAL.GT.0) THEN
NNUM = K
RNU(NNUM,NRNU) = RNU(NNUM,NRNU) + RVAL
ENDIF
110 CONTINUE
ELSE
DO 111 K = 1, NS
IF (KNUM.EQ.NUNK(K,II) .AND.
1 NU(K,II)/IVAL.GT.0) THEN
NNUM=K
NU(NNUM,II) = NU(NNUM,II) + IVAL
ENDIF
111 CONTINUE
ENDIF
C
IF (NNUM .LE. 0) THEN
IF (J.EQ.1 .AND. NS.EQ.3) THEN
WRITE (LOUT, 690)
KERR = .TRUE.
RETURN
ELSEIF (J.EQ.2 .AND. NS.EQ.MAXSP) THEN
WRITE (LOUT, 700)
KERR = .TRUE.
RETURN
ELSE
NS = NS + 1
NSPEC(II) = NSPEC(II)+1
IF (J .EQ. 1) NREAC(II) = NS
NUNK(NS,II) = KNUM
IF (LRSTO) THEN
RNU(NS,NRNU) = RVAL
ELSE
NU(NS,II) = IVAL
ENDIF
ENDIF
ENDIF
ENDIF
IF (N .EQ. NPLUS) GO TO 600
NSTART = N
GO TO 505
C
510 CONTINUE
600 CONTINUE
C
NSPEC(II) = IR*NSPEC(II)
RETURN
END
C---------------------------------------------------------------------- |
|