C 22 DEC 06 - ST,NK,MC - ADD LC EXCHANGE ARGUMENTS
C  5 JUL 05 - MWS - SELECT NEW ATOM,BASIS,EFP,PCM,DAF DIMENSIONS
C 13 FEB 05 - MWS - PAD COMMON BLOCK NSHEL
C  5 FEB 05 - MWS - CHANGE COMMON NAME GAMMAF TO BE FMTTBL INSTEAD
C 10 NOV 04 - KI  - IMPLEMENT S,P,D,L ROTATED AXIS INTEGRAL CODE
C
C*MODULE INT2R   *DECK GENR03
      SUBROUTINE GENR03(GHONDO)
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
      DIMENSION GHONDO(*)
C
C     CARTESIAN GAUSSIAN S,P,D,L ROTATED AXIS TWO ELECTRON INTEGRAL CODE
C         THIS PROGRAM WAS WRITTEN BY KAZUYA ISHIMURA, INSTITUTE FOR
C         MOLECULAR SCIENCE, OKAZAKI, JAPAN DURING THE YEAR 2004.
C     THIS PROGRAM WAS SPONSORED BY THE NAREGI NANO SCIENCE PROJECT,
C     FUNDED BY THE JAPANESE MINISTRY OF EDUCATION, CULTURE, SPORTS,
C     SCIENCE AND TECHNOLOGY.
C
      PARAMETER (MXGTOT=20000, MXSH=5000, MXGSH=30,
     *           MXG2=MXGSH*MXGSH)
C
      COMMON /B     / CO(MXSH,3)
      COMMON /FLIPS / IB(4,3)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /INTAC2/ EI1,EI2,CUX
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NSHEL / EX(MXGTOT),CS(MXGTOT),CP(MXGTOT),CD(MXGTOT),
     2                CF(MXGTOT),CG(MXGTOT),CH(MXGTOT),CI(MXGTOT),
     3                KSTART(MXSH),KATOM(MXSH),KTYPE(MXSH),KNG(MXSH),
     4                KLOC(MXSH),KMIN(MXSH),KMAX(MXSH),NSHELL
      COMMON /SHLG70/ ISHELL,JSHELL,KSHELL,LSHELL,INEW,JNEW,KNEW,LNEW
      COMMON /SHLLFO/ NGA,LA,EXA(MXGSH),CSA(MXGSH),CPA(MXGSH),
     2                NGB,LB,EXB(MXGSH),CSB(MXGSH),CPB(MXGSH),
     3                NGC,LC,EXC(MXGSH),CSC(MXGSH),CPC(MXGSH),
     4                NGD,LD,EXD(MXGSH),CSD(MXGSH),CPD(MXGSH)
      COMMON /SHLNOS/ QQ4,LIT,LJT,LKT,LLT,LOCI,LOCJ,LOCK,LOCL,
     2                MINI,MINJ,MINK,MINL,MAXI,MAXJ,MAXK,MAXL,
     3                NIJ,IJ,KL,IJKL
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
CJMS  LABELLED COMMON JMSGYH DEFINED FOR COMPUTATIONAL EFFICIENCY.
CJMS  IT IS ONLY USED IN THIS MODULE INT2R.
C
      COMMON /JMSGYH/ SQ(4)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(25),RD1(120),RD2(336),RD3(520),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION P12(3,3),P34(3,3),P(3,3),T(3)
C
      PARAMETER (ZER=0.0D+00, ONE=1.0D+00)
      PARAMETER (PT5=0.5D+00,PT7=0.7D+00, PT9=0.9D+00)
      PARAMETER (ACYCUT=1.0D-10, TENM12=1.0D-12)
C
      PARAMETER (PITO52=0.349868366552497D+02)
C
      PIF= PITO52
C
      IEXCH= 1
      LAT= KTYPE(ISHELL)-1
      LBT= KTYPE(JSHELL)-1
      LCT= KTYPE(KSHELL)-1
      LDT= KTYPE(LSHELL)-1
      ITYPE= 1+LDT+3*(LCT+3*(LBT+3*LAT))
      LTYPE= LAT+LBT+LCT+LDT
C
      IF(LTYPE.EQ.2) THEN
         JTYPE= 7
         IF(ITYPE.EQ.3) THEN
            GO TO 1010
         ELSEIF(ITYPE.EQ. 7) THEN
            GO TO 1030
         ELSEIF(ITYPE.EQ.19) THEN
            GO TO 1040
         ELSEIF(ITYPE.EQ.55) THEN
            GO TO 1060
         ENDIF
C
      ELSEIF(LTYPE.EQ.3) THEN
         IF(ITYPE.EQ. 6) THEN
            JTYPE= 8
            GO TO 1010
         ELSEIF(ITYPE.EQ. 8) THEN
            JTYPE= 8
            GO TO 1030
         ELSEIF(ITYPE.EQ.46) THEN
            JTYPE= 8
            GO TO 1040
         ELSEIF(ITYPE.EQ.64) THEN
            JTYPE= 8
            GO TO 1060
         ELSEIF(ITYPE.EQ.12) THEN
            JTYPE= 9
            GO TO 1010
         ELSEIF(ITYPE.EQ.30) THEN
            JTYPE= 9
            GO TO 1020
         ELSEIF(ITYPE.EQ.16) THEN
            JTYPE= 9
            GO TO 1030
         ELSEIF(ITYPE.EQ.20) THEN
            JTYPE= 9
            GO TO 1040
         ELSEIF(ITYPE.EQ.34) THEN
            JTYPE= 9
            GO TO 1050
         ELSEIF(ITYPE.EQ.56) THEN
            JTYPE= 9
            GO TO 1060
         ELSEIF(ITYPE.EQ.22) THEN
            JTYPE= 9
            GO TO 1070
         ELSEIF(ITYPE.EQ.58) THEN
            JTYPE= 9
            GO TO 1080
         ENDIF
C
      ELSEIF(LTYPE.EQ.4) THEN
         IF(ITYPE.EQ. 9) THEN
            JTYPE= 10
            GO TO 1010
         ELSEIF(ITYPE.EQ.73) THEN
            JTYPE= 10
            GO TO 1040
         ELSEIF(ITYPE.EQ.15) THEN
            JTYPE= 11
            GO TO 1010
         ELSEIF(ITYPE.EQ.33) THEN
            JTYPE= 11
            GO TO 1020
         ELSEIF(ITYPE.EQ.17) THEN
            JTYPE= 11
            GO TO 1030
         ELSEIF(ITYPE.EQ.47) THEN
            JTYPE= 11
            GO TO 1040
         ELSEIF(ITYPE.EQ.35) THEN
            JTYPE= 11
            GO TO 1050
         ELSEIF(ITYPE.EQ.65) THEN
            JTYPE= 11
            GO TO 1060
         ELSEIF(ITYPE.EQ.49) THEN
            JTYPE= 11
            GO TO 1070
         ELSEIF(ITYPE.EQ.67) THEN
            JTYPE= 11
            GO TO 1080
         ELSEIF(ITYPE.EQ.21) THEN
            JTYPE= 12
            GO TO 1010
         ELSEIF(ITYPE.EQ.57) THEN
            JTYPE= 12
            GO TO 1020
         ELSEIF(ITYPE.EQ.25) THEN
            JTYPE= 12
            GO TO 1030
         ELSEIF(ITYPE.EQ.61) THEN
            JTYPE= 12
            GO TO 1050
         ELSEIF(ITYPE.EQ.39) THEN
            JTYPE= 13
            GO TO 1010
         ELSEIF(ITYPE.EQ.43) THEN
            JTYPE= 13
            GO TO 1030
         ELSEIF(ITYPE.EQ.23) THEN
            JTYPE= 13
            GO TO 1040
         ELSEIF(ITYPE.EQ.59) THEN
            JTYPE= 13
            GO TO 1060
         ENDIF
C
      ELSEIF(LTYPE.EQ.5) THEN
         IF(ITYPE.EQ.18) THEN
            JTYPE= 14
            GO TO 1010
         ELSEIF(ITYPE.EQ.36) THEN
            JTYPE= 14
            GO TO 1020
         ELSEIF(ITYPE.EQ.74) THEN
            JTYPE= 14
            GO TO 1040
         ELSEIF(ITYPE.EQ.76) THEN
            JTYPE= 14
            GO TO 1070
         ELSEIF(ITYPE.EQ.24) THEN
            JTYPE= 15
            GO TO 1010
         ELSEIF(ITYPE.EQ.60) THEN
            JTYPE= 15
            GO TO 1020
         ELSEIF(ITYPE.EQ.26) THEN
            JTYPE= 15
            GO TO 1030
         ELSEIF(ITYPE.EQ.48) THEN
            JTYPE= 15
            GO TO 1040
         ELSEIF(ITYPE.EQ.62) THEN
            JTYPE= 15
            GO TO 1050
         ELSEIF(ITYPE.EQ.66) THEN
            JTYPE= 15
            GO TO 1060
         ELSEIF(ITYPE.EQ.52) THEN
            JTYPE= 15
            GO TO 1070
         ELSEIF(ITYPE.EQ.70) THEN
            JTYPE= 15
            GO TO 1080
         ELSEIF(ITYPE.EQ.42) THEN
            JTYPE= 16
            GO TO 1010
         ELSEIF(ITYPE.EQ.44) THEN
            JTYPE= 16
            GO TO 1030
         ELSEIF(ITYPE.EQ.50) THEN
            JTYPE= 16
            GO TO 1040
         ELSEIF(ITYPE.EQ.68) THEN
            JTYPE= 16
            GO TO 1060
         ENDIF
C
      ELSEIF(LTYPE.EQ.6) THEN
         IF(ITYPE.EQ.27) THEN
            JTYPE= 17
            GO TO 1010
         ELSEIF(ITYPE.EQ.63) THEN
            JTYPE= 17
            GO TO 1020
         ELSEIF(ITYPE.EQ.75) THEN
            JTYPE= 17
            GO TO 1040
         ELSEIF(ITYPE.EQ.79) THEN
            JTYPE= 17
            GO TO 1070
         ELSEIF(ITYPE.EQ.45) THEN
            JTYPE= 18
            GO TO 1010
         ELSEIF(ITYPE.EQ.77) THEN
            JTYPE= 18
            GO TO 1040
         ELSEIF(ITYPE.EQ.51) THEN
            JTYPE= 19
            GO TO 1010
         ELSEIF(ITYPE.EQ.69) THEN
            JTYPE= 19
            GO TO 1020
         ELSEIF(ITYPE.EQ.53) THEN
            JTYPE= 19
            GO TO 1030
         ELSEIF(ITYPE.EQ.71) THEN
            JTYPE= 19
            GO TO 1050
         ENDIF
C
      ELSEIF(LTYPE.EQ.7) THEN
         JTYPE= 20
         IF(ITYPE.EQ.54) THEN
            GO TO 1010
         ELSEIF(ITYPE.EQ.72) THEN
            GO TO 1020
         ELSEIF(ITYPE.EQ.78) THEN
            GO TO 1040
         ELSEIF(ITYPE.EQ.80) THEN
            GO TO 1070
         ENDIF
C
      ELSEIF(LTYPE.EQ.8) THEN
         JTYPE= 21
         GO TO 1010
      ENDIF
C
 1010 INEW= ISHELL
      JNEW= JSHELL
      KNEW= KSHELL
      LNEW= LSHELL
      LA= LAT
      LB= LBT
      LC= LCT
      LD= LDT
      IB(1,IEXCH)= 1
      IB(2,IEXCH)= 2
      IB(3,IEXCH)= 3
      IB(4,IEXCH)= 4
      GO TO 1090
C
 1020 INEW= JSHELL
      JNEW= ISHELL
      KNEW= KSHELL
      LNEW= LSHELL
      LA= LBT
      LB= LAT
      LC= LCT
      LD= LDT
      IB(1,IEXCH)= 2
      IB(2,IEXCH)= 1
      IB(3,IEXCH)= 3
      IB(4,IEXCH)= 4
      GO TO 1090
C
 1030 INEW= ISHELL
      JNEW= JSHELL
      KNEW= LSHELL
      LNEW= KSHELL
      LA= LAT
      LB= LBT
      LC= LDT
      LD= LCT
      IB(1,IEXCH)= 1
      IB(2,IEXCH)= 2
      IB(3,IEXCH)= 4
      IB(4,IEXCH)= 3
      GO TO 1090
C
 1040 INEW= KSHELL
      JNEW= LSHELL
      KNEW= ISHELL
      LNEW= JSHELL
      LA= LCT
      LB= LDT
      LC= LAT
      LD= LBT
      IB(1,IEXCH)= 3
      IB(2,IEXCH)= 4
      IB(3,IEXCH)= 1
      IB(4,IEXCH)= 2
      GO TO 1090
C
 1050 INEW= JSHELL
      JNEW= ISHELL
      KNEW= LSHELL
      LNEW= KSHELL
      LA= LBT
      LB= LAT
      LC= LDT
      LD= LCT
      IB(1,IEXCH)= 2
      IB(2,IEXCH)= 1
      IB(3,IEXCH)= 4
      IB(4,IEXCH)= 3
      GO TO 1090
C
 1060 INEW= KSHELL
      JNEW= LSHELL
      KNEW= JSHELL
      LNEW= ISHELL
      LA= LCT
      LB= LDT
      LC= LBT
      LD= LAT
      IB(1,IEXCH)= 4
      IB(2,IEXCH)= 3
      IB(3,IEXCH)= 1
      IB(4,IEXCH)= 2
      GO TO 1090
C
 1070 INEW= LSHELL
      JNEW= KSHELL
      KNEW= ISHELL
      LNEW= JSHELL
      LA= LDT
      LB= LCT
      LC= LAT
      LD= LBT
      IB(1,IEXCH)= 3
      IB(2,IEXCH)= 4
      IB(3,IEXCH)= 2
      IB(4,IEXCH)= 1
      GO TO 1090
C
 1080 INEW= LSHELL
      JNEW= KSHELL
      KNEW= JSHELL
      LNEW= ISHELL
      LA= LDT
      LB= LCT
      LC= LBT
      LD= LAT
      IB(1,IEXCH)= 4
      IB(2,IEXCH)= 3
      IB(3,IEXCH)= 2
      IB(4,IEXCH)= 1
 1090 CONTINUE
C
C EMPTY INTEGRAL SUMMATION STORAGE
C
      IF(JTYPE.EQ.7) THEN
         RD0(1)= ZER
         RD0(2)= ZER
         RD1(1)= ZER
         RD1(2)= ZER
         RD1(3)= ZER
         DO 1710 I=1,6
            RD2(I)= ZER
 1710    CONTINUE
      ELSEIF(JTYPE.EQ.8) THEN
         DO 1810 I=1,5
            RD0(I)= ZER
 1810    CONTINUE
         DO 1820 I=1,12
            RD1(I)= ZER
 1820    CONTINUE
         DO 1830 I=1,18
            RD2(I)= ZER
 1830    CONTINUE
         DO 1840 I=1,10
            RD3(I)= ZER
 1840    CONTINUE
      ELSEIF(JTYPE.EQ.9) THEN
         DO 1910 I=1,4
            RD0(I)= ZER
 1910    CONTINUE
         DO 1920 I=1,12
            RD1(I)= ZER
 1920    CONTINUE
         DO 1930 I=1,18
            RD2(I)= ZER
 1930    CONTINUE
         DO 1940 I=1,10
            RD3(I)= ZER
 1940    CONTINUE
      ELSEIF(JTYPE.EQ.10) THEN
         DO 2010 I=1,5
            RD0(I)= ZER
 2010    CONTINUE
         DO 2020 I=1,12
            RD1(I)= ZER
 2020    CONTINUE
         DO 2030 I=1,24
            RD2(I)= ZER
 2030    CONTINUE
         DO 2040 I=1,20
            RD3(I)= ZER
 2040    CONTINUE
         DO 2050 I=1,15
            RD4(I)= ZER
 2050    CONTINUE
      ELSEIF(JTYPE.EQ.11) THEN
         DO 2110 I=1,10
            RD0(I)= ZER
 2110    CONTINUE
         DO 2120 I=1,39
            RD1(I)= ZER
 2120    CONTINUE
         DO 2130 I=1,60
            RD2(I)= ZER
 2130    CONTINUE
         DO 2140 I=1,50
            RD3(I)= ZER
 2140    CONTINUE
         DO 2150 I=1,15
            RD4(I)= ZER
 2150    CONTINUE
      ELSEIF(JTYPE.EQ.12) THEN
         DO 2210 I=1,4
            RD0(I)= ZER
 2210    CONTINUE
         DO 2220 I=1,12
            RD1(I)= ZER
 2220    CONTINUE
         DO 2230 I=1,30
            RD2(I)= ZER
 2230    CONTINUE
         DO 2240 I=1,20
            RD3(I)= ZER
 2240    CONTINUE
         DO 2250 I=1,15
            RD4(I)= ZER
 2250    CONTINUE
      ELSEIF(JTYPE.EQ.13) THEN
         DO 2310 I=1,10
            RD0(I)= ZER
 2310    CONTINUE
         DO 2320 I=1,39
            RD1(I)= ZER
 2320    CONTINUE
         DO 2330 I=1,66
            RD2(I)= ZER
 2330    CONTINUE
         DO 2340 I=1,50
            RD3(I)= ZER
 2340    CONTINUE
         DO 2350 I=1,15
            RD4(I)= ZER
 2350    CONTINUE
      ELSEIF(JTYPE.EQ.14) THEN
         DO 2410 I=1,10
            RD0(I)= ZER
 2410    CONTINUE
         DO 2420 I=1,39
            RD1(I)= ZER
 2420    CONTINUE
         DO 2430 I=1,72
            RD2(I)= ZER
 2430    CONTINUE
         DO 2440 I=1,80
            RD3(I)= ZER
 2440    CONTINUE
         DO 2450 I=1,60
            RD4(I)= ZER
 2450    CONTINUE
         DO 2460 I=1,21
            RD5(I)= ZER
 2460    CONTINUE
      ELSEIF(JTYPE.EQ.15) THEN
         DO 2510 I=1,10
            RD0(I)= ZER
 2510    CONTINUE
         DO 2520 I=1,39
            RD1(I)= ZER
 2520    CONTINUE
         DO 2530 I=1,90
            RD2(I)= ZER
 2530    CONTINUE
         DO 2540 I=1,90
            RD3(I)= ZER
 2540    CONTINUE
         DO 2550 I=1,60
            RD4(I)= ZER
 2550    CONTINUE
         DO 2560 I=1,21
            RD5(I)= ZER
 2560    CONTINUE
      ELSEIF(JTYPE.EQ.16) THEN
         DO 2610 I=1,25
            RD0(I)= ZER
 2610    CONTINUE
         DO 2620 I=1,120
            RD1(I)= ZER
 2620    CONTINUE
         DO 2630 I=1,216
            RD2(I)= ZER
 2630    CONTINUE
         DO 2640 I=1,210
            RD3(I)= ZER
 2640    CONTINUE
         DO 2650 I=1,105
            RD4(I)= ZER
 2650    CONTINUE
         DO 2660 I=1,21
            RD5(I)= ZER
 2660    CONTINUE
      ELSEIF(JTYPE.EQ.17) THEN
         DO 2710 I=1,10
            RD0(I)= ZER
 2710    CONTINUE
         DO 2720 I=1,39
            RD1(I)= ZER
 2720    CONTINUE
         DO 2730 I=1,102
            RD2(I)= ZER
 2730    CONTINUE
         DO 2740 I=1,120
            RD3(I)= ZER
 2740    CONTINUE
         DO 2750 I=1,120
            RD4(I)= ZER
 2750    CONTINUE
         DO 2760 I=1,63
            RD5(I)= ZER
 2760    CONTINUE
         DO 2770 I=1,28
            RD6(I)= ZER
 2770    CONTINUE
      ELSEIF(JTYPE.EQ.18) THEN
         DO 2810 I=1,25
            RD0(I)= ZER
 2810    CONTINUE
         DO 2820 I=1,120
            RD1(I)= ZER
 2820    CONTINUE
         DO 2830 I=1,246
            RD2(I)= ZER
 2830    CONTINUE
         DO 2840 I=1,300
            RD3(I)= ZER
 2840    CONTINUE
         DO 2850 I=1,255
            RD4(I)= ZER
 2850    CONTINUE
         DO 2860 I=1,126
            RD5(I)= ZER
 2860    CONTINUE
         DO 2870 I=1,28
            RD6(I)= ZER
 2870    CONTINUE
      ELSEIF(JTYPE.EQ.19) THEN
         DO 2910 I=1,25
            RD0(I)= ZER
 2910    CONTINUE
         DO 2920 I=1,120
            RD1(I)= ZER
 2920    CONTINUE
         DO 2930 I=1,276
            RD2(I)= ZER
 2930    CONTINUE
         DO 2940 I=1,340
            RD3(I)= ZER
 2940    CONTINUE
         DO 2950 I=1,255
            RD4(I)= ZER
 2950    CONTINUE
         DO 2960 I=1,126
            RD5(I)= ZER
 2960    CONTINUE
         DO 2970 I=1,28
            RD6(I)= ZER
 2970    CONTINUE
      ELSEIF(JTYPE.EQ.20) THEN
         DO 3010 I=1,25
            RD0(I)= ZER
 3010    CONTINUE
         DO 3020 I=1,120
            RD1(I)= ZER
 3020    CONTINUE
         DO 3030 I=1,306
            RD2(I)= ZER
 3030    CONTINUE
         DO 3040 I=1,430
            RD3(I)= ZER
 3040    CONTINUE
         DO 3050 I=1,435
            RD4(I)= ZER
 3050    CONTINUE
         DO 3060 I=1,294
            RD5(I)= ZER
 3060    CONTINUE
         DO 3070 I=1,140
            RD6(I)= ZER
 3070    CONTINUE
         DO 3080 I=1,36
            RD7(I)= ZER
 3080    CONTINUE
      ELSEIF(JTYPE.EQ.21) THEN
         DO 3110 I=1,25
            RD0(I)= ZER
 3110    CONTINUE
         DO 3120 I=1,120
            RD1(I)= ZER
 3120    CONTINUE
         DO 3130 I=1,336
            RD2(I)= ZER
 3130    CONTINUE
         DO 3140 I=1,520
            RD3(I)= ZER
 3140    CONTINUE
         DO 3150 I=1,630
            RD4(I)= ZER
 3150    CONTINUE
         DO 3160 I=1,504
            RD5(I)= ZER
 3160    CONTINUE
         DO 3170 I=1,336
            RD6(I)= ZER
 3170    CONTINUE
         DO 3180 I=1,144
            RD7(I)= ZER
 3180    CONTINUE
         DO 3190 I=1,45
            RD8(I)= ZER
 3190    CONTINUE
      ENDIF
C
C OBTAIN INFORMATION ABOUT SHELLS: INEW, KNEW, JNEW, LNEW
C NUMBER OF GAUSSIANS GO INTO NGA,... IN COMMON SHLLFO
C SHELL ANGULAR QUANTUM NUMBERS LA,... GO INTO COMMON SHLLFO
C GAUSSIAN EXPONENTS GO INTO ARRAYS EXA,EXB,EXC,EXD IN COMMON SHLLFO
C GAUSSIAN COEFFICIENTS GO INTO ARRAYS CSA,CPA,... IN COMMON SHLLFO
C
C NUMBERS OF GAUSSIAN FUNCTIONS IN SHELLS INEW JNEW KNEW AND LNEW
C
      NGA= KNG(INEW)
      NGB= KNG(JNEW)
      NGC= KNG(KNEW)
      NGD= KNG(LNEW)
C
C STARTING LOCATIONS OF SHELLS INEW JNEW KNEW AND LNEW IN LIST
C OF GAUSSIAN FUNCTIONS
C
      I= KSTART(INEW)-1
      J= KSTART(JNEW)-1
      K= KSTART(KNEW)-1
      L= KSTART(LNEW)-1
C
      MINI = KMIN(INEW)
      MAXI = KMAX(INEW)
      LOCI = KLOC(INEW)-MINI
      MINJ = KMIN(JNEW)
      MAXJ = KMAX(JNEW)
      LOCJ = KLOC(JNEW)-MINJ
      MINK = KMIN(KNEW)
      MAXK = KMAX(KNEW)
      LOCK = KLOC(KNEW)-MINK
      MINL = KMIN(LNEW)
      MAXL = KMAX(LNEW)
      LOCL = KLOC(LNEW)-MINL
C
C LOOP OVER GAUSSIANS IN EACH SHELL
C FIRST SHELL INEW
C
      DO NI=1,NGA
         N=I+NI
         CMAXA(NI)= CMAX(N)
         EXA(NI)= EX(N)
         CSA(NI)= CS(N)
         CPA(NI)= CP(N)
         CDA(NI)= CD(N)
      ENDDO
C
      DO NJ=1,NGB
         N=J+NJ
         CMAXB(NJ)= CMAX(N)
         EXB(NJ)= EX(N)
         CSB(NJ)= CS(N)
         CPB(NJ)= CP(N)
         CDB(NJ)= CD(N)
      ENDDO
C
      DO NK=1,NGC
         N=K+NK
         CMAXC(NK)= CMAX(N)*QQ4
         EXC(NK)= EX(N)
         CSC(NK)= CS(N)*QQ4
         CPC(NK)= CP(N)*QQ4
         CDC(NK)= CD(N)*QQ4
      ENDDO
C
      DO NL=1,NGD
         N=L+NL
         CMAXD(NL)=CMAX(N)
         EXD(NL)=EX(N)
         CDD(NL)=CD(N)
      ENDDO
C
      NGANGB=NGA*NGB
C
C COORDINATES OF ATOMS ASSOCIATED WITH SHELLS INEW JNEW KNEW AND LNEW
C
      R12= ZER
      R34= ZER
      DO 150 N=1,3
         P12(N,1)= CO(INEW,N)
         P12(N,2)= CO(JNEW,N)
         P12(N,3)= P12(N,2)-P12(N,1)
      R12= R12+P12(N,3)*P12(N,3)
         P34(N,1)= CO(KNEW,N)
         P34(N,2)= CO(LNEW,N)
         P34(N,3)= P34(N,2)-P34(N,1)
  150 R34= R34+P34(N,3)*P34(N,3)
C
C FIND DIRECTION COSINES OF PENULTIMATE AXES FROM COORDINATES OF AB
C P(1,1),P(1,2),... ARE DIRECTION COSINES OF AXES AT P.  Z-AXIS ALONG AB
C T(1),T(2),T(3)... ARE DIRECTION COSINES OF AXES AT Q.  Z-AXIS ALONG CD
C
C FIND DIRECTION COSINES OF AB AND CD. THESE ARE LOCAL Z-AXES.
C IF INDETERMINATE TAKE ALONG SPACE Z-AXIS
C
      P(1,3)= ZER
      P(2,3)= ZER
      P(3,3)= ONE
      RAB= ZER
      IF(R12.NE.ZER) THEN
         RAB= SQRT(R12)
         TMP= ONE/RAB
         P(1,3)= P12(1,3)*TMP
         P(2,3)= P12(2,3)*TMP
         P(3,3)= P12(3,3)*TMP
      ENDIF
C
      T(1)= ZER
      T(2)= ZER
      T(3)= ONE
      RCD= ZER
      IF(R34.NE.ZER) THEN
         RCD= SQRT(R34)
         TMP= ONE/RCD
         T(1)= P34(1,3)*TMP
         T(2)= P34(2,3)*TMP
         T(3)= P34(3,3)*TMP
      ENDIF
C
C FIND LOCAL Y-AXIS AS COMMON PERPENDICULAR TO AB AND CD
C IF INDETERMINATE TAKE PERPENDICULAR TO AB AND SPACE Z-AXIS
C IF STILL INDETERMINATE TAKE PERPENDICULAR TO AB AND SPACE X-AXIS
C
      COSG= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
      COSG= MIN( ONE,COSG)
      COSG= MAX(-ONE,COSG)
C     SING= SQRT(ONE-COSG*COSG)
C
C MODIFIED ROTATION TESTING.
C THIS FIX CURES THE SMALL ANGLE PROBLEM.
C
      P(1,2)= T(3)*P(2,3)-T(2)*P(3,3)
      P(2,2)= T(1)*P(3,3)-T(3)*P(1,3)
      P(3,2)= T(2)*P(1,3)-T(1)*P(2,3)
      IF( ABS(COSG).GT.PT9) THEN
         SING= SQRT(P(1,2)*P(1,2)+P(2,2)*P(2,2)+P(3,2)*P(3,2))
      ELSE
         SING= SQRT(ONE-COSG*COSG)
      ENDIF
      IF( ABS(COSG).LE.PT9 .OR. SING.GE.TENM12) THEN
         TMP= ONE/SING
         P(1,2)= P(1,2)*TMP
         P(2,2)= P(2,2)*TMP
         P(3,2)= P(3,2)*TMP
      ELSE
         I=3
         IF( ABS(P(1,3)).LE.PT7) I=1
         TMP = P(I,3)*P(I,3)
         TMP = MIN( ONE,TMP)
         TMP = SQRT(ONE-TMP)
         IF(TMP.NE.ZER) TMP= ONE/TMP
         IF( ABS(P(1,3)).LE.PT7) THEN
            P(1,2)= ZER
            P(2,2)= P(3,3)*TMP
            P(3,2)=-P(2,3)*TMP
         ELSE
            P(1,2)= P(2,3)*TMP
            P(2,2)=-P(1,3)*TMP
            P(3,2)= ZER
         ENDIF
      ENDIF
C
C FIND DIRECTION COSINES OF LOCAL X-AXES
C
      P(1,1)= P(2,2)*P(3,3)-P(3,2)*P(2,3)
      P(2,1)= P(3,2)*P(1,3)-P(1,2)*P(3,3)
      P(3,1)= P(1,2)*P(2,3)-P(2,2)*P(1,3)
C
C FIND COORDINATES OF C RELATIVE TO LOCAL AXES AT A
C
      T(1)= P34(1,1)-P12(1,1)
      T(2)= P34(2,1)-P12(2,1)
      T(3)= P34(3,1)-P12(3,1)
      ACX = T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
      ACY = T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
      ACZ = T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
C
C SET ACY= 0  IF CLOSE
C
      IF( ABS(ACY).LE.ACYCUT) THEN
         ACY =ZER
         ACY2=ZER
      ELSE
         ACY2=ACY*ACY
      ENDIF
C
C DIRECTION COSINES OF CD LOCAL AXES WITH RESPECT TO AB LOCAL AXES
C (COSG,0,-SING)  (0,1,0)  (SING,0,COSG)
C
C PRELIMINARY P LOOP
C
C FILL GEOMPQ WITH INFORMATION ABOUT P IN PRELIMINARY P-LOOP
C
      JI= 1
      DO 170 I=1,NGA
         X01= EXA(I)
         DO 170 J=1,NGB
            X02= EXB(J)
            X12= X01+X02
            X21= ONE/X12
            Y01= X01*X21
            Y02= ONE-Y01
            Y12= Y01*X02
            TX12(JI)= X12
            TX21(JI)= X21*PT5
            TY02(JI)= Y02*RAB
            TY01(JI)= TY02(JI)-RAB
            R12Y12= R12*Y12
            IF(R12Y12.GT.CUX) THEN
               ISMLP(JI)=2
               GO TO 160
            ENDIF
            E12= X21* EXP(-R12Y12)
            TST= E12*CMAXA(I)*CMAXB(J)
            ISMLP(JI)=0
            IF(TST.LE.EI1) ISMLP(JI)=1
            IF(TST.LE.EI2) ISMLP(JI)=2
            E12= PIF*E12
C
C FOR TYPES 0000,0001,0011 ONLY D00P NEEDED
C
            IF(LB.EQ.2) THEN
               D02D(JI)= E12*CSA(I)*CDB(J)
               IF(LA.EQ.1) THEN
                  D12D(JI)= E12*CPA(I)*CDB(J)
                  IF(D12D(JI).NE.ZER) D02D(JI)=D02D(JI)/D12D(JI)
               ELSEIF(LA.EQ.2) THEN
                  D22D(JI)= E12*CDA(I)*CDB(J)
               ENDIF
            ELSEIF(LB.EQ.1) THEN
               D00P(JI)= E12*CSA(I)*CSB(J)
               D01P(JI)= E12*CSA(I)*CPB(J)
               IF(LA.EQ.0) THEN
                  IF(D01P(JI).NE.ZER) D00P(JI)= D00P(JI)/D01P(JI)
               ELSE
                  D10P(JI)= E12*CPA(I)*CSB(J)
                  D11P(JI)= E12*CPA(I)*CPB(J)
                  IF(D11P(JI).NE.ZER) THEN
                     TMP = ONE/D11P(JI)
                     D00P(JI)= D00P(JI)*TMP
                     D01P(JI)= D01P(JI)*TMP
                     D10P(JI)= D10P(JI)*TMP
                  ENDIF
               ENDIF
            ELSE
               D00P(JI)= E12*CSA(I)*CSB(J)
            ENDIF
  160       CONTINUE
  170 JI=JI+1
C
C BEGIN Q LOOP
C
      DO 190 K=1,NGC
         X03= EXC(K)
         DO 180 L=1,NGD
            X04= EXD(L)
            X34= X03+X04
            X43= ONE/X34
            Y03= X03*X43
            Y04= ONE-Y03
            Y34= Y03*X04
            R34Y34= R34*Y34
            IF(R34Y34.GT.CUX) GO TO 180
            E34= X43* EXP(-R34Y34)
            TST= E34*CMAXC(K)*CMAXD(L)
            IF(TST.LE.EI2) GO TO 180
            ISMLQ= 0
            IF(TST.LE.EI1) ISMLQ= 1
C
C CQX = COMPONENT OF CQ ALONG PENULTIMATE X-AXIS
C CQZ = COMPONENT OF CQ ALONG PENULTIMATE Z-AXIS
C
            CQ = RCD*Y04
            CQX= CQ*SING
            CQZ= CQ*COSG
C
C FIND COORDINATES OF Q RELATIVE TO AXES AT A
C QPR IS PERPENDICULAR FROM Q TO AB
C
            AQX= ACX+CQX
            AQX2= AQX*AQX
            AQXY= AQX*ACY
            AQZ= ACZ+CQZ
            QPS= AQX2+ACY2
C
            SQ(1)= E34*CSC(K)*CDD(L)
            SQ(2)= E34*CPC(K)*CDD(L)
            SQ(3)= E34*CDC(K)*CDD(L)
C
C USE SPECIAL FAST ROUTINE FOR INNER LOOPS FOR 0000 ... 1111
C
            CALL SPDGEN(JTYPE)
  180    CONTINUE
  190 CONTINUE
C
CJMS  NOW, THE TRANSPOSE OF P TO BE USED FOR COMPUTATIONAL EFFICIENCY
C
         DO 195 J=1,2
            DO 195 I=J+1,3
               TMP= P(I,J)
               P(I,J)= P(J,I)
               P(J,I)= TMP
  195    CONTINUE
C
         QX= RCD*SING
         QZ= RCD*COSG
         IF(JTYPE.EQ.7) THEN
            CALL MCDV07(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.8) THEN
            CALL MCDV08(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.9) THEN
            CALL MCDV09(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.10) THEN
            CALL MCDV10(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.11) THEN
            CALL MCDV11(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.12) THEN
            CALL MCDV12(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.13) THEN
            CALL MCDV13(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.14) THEN
            CALL MCDV14(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.15) THEN
            CALL MCDV15(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.16) THEN
            CALL MCDV16(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.17) THEN
            CALL MCDV17(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.18) THEN
            CALL MCDV18(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.19) THEN
            CALL MCDV19(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.20) THEN
            CALL MCDV20(GHONDO,QX,QZ)
         ELSEIF(JTYPE.EQ.21) THEN
            CALL MCDV21(GHONDO,QX,QZ)
         ENDIF
C
      CALL R30S1D(JTYPE,GHONDO,P)
C
      RETURN
      END
C
C*MODULE INT2R   *DECK SPDGEN
      SUBROUTINE SPDGEN(JTYPE)
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
      PARAMETER (ZER=0.0D+00)
C
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
C
      IF(JTYPE.EQ.7) THEN
         FQD0(1)= ZER
         FQD1(1)= ZER
         FQD1(2)= ZER
         FQD2(1)= ZER
         FQD2(2)= ZER
         FQD2(3)= ZER
         CALL INTJ7
         CALL INTK7
      ELSEIF(JTYPE.EQ.8) THEN
         FQD0(1)= ZER
         FQD1(1)= ZER
         FQD1(2)= ZER
         FQD2(1)= ZER
         FQD2(2)= ZER
         FQD2(3)= ZER
         DO 810 I=1,4
            FQD3(I)= ZER
  810    CONTINUE
         CALL INTJ8
         CALL INTK8
      ELSEIF(JTYPE.EQ.9) THEN
         FQD0(1)= ZER
         FQD0(2)= ZER
         DO 910 I=1,6
            FQD1(I)= ZER
  910    CONTINUE
         DO 920 I=1,9
            FQD2(I)= ZER
  920    CONTINUE
         DO 930 I=1,4
            FQD3(I)= ZER
  930    CONTINUE
         CALL INTJ9
         CALL INTK9
      ELSEIF(JTYPE.EQ.10) THEN
         FQD0(1)= ZER
         FQD1(1)= ZER
         FQD1(2)= ZER
         FQD2(1)= ZER
         FQD2(2)= ZER
         FQD2(3)= ZER
         DO 1010 I=1,4
            FQD3(I)= ZER
 1010    CONTINUE
         DO 1020 I=1,5
            FQD4(I)= ZER
 1020    CONTINUE
         CALL INTJ10
         CALL INTK10
      ELSEIF(JTYPE.EQ.11) THEN
         FQD0(1)= ZER
         FQD0(2)= ZER
         DO 1110 I=1,6
            FQD1(I)= ZER
 1110    CONTINUE
         DO 1120 I=1,9
            FQD2(I)= ZER
 1120    CONTINUE
         DO 1130 I=1,12
            FQD3(I)= ZER
 1130    CONTINUE
         DO 1140 I=1,5
            FQD4(I)= ZER
 1140    CONTINUE
         CALL INTJ11
         CALL INTK11
      ELSEIF(JTYPE.EQ.12) THEN
         FQD0(1)= ZER
         FQD0(2)= ZER
         DO 1210 I=1,7
            FQD1(I)= ZER
 1210    CONTINUE
         DO 1220 I=1,12
            FQD2(I)= ZER
 1220    CONTINUE
         DO 1230 I=1,8
            FQD3(I)= ZER
 1230    CONTINUE
         DO 1240 I=1,5
            FQD4(I)= ZER
 1240    CONTINUE
         CALL INTJ12
         CALL INTK12
      ELSEIF(JTYPE.EQ.13) THEN
         DO 1310 I=1,5
            FQD0(I)= ZER
 1310    CONTINUE
         DO 1320 I=1,17
            FQD1(I)= ZER
 1320    CONTINUE
         DO 1330 I=1,27
            FQD2(I)= ZER
 1330    CONTINUE
         DO 1340 I=1,20
            FQD3(I)= ZER
 1340    CONTINUE
         DO 1350 I=1,5
            FQD4(I)= ZER
 1350    CONTINUE
         CALL INTJ13
         CALL INTK13
      ELSEIF(JTYPE.EQ.14) THEN
         FQD0(1)= ZER
         FQD0(2)= ZER
         DO 1410 I=1,6
            FQD1(I)= ZER
 1410    CONTINUE
         DO 1420 I=1,9
            FQD2(I)= ZER
 1420    CONTINUE
         DO 1430 I=1,12
            FQD3(I)= ZER
 1430    CONTINUE
         DO 1440 I=1,15
            FQD4(I)= ZER
 1440    CONTINUE
         DO 1450 I=1,6
            FQD5(I)= ZER
 1450    CONTINUE
         CALL INTJ14
         CALL INTK14
      ELSEIF(JTYPE.EQ.15) THEN
         FQD0(1)= ZER
         FQD0(2)= ZER
         DO 1510 I=1,7
            FQD1(I)= ZER
 1510    CONTINUE
         DO 1520 I=1,12
            FQD2(I)= ZER
 1520    CONTINUE
         DO 1530 I=1,16
            FQD3(I)= ZER
 1530    CONTINUE
         DO 1540 I=1,10
            FQD4(I)= ZER
 1540    CONTINUE
         DO 1550 I=1,6
            FQD5(I)= ZER
 1550    CONTINUE
         CALL INTJ15
         CALL INTK15
      ELSEIF(JTYPE.EQ.16) THEN
         DO 1610 I=1,5
            FQD0(I)= ZER
 1610    CONTINUE
         DO 1620 I=1,17
            FQD1(I)= ZER
 1620    CONTINUE
         DO 1630 I=1,27
            FQD2(I)= ZER
 1630    CONTINUE
         DO 1640 I=1,36
            FQD3(I)= ZER
 1640    CONTINUE
         DO 1650 I=1,25
            FQD4(I)= ZER
 1650    CONTINUE
         DO 1660 I=1,6
            FQD5(I)= ZER
 1660    CONTINUE
         CALL INTJ16
         CALL INTK16
      ELSEIF(JTYPE.EQ.17) THEN
         FQD0(1)= ZER
         FQD0(2)= ZER
         DO 1710 I=1,7
            FQD1(I)= ZER
 1710    CONTINUE
         DO 1720 I=1,12
            FQD2(I)= ZER
 1720    CONTINUE
         DO 1730 I=1,16
            FQD3(I)= ZER
 1730    CONTINUE
         DO 1740 I=1,20
            FQD4(I)= ZER
 1740    CONTINUE
         DO 1750 I=1,12
            FQD5(I)= ZER
 1750    CONTINUE
         DO 1760 I=1,7
            FQD6(I)= ZER
 1760    CONTINUE
         CALL INTJ17
         CALL INTK17
      ELSEIF(JTYPE.EQ.18) THEN
         DO 1810 I=1,5
            FQD0(I)= ZER
 1810    CONTINUE
         DO 1820 I=1,17
            FQD1(I)= ZER
 1820    CONTINUE
         DO 1830 I=1,27
            FQD2(I)= ZER
 1830    CONTINUE
         DO 1840 I=1,36
            FQD3(I)= ZER
 1840    CONTINUE
         DO 1850 I=1,45
            FQD4(I)= ZER
 1850    CONTINUE
         DO 1860 I=1,30
            FQD5(I)= ZER
 1860    CONTINUE
         DO 1870 I=1,7
            FQD6(I)= ZER
 1870    CONTINUE
         CALL INTJ18
         CALL INTK18
      ELSEIF(JTYPE.EQ.19) THEN
         DO 1910 I=1,5
            FQD0(I)= ZER
 1910    CONTINUE
         DO 1920 I=1,19
            FQD1(I)= ZER
 1920    CONTINUE
         DO 1930 I=1,32
            FQD2(I)= ZER
 1930    CONTINUE
         DO 1940 I=1,44
            FQD3(I)= ZER
 1940    CONTINUE
         DO 1950 I=1,35
            FQD4(I)= ZER
 1950    CONTINUE
         DO 1960 I=1,24
            FQD5(I)= ZER
 1960    CONTINUE
         DO 1970 I=1,7
            FQD6(I)= ZER
 1970    CONTINUE
         CALL INTJ19
         CALL INTK19
      ELSEIF(JTYPE.EQ.20) THEN
         DO 2010 I=1,5
            FQD0(I)= ZER
 2010    CONTINUE
         DO 2020 I=1,19
            FQD1(I)= ZER
 2020    CONTINUE
         DO 2030 I=1,32
            FQD2(I)= ZER
 2030    CONTINUE
         DO 2040 I=1,44
            FQD3(I)= ZER
 2040    CONTINUE
         DO 2050 I=1,55
            FQD4(I)= ZER
 2050    CONTINUE
         DO 2060 I=1,42
            FQD5(I)= ZER
 2060    CONTINUE
         DO 2070 I=1,28
            FQD6(I)= ZER
 2070    CONTINUE
         DO 2080 I=1,8
            FQD7(I)= ZER
 2080    CONTINUE
         CALL INTJ20
         CALL INTK20
      ELSEIF(JTYPE.EQ.21) THEN
         DO 2110 I=1,5
            FQD0(I)= ZER
 2110    CONTINUE
         DO 2120 I=1,25
            FQD1(I)= ZER
 2120    CONTINUE
         DO 2130 I=1,46
            FQD2(I)= ZER
 2130    CONTINUE
         DO 2140 I=1,63
            FQD3(I)= ZER
 2140    CONTINUE
         DO 2150 I=1,80
            FQD4(I)= ZER
 2150    CONTINUE
         DO 2160 I=1,66
            FQD5(I)= ZER
 2160    CONTINUE
         DO 2170 I=1,49
            FQD6(I)= ZER
 2170    CONTINUE
         DO 2180 I=1,24
            FQD7(I)= ZER
 2180    CONTINUE
         DO 2190 I=1,9
            FQD8(I)= ZER
 2190    CONTINUE
         CALL INTJ21
         CALL INTK21
      ENDIF
      RETURN
      END
C
C*MODULE INT2R   *DECK R30S1D
      SUBROUTINE R30S1D(JTYPE,F,P)
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C ROTATE UP TO 1296 INTEGRALS TO SPACE FIXED AXES
C INCOMING AND OUTGOING INTEGRALS IN F
C P(1,1),...ARE DIRECTION COSINES OF SPACE FIXED AXES WRT AXES AT P
C
      DIMENSION F(6,6,6,6),P(3,3),Q(6,6)
C
      DIMENSION T(6)
      PARAMETER(TWO=2.0D+00,SQRT3=1.73205080756888D+00)
C
      DO 110 I=1,3
         Q(1,I)= P(1,I)*P(1,I)
         Q(2,I)= P(2,I)*P(2,I)
         Q(3,I)= P(3,I)*P(3,I)
         Q(4,I)= P(1,I)*P(2,I)*TWO
         Q(5,I)= P(1,I)*P(3,I)*TWO
         Q(6,I)= P(2,I)*P(3,I)*TWO
  110 CONTINUE
      DO 120 I=4,5
         Q(1,I)= P(1,1)*P(1,I-2)
         Q(2,I)= P(2,1)*P(2,I-2)
         Q(3,I)= P(3,1)*P(3,I-2)
         Q(4,I)= P(1,1)*P(2,I-2)+P(2,1)*P(1,I-2)
         Q(5,I)= P(1,1)*P(3,I-2)+P(3,1)*P(1,I-2)
         Q(6,I)= P(2,1)*P(3,I-2)+P(3,1)*P(2,I-2)
  120 CONTINUE
      Q(1,6)= P(1,2)*P(1,3)
      Q(2,6)= P(2,2)*P(2,3)
      Q(3,6)= P(3,2)*P(3,3)
      Q(4,6)= P(1,2)*P(2,3)+P(2,2)*P(1,3)
      Q(5,6)= P(1,2)*P(3,3)+P(3,2)*P(1,3)
      Q(6,6)= P(2,2)*P(3,3)+P(3,2)*P(2,3)
      DO 130 I=4,6
         DO 130 J=1,6
            Q(J,I)= Q(J,I)*SQRT3
  130 CONTINUE
C
      IF(JTYPE.EQ.7) THEN
         DO 710 I=1,6
            T(I)= F(I,1,1,1)
  710    CONTINUE
         DO 720 I=1,6
            F(I,1,1,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                 +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
  720    CONTINUE
C
      ELSEIF(JTYPE.EQ.8) THEN
         DO 810 I=1,6
            T(1)= F(I,2,1,1)
            T(2)= F(I,3,1,1)
            T(3)= F(I,4,1,1)
            F(I,2,1,1)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
            F(I,3,1,1)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
            F(I,4,1,1)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
  810    CONTINUE
         DO 830 J=1,4
            DO 820 I=1,6
               T(I)= F(I,J,1,1)
  820       CONTINUE
            DO 830 I=1,6
               F(I,J,1,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                    +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
  830    CONTINUE
C
      ELSEIF(JTYPE.EQ.9) THEN
         DO 910 I=1,6
            T(1)= F(I,1,2,1)
            T(2)= F(I,1,3,1)
            T(3)= F(I,1,4,1)
            F(I,1,2,1)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
            F(I,1,3,1)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
            F(I,1,4,1)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
  910    CONTINUE
         DO 930 J=1,4
            DO 920 I=1,6
               T(I)= F(I,1,J,1)
  920       CONTINUE
            DO 930 I=1,6
               F(I,1,J,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                    +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
  930    CONTINUE
C
      ELSEIF(JTYPE.EQ.10) THEN
         DO 1020 I=1,6
            DO 1010 J=1,6
               T(J)= F(I,J,1,1)
 1010       CONTINUE
            DO 1020 J=1,6
               F(I,J,1,1)= T(1)*Q(1,J)+T(2)*Q(2,J)+T(3)*Q(3,J)
     *                    +T(4)*Q(4,J)+T(5)*Q(5,J)+T(6)*Q(6,J)
 1020    CONTINUE
         DO 1040 J=1,6
            DO 1030 I=1,6
               T(I)= F(I,J,1,1)
 1030       CONTINUE
            DO 1040 I=1,6
               F(I,J,1,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                    +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1040    CONTINUE
C
      ELSEIF(JTYPE.EQ.11) THEN
         DO 1110 J=1,4
            DO 1110 I=1,6
               T(1)= F(I,J,2,1)
               T(2)= F(I,J,3,1)
               T(3)= F(I,J,4,1)
               F(I,J,2,1)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
               F(I,J,3,1)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
               F(I,J,4,1)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1110    CONTINUE
         DO 1120 K=1,4
            DO 1120 I=1,6
               T(1)= F(I,2,K,1)
               T(2)= F(I,3,K,1)
               T(3)= F(I,4,K,1)
               F(I,2,K,1)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
               F(I,3,K,1)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
               F(I,4,K,1)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1120    CONTINUE
         DO 1140 K=1,4
            DO 1140 J=1,4
               DO 1130 I=1,6
                  T(I)= F(I,J,K,1)
 1130          CONTINUE
               DO 1140 I=1,6
                  F(I,J,K,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                       +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1140    CONTINUE
C
      ELSEIF(JTYPE.EQ.12) THEN
         DO 1220 I=1,6
            DO 1210 K=1,6
               T(K)= F(I,1,K,1)
 1210       CONTINUE
            DO 1220 K=1,6
               F(I,1,K,1)= T(1)*Q(1,K)+T(2)*Q(2,K)+T(3)*Q(3,K)
     *                    +T(4)*Q(4,K)+T(5)*Q(5,K)+T(6)*Q(6,K)
 1220    CONTINUE
         DO 1240 K=1,6
            DO 1230 I=1,6
               T(I)= F(I,1,K,1)
 1230       CONTINUE
            DO 1240 I=1,6
               F(I,1,K,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                    +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1240    CONTINUE
C
      ELSEIF(JTYPE.EQ.13) THEN
         DO 1310 K=1,4
            DO 1310 I=1,6
               T(1)= F(I,1,K,2)
               T(2)= F(I,1,K,3)
               T(3)= F(I,1,K,4)
               F(I,1,K,2)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
               F(I,1,K,3)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
               F(I,1,K,4)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1310    CONTINUE
         DO 1320 L=1,4
            DO 1320 I=1,6
               T(1)= F(I,1,2,L)
               T(2)= F(I,1,3,L)
               T(3)= F(I,1,4,L)
               F(I,1,2,L)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
               F(I,1,3,L)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
               F(I,1,4,L)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1320    CONTINUE
         DO 1340 L=1,4
            DO 1340 K=1,4
               DO 1330 I=1,6
                  T(I)= F(I,1,K,L)
 1330          CONTINUE
               DO 1340 I=1,6
                  F(I,1,K,L)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                       +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1340    CONTINUE
C
      ELSEIF(JTYPE.EQ.14) THEN
         DO 1410 J=1,6
            DO 1410 I=1,6
               T(1)= F(I,J,2,1)
               T(2)= F(I,J,3,1)
               T(3)= F(I,J,4,1)
               F(I,J,2,1)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
               F(I,J,3,1)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
               F(I,J,4,1)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1410    CONTINUE
         DO 1430 K=1,4
            DO 1430 I=1,6
               DO 1420 J=1,6
                  T(J)= F(I,J,K,1)
 1420          CONTINUE
               DO 1430 J=1,6
                  F(I,J,K,1)= T(1)*Q(1,J)+T(2)*Q(2,J)+T(3)*Q(3,J)
     *                       +T(4)*Q(4,J)+T(5)*Q(5,J)+T(6)*Q(6,J)
 1430    CONTINUE
         DO 1450 K=1,4
            DO 1450 J=1,6
               DO 1440 I=1,6
                  T(I)= F(I,J,K,1)
 1440          CONTINUE
               DO 1450 I=1,6
                  F(I,J,K,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                       +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1450    CONTINUE
C
      ELSEIF(JTYPE.EQ.15) THEN
         DO 1520 J=1,4
            DO 1520 I=1,6
               DO 1510 K=1,6
                  T(K)= F(I,J,K,1)
 1510          CONTINUE
               DO 1520 K=1,6
                  F(I,J,K,1)= T(1)*Q(1,K)+T(2)*Q(2,K)+T(3)*Q(3,K)
     *                       +T(4)*Q(4,K)+T(5)*Q(5,K)+T(6)*Q(6,K)
 1520    CONTINUE
         DO 1530 K=1,6
            DO 1530 I=1,6
               T(1)= F(I,2,K,1)
               T(2)= F(I,3,K,1)
               T(3)= F(I,4,K,1)
               F(I,2,K,1)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
               F(I,3,K,1)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
               F(I,4,K,1)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1530    CONTINUE
         DO 1550 K=1,6
            DO 1550 J=1,4
               DO 1540 I=1,6
                  T(I)= F(I,J,K,1)
 1540          CONTINUE
               DO 1550 I=1,6
                  F(I,J,K,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                       +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1550    CONTINUE
C
      ELSEIF(JTYPE.EQ.16) THEN
         DO 1610 K=1,4
            DO 1610 J=1,4
               DO 1610 I=1,6
                  T(1)= F(I,J,K,2)
                  T(2)= F(I,J,K,3)
                  T(3)= F(I,J,K,4)
                  F(I,J,K,2)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,J,K,3)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,J,K,4)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1610    CONTINUE
         DO 1620 L=1,4
            DO 1620 J=1,4
               DO 1620 I=1,6
                  T(1)= F(I,J,2,L)
                  T(2)= F(I,J,3,L)
                  T(3)= F(I,J,4,L)
                  F(I,J,2,L)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,J,3,L)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,J,4,L)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1620    CONTINUE
         DO 1630 L=1,4
            DO 1630 K=1,4
               DO 1630 I=1,6
                  T(1)= F(I,2,K,L)
                  T(2)= F(I,3,K,L)
                  T(3)= F(I,4,K,L)
                  F(I,2,K,L)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,3,K,L)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,4,K,L)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1630    CONTINUE
         DO 1650 L=1,4
            DO 1650 K=1,4
               DO 1650 J=1,4
                  DO 1640 I=1,6
                     T(I)= F(I,J,K,L)
 1640             CONTINUE
                  DO 1650 I=1,6
                     F(I,J,K,L)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                          +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1650    CONTINUE
C
      ELSEIF(JTYPE.EQ.17) THEN
         DO 1720 J=1,6
            DO 1720 I=1,6
               DO 1710 K=1,6
                  T(K)= F(I,J,K,1)
 1710          CONTINUE
               DO 1720 K=1,6
                  F(I,J,K,1)= T(1)*Q(1,K)+T(2)*Q(2,K)+T(3)*Q(3,K)
     *                       +T(4)*Q(4,K)+T(5)*Q(5,K)+T(6)*Q(6,K)
 1720    CONTINUE
         DO 1740 K=1,6
            DO 1740 I=1,6
               DO 1730 J=1,6
                  T(J)= F(I,J,K,1)
 1730          CONTINUE
               DO 1740 J=1,6
                  F(I,J,K,1)= T(1)*Q(1,J)+T(2)*Q(2,J)+T(3)*Q(3,J)
     *                       +T(4)*Q(4,J)+T(5)*Q(5,J)+T(6)*Q(6,J)
 1740    CONTINUE
         DO 1760 K=1,6
            DO 1760 J=1,6
               DO 1750 I=1,6
                  T(I)= F(I,J,K,1)
 1750          CONTINUE
               DO 1760 I=1,6
                  F(I,J,K,1)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                       +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1760    CONTINUE
C
      ELSEIF(JTYPE.EQ.18) THEN
         DO 1810 K=1,4
            DO 1810 J=1,6
               DO 1810 I=1,6
                  T(1)= F(I,J,K,2)
                  T(2)= F(I,J,K,3)
                  T(3)= F(I,J,K,4)
                  F(I,J,K,2)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,J,K,3)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,J,K,4)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1810    CONTINUE
         DO 1820 L=1,4
            DO 1820 J=1,6
               DO 1820 I=1,6
                  T(1)= F(I,J,2,L)
                  T(2)= F(I,J,3,L)
                  T(3)= F(I,J,4,L)
                  F(I,J,2,L)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,J,3,L)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,J,4,L)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1820    CONTINUE
         DO 1840 L=1,4
            DO 1840 K=1,4
               DO 1840 I=1,6
                  DO 1830 J=1,6
                     T(J)= F(I,J,K,L)
 1830             CONTINUE
                  DO 1840 J=1,6
                     F(I,J,K,L)= T(1)*Q(1,J)+T(2)*Q(2,J)+T(3)*Q(3,J)
     *                          +T(4)*Q(4,J)+T(5)*Q(5,J)+T(6)*Q(6,J)
 1840    CONTINUE
         DO 1860 L=1,4
            DO 1860 K=1,4
               DO 1860 J=1,6
                  DO 1850 I=1,6
                     T(I)= F(I,J,K,L)
 1850             CONTINUE
                  DO 1860 I=1,6
                     F(I,J,K,L)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                          +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1860    CONTINUE
      ELSEIF(JTYPE.EQ.19) THEN
         DO 1910 K=1,6
            DO 1910 J=1,4
               DO 1910 I=1,6
                  T(1)= F(I,J,K,2)
                  T(2)= F(I,J,K,3)
                  T(3)= F(I,J,K,4)
                  F(I,J,K,2)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,J,K,3)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,J,K,4)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1910    CONTINUE
         DO 1930 L=1,4
            DO 1930 J=1,4
               DO 1930 I=1,6
                  DO 1920 K=1,6
                     T(K)= F(I,J,K,L)
 1920             CONTINUE
                  DO 1930 K=1,6
                     F(I,J,K,L)= T(1)*Q(1,K)+T(2)*Q(2,K)+T(3)*Q(3,K)
     *                          +T(4)*Q(4,K)+T(5)*Q(5,K)+T(6)*Q(6,K)
 1930    CONTINUE
         DO 1940 L=1,4
            DO 1940 K=1,6
               DO 1940 I=1,6
                  T(1)= F(I,2,K,L)
                  T(2)= F(I,3,K,L)
                  T(3)= F(I,4,K,L)
                  F(I,2,K,L)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,3,K,L)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,4,K,L)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 1940    CONTINUE
         DO 1960 L=1,4
            DO 1960 K=1,6
               DO 1960 J=1,4
                  DO 1950 I=1,6
                     T(I)= F(I,J,K,L)
 1950             CONTINUE
                  DO 1960 I=1,6
                     F(I,J,K,L)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                          +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 1960    CONTINUE
C
      ELSEIF(JTYPE.EQ.20) THEN
         DO 2010 K=1,6
            DO 2010 J=1,6
               DO 2010 I=1,6
                  T(1)= F(I,J,K,2)
                  T(2)= F(I,J,K,3)
                  T(3)= F(I,J,K,4)
                  F(I,J,K,2)= T(1)*P(1,1)+T(2)*P(2,1)+T(3)*P(3,1)
                  F(I,J,K,3)= T(1)*P(1,2)+T(2)*P(2,2)+T(3)*P(3,2)
                  F(I,J,K,4)= T(1)*P(1,3)+T(2)*P(2,3)+T(3)*P(3,3)
 2010    CONTINUE
         DO 2030 L=1,4
            DO 2030 J=1,6
               DO 2030 I=1,6
                  DO 2020 K=1,6
                     T(K)= F(I,J,K,L)
 2020             CONTINUE
                  DO 2030 K=1,6
                     F(I,J,K,L)= T(1)*Q(1,K)+T(2)*Q(2,K)+T(3)*Q(3,K)
     *                          +T(4)*Q(4,K)+T(5)*Q(5,K)+T(6)*Q(6,K)
 2030    CONTINUE
         DO 2050 L=1,4
            DO 2050 K=1,6
               DO 2050 I=1,6
                  DO 2040 J=1,6
                     T(J)= F(I,J,K,L)
 2040             CONTINUE
                  DO 2050 J=1,6
                     F(I,J,K,L)= T(1)*Q(1,J)+T(2)*Q(2,J)+T(3)*Q(3,J)
     *                          +T(4)*Q(4,J)+T(5)*Q(5,J)+T(6)*Q(6,J)
 2050    CONTINUE
         DO 2070 L=1,4
            DO 2070 K=1,6
               DO 2070 J=1,6
                  DO 2060 I=1,6
                     T(I)= F(I,J,K,L)
 2060             CONTINUE
                  DO 2070 I=1,6
                     F(I,J,K,L)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                          +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 2070    CONTINUE
C
      ELSEIF(JTYPE.EQ.21) THEN
         DO 2120 K=1,6
            DO 2120 J=1,6
               DO 2120 I=1,6
                  DO 2110 L=1,6
                     T(L)= F(I,J,K,L)
 2110             CONTINUE
                  DO 2120 L=1,6
                     F(I,J,K,L)= T(1)*Q(1,L)+T(2)*Q(2,L)+T(3)*Q(3,L)
     *                          +T(4)*Q(4,L)+T(5)*Q(5,L)+T(6)*Q(6,L)
 2120    CONTINUE
         DO 2140 L=1,6
            DO 2140 J=1,6
               DO 2140 I=1,6
                  DO 2130 K=1,6
                     T(K)= F(I,J,K,L)
 2130             CONTINUE
                  DO 2140 K=1,6
                     F(I,J,K,L)= T(1)*Q(1,K)+T(2)*Q(2,K)+T(3)*Q(3,K)
     *                          +T(4)*Q(4,K)+T(5)*Q(5,K)+T(6)*Q(6,K)
 2140    CONTINUE
         DO 2160 L=1,6
            DO 2160 K=1,6
               DO 2160 I=1,6
                  DO 2150 J=1,6
                     T(J)= F(I,J,K,L)
 2150             CONTINUE
                  DO 2160 J=1,6
                     F(I,J,K,L)= T(1)*Q(1,J)+T(2)*Q(2,J)+T(3)*Q(3,J)
     *                          +T(4)*Q(4,J)+T(5)*Q(5,J)+T(6)*Q(6,J)
 2160    CONTINUE
         DO 2180 L=1,6
            DO 2180 K=1,6
               DO 2180 J=1,6
                  DO 2170 I=1,6
                     T(I)= F(I,J,K,L)
 2170             CONTINUE
                  DO 2180 I=1,6
                     F(I,J,K,L)= T(1)*Q(1,I)+T(2)*Q(2,I)+T(3)*Q(3,I)
     *                          +T(4)*Q(4,I)+T(5)*Q(5,I)+T(6)*Q(6,I)
 2180    CONTINUE
      ENDIF
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ7
      SUBROUTINE INTJ7
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=7 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D00P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION
C          SEE NOTES IN ROUTINE INTJ14 ABOUT THE FM(T) INTERPOLATIONS
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(2)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,2) *TVAL
            FX = (FX +FGRID(3,IPT,2))*TVAL
            FX = (FX +FGRID(2,IPT,2))*TVAL
            FX = (FX +FGRID(1,IPT,2))*TVAL
            FX =  FX +FGRID(0,IPT,2)
            FQD(2)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =       XGRID(4,IPT) *TVAL
            ET = (ET + XGRID(3,IPT))*TVAL
            ET = (ET + XGRID(2,IPT))*TVAL
            ET = (ET + XGRID(1,IPT))*TVAL
            ET =  ET + XGRID(0,IPT)
            T2 = XVA*TWO
            FQD( 1)=RMR( 2)*(T2*FQD( 2)+ET)
            FQD( 0)=RMR( 1)*(T2*FQD( 1)+ET)
            FQS = FQ00*SQRT(X41)
           IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 2
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)
            TMP= PT5*XIN
            DO M=1,2
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         FQD0(1)= FQD0(1)+FQD(0)
         FQD1(1)= FQD1(1)+FQD(1)
         FQD1(2)= FQD1(2)+FQD(1)*PQR
         FQD2(1)= FQD2(1)+FQD(2)
         FQD2(2)= FQD2(2)+FQD(2)*PQR
         FQD2(3)= FQD2(3)+FQD(2)*PQS
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ8
      SUBROUTINE INTJ8
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=8 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D00P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION...DOWNWARD RECURSION FOR M=3
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(3)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,3) *TVAL
            FX = (FX +FGRID(3,IPT,3))*TVAL
            FX = (FX +FGRID(2,IPT,3))*TVAL
            FX = (FX +FGRID(1,IPT,3))*TVAL
            FX =  FX +FGRID(0,IPT,3)
            FQD(3)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
            DO MXX = 3, 1, -1
              FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 3
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,3
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         FQD0(1)= FQD0(1)+FQD(0)
         FQD1(1)= FQD1(1)+FQD(1)
         FQD1(2)= FQD1(2)+FQD(1)*PQR
         FQD2(1)= FQD2(1)+FQD(2)
         FQD2(2)= FQD2(2)+FQD(2)*PQR
         FQD2(3)= FQD2(3)+FQD(2)*PQS
         FQD3(1)= FQD3(1)+FQD(3)
         FQD3(2)= FQD3(2)+FQD(3)*PQR
         FQD3(3)= FQD3(3)+FQD(3)*PQS
         FQD3(4)= FQD3(4)+FQD(3)*PQS*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ9
      SUBROUTINE INTJ9
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=9 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DIMENSION WORK(3,3)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D01P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION...DOWNWARD RECURSION FOR M=3
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(3)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,3) *TVAL
            FX = (FX +FGRID(3,IPT,3))*TVAL
            FX = (FX +FGRID(2,IPT,3))*TVAL
            FX = (FX +FGRID(1,IPT,3))*TVAL
            FX =  FX +FGRID(0,IPT,3)
            FQD(3)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
            DO MXX = 3, 1, -1
              FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 3
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,3
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         WORK(1,1)= D00P(I)
         WORK(1,2)= TY01(I)
         WORK(1,3)= TX21(I)
         DO 230 J=1,3
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
  230    CONTINUE
         FQD0(1)= FQD0(1)+FQD(0)*WORK(1,1)
         FQD0(2)= FQD0(2)+FQD(0)*WORK(1,2)
         DO 240 J=1,3
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  240    CONTINUE
         DO 250 J=1,3
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
         FQD3(1)= FQD3(1)+FQD(3)*WORK(1,3)
         FQD3(2)= FQD3(2)+FQD(3)*WORK(2,3)
         FQD3(3)= FQD3(3)+FQD(3)*WORK(3,3)
         FQD3(4)= FQD3(4)+FQD(3)*WORK(3,3)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ10
      SUBROUTINE INTJ10
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=10 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D00P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION...DOWNWARD RECURSION FOR M=4
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(4)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,4) *TVAL
            FX = (FX +FGRID(3,IPT,4))*TVAL
            FX = (FX +FGRID(2,IPT,4))*TVAL
            FX = (FX +FGRID(1,IPT,4))*TVAL
            FX =  FX +FGRID(0,IPT,4)
            FQD(4)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
            DO MXX = 4, 1, -1
              FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 4
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,4
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         PQT= PQS*PQR
         PQQ= PQS*PQS
         FQD0(1)= FQD0(1)+FQD(0)
         FQD1(1)= FQD1(1)+FQD(1)
         FQD1(2)= FQD1(2)+FQD(1)*PQR
         FQD2(1)= FQD2(1)+FQD(2)
         FQD2(2)= FQD2(2)+FQD(2)*PQR
         FQD2(3)= FQD2(3)+FQD(2)*PQS
         FQD3(1)= FQD3(1)+FQD(3)
         FQD3(2)= FQD3(2)+FQD(3)*PQR
         FQD3(3)= FQD3(3)+FQD(3)*PQS
         FQD3(4)= FQD3(4)+FQD(3)*PQT
         FQD4(1)= FQD4(1)+FQD(4)
         FQD4(2)= FQD4(2)+FQD(4)*PQR
         FQD4(3)= FQD4(3)+FQD(4)*PQS
         FQD4(4)= FQD4(4)+FQD(4)*PQT
         FQD4(5)= FQD4(5)+FQD(4)*PQQ
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ11
      SUBROUTINE INTJ11
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=11 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DIMENSION WORK(4,3)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D01P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION...DOWNWARD RECURSION FOR M=4
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(4)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,4) *TVAL
            FX = (FX +FGRID(3,IPT,4))*TVAL
            FX = (FX +FGRID(2,IPT,4))*TVAL
            FX = (FX +FGRID(1,IPT,4))*TVAL
            FX =  FX +FGRID(0,IPT,4)
            FQD(4)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
            DO MXX = 4, 1, -1
              FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 4
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,4
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         PQT = PQR*PQS
         WORK(1,1)= D00P(I)
         WORK(1,2)= TY01(I)
         WORK(1,3)= TX21(I)
         DO 230 J=1,3
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
  230    CONTINUE
         FQD0(1)= FQD0(1)+FQD(0)*WORK(1,1)
         FQD0(2)= FQD0(2)+FQD(0)*WORK(1,2)
         DO 240 J=1,3
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  240    CONTINUE
         DO 250 J=1,3
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
         DO 260 J=1,3
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  260    CONTINUE
         FQD4(1)= FQD4(1)+FQD(4)*WORK(1,3)
         FQD4(2)= FQD4(2)+FQD(4)*WORK(2,3)
         FQD4(3)= FQD4(3)+FQD(4)*WORK(3,3)
         FQD4(4)= FQD4(4)+FQD(4)*WORK(4,3)
         FQD4(5)= FQD4(5)+FQD(4)*WORK(4,3)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ12
      SUBROUTINE INTJ12
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=12 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
      DIMENSION WORK(4,4)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D02D(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF 
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION...DOWNWARD RECURSION FOR M=4
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(4)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,4) *TVAL
            FX = (FX +FGRID(3,IPT,4))*TVAL
            FX = (FX +FGRID(2,IPT,4))*TVAL
            FX = (FX +FGRID(1,IPT,4))*TVAL
            FX =  FX +FGRID(0,IPT,4)
            FQD(4)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
            DO MXX = 4, 1, -1
              FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 4
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,4
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         PQT = PQR*PQS
         XMD1= TX21(I)
         Y01= TY01(I)
         WORK(1,1)= XMD1
         WORK(1,2)= Y01*Y01
         WORK(1,3)= XMD1*Y01
         WORK(1,4)= XMD1*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
  230    CONTINUE
         WORK(4,3)= WORK(1,3)*PQT
         WORK(4,4)= WORK(1,4)*PQT
         FQD0(1)= FQD0(1)+FQD(0)*WORK(1,1)
         FQD0(2)= FQD0(2)+FQD(0)*WORK(1,2)
         DO 240 J=1,3
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  240    CONTINUE
         FQD1(1,4)= FQD1(1,4)+FQD(1)*WORK(1,4)
         DO 250 J=1,4
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
         DO 260 J=1,2
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J+2)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J+2)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J+2)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J+2)
  260    CONTINUE
         FQD4(1)= FQD4(1)+FQD(4)*WORK(1,4)
         FQD4(2)= FQD4(2)+FQD(4)*WORK(2,4)
         FQD4(3)= FQD4(3)+FQD(4)*WORK(3,4)
         FQD4(4)= FQD4(4)+FQD(4)*WORK(4,4)
         FQD4(5)= FQD4(5)+FQD(4)*WORK(4,4)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ13
      SUBROUTINE INTJ13
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=13 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DIMENSION WORK(4,9)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D11P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C            FM(T) EVALUATION...DOWNWARD RECURSION FOR M=4
C
         IF (XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(4)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,4) *TVAL
            FX = (FX +FGRID(3,IPT,4))*TVAL
            FX = (FX +FGRID(2,IPT,4))*TVAL
            FX = (FX +FGRID(1,IPT,4))*TVAL
            FX =  FX +FGRID(0,IPT,4)
            FQD(4)=FX
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
            DO MXX = 4, 1, -1
              FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 4
              FQD(MXX) = FQD(MXX)*FQS
              FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,4
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         DP00= D00P(I)
         DP01= D01P(I)
         DP10= D10P(I)
         PQT = PQR*PQS
         WORK(1,1)= DP00
         WORK(1,2)= Y01*DP01
         WORK(1,3)= Y02*DP10
         WORK(1,4)= Y01*Y02
         WORK(1,5)= XMD1
         WORK(1,6)= XMD1*DP01
         WORK(1,7)= XMD1*DP10
         WORK(1,8)= XMD1*Y01
         WORK(1,9)= XMD1*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
  230    CONTINUE
         DO 240 J=5,9
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
  240    CONTINUE
C
         DO 250 J=1,5
            FQD0(J)= FQD0(J)+FQD(0)*WORK(1,J)
  250    CONTINUE
C
         DO 260 J=1,8
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  260    CONTINUE
         FQD1(1,9)= FQD1(1,9)+FQD(1)*WORK(1,9)
C
         DO 270 J=1,9
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  270    CONTINUE
C
         DO 280 J=1,5
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J+4)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J+4)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J+4)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J+4)
  280    CONTINUE
C
         FQD4(1)= FQD4(1)+FQD(4)*WORK(1,9)
         FQD4(2)= FQD4(2)+FQD(4)*WORK(2,9)
         FQD4(3)= FQD4(3)+FQD(4)*WORK(3,9)
         FQD4(4)= FQD4(4)+FQD(4)*WORK(4,9)
         FQD4(5)= FQD4(5)+FQD(4)*WORK(4,9)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ14
      SUBROUTINE INTJ14
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=14 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DIMENSION WORK(5,3)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D01P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=5 INTERPOLATION, GENERATING WASTED M=8,7,6 DATA
C        FGRID(,,X) FOR  X=0,1,2,3,4,5, 6, 7 HOLDS NECESSARY DATA TO
C        INTERPOLATE FOR M=0,1,2,3,4,8,12,16.
C        HERE M=5, SO WE MUST GENERATE M=8,7,6 VALUES WE DON'T USE.
C        DOWNWARD RECURSION IS USED FOR GREATER NUMERICAL STABILITY.
C        NOTE THAT WE ALSO USE AN INTERPOLATION FOR EXP(-T) HERE.
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
C              THIS IS OTHER PARTS OF THE INTEGRAL, NOT FM(T)
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 5
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO M=1,5
               FQD(M)= FQD(M-1)*TMP*RHO
               TMP= TMP+XIN
            ENDDO
         ENDIF
C
         PQT = PQR*PQS
         PQQ = PQS*PQS
         WORK(1,1)= D00P(I)
         WORK(1,2)= TY01(I)
         WORK(1,3)= TX21(I)
         DO 230 J=1,3
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
  230    CONTINUE
C
         FQD0(1)= FQD0(1)+FQD(0)*WORK(1,1)
         FQD0(2)= FQD0(2)+FQD(0)*WORK(1,2)
C
         DO 240 J=1,3
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  240    CONTINUE
C
         DO 250 J=1,3
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
C
         DO 260 J=1,3
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  260    CONTINUE
C
         DO 270 J=1,3
            DO 270 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J)
  270    CONTINUE
C
         DO 280 K=1,5
            FQD5(K)= FQD5(K)+FQD(5)*WORK(K,3)
  280    CONTINUE
         FQD5(6)= FQD5(6)+FQD(5)*WORK(5,3)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ15
      SUBROUTINE INTJ15
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=15 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
      DIMENSION WORK(5,4)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D02D(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=5 INTERPOLATION, GENERATING WASTED M=8,7,6 DATA
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 5
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,5
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         PQT = PQR*PQS
         XMD1= TX21(I)
         Y01 = TY01(I)
         WORK(1,1)= XMD1
         WORK(1,2)= Y01*Y01
         WORK(1,3)= XMD1*Y01
         WORK(1,4)= XMD1*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
  230    CONTINUE
         WORK(5,3)= WORK(4,3)*PQR
         WORK(5,4)= WORK(4,4)*PQR
C
         FQD0(1)= FQD0(1)+FQD(0)*WORK(1,1)
         FQD0(2)= FQD0(2)+FQD(0)*WORK(1,2)
C
         DO 240 J=1,3
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  240    CONTINUE
         FQD1(1,4)= FQD1(1,4)+FQD(1)*WORK(1,4)
C
         DO 250 J=1,4
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
C
         DO 260 J=1,4
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  260    CONTINUE
C
         DO 270 J=1,2
            DO 270 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J+2)
  270    CONTINUE
C
         DO 280 K=1,5
            FQD5(K)= FQD5(K)+FQD(5)*WORK(K,4)
  280    CONTINUE
         FQD5(6)= FQD5(6)+FQD(5)*WORK(5,4)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ16
      SUBROUTINE INTJ16
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=16 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DIMENSION WORK(5,9)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D11P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=5 INTERPOLATION, GENERATING WASTED M=8,7,6 DATA
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 5
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,5
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         DP00= D00P(I)
         DP01= D01P(I)
         DP10= D10P(I)
         PQT = PQR*PQS
         PQQ = PQS*PQS
         WORK(1,1)= DP00
         WORK(1,2)= Y01*DP01
         WORK(1,3)= Y02*DP10
         WORK(1,4)= Y01*Y02
         WORK(1,5)= XMD1
         WORK(1,6)= XMD1*DP01
         WORK(1,7)= XMD1*DP10
         WORK(1,8)= XMD1*Y01
         WORK(1,9)= XMD1*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
  230    CONTINUE
         DO 235 J=5,9
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
  235    CONTINUE
C
         DO 240 J=1,5
            FQD0(J)= FQD0(J)+FQD(0)*WORK(1,J)
  240    CONTINUE
C
         DO 250 J=1,8
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  250    CONTINUE
         FQD1(1,9)= FQD1(1,9)+FQD(1)*WORK(1,9)
C
         DO 260 J=1,9
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  260    CONTINUE
C
         DO 270 J=1,9
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  270    CONTINUE
C
         DO 280 J=1,5
            DO 280 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J+4)
  280    CONTINUE
C
         DO 290 K=1,5
            FQD5(K)= FQD5(K)+FQD(5)*WORK(K,9)
  290    CONTINUE
         FQD5(6)= FQD5(6)+FQD(5)*WORK(5,9)*PQR
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ17
      SUBROUTINE INTJ17
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=17 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
      DIMENSION WORK(6,4)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D02D(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=6 INTERPOLATION, GENERATING WASTED M=8,7 DATA
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 6
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,6
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         PQT = PQR*PQS
         PQQ = PQS*PQS
         WORK(1,1)= XMD1
         WORK(1,2)= Y01*Y01
         WORK(1,3)= XMD1*Y01
         WORK(1,4)= XMD1*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
  230    CONTINUE
         WORK(6,3)= WORK(5,3)*PQR
         WORK(6,4)= WORK(5,4)*PQR
C
         FQD0(1)= FQD0(1)+FQD(0)*WORK(1,1)
         FQD0(2)= FQD0(2)+FQD(0)*WORK(1,2)
C
         DO 240 J=1,3
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  240    CONTINUE
         FQD1(1,4)= FQD1(1,4)+FQD(1)*WORK(1,4)
C
         DO 250 J=1,4
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
C
         DO 260 J=1,4
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  260    CONTINUE
C
         DO 270 J=1,4
            DO 270 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J)
  270    CONTINUE
C
         DO 280 J=1,2
            DO 280 K=1,6
               FQD5(K,J)= FQD5(K,J)+FQD(5)*WORK(K,J+2)
  280    CONTINUE
C
         DO 290 K=1,6
            FQD6(K)= FQD6(K)+FQD(6)*WORK(K,4)
  290    CONTINUE
         FQD6(7)= FQD6(7)+FQD(6)*WORK(6,4)*PQR
C
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ18
      SUBROUTINE INTJ18
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=18 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
C
      DIMENSION WORK(6,9)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D11P(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN 
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=6 INTERPOLATION, GENERATING WASTED M=8,7 DATA
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 6
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,6
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         DP00= D00P(I)
         DP01= D01P(I)
         DP10= D10P(I)
         PQT = PQR*PQS
         PQQ = PQS*PQS
         PQ5 = PQT*PQS
         WORK(1,1)= DP00
         WORK(1,2)= Y01*DP01
         WORK(1,3)= Y02*DP10
         WORK(1,4)= Y01*Y02
         WORK(1,5)= XMD1
         WORK(1,6)= XMD1*DP01
         WORK(1,7)= XMD1*DP10
         WORK(1,8)= XMD1*Y01
         WORK(1,9)= XMD1*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
  230    CONTINUE
         DO 235 J=5,9
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
            WORK(6,J)= WORK(1,J)*PQ5
  235    CONTINUE
C
         DO 240 J=1,5
            FQD0(J)= FQD0(J)+FQD(0)*WORK(1,J)
  240    CONTINUE
C
         DO 245 J=1,8
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  245    CONTINUE
         FQD1(1,9)= FQD1(1,9)+FQD(1)*WORK(1,9)
C
         DO 250 J=1,9
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  250    CONTINUE
C
         DO 255 J=1,9
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  255    CONTINUE
C
         DO 260 J=1,9
            DO 260 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J)
  260    CONTINUE
C
         DO 265 J=1,5
            DO 265 K=1,6
               FQD5(K,J)= FQD5(K,J)+FQD(5)*WORK(K,J+4)
  265    CONTINUE
C
         DO 270 K=1,6
            FQD6(K)= FQD6(K)+FQD(6)*WORK(K,9)
  270    CONTINUE
         FQD6(7)= FQD6(7)+FQD(6)*WORK(6,9)*PQR
C
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ19
      SUBROUTINE INTJ19
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=19 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(49),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
      DIMENSION WORK(6,11)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D12D(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=6 INTERPOLATION, GENERATING WASTED M=8,7 DATA
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 6
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,6
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         DD02= D02D(I)
         XMD11=XMD1*XMD1
         Y11 = Y01*Y01
         PQT = PQR*PQS
         PQQ = PQS*PQS
         PQ5 = PQT*PQS
         WORK(1, 1)= XMD1*DD02
         WORK(1, 2)= Y11*DD02
         WORK(1, 3)= Y11*Y02
         WORK(1, 4)= XMD1*Y02
         WORK(1, 5)= XMD1*Y01
         WORK(1, 6)= XMD1*Y01*DD02
         WORK(1, 7)= XMD1*Y11
         WORK(1, 8)= XMD11
         WORK(1, 9)= XMD11*DD02
         WORK(1,10)= XMD11*Y01
         WORK(1,11)= XMD11*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
  230    CONTINUE
         DO 235 J=5,7
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
  235    CONTINUE
         DO 240 J=8,11
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
            WORK(6,J)= WORK(1,J)*PQ5
  240    CONTINUE
C
         DO 245 J=1,5
            FQD0(J)= FQD0(J)+FQD(0)*WORK(1,J)
  245    CONTINUE
C
         DO 250 J=1,8
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  250    CONTINUE
         FQD1(1, 9)= FQD1(1, 9)+FQD(1)*WORK(1, 9)
         FQD1(1,10)= FQD1(1,10)+FQD(1)*WORK(1,10)
C
         DO 255 J=1,11
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  255    CONTINUE
C
         DO 260 J=1,11
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  260    CONTINUE
C
         DO 265 J=1,7
            DO 265 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J+4)
  265    CONTINUE
C
         DO 270 J=1,4
            DO 270 K=1,6
               FQD5(K,J)= FQD5(K,J)+FQD(5)*WORK(K,J+7)
  270    CONTINUE
C
         DO 275 K=1,6
            FQD6(K)= FQD6(K)+FQD(6)*WORK(K,11)
  275    CONTINUE
         FQD6(7)= FQD6(7)+FQD(6)*WORK(6,11)*PQR
C
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ20
      SUBROUTINE INTJ20
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=20 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(7,7),FQD7(24),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
      DIMENSION WORK(7,11)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D12D(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=7 INTERPOLATION, GENERATING WASTED M=8 DATA
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 7
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,7
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         DD02= D02D(I)
         XMD11=XMD1*XMD1
         Y11 = Y01*Y01
         PQT = PQR*PQS
         PQQ = PQS*PQS
         PQ5 = PQT*PQS
         PQ6 = PQQ*PQS
         WORK(1, 1)= XMD1*DD02
         WORK(1, 2)= Y11*DD02
         WORK(1, 3)= Y11*Y02
         WORK(1, 4)= XMD1*Y02
         WORK(1, 5)= XMD1*Y01
         WORK(1, 6)= XMD1*Y01*DD02
         WORK(1, 7)= XMD1*Y11
         WORK(1, 8)= XMD11
         WORK(1, 9)= XMD11*DD02
         WORK(1,10)= XMD11*Y01
         WORK(1,11)= XMD11*XMD1
         DO 230 J=1,4
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
  230    CONTINUE
         DO 235 J=5,7
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
            WORK(6,J)= WORK(1,J)*PQ5
  235    CONTINUE
         DO 240 J=8,11
            WORK(2,J)= WORK(1,J)*PQR
            WORK(3,J)= WORK(1,J)*PQS
            WORK(4,J)= WORK(1,J)*PQT
            WORK(5,J)= WORK(1,J)*PQQ
            WORK(6,J)= WORK(1,J)*PQ5
            WORK(7,J)= WORK(1,J)*PQ6
  240    CONTINUE
C
         DO 245 J=1,5
            FQD0(J)= FQD0(J)+FQD(0)*WORK(1,J)
  245    CONTINUE
C
         DO 250 J=1,8
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  250    CONTINUE
         FQD1(1, 9)= FQD1(1, 9)+FQD(1)*WORK(1, 9)
         FQD1(1,10)= FQD1(1,10)+FQD(1)*WORK(1,10)
C
         DO 255 J=1,11
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  255    CONTINUE
C
         DO 260 J=1,11
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  260    CONTINUE
C
         DO 265 J=1,11
            DO 265 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J)
  265    CONTINUE
C
         DO 270 J=1,7
            DO 270 K=1,6
               FQD5(K,J)= FQD5(K,J)+FQD(5)*WORK(K,J+4)
  270    CONTINUE
C
         DO 275 J=1,4
            DO 275 K=1,7
               FQD6(K,J)= FQD6(K,J)+FQD(6)*WORK(K,J+7)
  275    CONTINUE
C
         DO 280 K=1,7
            FQD7(K)= FQD7(K)+FQD(7)*WORK(K,11)
  280    CONTINUE
         FQD7(8)= FQD7(8)+FQD(7)*WORK(7,11)*PQR
C
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTJ21
      SUBROUTINE INTJ21
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=21 INTEGRALS
C
      LOGICAL   LCFLAG,LRINT
      PARAMETER (MXGTOT=20000)
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, ONE=1.0D+00, TWO=2.0D+00)
      PARAMETER (PI4=0.785398163397448D+00)
C
      PARAMETER (NTX=4, NPF=450, NGRD=7, NPX=1000, MXQT=16)
      COMMON /FMTTBL/ FGRID(0:NTX,0:NPF,0:NGRD),XGRID(0:NTX,0:NPX)
     *,               TMAX,RFINC(0:NGRD),RXINC
     *,               RMR(MXQT),TLGM(0:MXQT),NORD
      COMMON /FQ08  / FQD(0:8),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(7,7),FQD7(8,3),FQD8(9)
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /MAXC  / CMAX(MXGTOT),CMAXA(MXGSH),CMAXB(MXGSH),
     2                CMAXC(MXGSH),CMAXD(MXGSH),ISMLP(MXG2),ISMLQ
      COMMON /NLRC  / LCFLAG,LRINT,EMU,EMU2,LRFILE
      COMMON /SHLSPD/ CDA(MXGSH),CDB(MXGSH),CDC(MXGSH),CDD(MXGSH),
     2                D02D(MXG2),D12D(MXG2),D22D(MXG2)
C
      DIMENSION PQWK(2:8),WORK(8,16)
C
      DO 300 I=1,NGANGB
         ISML= ISMLQ+ISMLP(I)
         IF(ISML.GE.2) GO TO 300
         X12= TX12(I)
         Y02= TY02(I)
         FQ00= D22D(I)
         X41= ONE/(X12+X34)
         PQR= Y02-AQZ
         PQS= PQR*PQR
         RHO= X12*X34*X41
         IF(LRINT) THEN
            RHO0 = RHO
            RHO  = RHO0*EMU2/(RHO0+EMU2)
         ENDIF
         XVA=(PQS+QPS)*RHO
         RHO= RHO*TWO
C
C           FM(T) M=8 INTERPOLATION
C
         IF(XVA.LE.TMAX) THEN
            TVAL=XVA*RFINC(5)
            IPT=NINT(TVAL)
            FX =      FGRID(4,IPT,5) *TVAL
            FX = (FX +FGRID(3,IPT,5))*TVAL
            FX = (FX +FGRID(2,IPT,5))*TVAL
            FX = (FX +FGRID(1,IPT,5))*TVAL
            FX =  FX +FGRID(0,IPT,5)
            FQD(8)=FX
C
            TVAL=XVA*RXINC
            IPT=NINT(TVAL)
            ET =      XGRID(4,IPT) *TVAL
            ET = (ET +XGRID(3,IPT))*TVAL
            ET = (ET +XGRID(2,IPT))*TVAL
            ET = (ET +XGRID(1,IPT))*TVAL
            ET =  ET +XGRID(0,IPT)
            T2 = XVA*TWO
C
            DO MXX = 8, 1, -1
               FQD(MXX-1) = RMR(MXX)*(T2*FQD(MXX)+ET)
            END DO
C
            FQS = FQ00*SQRT(X41)
            IF(LRINT) FQS=FQS*SQRT(RHO/RHO0/TWO)
            DO MXX = 0, 8
               FQD(MXX) = FQD(MXX)*FQS
               FQS = FQS*RHO
            END DO
         ELSE
            XIN= ONE/XVA
            FQD(0)= SQRT(PI4*XIN*X41)*FQ00
            IF(LRINT)FQD(0)= FQD(0)*SQRT(RHO/RHO0/TWO)      
            TMP= PT5*XIN
            DO 220 M=1,8
               FQD(M)= FQD(M-1)*TMP*RHO
  220       TMP= TMP+XIN
         ENDIF
C
         XMD1= TX21(I)
         Y01 = TY01(I)
         XMD11=XMD1*XMD1
         XMD111=XMD1*XMD1*XMD1
         Y11 = Y01*Y01
         Y12 = Y01*Y02
         Y22 = Y02*Y02
         PQWK(2)= PQR
         PQWK(3)= PQS
         PQWK(4)= PQS*PQR
         PQWK(5)= PQS*PQS
         PQWK(6)= PQWK(4)*PQS
         PQWK(7)= PQWK(5)*PQS
         PQWK(8)= PQWK(6)*PQS
         WORK(1, 1)= XMD11
         WORK(1, 2)= XMD1*Y11
         WORK(1, 3)= XMD1*Y12
         WORK(1, 4)= XMD1*Y22
         WORK(1, 5)= Y11*Y22
         WORK(1, 6)= XMD11*Y01
         WORK(1, 7)= XMD11*Y02
         WORK(1, 8)= XMD1*Y11*Y02
         WORK(1, 9)= XMD1*Y12*Y02
         WORK(1,10)= XMD111
         WORK(1,11)= XMD11*Y11
         WORK(1,12)= XMD11*Y12
         WORK(1,13)= XMD11*Y22
         WORK(1,14)= XMD111*Y01
         WORK(1,15)= XMD111*Y02
         WORK(1,16)= XMD111*XMD1
         DO 230 J=1,5
            DO 230 K=2,5
               WORK(K,J)= WORK(1,J)*PQWK(K)
  230    CONTINUE
         DO 235 J=6,9
            DO 235 K=2,6
               WORK(K,J)= WORK(1,J)*PQWK(K)
  235    CONTINUE
         DO 240 J=10,13
            DO 240 K=2,7
               WORK(K,J)= WORK(1,J)*PQWK(K)
  240    CONTINUE
         DO 245 J=14,16
            DO 245 K=2,8
               WORK(K,J)= WORK(1,J)*PQWK(K)
  245    CONTINUE
C
         DO 250 J=1,5
            FQD0(J)= FQD0(J)+FQD(0)*WORK(1,J)
  250    CONTINUE
C
         DO 255 J=1,13
            FQD1(1,J)= FQD1(1,J)+FQD(1)*WORK(1,J)
            FQD1(2,J)= FQD1(2,J)+FQD(1)*WORK(2,J)
  255    CONTINUE
C
         DO 260 J=1,16
            FQD2(1,J)= FQD2(1,J)+FQD(2)*WORK(1,J)
            FQD2(2,J)= FQD2(2,J)+FQD(2)*WORK(2,J)
            FQD2(3,J)= FQD2(3,J)+FQD(2)*WORK(3,J)
  260    CONTINUE
C
         DO 265 J=1,16
            FQD3(1,J)= FQD3(1,J)+FQD(3)*WORK(1,J)
            FQD3(2,J)= FQD3(2,J)+FQD(3)*WORK(2,J)
            FQD3(3,J)= FQD3(3,J)+FQD(3)*WORK(3,J)
            FQD3(4,J)= FQD3(4,J)+FQD(3)*WORK(4,J)
  265    CONTINUE
C
         DO 270 J=1,16
            DO 270 K=1,5
               FQD4(K,J)= FQD4(K,J)+FQD(4)*WORK(K,J)
  270    CONTINUE
C
         DO 275 J=1,11
            DO 275 K=1,6
               FQD5(K,J)= FQD5(K,J)+FQD(5)*WORK(K,J+5)
  275    CONTINUE
C
         DO 280 J=1,7
            DO 280 K=1,7
               FQD6(K,J)= FQD6(K,J)+FQD(6)*WORK(K,J+9)
  280    CONTINUE
C
         DO 285 J=1,3
            DO 285 K=1,8
               FQD7(K,J)= FQD7(K,J)+FQD(7)*WORK(K,J+13)
  285    CONTINUE
C
         DO 290 K=1,8
            FQD8(K)= FQD8(K)+FQD(8)*WORK(K,16)
  290    CONTINUE
         FQD8(9)= FQD8(9)+FQD(8)*WORK(8,16)*PQR
C
  300 CONTINUE
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK7
      SUBROUTINE INTK7
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=7 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(25),RD1(120),RD2(336),RD3(520),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      XMD2= X43*PT5
      TMP1= XMD2*SQ(1)
      RD0(1)= RD0(1)+FQD0(1)*TMP1
      RD0(2)= RD0(2)+FQD0(1)*Y03*Y03*SQ(1)
C
      TMP2=-TMP1*Y03
      RD1(1)= RD1(1)-FQD1(1)*AQX*TMP2
      RD1(2)= RD1(2)-FQD1(1)*ACY*TMP2
      RD1(3)= RD1(3)+FQD1(2)*TMP2
C
      XMD4= XMD2*TMP1
      RD2(1)= RD2(1)+(FQD2(1)*AQX2-FQD1(1))*XMD4
      RD2(2)= RD2(2)+(FQD2(1)*ACY2-FQD1(1))*XMD4
      RD2(3)= RD2(3)+(FQD2(3)     -FQD1(1))*XMD4
      RD2(4)= RD2(4)+ FQD2(1)*AQXY*XMD4
      RD2(5)= RD2(5)- FQD2(2)*AQX *XMD4
      RD2(6)= RD2(6)- FQD2(2)*ACY *XMD4
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK8
      SUBROUTINE INTK8
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=8 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(25),RD1(3,40),RD2(6,56),RD3(520),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION FQWK(6),WORK(4)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2
      XMD6= XMD4*XMD2*SQ(2)
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y334= Y33*Y04
      RD0(1)= RD0(1)+FQD0(1)*XMD2*SQ(1)
      RD0(2)= RD0(2)+FQD0(1)*Y33*SQ(1)
      RD0(3)= RD0(3)-FQD0(1)*XMD2*Y03*SQ(2)
      RD0(4)= RD0(4)+FQD0(1)*XMD2*Y04*SQ(2)
      RD0(5)= RD0(5)+FQD0(1)*Y334*SQ(2)
C
      WORK(1)=-XMD2*Y03*SQ(1)
      WORK(2)= XMD4*SQ(2)
      WORK(3)= XMD2*Y33*SQ(2)
      WORK(4)= XMD2*Y34*SQ(2)
      FQWK(1)=-FQD1(1)*AQX
      FQWK(2)=-FQD1(1)*ACY
      FQWK(3)= FQD1(2)
      DO 110 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1)*WORK(I)
         RD1(2,I)= RD1(2,I)+FQWK(2)*WORK(I)
         RD1(3,I)= RD1(3,I)+FQWK(3)*WORK(I)
  110 CONTINUE
C
      WORK(1)= XMD4*SQ(1)
      WORK(2)=-XMD4*Y03*SQ(2)
      WORK(3)= XMD4*Y04*SQ(2)
      FQWK(1)= FQD2(1)*AQX2-FQD1(1)
      FQWK(2)= FQD2(1)*ACY2-FQD1(1)
      FQWK(3)= FQD2(3)     -FQD1(1)
      FQWK(4)= FQD2(1)*AQXY
      FQWK(5)=-FQD2(2)*AQX
      FQWK(6)=-FQD2(2)*ACY
      DO 210 I=1,3
         DO 210 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J)*WORK(I)
  210 CONTINUE
C
      XMD6X=-XMD6*AQX
      XMD6Y=-XMD6*ACY
      RD3( 1)= RD3( 1)+(FQD3(1)*AQX2-FQD2(1)*THREE)*XMD6X
      RD3( 2)= RD3( 2)+(FQD3(1)*AQX2-FQD2(1)      )*XMD6Y
      RD3( 3)= RD3( 3)+(FQD3(2)*AQX2-FQD2(2)      )*XMD6
      RD3( 4)= RD3( 4)+(FQD3(1)*ACY2-FQD2(1)      )*XMD6X
      RD3( 5)= RD3( 5)+(FQD3(2)*AQXY              )*XMD6
      RD3( 6)= RD3( 6)+(FQD3(3)     -FQD2(1)      )*XMD6X
      RD3( 7)= RD3( 7)+(FQD3(1)*ACY2-FQD2(1)*THREE)*XMD6Y
      RD3( 8)= RD3( 8)+(FQD3(2)*ACY2-FQD2(2)      )*XMD6
      RD3( 9)= RD3( 9)+(FQD3(3)     -FQD2(1)      )*XMD6Y
      RD3(10)= RD3(10)+(FQD3(4)     -FQD2(2)*THREE)*XMD6
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK9
      SUBROUTINE INTK9
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=9 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(25),RD1(3,40),RD2(6,56),RD3(520),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(3)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(1)
      WORK(1)= XMD2*SQ(1)
      WORK(2)= Y03*Y03*SQ(1)
      WORK(3)=-XMD2*Y03*SQ(1)
C
      RD0(1)= RD0(1)+FQD0(1)*WORK(1)
      RD0(2)= RD0(2)+FQD0(1)*WORK(2)
      RD0(3)= RD0(3)+FQD0(2)*WORK(1)
      RD0(4)= RD0(4)+FQD0(2)*WORK(2)
C
      DO 110 I=1,2
         RD1(1,I)= RD1(1,I)-FQD1(1,I)*AQX*WORK(3)
         RD1(2,I)= RD1(2,I)-FQD1(1,I)*ACY*WORK(3)
         RD1(3,I)= RD1(3,I)+FQD1(2,I)    *WORK(3)
  110 CONTINUE
      DO 120 I=3,4
         RD1(1,I)= RD1(1,I)-FQD1(1,3)*AQX*WORK(I-2)
         RD1(2,I)= RD1(2,I)-FQD1(1,3)*ACY*WORK(I-2)
         RD1(3,I)= RD1(3,I)+FQD1(2,3)    *WORK(I-2)
  120 CONTINUE
C
      WORK(1)= XMD4
      WORK(2)= XMD4
      DO 210 I=1,3
         RD2(1,I)= RD2(1,I)+(FQD2(1,I)*AQX2-FQD1(1,I))*WORK(I)
         RD2(2,I)= RD2(2,I)+(FQD2(1,I)*ACY2-FQD1(1,I))*WORK(I)
         RD2(3,I)= RD2(3,I)+(FQD2(3,I)     -FQD1(1,I))*WORK(I)
         RD2(4,I)= RD2(4,I)+ FQD2(1,I)*AQXY*WORK(I)
         RD2(5,I)= RD2(5,I)- FQD2(2,I)*AQX *WORK(I)
         RD2(6,I)= RD2(6,I)- FQD2(2,I)*ACY *WORK(I)
  210 CONTINUE
C
      XMD4X=-XMD4*AQX
      XMD4Y=-XMD4*ACY
      RD3( 1)= RD3( 1)+(FQD3(1)*AQX2-FQD2(1,3)*THREE)*XMD4X
      RD3( 2)= RD3( 2)+(FQD3(1)*AQX2-FQD2(1,3)      )*XMD4Y
      RD3( 3)= RD3( 3)+(FQD3(2)*AQX2-FQD2(2,3)      )*XMD4
      RD3( 4)= RD3( 4)+(FQD3(1)*ACY2-FQD2(1,3)      )*XMD4X
      RD3( 5)= RD3( 5)+(FQD3(2)*AQXY                )*XMD4
      RD3( 6)= RD3( 6)+(FQD3(3)     -FQD2(1,3)      )*XMD4X
      RD3( 7)= RD3( 7)+(FQD3(1)*ACY2-FQD2(1,3)*THREE)*XMD4Y
      RD3( 8)= RD3( 8)+(FQD3(2)*ACY2-FQD2(2,3)      )*XMD4
      RD3( 9)= RD3( 9)+(FQD3(3)     -FQD2(1,3)      )*XMD4Y
      RD3(10)= RD3(10)+(FQD3(4)     -FQD2(2,3)*THREE)*XMD4
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK10
      SUBROUTINE INTK10
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=10 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(26),FQD2(48),FQD3(64),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(25),RD1(3,40),RD2(6,56),RD3(10,52),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(4),FQWK(10)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(3)
      XMD6= XMD4*XMD2
      XMD8= XMD6*XMD2
      XMD2= XMD2*SQ(3)
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y44 = Y04*Y04
      Y334= Y33*Y04
      Y344= Y34*Y04
      Y3344=Y33*Y44
C
      RD0(1)= RD0(1)+FQD0(1)*XMD4
      RD0(2)= RD0(2)+FQD0(1)*XMD2*Y33
      RD0(3)= RD0(3)+FQD0(1)*XMD2*Y34
      RD0(4)= RD0(4)+FQD0(1)*XMD2*Y44
      RD0(5)= RD0(5)+FQD0(1)*Y3344*SQ(3)
C
      WORK(1)=-XMD4*Y03
      WORK(2)= XMD4*Y04
      WORK(3)= XMD2*Y334
      WORK(4)= XMD2*Y344
      FQWK(1)=-FQD1(1)*AQX
      FQWK(2)=-FQD1(1)*ACY
      FQWK(3)= FQD1(2)
      DO 110 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1)*WORK(I)
         RD1(2,I)= RD1(2,I)+FQWK(2)*WORK(I)
         RD1(3,I)= RD1(3,I)+FQWK(3)*WORK(I)
  110 CONTINUE
C
      WORK(1)= XMD6
      WORK(2)= XMD4*Y33
      WORK(3)= XMD4*Y34
      WORK(4)= XMD4*Y44
      FQWK(1)= FQD2(1)*AQX2-FQD1(1)
      FQWK(2)= FQD2(1)*ACY2-FQD1(1)
      FQWK(3)= FQD2(3)     -FQD1(1)
      FQWK(4)= FQD2(1)*AQXY
      FQWK(5)=-FQD2(2)*AQX
      FQWK(6)=-FQD2(2)*ACY
      DO 210 I=1,4
         DO 210 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J)*WORK(I)
  210 CONTINUE
C
      WORK(1)=-XMD6*Y03
      WORK(2)= XMD6*Y04
      FQWK( 1)=-(FQD3(1)*AQX2-FQD2(1)*THREE)*AQX
      FQWK( 2)=-(FQD3(1)*AQX2-FQD2(1)      )*ACY
      FQWK( 3)=  FQD3(2)*AQX2-FQD2(2)
      FQWK( 4)=-(FQD3(1)*ACY2-FQD2(1)      )*AQX
      FQWK( 5)=  FQD3(2)*AQXY
      FQWK( 6)=-(FQD3(3)     -FQD2(1)      )*AQX
      FQWK( 7)=-(FQD3(1)*ACY2-FQD2(1)*THREE)*ACY
      FQWK( 8)=  FQD3(2)*ACY2-FQD2(2)
      FQWK( 9)=-(FQD3(3)     -FQD2(1)      )*ACY
      FQWK(10)=  FQD3(4)     -FQD2(2)*THREE
      DO 310 I=1,2
         DO 310 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J)*WORK(I)
  310 CONTINUE
C
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      XMD8X=-XMD8*AQX
      XMD8Y=-XMD8*ACY
      XMD8XY=XMD8*AQXY
      RD4( 1)= RD4( 1)+(FQD4(1)*AQX4-FQD3(1)*SIX*AQX2
     *                 +FQD2(1)*THREE)*XMD8
      RD4( 2)= RD4( 2)+(FQD4(1)*AQX2-FQD3(1)*THREE)*XMD8XY
      RD4( 3)= RD4( 3)+(FQD4(2)*AQX2-FQD3(2)*THREE)*XMD8X
      RD4( 4)= RD4( 4)+(FQD4(1)*X2Y2-FQD3(1)*AQX2-FQD3(1)*ACY2
     *                 +FQD2(1))*XMD8
      RD4( 5)= RD4( 5)+(FQD4(2)*AQX2-FQD3(2)      )*XMD8Y
      RD4( 6)= RD4( 6)+(FQD4(3)*AQX2-FQD3(1)*AQX2-FQD3(3)
     *                 +FQD2(1))*XMD8
      RD4( 7)= RD4( 7)+(FQD4(1)*ACY2-FQD3(1)*THREE)*XMD8XY
      RD4( 8)= RD4( 8)+(FQD4(2)*ACY2-FQD3(2)      )*XMD8X
      RD4( 9)= RD4( 9)+(FQD4(3)     -FQD3(1)      )*XMD8XY
      RD4(10)= RD4(10)+(FQD4(4)     -FQD3(2)*THREE)*XMD8X
      RD4(11)= RD4(11)+(FQD4(1)*ACY4-FQD3(1)*SIX*ACY2
     *                 +FQD2(1)*THREE)*XMD8
      RD4(12)= RD4(12)+(FQD4(2)*ACY2-FQD3(2)*THREE)*XMD8Y
      RD4(13)= RD4(13)+(FQD4(3)*ACY2-FQD3(1)*ACY2-FQD3(3)
     *                 +FQD2(1))*XMD8
      RD4(14)= RD4(14)+(FQD4(4)     -FQD3(2)*THREE)*XMD8Y
      RD4(15)= RD4(15)+(FQD4(5)     -FQD3(3)*SIX+FQD2(1)*THREE)*XMD8
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK11
      SUBROUTINE INTK11
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=11 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(12),FQWK(10,3)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2
      XMD6= XMD4*XMD2*SQ(2)
      Y33 = Y03*Y03
      Y34 =-Y03*Y04*SQ(2)
      Y334= Y33*Y04*SQ(2)
C
      WORK( 1)= XMD2*SQ(1)
      WORK( 2)= Y33*SQ(1)
      WORK( 3)=-XMD2*Y03*SQ(2)
      WORK( 4)= XMD2*Y04*SQ(2)
      WORK( 5)= Y334
      WORK( 6)=-XMD2*Y03*SQ(1)
      WORK( 7)= XMD4*SQ(2)
      WORK( 8)= XMD2*Y33*SQ(2)
      WORK( 9)= XMD2*Y34
      WORK(10)= XMD4*SQ(1)
      WORK(11)=-XMD4*Y03*SQ(2)
      WORK(12)= XMD4*Y04*SQ(2)
C
      DO 10 J=1,2
         DO 10 I=1,5
            RD0(I,J)= RD0(I,J)+FQD0(J)*WORK(I)
   10 CONTINUE
C
      DO 110 I=1,3
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  110 CONTINUE
      DO 120 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  120 CONTINUE
      DO 130 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  130 CONTINUE
      DO 140 I=9,13
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-8)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-8)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-8)
  140 CONTINUE
C
      DO 210 I=1,3
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  210 CONTINUE
      DO 220 I=1,3
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  220 CONTINUE
      DO 230 I=4,6
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+6)
  230 CONTINUE
      DO 240 I=7,10
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I-1)
  240 CONTINUE
C
      XMD6X=-XMD6*AQX
      XMD6Y=-XMD6*ACY
      DO 310 I=1,2
         RD3( 1,I)= RD3( 1,I)+(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*XMD6X
         RD3( 2,I)= RD3( 2,I)+(FQD3(1,I)*AQX2-FQD2(1,I)      )*XMD6Y
         RD3( 3,I)= RD3( 3,I)+(FQD3(2,I)*AQX2-FQD2(2,I)      )*XMD6
         RD3( 4,I)= RD3( 4,I)+(FQD3(1,I)*ACY2-FQD2(1,I)      )*XMD6X
         RD3( 5,I)= RD3( 5,I)+(FQD3(2,I)*AQXY                )*XMD6
         RD3( 6,I)= RD3( 6,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6X
         RD3( 7,I)= RD3( 7,I)+(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*XMD6Y
         RD3( 8,I)= RD3( 8,I)+(FQD3(2,I)*ACY2-FQD2(2,I)      )*XMD6
         RD3( 9,I)= RD3( 9,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6Y
         RD3(10,I)= RD3(10,I)+(FQD3(4,I)     -FQD2(2,I)*THREE)*XMD6
  310 CONTINUE
      FQWK( 1,1)=-(FQD3(1,3)*AQX2-FQD2(1,3)*THREE)*AQX
      FQWK( 2,1)=-(FQD3(1,3)*AQX2-FQD2(1,3)      )*ACY
      FQWK( 3,1)=  FQD3(2,3)*AQX2-FQD2(2,3)
      FQWK( 4,1)=-(FQD3(1,3)*ACY2-FQD2(1,3)      )*AQX
      FQWK( 5,1)=  FQD3(2,3)*AQXY
      FQWK( 6,1)=-(FQD3(3,3)     -FQD2(1,3)      )*AQX
      FQWK( 7,1)=-(FQD3(1,3)*ACY2-FQD2(1,3)*THREE)*ACY
      FQWK( 8,1)=  FQD3(2,3)*ACY2-FQD2(2,3)
      FQWK( 9,1)=-(FQD3(3,3)     -FQD2(1,3)      )*ACY
      FQWK(10,1)=  FQD3(4,3)     -FQD2(2,3)*THREE
      DO 320 I=3,5
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+7)
  320 CONTINUE
C
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      XMD6XY=XMD6*AQXY
      RD4( 1)= RD4( 1)+(FQD4(1)*AQX4-FQD3(1,3)*SIX*AQX2
     *                 +FQD2(1,3)*THREE)*XMD6
      RD4( 2)= RD4( 2)+(FQD4(1)*AQX2-FQD3(1,3)*THREE)*XMD6XY
      RD4( 3)= RD4( 3)+(FQD4(2)*AQX2-FQD3(2,3)*THREE)*XMD6X
      RD4( 4)= RD4( 4)+(FQD4(1)*X2Y2-FQD3(1,3)*AQX2-FQD3(1,3)*ACY2
     *                 +FQD2(1,3))*XMD6
      RD4( 5)= RD4( 5)+(FQD4(2)*AQX2-FQD3(2,3)      )*XMD6Y
      RD4( 6)= RD4( 6)+(FQD4(3)*AQX2-FQD3(1,3)*AQX2-FQD3(3,3)
     *                 +FQD2(1,3))*XMD6
      RD4( 7)= RD4( 7)+(FQD4(1)*ACY2-FQD3(1,3)*THREE)*XMD6XY
      RD4( 8)= RD4( 8)+(FQD4(2)*ACY2-FQD3(2,3)      )*XMD6X
      RD4( 9)= RD4( 9)+(FQD4(3)     -FQD3(1,3)      )*XMD6XY
      RD4(10)= RD4(10)+(FQD4(4)     -FQD3(2,3)*THREE)*XMD6X
      RD4(11)= RD4(11)+(FQD4(1)*ACY4-FQD3(1,3)*SIX*ACY2
     *                 +FQD2(1,3)*THREE)*XMD6
      RD4(12)= RD4(12)+(FQD4(2)*ACY2-FQD3(2,3)*THREE)*XMD6Y
      RD4(13)= RD4(13)+(FQD4(3)*ACY2-FQD3(1,3)*ACY2-FQD3(3,3)
     *                 +FQD2(1,3))*XMD6
      RD4(14)= RD4(14)+(FQD4(4)     -FQD3(2,3)*THREE)*XMD6Y
      RD4(15)= RD4(15)+(FQD4(5)     -FQD3(3,3)*SIX+FQD2(1,3)*THREE)*XMD6
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK12
      SUBROUTINE INTK12
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=12 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(25),RD1(3,40),RD2(6,56),RD3(10,52),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(5),FQWK(10)
C
      XMD2= X43*PT5
      XMD3=-XMD2*Y03*SQ(1)
      XMD4= XMD2*XMD2*SQ(1)
      WORK(1)= XMD2*SQ(1)
      WORK(2)= Y03*Y03*SQ(1)
      WORK(3)= XMD4
      WORK(4)= XMD4
      WORK(5)= XMD3
      XMD3X=-XMD3*AQX
      XMD3Y=-XMD3*ACY
      XMD4XY=XMD4*AQXY
      XMD4X=-XMD4*AQX
      XMD4Y=-XMD4*ACY
C
      RD0(1)= RD0(1)+FQD0(1)*WORK(1)
      RD0(2)= RD0(2)+FQD0(1)*WORK(2)
      RD0(3)= RD0(3)+FQD0(2)*WORK(1)
      RD0(4)= RD0(4)+FQD0(2)*WORK(2)
C
      DO 110 I=1,2
         RD1(1,I)= RD1(1,I)+FQD1(1,I)*XMD3X
         RD1(2,I)= RD1(2,I)+FQD1(1,I)*XMD3Y
         RD1(3,I)= RD1(3,I)+FQD1(2,I)*XMD3
  110 CONTINUE
      FQWK(1)=-FQD1(1,3)*AQX
      FQWK(2)=-FQD1(1,3)*ACY
      FQWK(3)= FQD1(2,3)
      DO 120 I=3,4
         RD1(1,I)= RD1(1,I)+FQWK(1)*WORK(I-2)
         RD1(2,I)= RD1(2,I)+FQWK(2)*WORK(I-2)
         RD1(3,I)= RD1(3,I)+FQWK(3)*WORK(I-2)
  120 CONTINUE
C
      DO 210 I=1,3
         RD2(1,I)= RD2(1,I)+(FQD2(1,I)*AQX2-FQD1(1,I))*WORK(I+2)
         RD2(2,I)= RD2(2,I)+(FQD2(1,I)*ACY2-FQD1(1,I))*WORK(I+2)
         RD2(3,I)= RD2(3,I)+(FQD2(3,I)     -FQD1(1,I))*WORK(I+2)
         RD2(4,I)= RD2(4,I)+ FQD2(1,I)*AQXY*WORK(I+2)
         RD2(5,I)= RD2(5,I)- FQD2(2,I)*AQX *WORK(I+2)
         RD2(6,I)= RD2(6,I)- FQD2(2,I)*ACY *WORK(I+2)
  210 CONTINUE
      FQWK(1)= FQD2(1,4)*AQX2-FQD1(1,4)
      FQWK(2)= FQD2(1,4)*ACY2-FQD1(1,4)
      FQWK(3)= FQD2(3,4)     -FQD1(1,4)
      FQWK(4)= FQD2(1,4)*AQXY
      FQWK(5)=-FQD2(2,4)*AQX
      FQWK(6)=-FQD2(2,4)*ACY
      DO 220 I=4,5
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J)*WORK(I-3)
  220 CONTINUE
C
      RD3( 1,1)= RD3( 1,1)+(FQD3(1,1)*AQX2-FQD2(1,3)*THREE)*XMD4X
      RD3( 2,1)= RD3( 2,1)+(FQD3(1,1)*AQX2-FQD2(1,3)      )*XMD4Y
      RD3( 3,1)= RD3( 3,1)+(FQD3(2,1)*AQX2-FQD2(2,3)      )*XMD4
      RD3( 4,1)= RD3( 4,1)+(FQD3(1,1)*ACY2-FQD2(1,3)      )*XMD4X
      RD3( 5,1)= RD3( 5,1)+(FQD3(2,1)*AQXY                )*XMD4
      RD3( 6,1)= RD3( 6,1)+(FQD3(3,1)     -FQD2(1,3)      )*XMD4X
      RD3( 7,1)= RD3( 7,1)+(FQD3(1,1)*ACY2-FQD2(1,3)*THREE)*XMD4Y
      RD3( 8,1)= RD3( 8,1)+(FQD3(2,1)*ACY2-FQD2(2,3)      )*XMD4
      RD3( 9,1)= RD3( 9,1)+(FQD3(3,1)     -FQD2(1,3)      )*XMD4Y
      RD3(10,1)= RD3(10,1)+(FQD3(4,1)     -FQD2(2,3)*THREE)*XMD4
      RD3( 1,2)= RD3( 1,2)+(FQD3(1,2)*AQX2-FQD2(1,4)*THREE)*XMD3X
      RD3( 2,2)= RD3( 2,2)+(FQD3(1,2)*AQX2-FQD2(1,4)      )*XMD3Y
      RD3( 3,2)= RD3( 3,2)+(FQD3(2,2)*AQX2-FQD2(2,4)      )*XMD3
      RD3( 4,2)= RD3( 4,2)+(FQD3(1,2)*ACY2-FQD2(1,4)      )*XMD3X
      RD3( 5,2)= RD3( 5,2)+(FQD3(2,2)*AQXY                )*XMD3
      RD3( 6,2)= RD3( 6,2)+(FQD3(3,2)     -FQD2(1,4)      )*XMD3X
      RD3( 7,2)= RD3( 7,2)+(FQD3(1,2)*ACY2-FQD2(1,4)*THREE)*XMD3Y
      RD3( 8,2)= RD3( 8,2)+(FQD3(2,2)*ACY2-FQD2(2,4)      )*XMD3
      RD3( 9,2)= RD3( 9,2)+(FQD3(3,2)     -FQD2(1,4)      )*XMD3Y
      RD3(10,2)= RD3(10,2)+(FQD3(4,2)     -FQD2(2,4)*THREE)*XMD3
C
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      RD4( 1)= RD4( 1)
     *        +(FQD4(1)*AQX4-FQD3(1,2)*SIX*AQX2+FQD2(1,4)*THREE)*XMD4
      RD4( 2)= RD4( 2)+(FQD4(1)*AQX2-FQD3(1,2)*THREE)*XMD4XY
      RD4( 3)= RD4( 3)+(FQD4(2)*AQX2-FQD3(2,2)*THREE)*XMD4X
      RD4( 4)= RD4( 4)+(FQD4(1)*X2Y2-FQD3(1,2)*AQX2-FQD3(1,2)*ACY2
     *                 +FQD2(1,4))*XMD4
      RD4( 5)= RD4( 5)+(FQD4(2)*AQX2-FQD3(2,2)      )*XMD4Y
      RD4( 6)= RD4( 6)+(FQD4(3)*AQX2-FQD3(1,2)*AQX2-FQD3(3,2)
     *                 +FQD2(1,4))*XMD4
      RD4( 7)= RD4( 7)+(FQD4(1)*ACY2-FQD3(1,2)*THREE)*XMD4XY
      RD4( 8)= RD4( 8)+(FQD4(2)*ACY2-FQD3(2,2)      )*XMD4X
      RD4( 9)= RD4( 9)+(FQD4(3)     -FQD3(1,2)      )*XMD4XY
      RD4(10)= RD4(10)+(FQD4(4)     -FQD3(2,2)*THREE)*XMD4X
      RD4(11)= RD4(11)+(FQD4(1)*ACY4-FQD3(1,2)*SIX*ACY2
     *                 +FQD2(1,4)*THREE)*XMD4
      RD4(12)= RD4(12)+(FQD4(2)*ACY2-FQD3(2,2)*THREE)*XMD4Y
      RD4(13)= RD4(13)+(FQD4(3)*ACY2-FQD3(1,2)*ACY2-FQD3(3,2)
     *                 +FQD2(1,4))*XMD4
      RD4(14)= RD4(14)+(FQD4(4)     -FQD3(2,2)*THREE)*XMD4Y
      RD4(15)= RD4(15)+(FQD4(5)     -FQD3(3,2)*SIX+FQD2(1,4)*THREE)*XMD4
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK13
      SUBROUTINE INTK13
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=13 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(80),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(630),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(2),FQWK(6,4)
C
      XMD2= X43*PT5
      XMD3=-Y03*XMD2*SQ(1)
      XMD4= XMD2*XMD2*SQ(1)
      WORK(1)= XMD2*SQ(1)
      WORK(2)= Y03*Y03*SQ(1)
      DO 10 I=1,5
         RD0(I,1)= RD0(I,1)+FQD0(I)*WORK(1)
         RD0(I,2)= RD0(I,2)+FQD0(I)*WORK(2)
   10 CONTINUE
C
      XMD3XY=XMD3*AQXY
      XMD3X=-XMD3*AQX
      XMD3Y=-XMD3*ACY
      DO 110 I=1,5
         RD1(1,I)= RD1(1,I)+FQD1(1,I)*XMD3X
         RD1(2,I)= RD1(2,I)+FQD1(1,I)*XMD3Y
         RD1(3,I)= RD1(3,I)+FQD1(2,I)*XMD3
  110 CONTINUE
      DO 120 I=1,3
         FQWK(1,I)=-FQD1(1,I+5)*AQX
         FQWK(2,I)=-FQD1(1,I+5)*ACY
         FQWK(3,I)= FQD1(2,I+5)
  120 CONTINUE
      FQD11= FQD1(1,5)*RAB+FQD1(1,8)
      FQD12= FQD1(2,5)*RAB+FQD1(2,8)
      FQWK(1,4)=-FQD11*AQX
      FQWK(2,4)=-FQD11*ACY
      FQWK(3,4)= FQD12
      DO 130 I=6,7
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I-5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I-5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I-5)
  130 CONTINUE
      DO 140 I=8,9
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I-7)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I-7)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I-7)
  140 CONTINUE
      DO 150 I=10,11
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-9)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-9)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-9)
  150 CONTINUE
      DO 160 I=12,13
         RD1(1,I)= RD1(1,I)+FQWK(1,4)*WORK(I-11)
         RD1(2,I)= RD1(2,I)+FQWK(2,4)*WORK(I-11)
         RD1(3,I)= RD1(3,I)+FQWK(3,4)*WORK(I-11)
  160 CONTINUE
C
      XMD4XY=XMD4*AQXY
      XMD4X=-XMD4*AQX
      XMD4Y=-XMD4*ACY
      DO 210 I=1,5
         RD2(1,I)= RD2(1,I)+(FQD2(1,I)*AQX2-FQD1(1,I))*XMD4
         RD2(2,I)= RD2(2,I)+(FQD2(1,I)*ACY2-FQD1(1,I))*XMD4
         RD2(3,I)= RD2(3,I)+(FQD2(3,I)     -FQD1(1,I))*XMD4
         RD2(4,I)= RD2(4,I)+FQD2(1,I)*XMD4XY
         RD2(5,I)= RD2(5,I)+FQD2(2,I)*XMD4X
         RD2(6,I)= RD2(6,I)+FQD2(2,I)*XMD4Y
  210 CONTINUE
      DO 220 I=6,8
         RD2(1,I)= RD2(1,I)+(FQD2(1,I)*AQX2-FQD1(1,I))*XMD3
         RD2(2,I)= RD2(2,I)+(FQD2(1,I)*ACY2-FQD1(1,I))*XMD3
         RD2(3,I)= RD2(3,I)+(FQD2(3,I)     -FQD1(1,I))*XMD3
         RD2(4,I)= RD2(4,I)+FQD2(1,I)*XMD3XY
         RD2(5,I)= RD2(5,I)+FQD2(2,I)*XMD3X
         RD2(6,I)= RD2(6,I)+FQD2(2,I)*XMD3Y
  220 CONTINUE
      FQD2(1,5)= FQD2(1,5)*RAB+FQD2(1,8)
      FQD2(2,5)= FQD2(2,5)*RAB+FQD2(2,8)
      FQD2(3,5)= FQD2(3,5)*RAB+FQD2(3,8)
      RD2(1,9)= RD2(1,9)+(FQD2(1,5)*AQX2-FQD11)*XMD3
      RD2(2,9)= RD2(2,9)+(FQD2(1,5)*ACY2-FQD11)*XMD3
      RD2(3,9)= RD2(3,9)+(FQD2(3,5)     -FQD11)*XMD3
      RD2(4,9)= RD2(4,9)+FQD2(1,5)*XMD3XY
      RD2(5,9)= RD2(5,9)+FQD2(2,5)*XMD3X
      RD2(6,9)= RD2(6,9)+FQD2(2,5)*XMD3Y
      FQWK(1,1)= FQD2(1,9)*AQX2-FQD1(1,9)
      FQWK(2,1)= FQD2(1,9)*ACY2-FQD1(1,9)
      FQWK(3,1)= FQD2(3,9)     -FQD1(1,9)
      FQWK(4,1)= FQD2(1,9)*AQXY
      FQWK(5,1)=-FQD2(2,9)*AQX
      FQWK(6,1)=-FQD2(2,9)*ACY
      DO 240 I=10,11
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I-9)
  240 CONTINUE
C
      FQD3(1,1)= FQD3(1,1)*RAB+FQD3(1,4)
      FQD3(2,1)= FQD3(2,1)*RAB+FQD3(2,4)
      FQD3(3,1)= FQD3(3,1)*RAB+FQD3(3,4)
      FQD3(4,1)= FQD3(4,1)*RAB+FQD3(4,4)
      DO 310 I=1,4
         RD3( 1,I)= RD3( 1,I)+(FQD3(1,I)*AQX2-FQD2(1,I+4)*THREE)*XMD4X
         RD3( 2,I)= RD3( 2,I)+(FQD3(1,I)*AQX2-FQD2(1,I+4)      )*XMD4Y
         RD3( 3,I)= RD3( 3,I)+(FQD3(2,I)*AQX2-FQD2(2,I+4)      )*XMD4
         RD3( 4,I)= RD3( 4,I)+(FQD3(1,I)*ACY2-FQD2(1,I+4)      )*XMD4X
         RD3( 5,I)= RD3( 5,I)+(FQD3(2,I)*AQXY                  )*XMD4
         RD3( 6,I)= RD3( 6,I)+(FQD3(3,I)     -FQD2(1,I+4)      )*XMD4X
         RD3( 7,I)= RD3( 7,I)+(FQD3(1,I)*ACY2-FQD2(1,I+4)*THREE)*XMD4Y
         RD3( 8,I)= RD3( 8,I)+(FQD3(2,I)*ACY2-FQD2(2,I+4)      )*XMD4
         RD3( 9,I)= RD3( 9,I)+(FQD3(3,I)     -FQD2(1,I+4)      )*XMD4Y
         RD3(10,I)= RD3(10,I)+(FQD3(4,I)     -FQD2(2,I+4)*THREE)*XMD4
  310 CONTINUE
      RD3( 1,5)= RD3( 1,5)+(FQD3(1,5)*AQX2-FQD2(1,9)*THREE)*XMD3X
      RD3( 2,5)= RD3( 2,5)+(FQD3(1,5)*AQX2-FQD2(1,9)      )*XMD3Y
      RD3( 3,5)= RD3( 3,5)+(FQD3(2,5)*AQX2-FQD2(2,9)      )*XMD3
      RD3( 4,5)= RD3( 4,5)+(FQD3(1,5)*ACY2-FQD2(1,9)      )*XMD3X
      RD3( 5,5)= RD3( 5,5)+(FQD3(2,5)*AQXY                )*XMD3
      RD3( 6,5)= RD3( 6,5)+(FQD3(3,5)     -FQD2(1,9)      )*XMD3X
      RD3( 7,5)= RD3( 7,5)+(FQD3(1,5)*ACY2-FQD2(1,9)*THREE)*XMD3Y
      RD3( 8,5)= RD3( 8,5)+(FQD3(2,5)*ACY2-FQD2(2,9)      )*XMD3
      RD3( 9,5)= RD3( 9,5)+(FQD3(3,5)     -FQD2(1,9)      )*XMD3Y
      RD3(10,5)= RD3(10,5)+(FQD3(4,5)     -FQD2(2,9)*THREE)*XMD3
C
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      RD4( 1)= RD4( 1)+(FQD4(1)*AQX4-FQD3(1,5)*SIX*AQX2
     *                 +FQD2(1,9)*THREE)*XMD4
      RD4( 2)= RD4( 2)+(FQD4(1)*AQX2-FQD3(1,5)*THREE)*XMD4XY
      RD4( 3)= RD4( 3)+(FQD4(2)*AQX2-FQD3(2,5)*THREE)*XMD4X
      RD4( 4)= RD4( 4)+(FQD4(1)*X2Y2-FQD3(1,5)*AQX2-FQD3(1,5)*ACY2
     *                 +FQD2(1,9))*XMD4
      RD4( 5)= RD4( 5)+(FQD4(2)*AQX2-FQD3(2,5)      )*XMD4Y
      RD4( 6)= RD4( 6)
     *        +(FQD4(3)*AQX2-FQD3(1,5)*AQX2-FQD3(3,5)+FQD2(1,9))*XMD4
      RD4( 7)= RD4( 7)+(FQD4(1)*ACY2-FQD3(1,5)*THREE)*XMD4XY
      RD4( 8)= RD4( 8)+(FQD4(2)*ACY2-FQD3(2,5)      )*XMD4X
      RD4( 9)= RD4( 9)+(FQD4(3)     -FQD3(1,5)      )*XMD4XY
      RD4(10)= RD4(10)+(FQD4(4)     -FQD3(2,5)*THREE)*XMD4X
      RD4(11)= RD4(11)+(FQD4(1)*ACY4-FQD3(1,5)*SIX*ACY2
     *                 +FQD2(1,9)*THREE)*XMD4
      RD4(12)= RD4(12)+(FQD4(2)*ACY2-FQD3(2,5)*THREE)*XMD4Y
      RD4(13)= RD4(13)+(FQD4(3)*ACY2-FQD3(1,5)*ACY2-FQD3(3,5)
     *                 +FQD2(1,9))*XMD4
      RD4(14)= RD4(14)+(FQD4(4)     -FQD3(2,5)*THREE)*XMD4Y
      RD4(15)= RD4(15)+(FQD4(5)     -FQD3(3,5)*SIX+FQD2(1,9)*THREE)*XMD4
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK14
      SUBROUTINE INTK14
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=14 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(15),FQWK(15,3)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(3)
      XMD6= XMD4*XMD2
      XMD8= XMD6*XMD2
      XMD2= XMD2*SQ(3)
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y44 = Y04*Y04
      Y334= Y33*Y04
      Y344= Y34*Y04
      WORK( 1)= XMD4
      WORK( 2)= XMD2*Y33
      WORK( 3)= XMD2*Y34
      WORK( 4)= XMD2*Y44
      WORK( 5)= Y33*Y44*SQ(3)
C
      WORK( 6)=-XMD4*Y03
      WORK( 7)= XMD4*Y04
      WORK( 8)= XMD2*Y334
      WORK( 9)= XMD2*Y344
C
      WORK(10)= XMD6
      WORK(11)= XMD4*Y33
      WORK(12)= XMD4*Y34
      WORK(13)= XMD4*Y44
C
      WORK(14)=-XMD6*Y03
      WORK(15)= XMD6*Y04
C
      DO 10 I=1,2
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 110 I=1,3
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  110 CONTINUE
      DO 120 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  120 CONTINUE
      DO 130 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  130 CONTINUE
      DO 140 I=9,13
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-8)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-8)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-8)
  140 CONTINUE
C
      DO 210 I=1,3
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  210 CONTINUE
      DO 220 I=1,4
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  220 CONTINUE
      DO 230 I=5,8
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+5)
  230 CONTINUE
      DO 240 I=9,12
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I-3)
  240 CONTINUE
C
      DO 310 I=1,3
         FQWK( 1,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)      )*ACY
         FQWK( 3,I)=  FQD3(2,I)*AQX2-FQD2(2,I)
         FQWK( 4,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)      )*AQX
         FQWK( 5,I)=  FQD3(2,I)*AQXY
         FQWK( 6,I)=-(FQD3(3,I)     -FQD2(1,I)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I)*ACY2-FQD2(2,I)
         FQWK( 9,I)=-(FQD3(3,I)     -FQD2(1,I)      )*ACY
         FQWK(10,I)=  FQD3(4,I)     -FQD2(2,I)*THREE
  310 CONTINUE
      DO 320 I=1,2
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+13)
  320 CONTINUE
      DO 330 I=3,4
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+11)
  330 CONTINUE
      DO 340 I=5,8
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I+5)
  340 CONTINUE
C
      XMD8XY=XMD8*AQXY
      XMD8X=-XMD8*AQX
      XMD8Y=-XMD8*ACY
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      DO 410 I=1,2
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*XMD8X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2
     *                        -FQD3(1,I)*ACY2+FQD2(1,I))*XMD8
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I)      )*XMD8Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I)*AQX2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I)      )*XMD8X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I)      )*XMD8XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*XMD8Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I)*ACY2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)-FQD3(3,I)*SIX
     *                        +FQD2(1,I)*THREE)*XMD8
  410 CONTINUE
      FQWK( 1,1)=  FQD4(1,3)*AQX4-FQD3(1,3)*SIX*AQX2+FQD2(1,3)*THREE
      FQWK( 2,1)= (FQD4(1,3)*AQX2-FQD3(1,3)*THREE)*AQXY
      FQWK( 3,1)=-(FQD4(2,3)*AQX2-FQD3(2,3)*THREE)*AQX
      FQWK( 4,1)=  FQD4(1,3)*X2Y2-FQD3(1,3)*AQX2-FQD3(1,3)*ACY2
     *            +FQD2(1,3)
      FQWK( 5,1)=-(FQD4(2,3)*AQX2-FQD3(2,3)      )*ACY
      FQWK( 6,1)=  FQD4(3,3)*AQX2-FQD3(1,3)*AQX2-FQD3(3,3)+FQD2(1,3)
      FQWK( 7,1)= (FQD4(1,3)*ACY2-FQD3(1,3)*THREE)*AQXY
      FQWK( 8,1)=-(FQD4(2,3)*ACY2-FQD3(2,3)      )*AQX
      FQWK( 9,1)= (FQD4(3,3)     -FQD3(1,3)      )*AQXY
      FQWK(10,1)=-(FQD4(4,3)     -FQD3(2,3)*THREE)*AQX
      FQWK(11,1)=  FQD4(1,3)*ACY4-FQD3(1,3)*SIX*ACY2+FQD2(1,3)*THREE
      FQWK(12,1)=-(FQD4(2,3)*ACY2-FQD3(2,3)*THREE)*ACY
      FQWK(13,1)=  FQD4(3,3)*ACY2-FQD3(1,3)*ACY2-FQD3(3,3)+FQD2(1,3)
      FQWK(14,1)=-(FQD4(4,3)     -FQD3(2,3)*THREE)*ACY
      FQWK(15,1)=  FQD4(5,3)     -FQD3(3,3)*SIX+FQD2(1,3)*THREE
      DO 420 I=3,4
         DO 420 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,1)*WORK(I+11)
  420 CONTINUE
C
      RD5( 1)= RD5( 1)+(FQD5(1)*AQX4-FQD4(1,3)*AQX2*TEN
     *                 +FQD3(1,3)*FIFT)*XMD8X
      RD5( 2)= RD5( 2)+(FQD5(1)*AQX4-FQD4(1,3)*AQX2*SIX
     *                 +FQD3(1,3)*THREE)*XMD8Y
      RD5( 3)= RD5( 3)+(FQD5(2)*AQX4-FQD4(2,3)*AQX2*SIX
     *                 +FQD3(2,3)*THREE)*XMD8
      RD5( 4)= RD5( 4)+(FQD5(1)*X2Y2-FQD4(1,3)*AQX2-FQD4(1,3)*ACY2*THREE
     *                 +FQD3(1,3)*THREE)*XMD8X
      RD5( 5)= RD5( 5)+(FQD5(2)*AQX2-FQD4(2,3)*THREE)*XMD8XY
      RD5( 6)= RD5( 6)+(FQD5(3)*AQX2-FQD4(1,3)*AQX2-FQD4(3,3)*THREE
     *                 +FQD3(1,3)*THREE)*XMD8X
      RD5( 7)= RD5( 7)+(FQD5(1)*X2Y2-FQD4(1,3)*AQX2*THREE-FQD4(1,3)*ACY2
     *                 +FQD3(1,3)*THREE)*XMD8Y
      RD5( 8)= RD5( 8)+(FQD5(2)*X2Y2-FQD4(2,3)*AQX2-FQD4(2,3)*ACY2
     *                 +FQD3(2,3))*XMD8
      RD5( 9)= RD5( 9)+(FQD5(3)*AQX2-FQD4(1,3)*AQX2-FQD4(3,3)
     *                 +FQD3(1,3))*XMD8Y
      RD5(10)= RD5(10)+(FQD5(4)*AQX2-FQD4(2,3)*AQX2*THREE-FQD4(4,3)
     *                 +FQD3(2,3)*THREE)*XMD8
      RD5(11)= RD5(11)+(FQD5(1)*ACY4-FQD4(1,3)*ACY2*SIX
     *                 +FQD3(1,3)*THREE)*XMD8X
      RD5(12)= RD5(12)+(FQD5(2)*ACY2-FQD4(2,3)*THREE)*XMD8XY
      RD5(13)= RD5(13)+(FQD5(3)*ACY2-FQD4(1,3)*ACY2-FQD4(3,3)
     *                 +FQD3(1,3))*XMD8X
      RD5(14)= RD5(14)+(FQD5(4)-FQD4(2,3)*THREE)*XMD8XY
      RD5(15)= RD5(15)+(FQD5(5)-FQD4(3,3)*SIX+FQD3(1,3)*THREE)*XMD8X
      RD5(16)= RD5(16)+(FQD5(1)*ACY4-FQD4(1,3)*ACY2*TEN
     *                 +FQD3(1,3)*FIFT)*XMD8Y
      RD5(17)= RD5(17)+(FQD5(2)*ACY4-FQD4(2,3)*ACY2*SIX
     *                 +FQD3(2,3)*THREE)*XMD8
      RD5(18)= RD5(18)+(FQD5(3)*ACY2-FQD4(1,3)*ACY2-FQD4(3,3)*THREE
     *                 +FQD3(1,3)*THREE)*XMD8Y
      RD5(19)= RD5(19)+(FQD5(4)*ACY2-FQD4(2,3)*ACY2*THREE-FQD4(4,3)
     *                 +FQD3(2,3)*THREE)*XMD8
      RD5(20)= RD5(20)+(FQD5(5)-FQD4(3,3)*SIX+FQD3(1,3)*THREE)*XMD8Y
      RD5(21)= RD5(21)+(FQD5(6)-FQD4(4,3)*TEN+FQD3(2,3)*FIFT)*XMD8
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK15
      SUBROUTINE INTK15
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=15 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(12),FQWK(15,4)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2
      XMD6= XMD4*XMD2*SQ(2)
      XMD6XY=XMD6*AQXY
      XMD6X=-XMD6*AQX
      XMD6Y=-XMD6*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      WORK( 1)= XMD2*SQ(1)
      WORK( 2)= Y33*SQ(1)
      WORK( 3)=-XMD2*Y03*SQ(2)
      WORK( 4)= XMD2*Y04*SQ(2)
      WORK( 5)= Y33*Y04*SQ(2)
C
      WORK( 6)=-XMD2*Y03*SQ(1)
      WORK( 7)= XMD4*SQ(2)
      WORK( 8)= XMD2*Y33*SQ(2)
      WORK( 9)= XMD2*Y34*SQ(2)
C
      WORK(10)= XMD4*SQ(1)
      WORK(11)=-XMD4*Y03*SQ(2)
      WORK(12)= XMD4*Y04*SQ(2)
C
      DO 10 I=1,2
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 110 I=1,3
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  110 CONTINUE
      DO 120 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  120 CONTINUE
      DO 130 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  130 CONTINUE
      DO 140 I=9,13
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-8)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-8)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-8)
  140 CONTINUE
C
      DO 210 I=1,4
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  210 CONTINUE
      DO 220 I=1,3
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  220 CONTINUE
      DO 230 I=4,6
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+6)
  230 CONTINUE
      DO 240 I=7,10
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I-1)
  240 CONTINUE
      DO 250 I=11,15
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I-10)
  250 CONTINUE
C
      DO 310 I=1,2
         RD3( 1,I)= RD3( 1,I)+(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*XMD6X
         RD3( 2,I)= RD3( 2,I)+(FQD3(1,I)*AQX2-FQD2(1,I)      )*XMD6Y
         RD3( 3,I)= RD3( 3,I)+(FQD3(2,I)*AQX2-FQD2(2,I)      )*XMD6
         RD3( 4,I)= RD3( 4,I)+(FQD3(1,I)*ACY2-FQD2(1,I)      )*XMD6X
         RD3( 5,I)= RD3( 5,I)+(FQD3(2,I)*AQXY                )*XMD6
         RD3( 6,I)= RD3( 6,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6X
         RD3( 7,I)= RD3( 7,I)+(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*XMD6Y
         RD3( 8,I)= RD3( 8,I)+(FQD3(2,I)*ACY2-FQD2(2,I)      )*XMD6
         RD3( 9,I)= RD3( 9,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6Y
         RD3(10,I)= RD3(10,I)+(FQD3(4,I)     -FQD2(2,I)*THREE)*XMD6
  310 CONTINUE
      DO 320 I=3,4
         FQWK( 1,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)      )*ACY
         FQWK( 3,I)=  FQD3(2,I)*AQX2-FQD2(2,I)
         FQWK( 4,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)      )*AQX
         FQWK( 5,I)=  FQD3(2,I)*AQXY
         FQWK( 6,I)=-(FQD3(3,I)     -FQD2(1,I)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I)*ACY2-FQD2(2,I)
         FQWK( 9,I)=-(FQD3(3,I)     -FQD2(1,I)      )*ACY
         FQWK(10,I)=  FQD3(4,I)     -FQD2(2,I)*THREE
  320 CONTINUE
C
      DO 330 I=3,5
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I+7)
  330 CONTINUE
      DO 340 I=6,9
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I)
  340 CONTINUE
C
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      RD4( 1,1)= RD4( 1,1)+(FQD4(1,1)*AQX4-FQD3(1,3)*SIX*AQX2
     *                     +FQD2(1,3)*THREE)*XMD6
      RD4( 2,1)= RD4( 2,1)+(FQD4(1,1)*AQX2-FQD3(1,3)*THREE)*XMD6XY
      RD4( 3,1)= RD4( 3,1)+(FQD4(2,1)*AQX2-FQD3(2,3)*THREE)*XMD6X
      RD4( 4,1)= RD4( 4,1)+(FQD4(1,1)*X2Y2-FQD3(1,3)*AQX2
     *                     -FQD3(1,3)*ACY2+FQD2(1,3))*XMD6
      RD4( 5,1)= RD4( 5,1)+(FQD4(2,1)*AQX2-FQD3(2,3)      )*XMD6Y
      RD4( 6,1)= RD4( 6,1)+(FQD4(3,1)*AQX2-FQD3(1,3)*AQX2
     *                     -FQD3(3,3)+FQD2(1,3))*XMD6
      RD4( 7,1)= RD4( 7,1)+(FQD4(1,1)*ACY2-FQD3(1,3)*THREE)*XMD6XY
      RD4( 8,1)= RD4( 8,1)+(FQD4(2,1)*ACY2-FQD3(2,3)      )*XMD6X
      RD4( 9,1)= RD4( 9,1)+(FQD4(3,1)     -FQD3(1,3)      )*XMD6XY
      RD4(10,1)= RD4(10,1)+(FQD4(4,1)     -FQD3(2,3)*THREE)*XMD6X
      RD4(11,1)= RD4(11,1)+(FQD4(1,1)*ACY4-FQD3(1,3)*SIX*ACY2
     *                     +FQD2(1,3)*THREE)*XMD6
      RD4(12,1)= RD4(12,1)+(FQD4(2,1)*ACY2-FQD3(2,3)*THREE)*XMD6Y
      RD4(13,1)= RD4(13,1)+(FQD4(3,1)*ACY2-FQD3(1,3)*ACY2
     *                     -FQD3(3,3)+FQD2(1,3))*XMD6
      RD4(14,1)= RD4(14,1)+(FQD4(4,1)     -FQD3(2,3)*THREE)*XMD6Y
      RD4(15,1)= RD4(15,1)+(FQD4(5,1)-FQD3(3,3)*SIX
     *                     +FQD2(1,3)*THREE)*XMD6
      FQWK( 1,1)=  FQD4(1,2)*AQX4-FQD3(1,4)*SIX*AQX2+FQD2(1,4)*THREE
      FQWK( 2,1)= (FQD4(1,2)*AQX2-FQD3(1,4)*THREE)*AQXY
      FQWK( 3,1)=-(FQD4(2,2)*AQX2-FQD3(2,4)*THREE)*AQX
      FQWK( 4,1)=  FQD4(1,2)*X2Y2-FQD3(1,4)*AQX2-FQD3(1,4)*ACY2
     *            +FQD2(1,4)
      FQWK( 5,1)=-(FQD4(2,2)*AQX2-FQD3(2,4)      )*ACY
      FQWK( 6,1)=  FQD4(3,2)*AQX2-FQD3(1,4)*AQX2-FQD3(3,4)+FQD2(1,4)
      FQWK( 7,1)= (FQD4(1,2)*ACY2-FQD3(1,4)*THREE)*AQXY
      FQWK( 8,1)=-(FQD4(2,2)*ACY2-FQD3(2,4)      )*AQX
      FQWK( 9,1)= (FQD4(3,2)     -FQD3(1,4)      )*AQXY
      FQWK(10,1)=-(FQD4(4,2)     -FQD3(2,4)*THREE)*AQX
      FQWK(11,1)=  FQD4(1,2)*ACY4-FQD3(1,4)*SIX*ACY2+FQD2(1,4)*THREE
      FQWK(12,1)=-(FQD4(2,2)*ACY2-FQD3(2,4)*THREE)*ACY
      FQWK(13,1)=  FQD4(3,2)*ACY2-FQD3(1,4)*ACY2-FQD3(3,4)+FQD2(1,4)
      FQWK(14,1)=-(FQD4(4,2)     -FQD3(2,4)*THREE)*ACY
      FQWK(15,1)=  FQD4(5,2)     -FQD3(3,4)*SIX+FQD2(1,4)*THREE
      DO 410 I=2,4
         DO 410 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,1)*WORK(I+8)
  410 CONTINUE
C
      RD5( 1)= RD5( 1)+(FQD5(1)*AQX4-FQD4(1,2)*AQX2*TEN
     *                 +FQD3(1,4)*FIFT)*XMD6X
      RD5( 2)= RD5( 2)+(FQD5(1)*AQX4-FQD4(1,2)*AQX2*SIX
     *                 +FQD3(1,4)*THREE)*XMD6Y
      RD5( 3)= RD5( 3)+(FQD5(2)*AQX4-FQD4(2,2)*AQX2*SIX
     *                 +FQD3(2,4)*THREE)*XMD6
      RD5( 4)= RD5( 4)+(FQD5(1)*X2Y2-FQD4(1,2)*AQX2-FQD4(1,2)*ACY2*THREE
     *                 +FQD3(1,4)*THREE)*XMD6X
      RD5( 5)= RD5( 5)+(FQD5(2)*AQX2-FQD4(2,2)*THREE)*XMD6XY
      RD5( 6)= RD5( 6)+(FQD5(3)*AQX2-FQD4(1,2)*AQX2-FQD4(3,2)*THREE
     *                 +FQD3(1,4)*THREE)*XMD6X
      RD5( 7)= RD5( 7)+(FQD5(1)*X2Y2-FQD4(1,2)*AQX2*THREE-FQD4(1,2)*ACY2
     *                 +FQD3(1,4)*THREE)*XMD6Y
      RD5( 8)= RD5( 8)+(FQD5(2)*X2Y2-FQD4(2,2)*AQX2-FQD4(2,2)*ACY2
     *                 +FQD3(2,4))*XMD6
      RD5( 9)= RD5( 9)+(FQD5(3)*AQX2-FQD4(1,2)*AQX2-FQD4(3,2)
     *                 +FQD3(1,4))*XMD6Y
      RD5(10)= RD5(10)+(FQD5(4)*AQX2-FQD4(2,2)*AQX2*THREE-FQD4(4,2)
     *                 +FQD3(2,4)*THREE)*XMD6
      RD5(11)= RD5(11)+(FQD5(1)*ACY4-FQD4(1,2)*ACY2*SIX
     *                 +FQD3(1,4)*THREE)*XMD6X
      RD5(12)= RD5(12)+(FQD5(2)*ACY2-FQD4(2,2)*THREE)*XMD6XY
      RD5(13)= RD5(13)+(FQD5(3)*ACY2-FQD4(1,2)*ACY2-FQD4(3,2)
     *                 +FQD3(1,4))*XMD6X
      RD5(14)= RD5(14)+(FQD5(4)-FQD4(2,2)*THREE)*XMD6XY
      RD5(15)= RD5(15)+(FQD5(5)-FQD4(3,2)*SIX+FQD3(1,4)*THREE)*XMD6X
      RD5(16)= RD5(16)+(FQD5(1)*ACY4-FQD4(1,2)*ACY2*TEN
     *                 +FQD3(1,4)*FIFT)*XMD6Y
      RD5(17)= RD5(17)+(FQD5(2)*ACY4-FQD4(2,2)*ACY2*SIX
     *                 +FQD3(2,4)*THREE)*XMD6
      RD5(18)= RD5(18)+(FQD5(3)*ACY2-FQD4(1,2)*ACY2-FQD4(3,2)*THREE
     *                 +FQD3(1,4)*THREE)*XMD6Y
      RD5(19)= RD5(19)+(FQD5(4)*ACY2-FQD4(2,2)*ACY2*THREE-FQD4(4,2)
     *                 +FQD3(2,4)*THREE)*XMD6
      RD5(20)= RD5(20)+(FQD5(5)-FQD4(3,2)*SIX+FQD3(1,4)*THREE)*XMD6Y
      RD5(21)= RD5(21)+(FQD5(6)-FQD4(4,2)*TEN+FQD3(2,4)*FIFT)*XMD6
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK16
      SUBROUTINE INTK16
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
C GENERATE JTYPE=16 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(66),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(504),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(12),FQWK(15,10)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2
      XMD6= XMD4*XMD2*SQ(2)
      XMD6XY=XMD6*AQXY
      XMD6X=-XMD6*AQX
      XMD6Y=-XMD6*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      WORK( 1)= XMD2*SQ(1)
      WORK( 2)= Y33*SQ(1)
      WORK( 3)=-XMD2*Y03*SQ(2)
      WORK( 4)= XMD2*Y04*SQ(2)
      WORK( 5)= Y33*Y04*SQ(2)
C
      WORK( 6)=-XMD2*Y03*SQ(1)
      WORK( 7)= XMD4*SQ(2)
      WORK( 8)= XMD2*Y33*SQ(2)
      WORK( 9)= XMD2*Y34*SQ(2)
C
      WORK(10)= XMD4*SQ(1)
      WORK(11)=-XMD4*Y03*SQ(2)
      WORK(12)= XMD4*Y04*SQ(2)
C
      DO 10 I=1,5
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 110 I=1,8
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  110 CONTINUE
      FQD11= FQD1(1,5)*RAB+FQD1(1,8)
      FQD12= FQD1(2,5)*RAB+FQD1(2,8)
      FQWK(1,9)=-FQD11*AQX
      FQWK(2,9)=-FQD11*ACY
      FQWK(3,9)= FQD12
      DO 115 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  115 CONTINUE
      DO 120 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  120 CONTINUE
      DO 125 I=9,12
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-3)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-3)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-3)
  125 CONTINUE
      DO 130 I=13,16
         RD1(1,I)= RD1(1,I)+FQWK(1,4)*WORK(I-7)
         RD1(2,I)= RD1(2,I)+FQWK(2,4)*WORK(I-7)
         RD1(3,I)= RD1(3,I)+FQWK(3,4)*WORK(I-7)
  130 CONTINUE
      DO 135 I=17,20
         RD1(1,I)= RD1(1,I)+FQWK(1,5)*WORK(I-11)
         RD1(2,I)= RD1(2,I)+FQWK(2,5)*WORK(I-11)
         RD1(3,I)= RD1(3,I)+FQWK(3,5)*WORK(I-11)
  135 CONTINUE
      DO 140 I=21,25      
         RD1(1,I)= RD1(1,I)+FQWK(1,6)*WORK(I-20)
         RD1(2,I)= RD1(2,I)+FQWK(2,6)*WORK(I-20)
         RD1(3,I)= RD1(3,I)+FQWK(3,6)*WORK(I-20)
  140 CONTINUE
      DO 145 I=26,30
         RD1(1,I)= RD1(1,I)+FQWK(1,7)*WORK(I-25)
         RD1(2,I)= RD1(2,I)+FQWK(2,7)*WORK(I-25)
         RD1(3,I)= RD1(3,I)+FQWK(3,7)*WORK(I-25)
  145 CONTINUE
      DO 150 I=31,35
         RD1(1,I)= RD1(1,I)+FQWK(1,8)*WORK(I-30)
         RD1(2,I)= RD1(2,I)+FQWK(2,8)*WORK(I-30)
         RD1(3,I)= RD1(3,I)+FQWK(3,8)*WORK(I-30)
  150 CONTINUE
      DO 155 I=36,40
         RD1(1,I)= RD1(1,I)+FQWK(1,9)*WORK(I-35)
         RD1(2,I)= RD1(2,I)+FQWK(2,9)*WORK(I-35)
         RD1(3,I)= RD1(3,I)+FQWK(3,9)*WORK(I-35)
  155 CONTINUE
C
      DO 210 I=1,9
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  210 CONTINUE
      FQD21= FQD2(1,5)*RAB+FQD2(1,8)
      FQD22= FQD2(2,5)*RAB+FQD2(2,8)
      FQD23= FQD2(3,5)*RAB+FQD2(3,8)
      FQWK(1,10)= FQD21*AQX2-FQD11
      FQWK(2,10)= FQD21*ACY2-FQD11
      FQWK(3,10)= FQD23     -FQD11
      FQWK(4,10)= FQD21*AQXY
      FQWK(5,10)=-FQD22*AQX
      FQWK(6,10)=-FQD22*ACY
      DO 215 I=1,3
         DO 215 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  215 CONTINUE
      DO 220 I=4,6
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+6)
  220 CONTINUE
      DO 225 I=7,9
         DO 225 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I+3)
  225 CONTINUE
      DO 230 I=10,12
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I)
  230 CONTINUE
      DO 235 I=13,15
         DO 235 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,5)*WORK(I-3)
  235 CONTINUE
      DO 240 I=16,19
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,6)*WORK(I-10)
  240 CONTINUE
      DO 245 I=20,23
         DO 245 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,7)*WORK(I-14)
  245 CONTINUE
      DO 250 I=24,27
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,8)*WORK(I-18)
  250 CONTINUE
      DO 255 I=28,31
         DO 255 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,10)*WORK(I-22)
  255 CONTINUE
      DO 260 I=32,36
         DO 260 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,9)*WORK(I-31)
  260 CONTINUE
C
      DO 310 I=1,5
         RD3( 1,I)= RD3( 1,I)+(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*XMD6X
         RD3( 2,I)= RD3( 2,I)+(FQD3(1,I)*AQX2-FQD2(1,I)      )*XMD6Y
         RD3( 3,I)= RD3( 3,I)+(FQD3(2,I)*AQX2-FQD2(2,I)      )*XMD6
         RD3( 4,I)= RD3( 4,I)+(FQD3(1,I)*ACY2-FQD2(1,I)      )*XMD6X
         RD3( 5,I)= RD3( 5,I)+(FQD3(2,I)*AQXY                )*XMD6
         RD3( 6,I)= RD3( 6,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6X
         RD3( 7,I)= RD3( 7,I)+(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*XMD6Y
         RD3( 8,I)= RD3( 8,I)+(FQD3(2,I)*ACY2-FQD2(2,I)      )*XMD6
         RD3( 9,I)= RD3( 9,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6Y
         RD3(10,I)= RD3(10,I)+(FQD3(4,I)     -FQD2(2,I)*THREE)*XMD6
  310 CONTINUE
      FQD3(1,5)= FQD3(1,5)*RAB+FQD3(1,8)
      FQD3(2,5)= FQD3(2,5)*RAB+FQD3(2,8)
      FQD3(3,5)= FQD3(3,5)*RAB+FQD3(3,8)
      FQD3(4,5)= FQD3(4,5)*RAB+FQD3(4,8)
      FQD2(1,5)= FQD21
      FQD2(2,5)= FQD22
      DO 320 I=1,5
         FQWK( 1,I)=-(FQD3(1,I+4)*AQX2-FQD2(1,I+4)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I+4)*AQX2-FQD2(1,I+4)      )*ACY
         FQWK( 3,I)=  FQD3(2,I+4)*AQX2-FQD2(2,I+4)
         FQWK( 4,I)=-(FQD3(1,I+4)*ACY2-FQD2(1,I+4)      )*AQX
         FQWK( 5,I)=  FQD3(2,I+4)*AQXY
         FQWK( 6,I)=-(FQD3(3,I+4)     -FQD2(1,I+4)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I+4)*ACY2-FQD2(1,I+4)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I+4)*ACY2-FQD2(2,I+4)
         FQWK( 9,I)=-(FQD3(3,I+4)     -FQD2(1,I+4)      )*ACY
         FQWK(10,I)=  FQD3(4,I+4)     -FQD2(2,I+4)*THREE
  320 CONTINUE
      DO 330 I=6,8
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+4)
  330 CONTINUE
      DO 340 I=9,11
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+1)
  340 CONTINUE
      DO 350 I=12,14
         DO 350 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I-2)
  350 CONTINUE
      DO 360 I=15,17
         DO 360 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I-5)
  360 CONTINUE
      DO 370 I=18,21
         DO 370 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,5)*WORK(I-12)
  370 CONTINUE
C
      AQX4= AQX2*AQX2
      ACY4= ACY2*ACY2
      X2Y2= AQX2*ACY2
      DO 410 I=1,5
         FQD4(I,1)= FQD4(I,1)*RAB+FQD4(I,4)
  410 CONTINUE
      DO 420 I=1,4
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I+4)*SIX*AQX2
     *                        +FQD2(1,I+4)*THREE)*XMD6
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I+4)*THREE)*XMD6XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I+4)*THREE)*XMD6X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I+4)*AQX2
     *                        -FQD3(1,I+4)*ACY2+FQD2(1,I+4))*XMD6
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I+4)      )*XMD6Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I+4)*AQX2
     *                        -FQD3(3,I+4)+FQD2(1,I+4))*XMD6
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I+4)*THREE)*XMD6XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I+4)      )*XMD6X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I+4)      )*XMD6XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I+4)*THREE)*XMD6X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I+4)*SIX*ACY2
     *                        +FQD2(1,I+4)*THREE)*XMD6
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I+4)*THREE)*XMD6Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I+4)*ACY2
     *                        -FQD3(3,I+4)+FQD2(1,I+4))*XMD6
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I+4)*THREE)*XMD6Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)-FQD3(3,I+4)*SIX
     *                        +FQD2(1,I+4)*THREE)*XMD6
  420 CONTINUE
      FQWK( 1,1)=  FQD4(1,5)*AQX4-FQD3(1,9)*SIX*AQX2+FQD2(1,9)*THREE
      FQWK( 2,1)= (FQD4(1,5)*AQX2-FQD3(1,9)*THREE)*AQXY
      FQWK( 3,1)=-(FQD4(2,5)*AQX2-FQD3(2,9)*THREE)*AQX
      FQWK( 4,1)=  FQD4(1,5)*X2Y2-FQD3(1,9)*AQX2-FQD3(1,9)*ACY2
     *            +FQD2(1,9)
      FQWK( 5,1)=-(FQD4(2,5)*AQX2-FQD3(2,9)      )*ACY
      FQWK( 6,1)=  FQD4(3,5)*AQX2-FQD3(1,9)*AQX2-FQD3(3,9)+FQD2(1,9)
      FQWK( 7,1)= (FQD4(1,5)*ACY2-FQD3(1,9)*THREE)*AQXY
      FQWK( 8,1)=-(FQD4(2,5)*ACY2-FQD3(2,9)      )*AQX
      FQWK( 9,1)= (FQD4(3,5)     -FQD3(1,9)      )*AQXY
      FQWK(10,1)=-(FQD4(4,5)     -FQD3(2,9)*THREE)*AQX
      FQWK(11,1)=  FQD4(1,5)*ACY4-FQD3(1,9)*SIX*ACY2+FQD2(1,9)*THREE
      FQWK(12,1)=-(FQD4(2,5)*ACY2-FQD3(2,9)*THREE)*ACY
      FQWK(13,1)=  FQD4(3,5)*ACY2-FQD3(1,9)*ACY2-FQD3(3,9)+FQD2(1,9)
      FQWK(14,1)=-(FQD4(4,5)     -FQD3(2,9)*THREE)*ACY
      FQWK(15,1)=  FQD4(5,5)     -FQD3(3,9)*SIX+FQD2(1,9)*THREE
      DO 430 I=5,7
         DO 430 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,1)*WORK(I+5)
  430 CONTINUE
C
      RD5( 1)= RD5( 1)+(FQD5(1)*AQX4-FQD4(1,5)*AQX2*TEN
     *                 +FQD3(1,9)*FIFT)*XMD6X
      RD5( 2)= RD5( 2)+(FQD5(1)*AQX4-FQD4(1,5)*AQX2*SIX
     *                 +FQD3(1,9)*THREE)*XMD6Y
      RD5( 3)= RD5( 3)+(FQD5(2)*AQX4-FQD4(2,5)*AQX2*SIX
     *                 +FQD3(2,9)*THREE)*XMD6
      RD5( 4)= RD5( 4)+(FQD5(1)*X2Y2-FQD4(1,5)*AQX2-FQD4(1,5)*ACY2*THREE
     *                 +FQD3(1,9)*THREE)*XMD6X
      RD5( 5)= RD5( 5)+(FQD5(2)*AQX2-FQD4(2,5)*THREE)*XMD6XY
      RD5( 6)= RD5( 6)+(FQD5(3)*AQX2-FQD4(1,5)*AQX2-FQD4(3,5)*THREE
     *                 +FQD3(1,9)*THREE)*XMD6X
      RD5( 7)= RD5( 7)+(FQD5(1)*X2Y2-FQD4(1,5)*AQX2*THREE-FQD4(1,5)*ACY2
     *                 +FQD3(1,9)*THREE)*XMD6Y
      RD5( 8)= RD5( 8)+(FQD5(2)*X2Y2-FQD4(2,5)*AQX2-FQD4(2,5)*ACY2
     *                 +FQD3(2,9))*XMD6
      RD5( 9)= RD5( 9)+(FQD5(3)*AQX2-FQD4(1,5)*AQX2-FQD4(3,5)
     *                 +FQD3(1,9))*XMD6Y
      RD5(10)= RD5(10)+(FQD5(4)*AQX2-FQD4(2,5)*AQX2*THREE-FQD4(4,5)
     *                 +FQD3(2,9)*THREE)*XMD6
      RD5(11)= RD5(11)+(FQD5(1)*ACY4-FQD4(1,5)*ACY2*SIX
     *                 +FQD3(1,9)*THREE)*XMD6X
      RD5(12)= RD5(12)+(FQD5(2)*ACY2-FQD4(2,5)*THREE)*XMD6XY
      RD5(13)= RD5(13)+(FQD5(3)*ACY2-FQD4(1,5)*ACY2-FQD4(3,5)
     *                 +FQD3(1,9))*XMD6X
      RD5(14)= RD5(14)+(FQD5(4)-FQD4(2,5)*THREE)*XMD6XY
      RD5(15)= RD5(15)+(FQD5(5)-FQD4(3,5)*SIX+FQD3(1,9)*THREE)*XMD6X
      RD5(16)= RD5(16)+(FQD5(1)*ACY4-FQD4(1,5)*ACY2*TEN
     *                 +FQD3(1,9)*FIFT)*XMD6Y
      RD5(17)= RD5(17)+(FQD5(2)*ACY4-FQD4(2,5)*ACY2*SIX
     *                 +FQD3(2,9)*THREE)*XMD6
      RD5(18)= RD5(18)+(FQD5(3)*ACY2-FQD4(1,5)*ACY2-FQD4(3,5)*THREE
     *                 +FQD3(1,9)*THREE)*XMD6Y
      RD5(19)= RD5(19)+(FQD5(4)*ACY2-FQD4(2,5)*ACY2*THREE-FQD4(4,5)
     *                 +FQD3(2,9)*THREE)*XMD6
      RD5(20)= RD5(20)+(FQD5(5)-FQD4(3,5)*SIX+FQD3(1,9)*THREE)*XMD6Y
      RD5(21)= RD5(21)+(FQD5(6)-FQD4(4,5)*TEN+FQD3(2,9)*FIFT)*XMD6
C
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK17
      SUBROUTINE INTK17
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION NINE
C
C GENERATE JTYPE=17 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00, NINE=9.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01, FORF=4.5D+01)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(21,24),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(15),FQWK(21,4)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(3)
      XMD6= XMD4*XMD2
      XMD8= XMD6*XMD2
      XMD2= XMD2*SQ(3)
      XMD8XY=XMD8*AQXY
      XMD8X=-XMD8*AQX
      XMD8Y=-XMD8*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y44 = Y04*Y04
      WORK( 1)= XMD4
      WORK( 2)= XMD2*Y33
      WORK( 3)= XMD2*Y34
      WORK( 4)= XMD2*Y44
      WORK( 5)= Y33*Y44*SQ(3)
C
      WORK( 6)=-XMD4*Y03
      WORK( 7)= XMD4*Y04
      WORK( 8)= XMD2*Y33*Y04
      WORK( 9)= XMD2*Y34*Y04
C
      WORK(10)= XMD6
      WORK(11)= XMD4*Y33
      WORK(12)= XMD4*Y34
      WORK(13)= XMD4*Y44
C
      WORK(14)=-XMD6*Y03
      WORK(15)= XMD6*Y04
C
      DO 10 I=1,2
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 110 I=1,3
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  110 CONTINUE
      DO 120 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  120 CONTINUE
      DO 130 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  130 CONTINUE
      DO 140 I=9,13
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-8)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-8)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-8)
  140 CONTINUE
C
      DO 210 I=1,4
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  210 CONTINUE
      DO 220 I=1,4
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  220 CONTINUE
      DO 230 I=5,8
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+5)
  230 CONTINUE
      DO 240 I=9,12
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I-3)
  240 CONTINUE
      DO 250 I=13,17
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I-12)
  250 CONTINUE
C
      DO 310 I=1,4
         FQWK( 1,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)      )*ACY
         FQWK( 3,I)=  FQD3(2,I)*AQX2-FQD2(2,I)
         FQWK( 4,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)      )*AQX
         FQWK( 5,I)=  FQD3(2,I)*AQXY
         FQWK( 6,I)=-(FQD3(3,I)     -FQD2(1,I)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I)*ACY2-FQD2(2,I)
         FQWK( 9,I)=-(FQD3(3,I)     -FQD2(1,I)      )*ACY
         FQWK(10,I)=  FQD3(4,I)     -FQD2(2,I)*THREE
  310 CONTINUE
      DO 320 I=1,2
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+13)
  320 CONTINUE
      DO 330 I=3,4
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+11)
  330 CONTINUE
      DO 340 I=5,8
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I+5)
  340 CONTINUE
      DO 350 I=9,12
         DO 350 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I-3)
  350 CONTINUE
C
      AQX4= AQX2*AQX2
      AQX6= AQX4*AQX2
      ACY4= ACY2*ACY2
      ACY6= ACY4*ACY2
      X2Y2= AQX2*ACY2
      X4Y2= X2Y2*AQX2
      X2Y4= X2Y2*ACY2
      DO 410 I=1,2
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*XMD8X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2
     *                        -FQD3(1,I)*ACY2+FQD2(1,I))*XMD8
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I)      )*XMD8Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I)*AQX2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I)      )*XMD8X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I)      )*XMD8XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*XMD8Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I)*ACY2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)-FQD3(3,I)*SIX
     *                        +FQD2(1,I)*THREE)*XMD8
  410 CONTINUE
      DO 420 I=3,4
         FQWK( 1,I)=  FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2+FQD2(1,I)*THREE
         FQWK( 2,I)= (FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*AQXY
         FQWK( 3,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*AQX
         FQWK( 4,I)=  FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2-FQD3(1,I)*ACY2
     *               +FQD2(1,I)
         FQWK( 5,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)      )*ACY
         FQWK( 6,I)=  FQD4(3,I)*AQX2-FQD3(1,I)*AQX2-FQD3(3,I)+FQD2(1,I)
         FQWK( 7,I)= (FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*AQXY
         FQWK( 8,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)      )*AQX
         FQWK( 9,I)= (FQD4(3,I)     -FQD3(1,I)      )*AQXY
         FQWK(10,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*AQX
         FQWK(11,I)=  FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2+FQD2(1,I)*THREE
         FQWK(12,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*ACY
         FQWK(13,I)=  FQD4(3,I)*ACY2-FQD3(1,I)*ACY2-FQD3(3,I)+FQD2(1,I)
         FQWK(14,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*ACY
         FQWK(15,I)=  FQD4(5,I)     -FQD3(3,I)*SIX+FQD2(1,I)*THREE
  420 CONTINUE
      DO 430 I=3,4
         DO 430 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,3)*WORK(I+11)
  430 CONTINUE
      DO 440 I=5,8
         DO 440 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,4)*WORK(I+5)
  440 CONTINUE
C
      RD5( 1,1)= RD5( 1,1)+(FQD5(1,1)*AQX4-FQD4(1,3)*AQX2*TEN
     *                     +FQD3(1,3)*FIFT)*XMD8X
      RD5( 2,1)= RD5( 2,1)+(FQD5(1,1)*AQX4-FQD4(1,3)*AQX2*SIX
     *                     +FQD3(1,3)*THREE)*XMD8Y
      RD5( 3,1)= RD5( 3,1)+(FQD5(2,1)*AQX4-FQD4(2,3)*AQX2*SIX
     *                     +FQD3(2,3)*THREE)*XMD8
      RD5( 4,1)= RD5( 4,1)+(FQD5(1,1)*X2Y2-FQD4(1,3)*AQX2
     *                     -FQD4(1,3)*ACY2*THREE+FQD3(1,3)*THREE)*XMD8X
      RD5( 5,1)= RD5( 5,1)+(FQD5(2,1)*AQX2-FQD4(2,3)*THREE)*XMD8XY
      RD5( 6,1)= RD5( 6,1)+(FQD5(3,1)*AQX2-FQD4(1,3)*AQX2
     *                     -FQD4(3,3)*THREE+FQD3(1,3)*THREE)*XMD8X
      RD5( 7,1)= RD5( 7,1)+(FQD5(1,1)*X2Y2-FQD4(1,3)*AQX2*THREE
     *                     -FQD4(1,3)*ACY2+FQD3(1,3)*THREE)*XMD8Y
      RD5( 8,1)= RD5( 8,1)+(FQD5(2,1)*X2Y2-FQD4(2,3)*AQX2-FQD4(2,3)*ACY2
     *                     +FQD3(2,3))*XMD8
      RD5( 9,1)= RD5( 9,1)+(FQD5(3,1)*AQX2-FQD4(1,3)*AQX2-FQD4(3,3)
     *                     +FQD3(1,3))*XMD8Y
      RD5(10,1)= RD5(10,1)+(FQD5(4,1)*AQX2-FQD4(2,3)*AQX2*THREE
     *                     -FQD4(4,3)+FQD3(2,3)*THREE)*XMD8
      RD5(11,1)= RD5(11,1)+(FQD5(1,1)*ACY4-FQD4(1,3)*ACY2*SIX
     *                     +FQD3(1,3)*THREE)*XMD8X
      RD5(12,1)= RD5(12,1)+(FQD5(2,1)*ACY2-FQD4(2,3)*THREE)*XMD8XY
      RD5(13,1)= RD5(13,1)+(FQD5(3,1)*ACY2-FQD4(1,3)*ACY2-FQD4(3,3)
     *                     +FQD3(1,3))*XMD8X
      RD5(14,1)= RD5(14,1)+(FQD5(4,1)-FQD4(2,3)*THREE)*XMD8XY
      RD5(15,1)= RD5(15,1)+(FQD5(5,1)-FQD4(3,3)*SIX+FQD3(1,3)*THREE)
     *                     *XMD8X
      RD5(16,1)= RD5(16,1)+(FQD5(1,1)*ACY4-FQD4(1,3)*ACY2*TEN
     *                     +FQD3(1,3)*FIFT)*XMD8Y
      RD5(17,1)= RD5(17,1)+(FQD5(2,1)*ACY4-FQD4(2,3)*ACY2*SIX
     *                     +FQD3(2,3)*THREE)*XMD8
      RD5(18,1)= RD5(18,1)+(FQD5(3,1)*ACY2-FQD4(1,3)*ACY2
     *                     -FQD4(3,3)*THREE+FQD3(1,3)*THREE)*XMD8Y
      RD5(19,1)= RD5(19,1)+(FQD5(4,1)*ACY2-FQD4(2,3)*ACY2*THREE
     *                     -FQD4(4,3)+FQD3(2,3)*THREE)*XMD8
      RD5(20,1)= RD5(20,1)+(FQD5(5,1)-FQD4(3,3)*SIX+FQD3(1,3)*THREE)
     *                     *XMD8Y
      RD5(21,1)= RD5(21,1)+(FQD5(6,1)-FQD4(4,3)*TEN+FQD3(2,3)*FIFT)*XMD8
C
      FQWK( 1,1)=-(FQD5(1,2)*AQX4-FQD4(1,4)*AQX2*TEN+FQD3(1,4)*FIFT)*AQX
      FQWK( 2,1)=-(FQD5(1,2)*AQX4-FQD4(1,4)*AQX2*SIX+FQD3(1,4)*THREE)
     *            *ACY
      FQWK( 3,1)=  FQD5(2,2)*AQX4-FQD4(2,4)*AQX2*SIX+FQD3(2,4)*THREE
      FQWK( 4,1)=-(FQD5(1,2)*X2Y2-FQD4(1,4)*AQX2-FQD4(1,4)*ACY2*THREE
     *            +FQD3(1,4)*THREE)*AQX
      FQWK( 5,1)= (FQD5(2,2)*AQX2-FQD4(2,4)*THREE)*AQXY
      FQWK( 6,1)=-(FQD5(3,2)*AQX2-FQD4(1,4)*AQX2-FQD4(3,4)*THREE
     *            +FQD3(1,4)*THREE)*AQX
      FQWK( 7,1)=-(FQD5(1,2)*X2Y2-FQD4(1,4)*AQX2*THREE-FQD4(1,4)*ACY2
     *            +FQD3(1,4)*THREE)*ACY
      FQWK( 8,1)=  FQD5(2,2)*X2Y2-FQD4(2,4)*AQX2-FQD4(2,4)*ACY2
     *            +FQD3(2,4)
      FQWK( 9,1)=-(FQD5(3,2)*AQX2-FQD4(1,4)*AQX2-FQD4(3,4)+FQD3(1,4))
     *            *ACY
      FQWK(10,1)=  FQD5(4,2)*AQX2-FQD4(2,4)*AQX2*THREE-FQD4(4,4)
     *            +FQD3(2,4)*THREE
      FQWK(11,1)=-(FQD5(1,2)*ACY4-FQD4(1,4)*ACY2*SIX+FQD3(1,4)*THREE)
     *            *AQX
      FQWK(12,1)= (FQD5(2,2)*ACY2-FQD4(2,4)*THREE)*AQXY
      FQWK(13,1)=-(FQD5(3,2)*ACY2-FQD4(1,4)*ACY2-FQD4(3,4)+FQD3(1,4))
     *            *AQX
      FQWK(14,1)= (FQD5(4,2)     -FQD4(2,4)*THREE)*AQXY
      FQWK(15,1)=-(FQD5(5,2)     -FQD4(3,4)*SIX+FQD3(1,4)*THREE)*AQX
      FQWK(16,1)=-(FQD5(1,2)*ACY4-FQD4(1,4)*ACY2*TEN+FQD3(1,4)*FIFT)*ACY
      FQWK(17,1)=  FQD5(2,2)*ACY4-FQD4(2,4)*ACY2*SIX+FQD3(2,4)*THREE
      FQWK(18,1)=-(FQD5(3,2)*ACY2-FQD4(1,4)*ACY2-FQD4(3,4)*THREE
     *            +FQD3(1,4)*THREE)*ACY
      FQWK(19,1)=  FQD5(4,2)*ACY2-FQD4(2,4)*ACY2*THREE-FQD4(4,4)
     *            +FQD3(2,4)*THREE
      FQWK(20,1)=-(FQD5(5,2)     -FQD4(3,4)*SIX+FQD3(1,4)*THREE)*ACY
      FQWK(21,1)=  FQD5(6,2)     -FQD4(4,4)*TEN+FQD3(2,4)*FIFT
      DO 510 I=2,3
         DO 510 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,1)*WORK(I+12)
  510 CONTINUE
C
      RD6( 1)= RD6( 1)+(FQD6(1)*AQX6-FQD5(1,2)*AQX4*FIFT
     *                 +FQD4(1,4)*AQX2*FORF-FQD3(1,4)*FIFT)*XMD8
      RD6( 2)= RD6( 2)+(FQD6(1)*AQX4-FQD5(1,2)*AQX2*TEN
     *                 +FQD4(1,4)*FIFT)*XMD8XY
      RD6( 3)= RD6( 3)+(FQD6(2)*AQX4-FQD5(2,2)*AQX2*TEN
     *                 +FQD4(2,4)*FIFT)*XMD8X
      RD6( 4)= RD6( 4)+(FQD6(1)*X4Y2-FQD5(1,2)*AQX4-FQD5(1,2)*X2Y2*SIX
     *                 +FQD4(1,4)*AQX2*SIX+FQD4(1,4)*ACY2*THREE
     *                 -FQD3(1,4)*THREE)*XMD8
      RD6( 5)= RD6( 5)+(FQD6(2)*AQX4-FQD5(2,2)*AQX2*SIX
     *                 +FQD4(2,4)*THREE)*XMD8Y
      RD6( 6)= RD6( 6)+(FQD6(3)*AQX4-FQD5(1,2)*AQX4-FQD5(3,2)*AQX2*SIX
     *                 +FQD4(1,4)*AQX2*SIX+FQD4(3,4)*THREE
     *                 -FQD3(1,4)*THREE)*XMD8
      RD6( 7)= RD6( 7)+(FQD6(1)*X2Y2-FQD5(1,2)*AQX2*THREE
     *                 -FQD5(1,2)*ACY2*THREE+FQD4(1,4)*NINE)*XMD8XY
      RD6( 8)= RD6( 8)+(FQD6(2)*X2Y2-FQD5(2,2)*AQX2
     *                 -FQD5(2,2)*ACY2*THREE+FQD4(2,4)*THREE)*XMD8X
      RD6( 9)= RD6( 9)+(FQD6(3)*AQX2-FQD5(1,2)*AQX2-FQD5(3,2)*THREE
     *                 +FQD4(1,4)*THREE)*XMD8XY
      RD6(10)= RD6(10)+(FQD6(4)*AQX2-FQD5(2,2)*AQX2*THREE
     *                 -FQD5(4,2)*THREE+FQD4(2,4)*NINE)*XMD8X
      RD6(11)= RD6(11)+(FQD6(1)*X2Y4-FQD5(1,2)*X2Y2*SIX-FQD5(1,2)*ACY4
     *                 +FQD4(1,4)*AQX2*THREE+FQD4(1,4)*ACY2*SIX
     *                 -FQD3(1,4)*THREE)*XMD8
      RD6(12)= RD6(12)+(FQD6(2)*X2Y2-FQD5(2,2)*AQX2*THREE
     *                 -FQD5(2,2)*ACY2+FQD4(2,4)*THREE)*XMD8Y
      RD6(13)= RD6(13)+(FQD6(3)*X2Y2-FQD5(1,2)*X2Y2-FQD5(3,2)*AQX2
     *                 -FQD5(3,2)*ACY2+FQD4(1,4)*AQX2+FQD4(1,4)*ACY2
     *                 +FQD4(3,4)-FQD3(1,4))*XMD8
      RD6(14)= RD6(14)+(FQD6(4)*AQX2-FQD5(2,2)*AQX2*THREE-FQD5(4,2)
     *                 +FQD4(2,4)*THREE)*XMD8Y
      RD6(15)= RD6(15)+(FQD6(5)*AQX2-FQD5(3,2)*AQX2*SIX-FQD5(5,2)
     *                 +FQD4(1,4)*AQX2*THREE+FQD4(3,4)*SIX
     *                 -FQD3(1,4)*THREE)*XMD8
      RD6(16)= RD6(16)+(FQD6(1)*ACY4-FQD5(1,2)*ACY2*TEN
     *                 +FQD4(1,4)*FIFT)*XMD8XY
      RD6(17)= RD6(17)+(FQD6(2)*ACY4-FQD5(2,2)*ACY2*SIX
     *                 +FQD4(2,4)*THREE)*XMD8X
      RD6(18)= RD6(18)+(FQD6(3)*ACY2-FQD5(1,2)*ACY2-FQD5(3,2)*THREE
     *                 +FQD4(1,4)*THREE)*XMD8XY
      RD6(19)= RD6(19)+(FQD6(4)*ACY2-FQD5(2,2)*ACY2*THREE-FQD5(4,2)
     *                 +FQD4(2,4)*THREE)*XMD8X
      RD6(20)= RD6(20)+(FQD6(5)-FQD5(3,2)*SIX+FQD4(1,4)*THREE)*XMD8XY
      RD6(21)= RD6(21)+(FQD6(6)-FQD5(4,2)*TEN+FQD4(2,4)*FIFT)*XMD8X
      RD6(22)= RD6(22)+(FQD6(1)*ACY6-FQD5(1,2)*ACY4*FIFT
     *                 +FQD4(1,4)*ACY2*FORF-FQD3(1,4)*FIFT)*XMD8
      RD6(23)= RD6(23)+(FQD6(2)*ACY4-FQD5(2,2)*ACY2*TEN
     *                 +FQD4(2,4)*FIFT)*XMD8Y
      RD6(24)= RD6(24)+(FQD6(3)*ACY4-FQD5(1,2)*ACY4-FQD5(3,2)*ACY2*SIX
     *                 +FQD4(1,4)*ACY2*SIX+FQD4(3,4)*THREE
     *                 -FQD3(1,4)*THREE)*XMD8
      RD6(25)= RD6(25)+(FQD6(4)*ACY2-FQD5(2,2)*ACY2*THREE
     *                 -FQD5(4,2)*THREE+FQD4(2,4)*NINE)*XMD8Y
      RD6(26)= RD6(26)+(FQD6(5)*ACY2-FQD5(3,2)*ACY2*SIX-FQD5(5,2)
     *                 +FQD4(1,4)*ACY2*THREE+FQD4(3,4)*SIX
     *                 -FQD3(1,4)*THREE)*XMD8
      RD6(27)= RD6(27)+(FQD6(6)-FQD5(4,2)*TEN+FQD4(2,4)*FIFT)*XMD8Y
      RD6(28)= RD6(28)+(FQD6(7)-FQD5(5,2)*FIFT+FQD4(3,4)*FORF
     *                 -FQD3(1,4)*FIFT)*XMD8
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK18
      SUBROUTINE INTK18
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION NINE
C
C GENERATE JTYPE=18 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00, NINE=9.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01, FORF=4.5D+01)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(21,24),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(15),FQWK(21,10)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(3)
      XMD6= XMD4*XMD2
      XMD8= XMD6*XMD2
      XMD2= XMD2*SQ(3)
      XMD8XY=XMD8*AQXY
      XMD8X=-XMD8*AQX
      XMD8Y=-XMD8*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y44 = Y04*Y04
      WORK( 1)= XMD4
      WORK( 2)= XMD2*Y33
      WORK( 3)= XMD2*Y34
      WORK( 4)= XMD2*Y44
      WORK( 5)= Y33*Y44*SQ(3)
C
      WORK( 6)=-XMD4*Y03
      WORK( 7)= XMD4*Y04
      WORK( 8)= XMD2*Y33*Y04
      WORK( 9)= XMD2*Y34*Y04
C
      WORK(10)= XMD6
      WORK(11)= XMD4*Y33
      WORK(12)= XMD4*Y34
      WORK(13)= XMD4*Y44
C
      WORK(14)=-XMD6*Y03
      WORK(15)= XMD6*Y04
C
      DO 10 I=1,5
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 105 I=1,8
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  105 CONTINUE
      FQD11= FQD1(1,5)*RAB+FQD1(1,8)
      FQD12= FQD1(2,5)*RAB+FQD1(2,8)
      FQWK(1,9)=-FQD11*AQX
      FQWK(2,9)=-FQD11*ACY
      FQWK(3,9)= FQD12
      DO 110 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  110 CONTINUE
      DO 115 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  115 CONTINUE
      DO 120 I=9,12
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-3)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-3)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-3)
  120 CONTINUE
      DO 125 I=13,16
         RD1(1,I)= RD1(1,I)+FQWK(1,4)*WORK(I-7)
         RD1(2,I)= RD1(2,I)+FQWK(2,4)*WORK(I-7)
         RD1(3,I)= RD1(3,I)+FQWK(3,4)*WORK(I-7)
  125 CONTINUE
      DO 130 I=17,20
         RD1(1,I)= RD1(1,I)+FQWK(1,5)*WORK(I-11)
         RD1(2,I)= RD1(2,I)+FQWK(2,5)*WORK(I-11)
         RD1(3,I)= RD1(3,I)+FQWK(3,5)*WORK(I-11)
  130 CONTINUE
      DO 135 I=21,25
         RD1(1,I)= RD1(1,I)+FQWK(1,6)*WORK(I-20)
         RD1(2,I)= RD1(2,I)+FQWK(2,6)*WORK(I-20)
         RD1(3,I)= RD1(3,I)+FQWK(3,6)*WORK(I-20)
  135 CONTINUE
      DO 140 I=26,30
         RD1(1,I)= RD1(1,I)+FQWK(1,7)*WORK(I-25)
         RD1(2,I)= RD1(2,I)+FQWK(2,7)*WORK(I-25)
         RD1(3,I)= RD1(3,I)+FQWK(3,7)*WORK(I-25)
  140 CONTINUE
      DO 145 I=31,35
         RD1(1,I)= RD1(1,I)+FQWK(1,8)*WORK(I-30)
         RD1(2,I)= RD1(2,I)+FQWK(2,8)*WORK(I-30)
         RD1(3,I)= RD1(3,I)+FQWK(3,8)*WORK(I-30)
  145 CONTINUE
      DO 150 I=36,40
         RD1(1,I)= RD1(1,I)+FQWK(1,9)*WORK(I-35)
         RD1(2,I)= RD1(2,I)+FQWK(2,9)*WORK(I-35)
         RD1(3,I)= RD1(3,I)+FQWK(3,9)*WORK(I-35)
  150 CONTINUE
C
      DO 205 I=1,9
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  205 CONTINUE
      FQD21= FQD2(1,5)*RAB+FQD2(1,8)
      FQD22= FQD2(2,5)*RAB+FQD2(2,8)
      FQD23= FQD2(3,5)*RAB+FQD2(3,8)
      FQWK(1,10)= FQD21*AQX2-FQD11
      FQWK(2,10)= FQD21*ACY2-FQD11
      FQWK(3,10)= FQD23     -FQD11
      FQWK(4,10)= FQD21*AQXY
      FQWK(5,10)=-FQD22*AQX
      FQWK(6,10)=-FQD22*ACY
      DO 210 I=1,4
         DO 210 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  210 CONTINUE
      DO 215 I=5,8
         DO 215 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+5)
  215 CONTINUE
      DO 220 I=9,12
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I+1)
  220 CONTINUE
      DO 225 I=13,16
         DO 225 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I-3)
  225 CONTINUE
      DO 230 I=17,20
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,5)*WORK(I-7)
  230 CONTINUE
      DO 235 I=21,24
         DO 235 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,6)*WORK(I-15)
  235 CONTINUE
      DO 240 I=25,28
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,7)*WORK(I-19)
  240 CONTINUE
      DO 245 I=29,32
         DO 245 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,8)*WORK(I-23)
  245 CONTINUE
      DO 250 I=33,36
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,10)*WORK(I-27)
  250 CONTINUE
      DO 255 I=37,41
         DO 255 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,9)*WORK(I-36)
  255 CONTINUE
C
      DO 305 I=1,9
         FQWK( 1,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)      )*ACY
         FQWK( 3,I)=  FQD3(2,I)*AQX2-FQD2(2,I)
         FQWK( 4,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)      )*AQX
         FQWK( 5,I)=  FQD3(2,I)*AQXY
         FQWK( 6,I)=-(FQD3(3,I)     -FQD2(1,I)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I)*ACY2-FQD2(2,I)
         FQWK( 9,I)=-(FQD3(3,I)     -FQD2(1,I)      )*ACY
         FQWK(10,I)=  FQD3(4,I)     -FQD2(2,I)*THREE
  305 CONTINUE
      FQD31= FQD3(1,5)*RAB+FQD3(1,8)
      FQD32= FQD3(2,5)*RAB+FQD3(2,8)
      FQD33= FQD3(3,5)*RAB+FQD3(3,8)
      FQD34= FQD3(4,5)*RAB+FQD3(4,8)
      FQWK( 1,10)=-(FQD31*AQX2-FQD21*THREE)*AQX
      FQWK( 2,10)=-(FQD31*AQX2-FQD21      )*ACY
      FQWK( 3,10)=  FQD32*AQX2-FQD22
      FQWK( 4,10)=-(FQD31*ACY2-FQD21      )*AQX
      FQWK( 5,10)=  FQD32*AQXY
      FQWK( 6,10)=-(FQD33     -FQD21      )*AQX
      FQWK( 7,10)=-(FQD31*ACY2-FQD21*THREE)*ACY
      FQWK( 8,10)=  FQD32*ACY2-FQD22
      FQWK( 9,10)=-(FQD33     -FQD21      )*ACY
      FQWK(10,10)=  FQD34     -FQD22*THREE
      DO 310 I=1,2
         DO 310 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+13)
  310 CONTINUE
      DO 315 I=3,4
         DO 315 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+11)
  315 CONTINUE
      DO 320 I=5,6
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I+9)
  320 CONTINUE
      DO 325 I=7,8
         DO 325 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I+7)
  325 CONTINUE
      DO 330 I=9,10
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,5)*WORK(I+5)
  330 CONTINUE
      DO 335 I=11,14
         DO 335 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,6)*WORK(I-1)
  335 CONTINUE
      DO 340 I=15,18
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,7)*WORK(I-5)
  340 CONTINUE
      DO 345 I=19,22
         DO 345 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,8)*WORK(I-9)
  345 CONTINUE
      DO 350 I=23,26
         DO 350 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,10)*WORK(I-13)
  350 CONTINUE
      DO 355 I=27,30
         DO 355 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,9)*WORK(I-21)
  355 CONTINUE
C
      AQX4= AQX2*AQX2
      AQX6= AQX4*AQX2
      ACY4= ACY2*ACY2
      ACY6= ACY4*ACY2
      X2Y2= AQX2*ACY2
      X4Y2= X2Y2*AQX2
      X2Y4= X2Y2*ACY2
      DO 410 I=1,5
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*XMD8X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2
     *                        -FQD3(1,I)*ACY2+FQD2(1,I))*XMD8
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I)      )*XMD8Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I)*AQX2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I)      )*XMD8X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I)      )*XMD8XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*XMD8Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I)*ACY2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)-FQD3(3,I)*SIX
     *                        +FQD2(1,I)*THREE)*XMD8
  410 CONTINUE
      DO 420 I=1,5
         FQD4(I,5)= FQD4(I,5)*RAB+FQD4(I,8)
  420 CONTINUE
      FQD3(1,5)= FQD31
      FQD3(2,5)= FQD32
      FQD3(3,5)= FQD33
      FQD2(1,5)= FQD21
      DO 430 I=5,9
         FQWK( 1,I)=  FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2+FQD2(1,I)*THREE
         FQWK( 2,I)= (FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*AQXY
         FQWK( 3,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*AQX
         FQWK( 4,I)=  FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2-FQD3(1,I)*ACY2
     *               +FQD2(1,I)
         FQWK( 5,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)      )*ACY
         FQWK( 6,I)=  FQD4(3,I)*AQX2-FQD3(1,I)*AQX2-FQD3(3,I)+FQD2(1,I)
         FQWK( 7,I)= (FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*AQXY
         FQWK( 8,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)      )*AQX
         FQWK( 9,I)= (FQD4(3,I)     -FQD3(1,I)      )*AQXY
         FQWK(10,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*AQX
         FQWK(11,I)=  FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2+FQD2(1,I)*THREE
         FQWK(12,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*ACY
         FQWK(13,I)=  FQD4(3,I)*ACY2-FQD3(1,I)*ACY2-FQD3(3,I)+FQD2(1,I)
         FQWK(14,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*ACY
         FQWK(15,I)=  FQD4(5,I)     -FQD3(3,I)*SIX+FQD2(1,I)*THREE
  430 CONTINUE
      DO 440 I=6,7
         DO 440 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,5)*WORK(I+8)
  440 CONTINUE
      DO 450 I=8,9
         DO 450 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,6)*WORK(I+6)
  450 CONTINUE
      DO 460 I=10,11
         DO 460 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,7)*WORK(I+4)
  460 CONTINUE
      DO 470 I=12,13
         DO 470 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,8)*WORK(I+2)
  470 CONTINUE
      DO 480 I=14,17
         DO 480 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,9)*WORK(I-4)
  480 CONTINUE
C
      DO 510 I=1,6
         FQD5(I,1)= FQD5(I,1)*RAB+FQD5(I,4)
  510 CONTINUE
      DO 520 I=1,4
        RD5( 1,I)= RD5( 1,I)+(FQD5(1,I)*AQX4-FQD4(1,I+4)*AQX2*TEN
     *                       +FQD3(1,I+4)*FIFT)*XMD8X
        RD5( 2,I)= RD5( 2,I)+(FQD5(1,I)*AQX4-FQD4(1,I+4)*AQX2*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8Y
        RD5( 3,I)= RD5( 3,I)+(FQD5(2,I)*AQX4-FQD4(2,I+4)*AQX2*SIX
     *                       +FQD3(2,I+4)*THREE)*XMD8
        RD5( 4,I)= RD5( 4,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+4)*ACY2*THREE
     *                       -FQD4(1,I+4)*AQX2+FQD3(1,I+4)*THREE)*XMD8X
        RD5( 5,I)= RD5( 5,I)+(FQD5(2,I)*AQX2-FQD4(2,I+4)*THREE)*XMD8XY
        RD5( 6,I)= RD5( 6,I)+(FQD5(3,I)*AQX2-FQD4(1,I+4)*AQX2
     *                       -FQD4(3,I+4)*THREE+FQD3(1,I+4)*THREE)*XMD8X
        RD5( 7,I)= RD5( 7,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+4)*AQX2*THREE
     *                       -FQD4(1,I+4)*ACY2+FQD3(1,I+4)*THREE)*XMD8Y
        RD5( 8,I)= RD5( 8,I)+(FQD5(2,I)*X2Y2-FQD4(2,I+4)*AQX2
     *                       -FQD4(2,I+4)*ACY2+FQD3(2,I+4))*XMD8
        RD5( 9,I)= RD5( 9,I)+(FQD5(3,I)*AQX2-FQD4(1,I+4)*AQX2
     *                       -FQD4(3,I+4)+FQD3(1,I+4))*XMD8Y
        RD5(10,I)= RD5(10,I)+(FQD5(4,I)*AQX2-FQD4(2,I+4)*AQX2*THREE
     *                       -FQD4(4,I+4)+FQD3(2,I+4)*THREE)*XMD8
        RD5(11,I)= RD5(11,I)+(FQD5(1,I)*ACY4-FQD4(1,I+4)*ACY2*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8X
        RD5(12,I)= RD5(12,I)+(FQD5(2,I)*ACY2-FQD4(2,I+4)*THREE)*XMD8XY
        RD5(13,I)= RD5(13,I)+(FQD5(3,I)*ACY2-FQD4(1,I+4)*ACY2
     *                       -FQD4(3,I+4)+FQD3(1,I+4))*XMD8X
        RD5(14,I)= RD5(14,I)+(FQD5(4,I)-FQD4(2,I+4)*THREE)*XMD8XY
        RD5(15,I)= RD5(15,I)+(FQD5(5,I)-FQD4(3,I+4)*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8X
        RD5(16,I)= RD5(16,I)+(FQD5(1,I)*ACY4-FQD4(1,I+4)*ACY2*TEN
     *                       +FQD3(1,I+4)*FIFT)*XMD8Y
        RD5(17,I)= RD5(17,I)+(FQD5(2,I)*ACY4-FQD4(2,I+4)*ACY2*SIX
     *                       +FQD3(2,I+4)*THREE)*XMD8
        RD5(18,I)= RD5(18,I)+(FQD5(3,I)*ACY2-FQD4(1,I+4)*ACY2
     *                       -FQD4(3,I+4)*THREE+FQD3(1,I+4)*THREE)*XMD8Y
        RD5(19,I)= RD5(19,I)+(FQD5(4,I)*ACY2-FQD4(2,I+4)*ACY2*THREE
     *                       -FQD4(4,I+4)+FQD3(2,I+4)*THREE)*XMD8
        RD5(20,I)= RD5(20,I)+(FQD5(5,I)-FQD4(3,I+4)*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8Y
        RD5(21,I)= RD5(21,I)+(FQD5(6,I)-FQD4(4,I+4)*TEN
     *                       +FQD3(2,I+4)*FIFT)*XMD8
  520 CONTINUE
C
      FQWK( 1,1)=-(FQD5(1,5)*AQX4-FQD4(1,9)*AQX2*TEN+FQD3(1,9)*FIFT)*AQX
      FQWK( 2,1)=-(FQD5(1,5)*AQX4-FQD4(1,9)*AQX2*SIX+FQD3(1,9)*THREE)
     *            *ACY
      FQWK( 3,1)=  FQD5(2,5)*AQX4-FQD4(2,9)*AQX2*SIX+FQD3(2,9)*THREE
      FQWK( 4,1)=-(FQD5(1,5)*X2Y2-FQD4(1,9)*AQX2-FQD4(1,9)*ACY2*THREE
     *            +FQD3(1,9)*THREE)*AQX
      FQWK( 5,1)= (FQD5(2,5)*AQX2-FQD4(2,9)*THREE)*AQXY
      FQWK( 6,1)=-(FQD5(3,5)*AQX2-FQD4(1,9)*AQX2-FQD4(3,9)*THREE
     *            +FQD3(1,9)*THREE)*AQX
      FQWK( 7,1)=-(FQD5(1,5)*X2Y2-FQD4(1,9)*AQX2*THREE-FQD4(1,9)*ACY2
     *            +FQD3(1,9)*THREE)*ACY
      FQWK( 8,1)=  FQD5(2,5)*X2Y2-FQD4(2,9)*AQX2-FQD4(2,9)*ACY2
     *            +FQD3(2,9)
      FQWK( 9,1)=-(FQD5(3,5)*AQX2-FQD4(1,9)*AQX2-FQD4(3,9)+FQD3(1,9))
     *            *ACY
      FQWK(10,1)=  FQD5(4,5)*AQX2-FQD4(2,9)*AQX2*THREE-FQD4(4,9)
     *            +FQD3(2,9)*THREE
      FQWK(11,1)=-(FQD5(1,5)*ACY4-FQD4(1,9)*ACY2*SIX+FQD3(1,9)*THREE)
     *            *AQX
      FQWK(12,1)= (FQD5(2,5)*ACY2-FQD4(2,9)*THREE)*AQXY
      FQWK(13,1)=-(FQD5(3,5)*ACY2-FQD4(1,9)*ACY2-FQD4(3,9)+FQD3(1,9))
     *            *AQX
      FQWK(14,1)= (FQD5(4,5)     -FQD4(2,9)*THREE)*AQXY
      FQWK(15,1)=-(FQD5(5,5)     -FQD4(3,9)*SIX+FQD3(1,9)*THREE)*AQX
      FQWK(16,1)=-(FQD5(1,5)*ACY4-FQD4(1,9)*ACY2*TEN+FQD3(1,9)*FIFT)*ACY
      FQWK(17,1)=  FQD5(2,5)*ACY4-FQD4(2,9)*ACY2*SIX+FQD3(2,9)*THREE
      FQWK(18,1)=-(FQD5(3,5)*ACY2-FQD4(1,9)*ACY2-FQD4(3,9)*THREE
     *            +FQD3(1,9)*THREE)*ACY
      FQWK(19,1)=  FQD5(4,5)*ACY2-FQD4(2,9)*ACY2*THREE-FQD4(4,9)
     *            +FQD3(2,9)*THREE
      FQWK(20,1)=-(FQD5(5,5)     -FQD4(3,9)*SIX+FQD3(1,9)*THREE)*ACY
      FQWK(21,1)=  FQD5(6,5)     -FQD4(4,9)*TEN+FQD3(2,9)*FIFT
      DO 530 I=5,6
         DO 530 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,1)*WORK(I+9)
  530 CONTINUE
C
      RD6( 1)= RD6( 1)+(FQD6(1)*AQX6-FQD5(1,5)*AQX4*FIFT
     *                 +FQD4(1,9)*AQX2*FORF-FQD3(1,9)*FIFT)*XMD8
      RD6( 2)= RD6( 2)+(FQD6(1)*AQX4-FQD5(1,5)*AQX2*TEN
     *                 +FQD4(1,9)*FIFT)*XMD8XY
      RD6( 3)= RD6( 3)+(FQD6(2)*AQX4-FQD5(2,5)*AQX2*TEN
     *                 +FQD4(2,9)*FIFT)*XMD8X
      RD6( 4)= RD6( 4)+(FQD6(1)*X4Y2-FQD5(1,5)*AQX4-FQD5(1,5)*X2Y2*SIX
     *                 +FQD4(1,9)*AQX2*SIX+FQD4(1,9)*ACY2*THREE
     *                 -FQD3(1,9)*THREE)*XMD8
      RD6( 5)= RD6( 5)+(FQD6(2)*AQX4-FQD5(2,5)*AQX2*SIX
     *                 +FQD4(2,9)*THREE)*XMD8Y
      RD6( 6)= RD6( 6)+(FQD6(3)*AQX4-FQD5(1,5)*AQX4-FQD5(3,5)*AQX2*SIX
     *                 +FQD4(1,9)*AQX2*SIX+FQD4(3,9)*THREE
     *                 -FQD3(1,9)*THREE)*XMD8
      RD6( 7)= RD6( 7)+(FQD6(1)*X2Y2-FQD5(1,5)*AQX2*THREE
     *                 -FQD5(1,5)*ACY2*THREE+FQD4(1,9)*NINE)*XMD8XY
      RD6( 8)= RD6( 8)+(FQD6(2)*X2Y2-FQD5(2,5)*AQX2
     *                 -FQD5(2,5)*ACY2*THREE+FQD4(2,9)*THREE)*XMD8X
      RD6( 9)= RD6( 9)+(FQD6(3)*AQX2-FQD5(1,5)*AQX2-FQD5(3,5)*THREE
     *                 +FQD4(1,9)*THREE)*XMD8XY
      RD6(10)= RD6(10)+(FQD6(4)*AQX2-FQD5(2,5)*AQX2*THREE
     *                 -FQD5(4,5)*THREE+FQD4(2,9)*NINE)*XMD8X
      RD6(11)= RD6(11)+(FQD6(1)*X2Y4-FQD5(1,5)*X2Y2*SIX-FQD5(1,5)*ACY4
     *                 +FQD4(1,9)*AQX2*THREE+FQD4(1,9)*ACY2*SIX
     *                 -FQD3(1,9)*THREE)*XMD8
      RD6(12)= RD6(12)+(FQD6(2)*X2Y2-FQD5(2,5)*AQX2*THREE
     *                 -FQD5(2,5)*ACY2+FQD4(2,9)*THREE)*XMD8Y
      RD6(13)= RD6(13)+(FQD6(3)*X2Y2-FQD5(1,5)*X2Y2-FQD5(3,5)*AQX2
     *                 -FQD5(3,5)*ACY2+FQD4(1,9)*AQX2+FQD4(1,9)*ACY2
     *                 +FQD4(3,9)-FQD3(1,9))*XMD8
      RD6(14)= RD6(14)+(FQD6(4)*AQX2-FQD5(2,5)*AQX2*THREE-FQD5(4,5)
     *                 +FQD4(2,9)*THREE)*XMD8Y
      RD6(15)= RD6(15)+(FQD6(5)*AQX2-FQD5(3,5)*AQX2*SIX-FQD5(5,5)
     *                 +FQD4(1,9)*AQX2*THREE+FQD4(3,9)*SIX
     *                 -FQD3(1,9)*THREE)*XMD8
      RD6(16)= RD6(16)+(FQD6(1)*ACY4-FQD5(1,5)*ACY2*TEN
     *                 +FQD4(1,9)*FIFT)*XMD8XY
      RD6(17)= RD6(17)+(FQD6(2)*ACY4-FQD5(2,5)*ACY2*SIX
     *                 +FQD4(2,9)*THREE)*XMD8X
      RD6(18)= RD6(18)+(FQD6(3)*ACY2-FQD5(1,5)*ACY2-FQD5(3,5)*THREE
     *                 +FQD4(1,9)*THREE)*XMD8XY
      RD6(19)= RD6(19)+(FQD6(4)*ACY2-FQD5(2,5)*ACY2*THREE-FQD5(4,5)
     *                 +FQD4(2,9)*THREE)*XMD8X
      RD6(20)= RD6(20)+(FQD6(5)-FQD5(3,5)*SIX+FQD4(1,9)*THREE)*XMD8XY
      RD6(21)= RD6(21)+(FQD6(6)-FQD5(4,5)*TEN+FQD4(2,9)*FIFT)*XMD8X
      RD6(22)= RD6(22)+(FQD6(1)*ACY6-FQD5(1,5)*ACY4*FIFT
     *                 +FQD4(1,9)*ACY2*FORF-FQD3(1,9)*FIFT)*XMD8
      RD6(23)= RD6(23)+(FQD6(2)*ACY4-FQD5(2,5)*ACY2*TEN
     *                 +FQD4(2,9)*FIFT)*XMD8Y
      RD6(24)= RD6(24)+(FQD6(3)*ACY4-FQD5(1,5)*ACY4-FQD5(3,5)*ACY2*SIX
     *                 +FQD4(1,9)*ACY2*SIX+FQD4(3,9)*THREE
     *                 -FQD3(1,9)*THREE)*XMD8
      RD6(25)= RD6(25)+(FQD6(4)*ACY2-FQD5(2,5)*ACY2*THREE
     *                 -FQD5(4,5)*THREE+FQD4(2,9)*NINE)*XMD8Y
      RD6(26)= RD6(26)+(FQD6(5)*ACY2-FQD5(3,5)*ACY2*SIX-FQD5(5,5)
     *                 +FQD4(1,9)*ACY2*THREE+FQD4(3,9)*SIX
     *                 -FQD3(1,9)*THREE)*XMD8
      RD6(27)= RD6(27)+(FQD6(6)-FQD5(4,5)*TEN+FQD4(2,9)*FIFT)*XMD8Y
      RD6(28)= RD6(28)+(FQD6(7)-FQD5(5,5)*FIFT+FQD4(3,9)*FORF
     *                 -FQD3(1,9)*FIFT)*XMD8
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK19
      SUBROUTINE INTK19
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION NINE
C
C GENERATE JTYPE=19 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00, NINE=9.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01, FORF=4.5D+01)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(49),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(21,24),RD6(336),RD7(144),RD8(45)
C
      DIMENSION WORK(12),FQWK(21,12)
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2
      XMD6= XMD4*XMD2*SQ(2)
      XMD6XY=XMD6*AQXY
      XMD6X=-XMD6*AQX
      XMD6Y=-XMD6*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      WORK( 1)= XMD2*SQ(1)
      WORK( 2)= Y33*SQ(1)
      WORK( 3)=-XMD2*Y03*SQ(2)
      WORK( 4)= XMD2*Y04*SQ(2)
      WORK( 5)= Y33*Y04*SQ(2)
C
      WORK( 6)=-XMD2*Y03*SQ(1)
      WORK( 7)= XMD4*SQ(2)
      WORK( 8)= XMD2*Y33*SQ(2)
      WORK( 9)= XMD2*Y34*SQ(2)
C
      WORK(10)= XMD4*SQ(1)
      WORK(11)=-XMD4*Y03*SQ(2)
      WORK(12)= XMD4*Y04*SQ(2)
C
      DO 10 I=1,5
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 105 I=1,8
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  105 CONTINUE
      FQD11= FQD1(1,5)*RAB+FQD1(1,7)
      FQD12= FQD1(2,5)*RAB+FQD1(2,7)
      FQD13= FQD1(1,8)*RAB+FQD1(1,10)
      FQWK(1,9)=-FQD11*AQX
      FQWK(2,9)=-FQD11*ACY
      FQWK(3,9)= FQD12
      DO 110 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  110 CONTINUE
      DO 115 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  115 CONTINUE
      DO 120 I=9,12
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-3)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-3)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-3)
  120 CONTINUE
      DO 125 I=13,16
         RD1(1,I)= RD1(1,I)+FQWK(1,4)*WORK(I-7)
         RD1(2,I)= RD1(2,I)+FQWK(2,4)*WORK(I-7)
         RD1(3,I)= RD1(3,I)+FQWK(3,4)*WORK(I-7)
  125 CONTINUE
      DO 130 I=17,20
         RD1(1,I)= RD1(1,I)+FQWK(1,5)*WORK(I-11)
         RD1(2,I)= RD1(2,I)+FQWK(2,5)*WORK(I-11)
         RD1(3,I)= RD1(3,I)+FQWK(3,5)*WORK(I-11)
  130 CONTINUE
      DO 135 I=21,25
         RD1(1,I)= RD1(1,I)+FQWK(1,6)*WORK(I-20)
         RD1(2,I)= RD1(2,I)+FQWK(2,6)*WORK(I-20)
         RD1(3,I)= RD1(3,I)+FQWK(3,6)*WORK(I-20)
  135 CONTINUE
      DO 140 I=26,30
         RD1(1,I)= RD1(1,I)+FQWK(1,7)*WORK(I-25)
         RD1(2,I)= RD1(2,I)+FQWK(2,7)*WORK(I-25)
         RD1(3,I)= RD1(3,I)+FQWK(3,7)*WORK(I-25)
  140 CONTINUE
      DO 145 I=31,35
         RD1(1,I)= RD1(1,I)+FQWK(1,8)*WORK(I-30)
         RD1(2,I)= RD1(2,I)+FQWK(2,8)*WORK(I-30)
         RD1(3,I)= RD1(3,I)+FQWK(3,8)*WORK(I-30)
  145 CONTINUE
      DO 150 I=36,40
         RD1(1,I)= RD1(1,I)+FQWK(1,9)*WORK(I-35)
         RD1(2,I)= RD1(2,I)+FQWK(2,9)*WORK(I-35)
         RD1(3,I)= RD1(3,I)+FQWK(3,9)*WORK(I-35)
  150 CONTINUE
C
      DO 205 I=1,10
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  205 CONTINUE
      FQD21= FQD2(1,5)*RAB+FQD2(1,7)
      FQD22= FQD2(2,5)*RAB+FQD2(2,7)
      FQD23= FQD2(3,5)*RAB+FQD2(3,7)
      FQD24= FQD2(1,8)*RAB+FQD2(1,10)
      FQD25= FQD2(2,8)*RAB+FQD2(2,10)
      FQD26= FQD2(3,8)*RAB+FQD2(3,10)
      FQWK(1,11)= FQD21*AQX2-FQD11
      FQWK(2,11)= FQD21*ACY2-FQD11
      FQWK(3,11)= FQD23     -FQD11
      FQWK(4,11)= FQD21*AQXY
      FQWK(5,11)=-FQD22*AQX
      FQWK(6,11)=-FQD22*ACY
      FQWK(1,12)= FQD24*AQX2-FQD13
      FQWK(2,12)= FQD24*ACY2-FQD13
      FQWK(3,12)= FQD26     -FQD13
      FQWK(4,12)= FQD24*AQXY
      FQWK(5,12)=-FQD25*AQX
      FQWK(6,12)=-FQD25*ACY
      DO 210 I=1,3
         DO 210 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  210 CONTINUE
      DO 215 I=4,6
         DO 215 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+6)
  215 CONTINUE
      DO 220 I=7,9
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I+3)
  220 CONTINUE
      DO 225 I=10,12
         DO 225 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I)
  225 CONTINUE
      DO 230 I=13,15
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,5)*WORK(I-3)
  230 CONTINUE
      DO 235 I=16,19
         DO 235 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,6)*WORK(I-10)
  235 CONTINUE
      DO 240 I=20,23
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,7)*WORK(I-14)
  240 CONTINUE
      DO 245 I=24,27
         DO 245 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,8)*WORK(I-18)
  245 CONTINUE
      DO 250 I=28,31
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,11)*WORK(I-22)
  250 CONTINUE
      DO 255 I=32,36
         DO 255 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,9)*WORK(I-31)
  255 CONTINUE
      DO 260 I=37,41
         DO 260 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,10)*WORK(I-36)
  260 CONTINUE
      DO 265 I=42,46
         DO 265 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,12)*WORK(I-41)
  265 CONTINUE
C
      DO 305 I=1,5
         RD3( 1,I)= RD3( 1,I)+(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*XMD6X
         RD3( 2,I)= RD3( 2,I)+(FQD3(1,I)*AQX2-FQD2(1,I)      )*XMD6Y
         RD3( 3,I)= RD3( 3,I)+(FQD3(2,I)*AQX2-FQD2(2,I)      )*XMD6
         RD3( 4,I)= RD3( 4,I)+(FQD3(1,I)*ACY2-FQD2(1,I)      )*XMD6X
         RD3( 5,I)= RD3( 5,I)+(FQD3(2,I)*AQXY                )*XMD6
         RD3( 6,I)= RD3( 6,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6X
         RD3( 7,I)= RD3( 7,I)+(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*XMD6Y
         RD3( 8,I)= RD3( 8,I)+(FQD3(2,I)*ACY2-FQD2(2,I)      )*XMD6
         RD3( 9,I)= RD3( 9,I)+(FQD3(3,I)     -FQD2(1,I)      )*XMD6Y
         RD3(10,I)= RD3(10,I)+(FQD3(4,I)     -FQD2(2,I)*THREE)*XMD6
  305 CONTINUE
      FQD3(1,5)= FQD3(1,5)*RAB+FQD3(1,7)
      FQD3(2,5)= FQD3(2,5)*RAB+FQD3(2,7)
      FQD3(3,5)= FQD3(3,5)*RAB+FQD3(3,7)
      FQD3(4,5)= FQD3(4,5)*RAB+FQD3(4,7)
      FQD2(1,5)= FQD21
      FQD2(2,5)= FQD22
      DO 310 I=1,7
         FQWK( 1,I)=-(FQD3(1,I+4)*AQX2-FQD2(1,I+4)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I+4)*AQX2-FQD2(1,I+4)      )*ACY
         FQWK( 3,I)=  FQD3(2,I+4)*AQX2-FQD2(2,I+4)
         FQWK( 4,I)=-(FQD3(1,I+4)*ACY2-FQD2(1,I+4)      )*AQX
         FQWK( 5,I)=  FQD3(2,I+4)*AQXY
         FQWK( 6,I)=-(FQD3(3,I+4)     -FQD2(1,I+4)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I+4)*ACY2-FQD2(1,I+4)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I+4)*ACY2-FQD2(2,I+4)
         FQWK( 9,I)=-(FQD3(3,I+4)     -FQD2(1,I+4)      )*ACY
         FQWK(10,I)=  FQD3(4,I+4)     -FQD2(2,I+4)*THREE
  310 CONTINUE
      FQD31= FQD3(1,8)*RAB+FQD3(1,10)
      FQD32= FQD3(2,8)*RAB+FQD3(2,10)
      FQD33= FQD3(3,8)*RAB+FQD3(3,10)
      FQD34= FQD3(4,8)*RAB+FQD3(4,10)
      FQWK( 1,8)=-(FQD31*AQX2-FQD24*THREE)*AQX
      FQWK( 2,8)=-(FQD31*AQX2-FQD24      )*ACY
      FQWK( 3,8)=  FQD32*AQX2-FQD25
      FQWK( 4,8)=-(FQD31*ACY2-FQD24      )*AQX
      FQWK( 5,8)=  FQD32*AQXY
      FQWK( 6,8)=-(FQD33     -FQD24      )*AQX
      FQWK( 7,8)=-(FQD31*ACY2-FQD24*THREE)*ACY
      FQWK( 8,8)=  FQD32*ACY2-FQD25
      FQWK( 9,8)=-(FQD33     -FQD24      )*ACY
      FQWK(10,8)=  FQD34     -FQD25*THREE
      DO 315 I=6,8
         DO 315 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+4)
  315 CONTINUE
      DO 320 I=9,11
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+1)
  320 CONTINUE
      DO 325 I=12,14
         DO 325 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I-2)
  325 CONTINUE
      DO 330 I=15,17
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I-5)
  330 CONTINUE
      DO 335 I=18,21
         DO 335 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,5)*WORK(I-12)
  335 CONTINUE
      DO 340 I=22,25
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,6)*WORK(I-16)
  340 CONTINUE
      DO 345 I=26,29
         DO 345 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,8)*WORK(I-20)
  345 CONTINUE
      DO 350 I=30,34
         DO 350 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,7)*WORK(I-29)
  350 CONTINUE
C
      AQX4= AQX2*AQX2
      AQX6= AQX4*AQX2
      ACY4= ACY2*ACY2
      ACY6= ACY4*ACY2
      X2Y2= AQX2*ACY2
      X4Y2= X2Y2*AQX2
      X2Y4= X2Y2*ACY2
      DO 410 I=1,5
         FQD4(I,1)= FQD4(I,1)*RAB+FQD4(I,3)
  410 CONTINUE
      DO 420 I=1,4
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I+4)*SIX*AQX2
     *                        +FQD2(1,I+4)*THREE)*XMD6
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I+4)*THREE)*XMD6XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I+4)*THREE)*XMD6X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I+4)*AQX2
     *                        -FQD3(1,I+4)*ACY2+FQD2(1,I+4))*XMD6
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I+4)      )*XMD6Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I+4)*AQX2
     *                        -FQD3(3,I+4)+FQD2(1,I+4))*XMD6
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I+4)*THREE)*XMD6XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I+4)      )*XMD6X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I+4)      )*XMD6XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I+4)*THREE)*XMD6X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I+4)*SIX*ACY2
     *                        +FQD2(1,I+4)*THREE)*XMD6
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I+4)*THREE)*XMD6Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I+4)*ACY2
     *                        -FQD3(3,I+4)+FQD2(1,I+4))*XMD6
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I+4)*THREE)*XMD6Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)-FQD3(3,I+4)*SIX
     *                        +FQD2(1,I+4)*THREE)*XMD6
  420 CONTINUE
      DO 430 I=1,5
         FQD4(I,4)= FQD4(I,4)*RAB+FQD4(I,6)
  430 CONTINUE
      FQD3(1,8)= FQD31
      FQD3(2,8)= FQD32
      FQD3(3,8)= FQD33
      FQD2(1,8)= FQD24
      DO 440 I=4,7
         FQWK( 1,I)=  FQD4(1,I)*AQX4-FQD3(1,I+4)*SIX*AQX2
     *               +FQD2(1,I+4)*THREE
         FQWK( 2,I)= (FQD4(1,I)*AQX2-FQD3(1,I+4)*THREE)*AQXY
         FQWK( 3,I)=-(FQD4(2,I)*AQX2-FQD3(2,I+4)*THREE)*AQX
         FQWK( 4,I)=  FQD4(1,I)*X2Y2-FQD3(1,I+4)*AQX2-FQD3(1,I+4)*ACY2
     *               +FQD2(1,I+4)
         FQWK( 5,I)=-(FQD4(2,I)*AQX2-FQD3(2,I+4)      )*ACY
         FQWK( 6,I)=  FQD4(3,I)*AQX2-FQD3(1,I+4)*AQX2-FQD3(3,I+4)
     *               +FQD2(1,I+4)
         FQWK( 7,I)= (FQD4(1,I)*ACY2-FQD3(1,I+4)*THREE)*AQXY
         FQWK( 8,I)=-(FQD4(2,I)*ACY2-FQD3(2,I+4)      )*AQX
         FQWK( 9,I)= (FQD4(3,I)     -FQD3(1,I+4)      )*AQXY
         FQWK(10,I)=-(FQD4(4,I)     -FQD3(2,I+4)*THREE)*AQX
         FQWK(11,I)=  FQD4(1,I)*ACY4-FQD3(1,I+4)*SIX*ACY2
     *               +FQD2(1,I+4)*THREE
         FQWK(12,I)=-(FQD4(2,I)*ACY2-FQD3(2,I+4)*THREE)*ACY
         FQWK(13,I)=  FQD4(3,I)*ACY2-FQD3(1,I+4)*ACY2-FQD3(3,I+4)
     *               +FQD2(1,I+4)
         FQWK(14,I)=-(FQD4(4,I)     -FQD3(2,I+4)*THREE)*ACY
         FQWK(15,I)=  FQD4(5,I)     -FQD3(3,I+4)*SIX+FQD2(1,I+4)*THREE
  440 CONTINUE
      DO 450 I=5,7
         DO 450 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,5)*WORK(I+5)
  450 CONTINUE
      DO 460 I=8,10
         DO 460 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,6)*WORK(I+2)
  460 CONTINUE
      DO 470 I=11,13
         DO 470 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,4)*WORK(I-1)
  470 CONTINUE
      DO 480 I=14,17
         DO 480 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,7)*WORK(I-8)
  480 CONTINUE
C
      DO 510 I=1,6
         FQD5(I,1)= FQD5(I,1)*RAB+FQD5(I,3)
  510 CONTINUE
      DO 520 I=1,3
        RD5( 1,I)= RD5( 1,I)+(FQD5(1,I)*AQX4-FQD4(1,I+3)*AQX2*TEN
     *                       +FQD3(1,I+7)*FIFT)*XMD6X
        RD5( 2,I)= RD5( 2,I)+(FQD5(1,I)*AQX4-FQD4(1,I+3)*AQX2*SIX
     *                       +FQD3(1,I+7)*THREE)*XMD6Y
        RD5( 3,I)= RD5( 3,I)+(FQD5(2,I)*AQX4-FQD4(2,I+3)*AQX2*SIX
     *                       +FQD3(2,I+7)*THREE)*XMD6
        RD5( 4,I)= RD5( 4,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+3)*ACY2*THREE
     *                       -FQD4(1,I+3)*AQX2+FQD3(1,I+7)*THREE)*XMD6X
        RD5( 5,I)= RD5( 5,I)+(FQD5(2,I)*AQX2-FQD4(2,I+3)*THREE)*XMD6XY
        RD5( 6,I)= RD5( 6,I)+(FQD5(3,I)*AQX2-FQD4(1,I+3)*AQX2
     *                       -FQD4(3,I+3)*THREE+FQD3(1,I+7)*THREE)*XMD6X
        RD5( 7,I)= RD5( 7,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+3)*AQX2*THREE
     *                       -FQD4(1,I+3)*ACY2+FQD3(1,I+7)*THREE)*XMD6Y
        RD5( 8,I)= RD5( 8,I)+(FQD5(2,I)*X2Y2-FQD4(2,I+3)*AQX2
     *                       -FQD4(2,I+3)*ACY2+FQD3(2,I+7))*XMD6
        RD5( 9,I)= RD5( 9,I)+(FQD5(3,I)*AQX2-FQD4(1,I+3)*AQX2
     *                       -FQD4(3,I+3)+FQD3(1,I+7))*XMD6Y
        RD5(10,I)= RD5(10,I)+(FQD5(4,I)*AQX2-FQD4(2,I+3)*AQX2*THREE
     *                       -FQD4(4,I+3)+FQD3(2,I+7)*THREE)*XMD6
        RD5(11,I)= RD5(11,I)+(FQD5(1,I)*ACY4-FQD4(1,I+3)*ACY2*SIX
     *                       +FQD3(1,I+7)*THREE)*XMD6X
        RD5(12,I)= RD5(12,I)+(FQD5(2,I)*ACY2-FQD4(2,I+3)*THREE)*XMD6XY
        RD5(13,I)= RD5(13,I)+(FQD5(3,I)*ACY2-FQD4(1,I+3)*ACY2
     *                       -FQD4(3,I+3)+FQD3(1,I+7))*XMD6X
        RD5(14,I)= RD5(14,I)+(FQD5(4,I)-FQD4(2,I+3)*THREE)*XMD6XY
        RD5(15,I)= RD5(15,I)+(FQD5(5,I)-FQD4(3,I+3)*SIX
     *                       +FQD3(1,I+7)*THREE)*XMD6X
        RD5(16,I)= RD5(16,I)+(FQD5(1,I)*ACY4-FQD4(1,I+3)*ACY2*TEN
     *                       +FQD3(1,I+7)*FIFT)*XMD6Y
        RD5(17,I)= RD5(17,I)+(FQD5(2,I)*ACY4-FQD4(2,I+3)*ACY2*SIX
     *                       +FQD3(2,I+7)*THREE)*XMD6
        RD5(18,I)= RD5(18,I)+(FQD5(3,I)*ACY2-FQD4(1,I+3)*ACY2
     *                       -FQD4(3,I+3)*THREE+FQD3(1,I+7)*THREE)*XMD6Y
        RD5(19,I)= RD5(19,I)+(FQD5(4,I)*ACY2-FQD4(2,I+3)*ACY2*THREE
     *                       -FQD4(4,I+3)+FQD3(2,I+7)*THREE)*XMD6
        RD5(20,I)= RD5(20,I)+(FQD5(5,I)-FQD4(3,I+3)*SIX
     *                       +FQD3(1,I+7)*THREE)*XMD6Y
        RD5(21,I)= RD5(21,I)+(FQD5(6,I)-FQD4(4,I+3)*TEN
     *                       +FQD3(2,I+7)*FIFT)*XMD6
  520 CONTINUE
C
      FQWK( 1,1)=-(FQD5(1,4)*AQX4-FQD4(1,7)*AQX2*TEN+FQD3(1,11)*FIFT)
     *            *AQX
      FQWK( 2,1)=-(FQD5(1,4)*AQX4-FQD4(1,7)*AQX2*SIX+FQD3(1,11)*THREE)
     *            *ACY
      FQWK( 3,1)=  FQD5(2,4)*AQX4-FQD4(2,7)*AQX2*SIX+FQD3(2,11)*THREE
      FQWK( 4,1)=-(FQD5(1,4)*X2Y2-FQD4(1,7)*AQX2-FQD4(1,7)*ACY2*THREE
     *            +FQD3(1,11)*THREE)*AQX
      FQWK( 5,1)= (FQD5(2,4)*AQX2-FQD4(2,7)*THREE)*AQXY
      FQWK( 6,1)=-(FQD5(3,4)*AQX2-FQD4(1,7)*AQX2-FQD4(3,7)*THREE
     *            +FQD3(1,11)*THREE)*AQX
      FQWK( 7,1)=-(FQD5(1,4)*X2Y2-FQD4(1,7)*AQX2*THREE-FQD4(1,7)*ACY2
     *            +FQD3(1,11)*THREE)*ACY
      FQWK( 8,1)=  FQD5(2,4)*X2Y2-FQD4(2,7)*AQX2-FQD4(2,7)*ACY2
     *            +FQD3(2,11)
      FQWK( 9,1)=-(FQD5(3,4)*AQX2-FQD4(1,7)*AQX2-FQD4(3,7)+FQD3(1,11))
     *            *ACY
      FQWK(10,1)=  FQD5(4,4)*AQX2-FQD4(2,7)*AQX2*THREE-FQD4(4,7)
     *            +FQD3(2,11)*THREE
      FQWK(11,1)=-(FQD5(1,4)*ACY4-FQD4(1,7)*ACY2*SIX+FQD3(1,11)*THREE)
     *            *AQX
      FQWK(12,1)= (FQD5(2,4)*ACY2-FQD4(2,7)*THREE)*AQXY
      FQWK(13,1)=-(FQD5(3,4)*ACY2-FQD4(1,7)*ACY2-FQD4(3,7)+FQD3(1,11))
     *            *AQX
      FQWK(14,1)= (FQD5(4,4)     -FQD4(2,7)*THREE)*AQXY
      FQWK(15,1)=-(FQD5(5,4)     -FQD4(3,7)*SIX+FQD3(1,11)*THREE)*AQX
      FQWK(16,1)=-(FQD5(1,4)*ACY4-FQD4(1,7)*ACY2*TEN+FQD3(1,11)*FIFT)
     *            *ACY
      FQWK(17,1)=  FQD5(2,4)*ACY4-FQD4(2,7)*ACY2*SIX+FQD3(2,11)*THREE
      FQWK(18,1)=-(FQD5(3,4)*ACY2-FQD4(1,7)*ACY2-FQD4(3,7)*THREE
     *            +FQD3(1,11)*THREE)*ACY
      FQWK(19,1)=  FQD5(4,4)*ACY2-FQD4(2,7)*ACY2*THREE-FQD4(4,7)
     *            +FQD3(2,11)*THREE
      FQWK(20,1)=-(FQD5(5,4)     -FQD4(3,7)*SIX+FQD3(1,11)*THREE)*ACY
      FQWK(21,1)=  FQD5(6,4)     -FQD4(4,7)*TEN+FQD3(2,11)*FIFT
      DO 530 I=4,6
         DO 530 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,1)*WORK(I+6)
  530 CONTINUE
C
      RD6( 1)= RD6( 1)+(FQD6(1)*AQX6-FQD5(1,4)*AQX4*FIFT
     *                 +FQD4(1,7)*AQX2*FORF-FQD3(1,11)*FIFT)*XMD6
      RD6( 2)= RD6( 2)+(FQD6(1)*AQX4-FQD5(1,4)*AQX2*TEN
     *                 +FQD4(1,7)*FIFT)*XMD6XY
      RD6( 3)= RD6( 3)+(FQD6(2)*AQX4-FQD5(2,4)*AQX2*TEN
     *                 +FQD4(2,7)*FIFT)*XMD6X
      RD6( 4)= RD6( 4)+(FQD6(1)*X4Y2-FQD5(1,4)*AQX4-FQD5(1,4)*X2Y2*SIX
     *                 +FQD4(1,7)*AQX2*SIX+FQD4(1,7)*ACY2*THREE
     *                 -FQD3(1,11)*THREE)*XMD6
      RD6( 5)= RD6( 5)+(FQD6(2)*AQX4-FQD5(2,4)*AQX2*SIX
     *                 +FQD4(2,7)*THREE)*XMD6Y
      RD6( 6)= RD6( 6)+(FQD6(3)*AQX4-FQD5(1,4)*AQX4-FQD5(3,4)*AQX2*SIX
     *                 +FQD4(1,7)*AQX2*SIX+FQD4(3,7)*THREE
     *                 -FQD3(1,11)*THREE)*XMD6
      RD6( 7)= RD6( 7)+(FQD6(1)*X2Y2-FQD5(1,4)*AQX2*THREE
     *                 -FQD5(1,4)*ACY2*THREE+FQD4(1,7)*NINE)*XMD6XY
      RD6( 8)= RD6( 8)+(FQD6(2)*X2Y2-FQD5(2,4)*AQX2
     *                 -FQD5(2,4)*ACY2*THREE+FQD4(2,7)*THREE)*XMD6X
      RD6( 9)= RD6( 9)+(FQD6(3)*AQX2-FQD5(1,4)*AQX2-FQD5(3,4)*THREE
     *                 +FQD4(1,7)*THREE)*XMD6XY
      RD6(10)= RD6(10)+(FQD6(4)*AQX2-FQD5(2,4)*AQX2*THREE
     *                 -FQD5(4,4)*THREE+FQD4(2,7)*NINE)*XMD6X
      RD6(11)= RD6(11)+(FQD6(1)*X2Y4-FQD5(1,4)*X2Y2*SIX-FQD5(1,4)*ACY4
     *                 +FQD4(1,7)*AQX2*THREE+FQD4(1,7)*ACY2*SIX
     *                 -FQD3(1,11)*THREE)*XMD6
      RD6(12)= RD6(12)+(FQD6(2)*X2Y2-FQD5(2,4)*AQX2*THREE
     *                 -FQD5(2,4)*ACY2+FQD4(2,7)*THREE)*XMD6Y
      RD6(13)= RD6(13)+(FQD6(3)*X2Y2-FQD5(1,4)*X2Y2-FQD5(3,4)*AQX2
     *                 -FQD5(3,4)*ACY2+FQD4(1,7)*AQX2+FQD4(1,7)*ACY2
     *                 +FQD4(3,7)-FQD3(1,11))*XMD6
      RD6(14)= RD6(14)+(FQD6(4)*AQX2-FQD5(2,4)*AQX2*THREE-FQD5(4,4)
     *                 +FQD4(2,7)*THREE)*XMD6Y
      RD6(15)= RD6(15)+(FQD6(5)*AQX2-FQD5(3,4)*AQX2*SIX-FQD5(5,4)
     *                 +FQD4(1,7)*AQX2*THREE+FQD4(3,7)*SIX
     *                 -FQD3(1,11)*THREE)*XMD6
      RD6(16)= RD6(16)+(FQD6(1)*ACY4-FQD5(1,4)*ACY2*TEN
     *                 +FQD4(1,7)*FIFT)*XMD6XY
      RD6(17)= RD6(17)+(FQD6(2)*ACY4-FQD5(2,4)*ACY2*SIX
     *                 +FQD4(2,7)*THREE)*XMD6X
      RD6(18)= RD6(18)+(FQD6(3)*ACY2-FQD5(1,4)*ACY2-FQD5(3,4)*THREE
     *                 +FQD4(1,7)*THREE)*XMD6XY
      RD6(19)= RD6(19)+(FQD6(4)*ACY2-FQD5(2,4)*ACY2*THREE-FQD5(4,4)
     *                 +FQD4(2,7)*THREE)*XMD6X
      RD6(20)= RD6(20)+(FQD6(5)-FQD5(3,4)*SIX+FQD4(1,7)*THREE)*XMD6XY
      RD6(21)= RD6(21)+(FQD6(6)-FQD5(4,4)*TEN+FQD4(2,7)*FIFT)*XMD6X
      RD6(22)= RD6(22)+(FQD6(1)*ACY6-FQD5(1,4)*ACY4*FIFT
     *                 +FQD4(1,7)*ACY2*FORF-FQD3(1,11)*FIFT)*XMD6
      RD6(23)= RD6(23)+(FQD6(2)*ACY4-FQD5(2,4)*ACY2*TEN
     *                 +FQD4(2,7)*FIFT)*XMD6Y
      RD6(24)= RD6(24)+(FQD6(3)*ACY4-FQD5(1,4)*ACY4-FQD5(3,4)*ACY2*SIX
     *                 +FQD4(1,7)*ACY2*SIX+FQD4(3,7)*THREE
     *                 -FQD3(1,11)*THREE)*XMD6
      RD6(25)= RD6(25)+(FQD6(4)*ACY2-FQD5(2,4)*ACY2*THREE
     *                 -FQD5(4,4)*THREE+FQD4(2,7)*NINE)*XMD6Y
      RD6(26)= RD6(26)+(FQD6(5)*ACY2-FQD5(3,4)*ACY2*SIX-FQD5(5,4)
     *                 +FQD4(1,7)*ACY2*THREE+FQD4(3,7)*SIX
     *                 -FQD3(1,11)*THREE)*XMD6
      RD6(27)= RD6(27)+(FQD6(6)-FQD5(4,4)*TEN+FQD4(2,7)*FIFT)*XMD6Y
      RD6(28)= RD6(28)+(FQD6(7)-FQD5(5,4)*FIFT+FQD4(3,7)*FORF
     *                 -FQD3(1,11)*FIFT)*XMD6
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK20
      SUBROUTINE INTK20
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION NINE
C
C GENERATE JTYPE=20 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00, NINE=9.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01, FORF=4.5D+01,
     3           EITEN=1.8D+01, TWONE=2.1D+01, ONEOF=1.05D+02)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(7,7),FQD7(24),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(21,24),RD6(28,12),RD7(144),RD8(45)
C
      DIMENSION WORK(15),FQWK(28,13)
C
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(3)
      XMD6= XMD4*XMD2
      XMD8= XMD6*XMD2
      XMD2= XMD2*SQ(3)
      XMD8XY=XMD8*AQXY
      XMD8X=-XMD8*AQX
      XMD8Y=-XMD8*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y44 = Y04*Y04
      WORK( 1)= XMD4
      WORK( 2)= XMD2*Y33
      WORK( 3)= XMD2*Y34
      WORK( 4)= XMD2*Y44
      WORK( 5)= Y33*Y44*SQ(3)
C
      WORK( 6)=-XMD4*Y03
      WORK( 7)= XMD4*Y04
      WORK( 8)= XMD2*Y33*Y04
      WORK( 9)= XMD2*Y34*Y04
C
      WORK(10)= XMD6
      WORK(11)= XMD4*Y33
      WORK(12)= XMD4*Y34
      WORK(13)= XMD4*Y44
C
      WORK(14)=-XMD6*Y03
      WORK(15)= XMD6*Y04
C
      DO 10 I=1,5
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 105 I=1,8
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  105 CONTINUE
      FQD1(1,12)= FQD1(1,8)*RAB+FQD1(1,10)
      FQD1(1,13)= FQD1(1,5)*RAB+FQD1(1,7)
      FQD1(2,13)= FQD1(2,5)*RAB+FQD1(2,7)
      FQWK(1,9)=-FQD1(1,13)*AQX
      FQWK(2,9)=-FQD1(1,13)*ACY
      FQWK(3,9)= FQD1(2,13)
      DO 110 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  110 CONTINUE
      DO 115 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  115 CONTINUE
      DO 120 I=9,12
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-3)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-3)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-3)
  120 CONTINUE
      DO 125 I=13,16
         RD1(1,I)= RD1(1,I)+FQWK(1,4)*WORK(I-7)
         RD1(2,I)= RD1(2,I)+FQWK(2,4)*WORK(I-7)
         RD1(3,I)= RD1(3,I)+FQWK(3,4)*WORK(I-7)
  125 CONTINUE
      DO 130 I=17,20
         RD1(1,I)= RD1(1,I)+FQWK(1,5)*WORK(I-11)
         RD1(2,I)= RD1(2,I)+FQWK(2,5)*WORK(I-11)
         RD1(3,I)= RD1(3,I)+FQWK(3,5)*WORK(I-11)
  130 CONTINUE
      DO 135 I=21,25
         RD1(1,I)= RD1(1,I)+FQWK(1,6)*WORK(I-20)
         RD1(2,I)= RD1(2,I)+FQWK(2,6)*WORK(I-20)
         RD1(3,I)= RD1(3,I)+FQWK(3,6)*WORK(I-20)
  135 CONTINUE
      DO 140 I=26,30
         RD1(1,I)= RD1(1,I)+FQWK(1,7)*WORK(I-25)
         RD1(2,I)= RD1(2,I)+FQWK(2,7)*WORK(I-25)
         RD1(3,I)= RD1(3,I)+FQWK(3,7)*WORK(I-25)
  140 CONTINUE
      DO 145 I=31,35
         RD1(1,I)= RD1(1,I)+FQWK(1,8)*WORK(I-30)
         RD1(2,I)= RD1(2,I)+FQWK(2,8)*WORK(I-30)
         RD1(3,I)= RD1(3,I)+FQWK(3,8)*WORK(I-30)
  145 CONTINUE
      DO 150 I=36,40
         RD1(1,I)= RD1(1,I)+FQWK(1,9)*WORK(I-35)
         RD1(2,I)= RD1(2,I)+FQWK(2,9)*WORK(I-35)
         RD1(3,I)= RD1(3,I)+FQWK(3,9)*WORK(I-35)
  150 CONTINUE
C
      DO 205 I=1,10
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  205 CONTINUE
      DO 210 I=1,3
         FQD2(I,12)= FQD2(I,8)*RAB+FQD2(I,10)
         FQD2(I,13)= FQD2(I,5)*RAB+FQD2(I,7)
  210 CONTINUE
      DO 215 I=12,13
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  215 CONTINUE
      DO 220 I=1,4
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  220 CONTINUE
      DO 225 I=5,8
         DO 225 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+5)
  225 CONTINUE
      DO 230 I=9,12
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I+1)
  230 CONTINUE
      DO 235 I=13,16
         DO 235 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I-3)
  235 CONTINUE
      DO 240 I=17,20
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,5)*WORK(I-7)
  240 CONTINUE
      DO 245 I=21,24
         DO 245 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,6)*WORK(I-15)
  245 CONTINUE
      DO 250 I=25,28
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,7)*WORK(I-19)
  250 CONTINUE
      DO 255 I=29,32
         DO 255 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,8)*WORK(I-23)
  255 CONTINUE
      DO 260 I=33,36
         DO 260 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,13)*WORK(I-27)
  260 CONTINUE
      DO 265 I=37,41
         DO 265 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,9)*WORK(I-36)
  265 CONTINUE
      DO 270 I=42,46
         DO 270 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,10)*WORK(I-41)
  270 CONTINUE
      DO 275 I=47,51
         DO 275 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,12)*WORK(I-46)
  275 CONTINUE
C
      DO 305 I=1,4
         FQD3(I,12)= FQD3(I,8)*RAB+FQD3(I,10)
         FQD3(I,13)= FQD3(I,5)*RAB+FQD3(I,7)
  305 CONTINUE
      DO 310 I=1,13
         FQWK( 1,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)      )*ACY
         FQWK( 3,I)=  FQD3(2,I)*AQX2-FQD2(2,I)
         FQWK( 4,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)      )*AQX
         FQWK( 5,I)=  FQD3(2,I)*AQXY
         FQWK( 6,I)=-(FQD3(3,I)     -FQD2(1,I)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I)*ACY2-FQD2(2,I)
         FQWK( 9,I)=-(FQD3(3,I)     -FQD2(1,I)      )*ACY
         FQWK(10,I)=  FQD3(4,I)     -FQD2(2,I)*THREE
  310 CONTINUE
      DO 315 I=1,2
         DO 315 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+13)
  315 CONTINUE
      DO 320 I=3,4
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+11)
  320 CONTINUE
      DO 325 I=5,6
         DO 325 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I+9)
  325 CONTINUE
      DO 330 I=7,8
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I+7)
  330 CONTINUE
      DO 335 I=9,10
         DO 335 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,5)*WORK(I+5)
  335 CONTINUE
      DO 340 I=11,14
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,6)*WORK(I-1)
  340 CONTINUE
      DO 345 I=15,18
         DO 345 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,7)*WORK(I-5)
  345 CONTINUE
      DO 350 I=19,22
         DO 350 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,8)*WORK(I-9)
  350 CONTINUE
      DO 355 I=23,26
         DO 355 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,13)*WORK(I-13)
  355 CONTINUE
      DO 360 I=27,30
         DO 360 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,9)*WORK(I-21)
  360 CONTINUE
      DO 365 I=31,34
         DO 365 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,10)*WORK(I-25)
  365 CONTINUE
      DO 370 I=35,38
         DO 370 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,12)*WORK(I-29)
  370 CONTINUE
      DO 375 I=39,43
         DO 375 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,11)*WORK(I-38)
  375 CONTINUE
C
      AQX4= AQX2*AQX2
      AQX6= AQX4*AQX2
      ACY4= ACY2*ACY2
      ACY6= ACY4*ACY2
      X2Y2= AQX2*ACY2
      X4Y2= X2Y2*AQX2
      X2Y4= X2Y2*ACY2
      DO 405 I=1,5
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*XMD8X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2
     *                        -FQD3(1,I)*ACY2+FQD2(1,I))*XMD8
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I)      )*XMD8Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I)*AQX2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I)      )*XMD8X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I)      )*XMD8XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*XMD8Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I)*ACY2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)     -FQD3(3,I)*SIX
     *                        +FQD2(1,I)*THREE)*XMD8
  405 CONTINUE
      DO 410 I=1,5
         FQD4(I,5)= FQD4(I,5)*RAB+FQD4(I,7)
         FQD4(I,12)= FQD4(I,8)*RAB+FQD4(I,10)
  410 CONTINUE
      FQD3(1,5)= FQD3(1,13)
      FQD3(2,5)= FQD3(2,13)
      FQD3(3,5)= FQD3(3,13)
      FQD2(1,5)= FQD2(1,13)
      DO 415 I=5,12
         FQWK( 1,I)=  FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *               +FQD2(1,I)*THREE
         FQWK( 2,I)= (FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*AQXY
         FQWK( 3,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*AQX
         FQWK( 4,I)=  FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2-FQD3(1,I)*ACY2
     *               +FQD2(1,I)
         FQWK( 5,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)      )*ACY
         FQWK( 6,I)=  FQD4(3,I)*AQX2-FQD3(1,I)*AQX2-FQD3(3,I)
     *               +FQD2(1,I)
         FQWK( 7,I)= (FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*AQXY
         FQWK( 8,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)      )*AQX
         FQWK( 9,I)= (FQD4(3,I)     -FQD3(1,I)      )*AQXY
         FQWK(10,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*AQX
         FQWK(11,I)=  FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *               +FQD2(1,I)*THREE
         FQWK(12,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*ACY
         FQWK(13,I)=  FQD4(3,I)*ACY2-FQD3(1,I)*ACY2-FQD3(3,I)
     *               +FQD2(1,I)
         FQWK(14,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*ACY
         FQWK(15,I)=  FQD4(5,I)     -FQD3(3,I)*SIX+FQD2(1,I)*THREE
  415 CONTINUE
      DO 420 I=6,7
         DO 420 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,5)*WORK(I+8)
  420 CONTINUE
      DO 425 I=8,9
         DO 425 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,6)*WORK(I+6)
  425 CONTINUE
      DO 430 I=10,11
         DO 430 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,7)*WORK(I+4)
  430 CONTINUE
      DO 435 I=12,13
         DO 435 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,8)*WORK(I+2)
  435 CONTINUE
      DO 440 I=14,17
         DO 440 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,9)*WORK(I-4)
  440 CONTINUE
      DO 445 I=18,21
         DO 445 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,10)*WORK(I-8)
  445 CONTINUE
      DO 450 I=22,25
         DO 450 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,12)*WORK(I-12)
  450 CONTINUE
      DO 455 I=26,29
         DO 455 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,11)*WORK(I-20)
  455 CONTINUE
C
      DO 510 I=1,6
         FQD5(I,1)= FQD5(I,1)*RAB+FQD5(I,3)
  510 CONTINUE
      DO 520 I=1,4
        RD5( 1,I)= RD5( 1,I)+(FQD5(1,I)*AQX4-FQD4(1,I+4)*AQX2*TEN
     *                       +FQD3(1,I+4)*FIFT)*XMD8X
        RD5( 2,I)= RD5( 2,I)+(FQD5(1,I)*AQX4-FQD4(1,I+4)*AQX2*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8Y
        RD5( 3,I)= RD5( 3,I)+(FQD5(2,I)*AQX4-FQD4(2,I+4)*AQX2*SIX
     *                       +FQD3(2,I+4)*THREE)*XMD8
        RD5( 4,I)= RD5( 4,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+4)*ACY2*THREE
     *                       -FQD4(1,I+4)*AQX2+FQD3(1,I+4)*THREE)*XMD8X
        RD5( 5,I)= RD5( 5,I)+(FQD5(2,I)*AQX2-FQD4(2,I+4)*THREE)*XMD8XY
        RD5( 6,I)= RD5( 6,I)+(FQD5(3,I)*AQX2-FQD4(1,I+4)*AQX2
     *                       -FQD4(3,I+4)*THREE+FQD3(1,I+4)*THREE)*XMD8X
        RD5( 7,I)= RD5( 7,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+4)*AQX2*THREE
     *                       -FQD4(1,I+4)*ACY2+FQD3(1,I+4)*THREE)*XMD8Y
        RD5( 8,I)= RD5( 8,I)+(FQD5(2,I)*X2Y2-FQD4(2,I+4)*AQX2
     *                       -FQD4(2,I+4)*ACY2+FQD3(2,I+4))*XMD8
        RD5( 9,I)= RD5( 9,I)+(FQD5(3,I)*AQX2-FQD4(1,I+4)*AQX2
     *                       -FQD4(3,I+4)+FQD3(1,I+4))*XMD8Y
        RD5(10,I)= RD5(10,I)+(FQD5(4,I)*AQX2-FQD4(2,I+4)*AQX2*THREE
     *                       -FQD4(4,I+4)+FQD3(2,I+4)*THREE)*XMD8
        RD5(11,I)= RD5(11,I)+(FQD5(1,I)*ACY4-FQD4(1,I+4)*ACY2*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8X
        RD5(12,I)= RD5(12,I)+(FQD5(2,I)*ACY2-FQD4(2,I+4)*THREE)*XMD8XY
        RD5(13,I)= RD5(13,I)+(FQD5(3,I)*ACY2-FQD4(1,I+4)*ACY2
     *                       -FQD4(3,I+4)+FQD3(1,I+4))*XMD8X
        RD5(14,I)= RD5(14,I)+(FQD5(4,I)-FQD4(2,I+4)*THREE)*XMD8XY
        RD5(15,I)= RD5(15,I)+(FQD5(5,I)-FQD4(3,I+4)*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8X
        RD5(16,I)= RD5(16,I)+(FQD5(1,I)*ACY4-FQD4(1,I+4)*ACY2*TEN
     *                       +FQD3(1,I+4)*FIFT)*XMD8Y
        RD5(17,I)= RD5(17,I)+(FQD5(2,I)*ACY4-FQD4(2,I+4)*ACY2*SIX
     *                       +FQD3(2,I+4)*THREE)*XMD8
        RD5(18,I)= RD5(18,I)+(FQD5(3,I)*ACY2-FQD4(1,I+4)*ACY2
     *                       -FQD4(3,I+4)*THREE+FQD3(1,I+4)*THREE)*XMD8Y
        RD5(19,I)= RD5(19,I)+(FQD5(4,I)*ACY2-FQD4(2,I+4)*ACY2*THREE
     *                       -FQD4(4,I+4)+FQD3(2,I+4)*THREE)*XMD8
        RD5(20,I)= RD5(20,I)+(FQD5(5,I)-FQD4(3,I+4)*SIX
     *                       +FQD3(1,I+4)*THREE)*XMD8Y
        RD5(21,I)= RD5(21,I)+(FQD5(6,I)-FQD4(4,I+4)*TEN
     *                       +FQD3(2,I+4)*FIFT)*XMD8
  520 CONTINUE
      DO 530 I=1,6
         FQD5(I,4)= FQD5(I,4)*RAB+FQD5(I,6)
  530 CONTINUE
      FQD4(1,8)= FQD4(1,12)
      FQD4(2,8)= FQD4(2,12)
      FQD4(3,8)= FQD4(3,12)
      FQD4(4,8)= FQD4(4,12)
      FQD3(1,8)= FQD3(1,12)
      FQD3(2,8)= FQD3(2,12)
C
      DO 540 I=4,7
         FQWK( 1,I)=-(FQD5(1,I)*AQX4-FQD4(1,I+4)*AQX2*TEN
     *               +FQD3(1,I+4)*FIFT)*AQX
         FQWK( 2,I)=-(FQD5(1,I)*AQX4-FQD4(1,I+4)*AQX2*SIX
     *               +FQD3(1,I+4)*THREE)*ACY
         FQWK( 3,I)=  FQD5(2,I)*AQX4-FQD4(2,I+4)*AQX2*SIX
     *               +FQD3(2,I+4)*THREE
         FQWK( 4,I)=-(FQD5(1,I)*X2Y2-FQD4(1,I+4)*AQX2
     *               -FQD4(1,I+4)*ACY2*THREE+FQD3(1,I+4)*THREE)*AQX
         FQWK( 5,I)= (FQD5(2,I)*AQX2-FQD4(2,I+4)*THREE)*AQXY
         FQWK( 6,I)=-(FQD5(3,I)*AQX2-FQD4(1,I+4)*AQX2-FQD4(3,I+4)*THREE
     *               +FQD3(1,I+4)*THREE)*AQX
         FQWK( 7,I)=-(FQD5(1,I)*X2Y2-FQD4(1,I+4)*AQX2*THREE
     *               -FQD4(1,I+4)*ACY2+FQD3(1,I+4)*THREE)*ACY
         FQWK( 8,I)=  FQD5(2,I)*X2Y2-FQD4(2,I+4)*AQX2-FQD4(2,I+4)*ACY2
     *               +FQD3(2,I+4)
         FQWK( 9,I)=-(FQD5(3,I)*AQX2-FQD4(1,I+4)*AQX2-FQD4(3,I+4)
     *               +FQD3(1,I+4))*ACY
         FQWK(10,I)=  FQD5(4,I)*AQX2-FQD4(2,I+4)*AQX2*THREE-FQD4(4,I+4)
     *               +FQD3(2,I+4)*THREE
         FQWK(11,I)=-(FQD5(1,I)*ACY4-FQD4(1,I+4)*ACY2*SIX
     *               +FQD3(1,I+4)*THREE)*AQX
         FQWK(12,I)= (FQD5(2,I)*ACY2-FQD4(2,I+4)*THREE)*AQXY
         FQWK(13,I)=-(FQD5(3,I)*ACY2-FQD4(1,I+4)*ACY2-FQD4(3,I+4)
     *               +FQD3(1,I+4))*AQX
         FQWK(14,I)= (FQD5(4,I)     -FQD4(2,I+4)*THREE)*AQXY
         FQWK(15,I)=-(FQD5(5,I)     -FQD4(3,I+4)*SIX
     *               +FQD3(1,I+4)*THREE)*AQX
         FQWK(16,I)=-(FQD5(1,I)*ACY4-FQD4(1,I+4)*ACY2*TEN
     *               +FQD3(1,I+4)*FIFT)*ACY
         FQWK(17,I)=  FQD5(2,I)*ACY4-FQD4(2,I+4)*ACY2*SIX
     *               +FQD3(2,I+4)*THREE
         FQWK(18,I)=-(FQD5(3,I)*ACY2-FQD4(1,I+4)*ACY2-FQD4(3,I+4)*THREE
     *               +FQD3(1,I+4)*THREE)*ACY
         FQWK(19,I)=  FQD5(4,I)*ACY2-FQD4(2,I+4)*ACY2*THREE-FQD4(4,I+4)
     *               +FQD3(2,I+4)*THREE
         FQWK(20,I)=-(FQD5(5,I)-FQD4(3,I+4)*SIX+FQD3(1,I+4)*THREE)*ACY
         FQWK(21,I)=  FQD5(6,I)-FQD4(4,I+4)*TEN+FQD3(2,I+4)*FIFT
  540 CONTINUE
      DO 550 I=5,6
         DO 550 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,5)*WORK(I+9)
  550 CONTINUE
      DO 560 I=7,8
         DO 560 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,6)*WORK(I+7)
  560 CONTINUE
      DO 570 I=9,10
         DO 570 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,4)*WORK(I+5)
  570 CONTINUE
      DO 580 I=11,14
         DO 580 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,7)*WORK(I-1)
  580 CONTINUE
C
      DO 610 I=1,7
         FQD6(I,1)=FQD6(I,1)*RAB+FQD6(I,3)
  610 CONTINUE
      DO 620 I=1,3
         RD6( 1,I)= RD6( 1,I)+(FQD6(1,I)*AQX6-FQD5(1,I+3)*AQX4*FIFT
     *             +FQD4(1,I+7)*AQX2*FORF-FQD3(1,I+7)*FIFT)*XMD8
         RD6( 2,I)= RD6( 2,I)+(FQD6(1,I)*AQX4-FQD5(1,I+3)*AQX2*TEN
     *             +FQD4(1,I+7)*FIFT)*XMD8XY
         RD6( 3,I)= RD6( 3,I)+(FQD6(2,I)*AQX4-FQD5(2,I+3)*AQX2*TEN
     *             +FQD4(2,I+7)*FIFT)*XMD8X
         RD6( 4,I)= RD6( 4,I)+(FQD6(1,I)*X4Y2-FQD5(1,I+3)*AQX4
     *             -FQD5(1,I+3)*X2Y2*SIX+FQD4(1,I+7)*AQX2*SIX
     *             +FQD4(1,I+7)*ACY2*THREE-FQD3(1,I+7)*THREE)*XMD8
         RD6( 5,I)= RD6( 5,I)+(FQD6(2,I)*AQX4-FQD5(2,I+3)*AQX2*SIX
     *             +FQD4(2,I+7)*THREE)*XMD8Y
         RD6( 6,I)= RD6( 6,I)+(FQD6(3,I)*AQX4-FQD5(1,I+3)*AQX4
     *             -FQD5(3,I+3)*AQX2*SIX+FQD4(1,I+7)*AQX2*SIX
     *             +FQD4(3,I+7)*THREE-FQD3(1,I+7)*THREE)*XMD8
         RD6( 7,I)= RD6( 7,I)+(FQD6(1,I)*X2Y2-FQD5(1,I+3)*AQX2*THREE
     *             -FQD5(1,I+3)*ACY2*THREE+FQD4(1,I+7)*NINE)*XMD8XY
         RD6( 8,I)= RD6( 8,I)+(FQD6(2,I)*X2Y2-FQD5(2,I+3)*AQX2
     *             -FQD5(2,I+3)*ACY2*THREE+FQD4(2,I+7)*THREE)*XMD8X
         RD6( 9,I)= RD6( 9,I)+(FQD6(3,I)*AQX2-FQD5(1,I+3)*AQX2
     *             -FQD5(3,I+3)*THREE+FQD4(1,I+7)*THREE)*XMD8XY
         RD6(10,I)= RD6(10,I)+(FQD6(4,I)*AQX2-FQD5(2,I+3)*AQX2*THREE
     *             -FQD5(4,I+3)*THREE+FQD4(2,I+7)*NINE)*XMD8X
         RD6(11,I)= RD6(11,I)+(FQD6(1,I)*X2Y4-FQD5(1,I+3)*X2Y2*SIX
     *             -FQD5(1,I+3)*ACY4+FQD4(1,I+7)*AQX2*THREE
     *             +FQD4(1,I+7)*ACY2*SIX-FQD3(1,I+7)*THREE)*XMD8
         RD6(12,I)= RD6(12,I)+(FQD6(2,I)*X2Y2-FQD5(2,I+3)*AQX2*THREE
     *             -FQD5(2,I+3)*ACY2+FQD4(2,I+7)*THREE)*XMD8Y
         RD6(13,I)= RD6(13,I)+(FQD6(3,I)*X2Y2-FQD5(1,I+3)*X2Y2
     *             -FQD5(3,I+3)*AQX2-FQD5(3,I+3)*ACY2+FQD4(1,I+7)*AQX2
     *             +FQD4(1,I+7)*ACY2+FQD4(3,I+7)-FQD3(1,I+7))*XMD8
         RD6(14,I)= RD6(14,I)+(FQD6(4,I)*AQX2-FQD5(2,I+3)*AQX2*THREE
     *             -FQD5(4,I+3)+FQD4(2,I+7)*THREE)*XMD8Y
         RD6(15,I)= RD6(15,I)+(FQD6(5,I)*AQX2-FQD5(3,I+3)*AQX2*SIX
     *             -FQD5(5,I+3)+FQD4(1,I+7)*AQX2*THREE+FQD4(3,I+7)*SIX
     *             -FQD3(1,I+7)*THREE)*XMD8
         RD6(16,I)= RD6(16,I)+(FQD6(1,I)*ACY4-FQD5(1,I+3)*ACY2*TEN
     *             +FQD4(1,I+7)*FIFT)*XMD8XY
         RD6(17,I)= RD6(17,I)+(FQD6(2,I)*ACY4-FQD5(2,I+3)*ACY2*SIX
     *             +FQD4(2,I+7)*THREE)*XMD8X
         RD6(18,I)= RD6(18,I)+(FQD6(3,I)*ACY2-FQD5(1,I+3)*ACY2
     *             -FQD5(3,I+3)*THREE+FQD4(1,I+7)*THREE)*XMD8XY
         RD6(19,I)= RD6(19,I)+(FQD6(4,I)*ACY2-FQD5(2,I+3)*ACY2*THREE
     *             -FQD5(4,I+3)+FQD4(2,I+7)*THREE)*XMD8X
         RD6(20,I)= RD6(20,I)+(FQD6(5,I)-FQD5(3,I+3)*SIX
     *             +FQD4(1,I+7)*THREE)*XMD8XY
         RD6(21,I)= RD6(21,I)+(FQD6(6,I)-FQD5(4,I+3)*TEN
     *             +FQD4(2,I+7)*FIFT)*XMD8X
         RD6(22,I)= RD6(22,I)+(FQD6(1,I)*ACY6-FQD5(1,I+3)*ACY4*FIFT
     *             +FQD4(1,I+7)*ACY2*FORF-FQD3(1,I+7)*FIFT)*XMD8
         RD6(23,I)= RD6(23,I)+(FQD6(2,I)*ACY4-FQD5(2,I+3)*ACY2*TEN
     *             +FQD4(2,I+7)*FIFT)*XMD8Y
         RD6(24,I)= RD6(24,I)+(FQD6(3,I)*ACY4-FQD5(1,I+3)*ACY4
     *             -FQD5(3,I+3)*ACY2*SIX+FQD4(1,I+7)*ACY2*SIX
     *             +FQD4(3,I+7)*THREE-FQD3(1,I+7)*THREE)*XMD8
         RD6(25,I)= RD6(25,I)+(FQD6(4,I)*ACY2-FQD5(2,I+3)*ACY2*THREE
     *             -FQD5(4,I+3)*THREE+FQD4(2,I+7)*NINE)*XMD8Y
         RD6(26,I)= RD6(26,I)+(FQD6(5,I)*ACY2-FQD5(3,I+3)*ACY2*SIX
     *             -FQD5(5,I+3)+FQD4(1,I+7)*ACY2*THREE
     *             +FQD4(3,I+7)*SIX-FQD3(1,I+7)*THREE)*XMD8
         RD6(27,I)= RD6(27,I)+(FQD6(6,I)-FQD5(4,I+3)*TEN
     *             +FQD4(2,I+7)*FIFT)*XMD8Y
         RD6(28,I)= RD6(28,I)+(FQD6(7,I)-FQD5(5,I+3)*FIFT
     *             +FQD4(3,I+7)*FORF-FQD3(1,I+7)*FIFT)*XMD8
  620 CONTINUE
      FQWK( 1,1)=  FQD6(1,4)*AQX6-FQD5(1,7)*AQX4*FIFT
     *            +FQD4(1,11)*AQX2*FORF-FQD3(1,11)*FIFT
      FQWK( 2,1)= (FQD6(1,4)*AQX4-FQD5(1,7)*AQX2*TEN
     *            +FQD4(1,11)*FIFT)*AQXY
      FQWK( 3,1)=-(FQD6(2,4)*AQX4-FQD5(2,7)*AQX2*TEN
     *            +FQD4(2,11)*FIFT)*AQX
      FQWK( 4,1)=  FQD6(1,4)*X4Y2-FQD5(1,7)*AQX4-FQD5(1,7)*X2Y2*SIX
     *            +FQD4(1,11)*AQX2*SIX+FQD4(1,11)*ACY2*THREE
     *            -FQD3(1,11)*THREE
      FQWK( 5,1)=-(FQD6(2,4)*AQX4-FQD5(2,7)*AQX2*SIX
     *            +FQD4(2,11)*THREE)*ACY
      FQWK( 6,1)=  FQD6(3,4)*AQX4-FQD5(1,7)*AQX4-FQD5(3,7)*AQX2*SIX
     *            +FQD4(1,11)*AQX2*SIX+FQD4(3,11)*THREE-FQD3(1,11)*THREE
      FQWK( 7,1)= (FQD6(1,4)*X2Y2-FQD5(1,7)*AQX2*THREE
     *            -FQD5(1,7)*ACY2*THREE+FQD4(1,11)*NINE)*AQXY
      FQWK( 8,1)=-(FQD6(2,4)*X2Y2-FQD5(2,7)*AQX2
     *            -FQD5(2,7)*ACY2*THREE+FQD4(2,11)*THREE)*AQX
      FQWK( 9,1)= (FQD6(3,4)*AQX2-FQD5(1,7)*AQX2-FQD5(3,7)*THREE
     *            +FQD4(1,11)*THREE)*AQXY
      FQWK(10,1)=-(FQD6(4,4)*AQX2-FQD5(2,7)*AQX2*THREE
     *            -FQD5(4,7)*THREE+FQD4(2,11)*NINE)*AQX
      FQWK(11,1)=  FQD6(1,4)*X2Y4-FQD5(1,7)*X2Y2*SIX-FQD5(1,7)*ACY4
     *            +FQD4(1,11)*AQX2*THREE+FQD4(1,11)*ACY2*SIX
     *            -FQD3(1,11)*THREE
      FQWK(12,1)=-(FQD6(2,4)*X2Y2-FQD5(2,7)*AQX2*THREE
     *            -FQD5(2,7)*ACY2+FQD4(2,11)*THREE)*ACY
      FQWK(13,1)=  FQD6(3,4)*X2Y2-FQD5(1,7)*X2Y2-FQD5(3,7)*AQX2
     *            -FQD5(3,7)*ACY2+FQD4(1,11)*AQX2+FQD4(1,11)*ACY2
     *            +FQD4(3,11)-FQD3(1,11)
      FQWK(14,1)=-(FQD6(4,4)*AQX2-FQD5(2,7)*AQX2*THREE-FQD5(4,7)
     *            +FQD4(2,11)*THREE)*ACY
      FQWK(15,1)=  FQD6(5,4)*AQX2-FQD5(3,7)*AQX2*SIX-FQD5(5,7)
     *            +FQD4(1,11)*AQX2*THREE+FQD4(3,11)*SIX-FQD3(1,11)*THREE
      FQWK(16,1)= (FQD6(1,4)*ACY4-FQD5(1,7)*ACY2*TEN
     *            +FQD4(1,11)*FIFT)*AQXY
      FQWK(17,1)=-(FQD6(2,4)*ACY4-FQD5(2,7)*ACY2*SIX
     *            +FQD4(2,11)*THREE)*AQX
      FQWK(18,1)= (FQD6(3,4)*ACY2-FQD5(1,7)*ACY2-FQD5(3,7)*THREE
     *            +FQD4(1,11)*THREE)*AQXY
      FQWK(19,1)=-(FQD6(4,4)*ACY2-FQD5(2,7)*ACY2*THREE-FQD5(4,7)
     *            +FQD4(2,11)*THREE)*AQX
      FQWK(20,1)= (FQD6(5,4)-FQD5(3,7)*SIX+FQD4(1,11)*THREE)*AQXY
      FQWK(21,1)=-(FQD6(6,4)-FQD5(4,7)*TEN+FQD4(2,11)*FIFT)*AQX
      FQWK(22,1)=  FQD6(1,4)*ACY6-FQD5(1,7)*ACY4*FIFT
     *            +FQD4(1,11)*ACY2*FORF-FQD3(1,11)*FIFT
      FQWK(23,1)=-(FQD6(2,4)*ACY4-FQD5(2,7)*ACY2*TEN
     *            +FQD4(2,11)*FIFT)*ACY
      FQWK(24,1)=  FQD6(3,4)*ACY4-FQD5(1,7)*ACY4-FQD5(3,7)*ACY2*SIX
     *            +FQD4(1,11)*ACY2*SIX+FQD4(3,11)*THREE-FQD3(1,11)*THREE
      FQWK(25,1)=-(FQD6(4,4)*ACY2-FQD5(2,7)*ACY2*THREE
     *            -FQD5(4,7)*THREE+FQD4(2,11)*NINE)*ACY
      FQWK(26,1)=  FQD6(5,4)*ACY2-FQD5(3,7)*ACY2*SIX-FQD5(5,7)
     *            +FQD4(1,11)*ACY2*THREE+FQD4(3,11)*SIX-FQD3(1,11)*THREE
      FQWK(27,1)=-(FQD6(6,4)-FQD5(4,7)*TEN+FQD4(2,11)*FIFT)*ACY
      FQWK(28,1)=  FQD6(7,4)-FQD5(5,7)*FIFT+FQD4(3,11)*FORF
     *            -FQD3(1,11)*FIFT
      DO 630 I=4,5
         DO 630 J=1,28
            RD6(J,I)= RD6(J,I)+FQWK(J,1)*WORK(I+10)
  630 CONTINUE
C
      RD7( 1)= RD7( 1)+(FQD7(1)*AQX6-FQD6(1,4)*AQX4*TWONE
     *        +FQD5(1,7)*AQX2*ONEOF-FQD4(1,11)*ONEOF)*XMD8X
      RD7( 2)= RD7( 2)+(FQD7(1)*AQX6-FQD6(1,4)*AQX4*FIFT
     *        +FQD5(1,7)*AQX2*FORF-FQD4(1,11)*FIFT)*XMD8Y
      RD7( 3)= RD7( 3)+(FQD7(2)*AQX6-FQD6(2,4)*AQX4*FIFT
     *        +FQD5(2,7)*AQX2*FORF-FQD4(2,11)*FIFT)*XMD8
      RD7( 4)= RD7( 4)+(FQD7(1)*X4Y2-FQD6(1,4)*AQX4-FQD6(1,4)*X2Y2*TEN
     *        +FQD5(1,7)*AQX2*TEN+FQD5(1,7)*ACY2*FIFT
     *        -FQD4(1,11)*FIFT)*XMD8X
      RD7( 5)= RD7( 5)+(FQD7(2)*AQX4-FQD6(2,4)*AQX2*TEN
     *        +FQD5(2,7)*FIFT)*XMD8XY
      RD7( 6)= RD7( 6)+(FQD7(3)*AQX4-FQD6(1,4)*AQX4-FQD6(3,4)*AQX2*TEN
     *        +FQD5(1,7)*AQX2*TEN+FQD5(3,7)*FIFT
     *        -FQD4(1,11)*FIFT)*XMD8X
      RD7( 7)= RD7( 7)+(FQD7(1)*X4Y2-FQD6(1,4)*AQX4*THREE
     *        -FQD6(1,4)*X2Y2*SIX+FQD5(1,7)*AQX2*EITEN
     *        +FQD5(1,7)*ACY2*THREE-FQD4(1,11)*NINE)*XMD8Y
      RD7( 8)= RD7( 8)+(FQD7(2)*X4Y2-FQD6(2,4)*AQX4-FQD6(2,4)*X2Y2*SIX
     *        +FQD5(2,7)*AQX2*SIX+FQD5(2,7)*ACY2*THREE
     *        -FQD4(2,11)*THREE)*XMD8
      RD7( 9)= RD7( 9)+(FQD7(3)*AQX4-FQD6(1,4)*AQX4-FQD6(3,4)*AQX2*SIX
     *        +FQD5(1,7)*AQX2*SIX+FQD5(3,7)*THREE
     *        -FQD4(1,11)*THREE)*XMD8Y
      RD7(10)= RD7(10)+(FQD7(4)*AQX4-FQD6(2,4)*AQX4*THREE
     *        -FQD6(4,4)*AQX2*SIX+FQD5(2,7)*AQX2*EITEN
     *        +FQD5(4,7)*THREE-FQD4(2,11)*NINE)*XMD8
      RD7(11)= RD7(11)+(FQD7(1)*X2Y4-FQD6(1,4)*X2Y2*SIX
     *        -FQD6(1,4)*ACY4*THREE+FQD5(1,7)*AQX2*THREE
     *        +FQD5(1,7)*ACY2*EITEN-FQD4(1,11)*NINE)*XMD8X
      RD7(12)= RD7(12)+(FQD7(2)*X2Y2-FQD6(2,4)*AQX2*THREE
     *        -FQD6(2,4)*ACY2*THREE+FQD5(2,7)*NINE)*XMD8XY
      RD7(13)= RD7(13)+(FQD7(3)*X2Y2-FQD6(1,4)*X2Y2-FQD6(3,4)*AQX2
     *        -FQD6(3,4)*ACY2*THREE+FQD5(1,7)*AQX2+FQD5(1,7)*ACY2*THREE
     *        +FQD5(3,7)*THREE-FQD4(1,11)*THREE)*XMD8X
      RD7(14)= RD7(14)+(FQD7(4)*AQX2-FQD6(2,4)*AQX2*THREE
     *        -FQD6(4,4)*THREE+FQD5(2,7)*NINE)*XMD8XY
      RD7(15)= RD7(15)+(FQD7(5)*AQX2-FQD6(3,4)*AQX2*SIX-FQD6(5,4)*THREE
     *        +FQD5(1,7)*AQX2*THREE+FQD5(3,7)*EITEN
     *        -FQD4(1,11)*NINE)*XMD8X
      RD7(16)= RD7(16)+(FQD7(1)*X2Y4-FQD6(1,4)*X2Y2*TEN-FQD6(1,4)*ACY4
     *        +FQD5(1,7)*AQX2*FIFT+FQD5(1,7)*ACY2*TEN
     *        -FQD4(1,11)*FIFT)*XMD8Y
      RD7(17)= RD7(17)+(FQD7(2)*X2Y4-FQD6(2,4)*X2Y2*SIX-FQD6(2,4)*ACY4
     *        +FQD5(2,7)*AQX2*THREE+FQD5(2,7)*ACY2*SIX
     *        -FQD4(2,11)*THREE)*XMD8
      RD7(18)= RD7(18)+(FQD7(3)*X2Y2-FQD6(1,4)*X2Y2-FQD6(3,4)*AQX2*THREE
     *        -FQD6(3,4)*ACY2+FQD5(1,7)*AQX2*THREE+FQD5(1,7)*ACY2
     *        +FQD5(3,7)*THREE-FQD4(1,11)*THREE)*XMD8Y
      RD7(19)= RD7(19)+(FQD7(4)*X2Y2-FQD6(2,4)*X2Y2*THREE-FQD6(4,4)*AQX2
     *        -FQD6(4,4)*ACY2+FQD5(2,7)*AQX2*THREE+FQD5(2,7)*ACY2*THREE
     *        +FQD5(4,7)-FQD4(2,11)*THREE)*XMD8
      RD7(20)= RD7(20)+(FQD7(5)*AQX2-FQD6(3,4)*AQX2*SIX-FQD6(5,4)
     *        +FQD5(1,7)*AQX2*THREE+FQD5(3,7)*SIX
     *        -FQD4(1,11)*THREE)*XMD8Y
      RD7(21)= RD7(21)+(FQD7(6)*AQX2-FQD6(4,4)*AQX2*TEN-FQD6(6,4)
     *        +FQD5(2,7)*AQX2*FIFT+FQD5(4,7)*TEN
     *        -FQD4(2,11)*FIFT)*XMD8
      RD7(22)= RD7(22)+(FQD7(1)*ACY6-FQD6(1,4)*ACY4*FIFT
     *        +FQD5(1,7)*ACY2*FORF-FQD4(1,11)*FIFT)*XMD8X
      RD7(23)= RD7(23)+(FQD7(2)*ACY4-FQD6(2,4)*ACY2*TEN
     *        +FQD5(2,7)*FIFT)*XMD8XY
      RD7(24)= RD7(24)+(FQD7(3)*ACY4-FQD6(1,4)*ACY4-FQD6(3,4)*ACY2*SIX
     *        +FQD5(1,7)*ACY2*SIX+FQD5(3,7)*THREE
     *        -FQD4(1,11)*THREE)*XMD8X
      RD7(25)= RD7(25)+(FQD7(4)*ACY2-FQD6(2,4)*ACY2*THREE
     *        -FQD6(4,4)*THREE+FQD5(2,7)*NINE)*XMD8XY
      RD7(26)= RD7(26)+(FQD7(5)*ACY2-FQD6(3,4)*ACY2*SIX-FQD6(5,4)
     *        +FQD5(1,7)*ACY2*THREE+FQD5(3,7)*SIX
     *        -FQD4(1,11)*THREE)*XMD8X
      RD7(27)= RD7(27)+(FQD7(6)-FQD6(4,4)*TEN+FQD5(2,7)*FIFT)*XMD8XY
      RD7(28)= RD7(28)+(FQD7(7)-FQD6(5,4)*FIFT+FQD5(3,7)*FORF
     *        -FQD4(1,11)*FIFT)*XMD8X
      RD7(29)= RD7(29)+(FQD7(1)*ACY6-FQD6(1,4)*ACY4*TWONE
     *        +FQD5(1,7)*ACY2*ONEOF-FQD4(1,11)*ONEOF)*XMD8Y
      RD7(30)= RD7(30)+(FQD7(2)*ACY6-FQD6(2,4)*ACY4*FIFT
     *        +FQD5(2,7)*ACY2*FORF-FQD4(2,11)*FIFT)*XMD8
      RD7(31)= RD7(31)+(FQD7(3)*ACY4-FQD6(1,4)*ACY4-FQD6(3,4)*ACY2*TEN
     *        +FQD5(1,7)*ACY2*TEN+FQD5(3,7)*FIFT-FQD4(1,11)*FIFT)*XMD8Y
      RD7(32)= RD7(32)+(FQD7(4)*ACY4-FQD6(2,4)*ACY4*THREE
     *        -FQD6(4,4)*ACY2*SIX+FQD5(2,7)*ACY2*EITEN
     *        +FQD5(4,7)*THREE-FQD4(2,11)*NINE)*XMD8
      RD7(33)= RD7(33)+(FQD7(5)*ACY2-FQD6(3,4)*ACY2*SIX-FQD6(5,4)*THREE
     *        +FQD5(1,7)*ACY2*THREE+FQD5(3,7)*EITEN
     *        -FQD4(1,11)*NINE)*XMD8Y
      RD7(34)= RD7(34)+(FQD7(6)*ACY2-FQD6(4,4)*ACY2*TEN-FQD6(6,4)
     *        +FQD5(2,7)*ACY2*FIFT+FQD5(4,7)*TEN
     *        -FQD4(2,11)*FIFT)*XMD8
      RD7(35)= RD7(35)+(FQD7(7)-FQD6(5,4)*FIFT+FQD5(3,7)*FORF
     *        -FQD4(1,11)*FIFT)*XMD8Y
      RD7(36)= RD7(36)+(FQD7(8)-FQD6(6,4)*TWONE+FQD5(4,7)*ONEOF
     *        -FQD4(2,11)*ONEOF)*XMD8
      RETURN
      END
C
C*MODULE INT2R   *DECK INTK21
      SUBROUTINE INTK21
C
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION NINE
C
C GENERATE JTYPE=21 INTEGRALS
C
      PARAMETER (MXGSH=30, MXG2=MXGSH*MXGSH)
C
      PARAMETER (PT5=0.5D+00, THREE=3.0D+00, SIX=6.0D+00, NINE=9.0D+00,
     2           TEN=1.0D+01, FIFT=1.5D+01,
     3           P18=1.8D+01, P21=2.1D+01, P28=2.8D+01,
     4           P30=3.0D+01, P36=3.6D+01, P45=4.5D+01,
     5           P105=1.05D+02, P210=2.1D+02, P420=4.2D+02)
C
      COMMON /GEOMPQ/ R12,RAB,X34,X43,AQZ,QPR,QPS,
     2                TX12(MXG2),TX21(MXG2),TY01(MXG2),TY02(MXG2),
     3                D00P(MXG2),D01P(MXG2),D10P(MXG2),D11P(MXG2),
     4                NGANGB
      COMMON /JMSGYH/ SQ(4)
CISHI
      COMMON /FQ08  / FQD(9),FQD0(5),FQD1(2,13),FQD2(3,16),FQD3(4,16),
     2                FQD4(5,16),FQD5(6,11),FQD6(7,7),FQD7(8,3),FQD8(9)
      COMMON/KI2/ACY,ACY2,AQX,AQX2,AQXY,Y03,Y04
      COMMON/KI4/RD0(5,5),RD1(3,40),RD2(6,56),RD3(10,52),RD4(15,42),
     *           RD5(21,24),RD6(28,12),RD7(36,4),RD8(45)
C
      DIMENSION WORK(15),FQWK(36,16)
C
C
      XMD2= X43*PT5
      XMD4= XMD2*XMD2*SQ(3)
      XMD6= XMD4*XMD2
      XMD8= XMD6*XMD2
      XMD2= XMD2*SQ(3)
      XMD8XY=XMD8*AQXY
      XMD8X=-XMD8*AQX
      XMD8Y=-XMD8*ACY
      Y33 = Y03*Y03
      Y34 =-Y03*Y04
      Y44 = Y04*Y04
      WORK( 1)= XMD4
      WORK( 2)= XMD2*Y33
      WORK( 3)= XMD2*Y34
      WORK( 4)= XMD2*Y44
      WORK( 5)= Y33*Y44*SQ(3)
C
      WORK( 6)=-XMD4*Y03
      WORK( 7)= XMD4*Y04
      WORK( 8)= XMD2*Y33*Y04
      WORK( 9)= XMD2*Y34*Y04
C
      WORK(10)= XMD6
      WORK(11)= XMD4*Y33
      WORK(12)= XMD4*Y34
      WORK(13)= XMD4*Y44
C
      WORK(14)=-XMD6*Y03
      WORK(15)= XMD6*Y04
C
      DO 10 I=1,5
         DO 10 J=1,5
            RD0(J,I)= RD0(J,I)+FQD0(I)*WORK(J)
   10 CONTINUE
C
      DO 105 I=1,9
         FQWK(1,I)=-FQD1(1,I)*AQX
         FQWK(2,I)=-FQD1(1,I)*ACY
         FQWK(3,I)= FQD1(2,I)
  105 CONTINUE
      DO 110 I=1,4
         RD1(1,I)= RD1(1,I)+FQWK(1,1)*WORK(I+5)
         RD1(2,I)= RD1(2,I)+FQWK(2,1)*WORK(I+5)
         RD1(3,I)= RD1(3,I)+FQWK(3,1)*WORK(I+5)
  110 CONTINUE
      DO 115 I=5,8
         RD1(1,I)= RD1(1,I)+FQWK(1,2)*WORK(I+1)
         RD1(2,I)= RD1(2,I)+FQWK(2,2)*WORK(I+1)
         RD1(3,I)= RD1(3,I)+FQWK(3,2)*WORK(I+1)
  115 CONTINUE
      DO 120 I=9,12
         RD1(1,I)= RD1(1,I)+FQWK(1,3)*WORK(I-3)
         RD1(2,I)= RD1(2,I)+FQWK(2,3)*WORK(I-3)
         RD1(3,I)= RD1(3,I)+FQWK(3,3)*WORK(I-3)
  120 CONTINUE
      DO 125 I=13,16
         RD1(1,I)= RD1(1,I)+FQWK(1,4)*WORK(I-7)
         RD1(2,I)= RD1(2,I)+FQWK(2,4)*WORK(I-7)
         RD1(3,I)= RD1(3,I)+FQWK(3,4)*WORK(I-7)
  125 CONTINUE
      DO 130 I=17,20
         RD1(1,I)= RD1(1,I)+FQWK(1,5)*WORK(I-11)
         RD1(2,I)= RD1(2,I)+FQWK(2,5)*WORK(I-11)
         RD1(3,I)= RD1(3,I)+FQWK(3,5)*WORK(I-11)
  130 CONTINUE
      DO 135 I=21,25
         RD1(1,I)= RD1(1,I)+FQWK(1,6)*WORK(I-20)
         RD1(2,I)= RD1(2,I)+FQWK(2,6)*WORK(I-20)
         RD1(3,I)= RD1(3,I)+FQWK(3,6)*WORK(I-20)
  135 CONTINUE
      DO 140 I=26,30
         RD1(1,I)= RD1(1,I)+FQWK(1,7)*WORK(I-25)
         RD1(2,I)= RD1(2,I)+FQWK(2,7)*WORK(I-25)
         RD1(3,I)= RD1(3,I)+FQWK(3,7)*WORK(I-25)
  140 CONTINUE
      DO 145 I=31,35
         RD1(1,I)= RD1(1,I)+FQWK(1,8)*WORK(I-30)
         RD1(2,I)= RD1(2,I)+FQWK(2,8)*WORK(I-30)
         RD1(3,I)= RD1(3,I)+FQWK(3,8)*WORK(I-30)
  145 CONTINUE
      DO 150 I=36,40
         RD1(1,I)= RD1(1,I)+FQWK(1,9)*WORK(I-35)
         RD1(2,I)= RD1(2,I)+FQWK(2,9)*WORK(I-35)
         RD1(3,I)= RD1(3,I)+FQWK(3,9)*WORK(I-35)
  150 CONTINUE
C
      DO 205 I=1,13
         FQWK(1,I)= FQD2(1,I)*AQX2-FQD1(1,I)
         FQWK(2,I)= FQD2(1,I)*ACY2-FQD1(1,I)
         FQWK(3,I)= FQD2(3,I)     -FQD1(1,I)
         FQWK(4,I)= FQD2(1,I)*AQXY
         FQWK(5,I)=-FQD2(2,I)*AQX
         FQWK(6,I)=-FQD2(2,I)*ACY
  205 CONTINUE
      DO 210 I=1,4
         DO 210 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,1)*WORK(I+9)
  210 CONTINUE
      DO 215 I=5,8
         DO 215 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,2)*WORK(I+5)
  215 CONTINUE
      DO 220 I=9,12
         DO 220 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,3)*WORK(I+1)
  220 CONTINUE
      DO 225 I=13,16
         DO 225 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,4)*WORK(I-3)
  225 CONTINUE
      DO 230 I=17,20
         DO 230 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,5)*WORK(I-7)
  230 CONTINUE
      DO 235 I=21,24
         DO 235 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,6)*WORK(I-15)
  235 CONTINUE
      DO 240 I=25,28
         DO 240 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,7)*WORK(I-19)
  240 CONTINUE
      DO 245 I=29,32
         DO 245 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,8)*WORK(I-23)
  245 CONTINUE
      DO 250 I=33,36
         DO 250 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,9)*WORK(I-27)
  250 CONTINUE
      DO 255 I=37,41
         DO 255 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,10)*WORK(I-36)
  255 CONTINUE
      DO 260 I=42,46
         DO 260 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,11)*WORK(I-41)
  260 CONTINUE
      DO 265 I=47,51
         DO 265 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,12)*WORK(I-46)
  265 CONTINUE
      DO 270 I=52,56
         DO 270 J=1,6
            RD2(J,I)= RD2(J,I)+FQWK(J,13)*WORK(I-51)
  270 CONTINUE
C
      DO 305 I=1,15
         FQWK( 1,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)*THREE)*AQX
         FQWK( 2,I)=-(FQD3(1,I)*AQX2-FQD2(1,I)      )*ACY
         FQWK( 3,I)=  FQD3(2,I)*AQX2-FQD2(2,I)
         FQWK( 4,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)      )*AQX
         FQWK( 5,I)=  FQD3(2,I)*AQXY
         FQWK( 6,I)=-(FQD3(3,I)     -FQD2(1,I)      )*AQX
         FQWK( 7,I)=-(FQD3(1,I)*ACY2-FQD2(1,I)*THREE)*ACY
         FQWK( 8,I)=  FQD3(2,I)*ACY2-FQD2(2,I)
         FQWK( 9,I)=-(FQD3(3,I)     -FQD2(1,I)      )*ACY
         FQWK(10,I)=  FQD3(4,I)     -FQD2(2,I)*THREE
  305 CONTINUE
      DO 310 I=1,2
         DO 310 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,1)*WORK(I+13)
  310 CONTINUE
      DO 315 I=3,4
         DO 315 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,2)*WORK(I+11)
  315 CONTINUE
      DO 320 I=5,6
         DO 320 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,3)*WORK(I+9)
  320 CONTINUE
      DO 325 I=7,8
         DO 325 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,4)*WORK(I+7)
  325 CONTINUE
      DO 330 I=9,10
         DO 330 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,5)*WORK(I+5)
  330 CONTINUE
      DO 335 I=11,14
         DO 335 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,6)*WORK(I-1)
  335 CONTINUE
      DO 340 I=15,18
         DO 340 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,7)*WORK(I-5)
  340 CONTINUE
      DO 345 I=19,22
         DO 345 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,8)*WORK(I-9)
  345 CONTINUE
      DO 350 I=23,26
         DO 350 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,9)*WORK(I-13)
  350 CONTINUE
      DO 355 I=27,30
         DO 355 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,10)*WORK(I-21)
  355 CONTINUE
      DO 360 I=31,34
         DO 360 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,11)*WORK(I-25)
  360 CONTINUE
      DO 365 I=35,38
         DO 365 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,12)*WORK(I-29)
  365 CONTINUE
      DO 370 I=39,42
         DO 370 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,13)*WORK(I-33)
  370 CONTINUE
      DO 375 I=43,47
         DO 375 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,14)*WORK(I-42)
  375 CONTINUE
      DO 380 I=48,52
         DO 380 J=1,10
            RD3(J,I)= RD3(J,I)+FQWK(J,15)*WORK(I-47)
  380 CONTINUE
C
      AQX4= AQX2*AQX2
      AQX6= AQX4*AQX2
      AQX8= AQX4*AQX4
      ACY4= ACY2*ACY2
      ACY6= ACY4*ACY2
      ACY8= ACY4*ACY4
      X2Y2= AQX2*ACY2
      X4Y2= X2Y2*AQX2
      X2Y4= X2Y2*ACY2
      X4Y4= AQX4*ACY4
      X6Y2= AQX6*ACY2
      X2Y6= AQX2*ACY6
      DO 405 I=1,5
         RD4( 1,I)= RD4( 1,I)+(FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4( 2,I)= RD4( 2,I)+(FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 3,I)= RD4( 3,I)+(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*XMD8X
         RD4( 4,I)= RD4( 4,I)+(FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2
     *                        -FQD3(1,I)*ACY2+FQD2(1,I))*XMD8
         RD4( 5,I)= RD4( 5,I)+(FQD4(2,I)*AQX2-FQD3(2,I)      )*XMD8Y
         RD4( 6,I)= RD4( 6,I)+(FQD4(3,I)*AQX2-FQD3(1,I)*AQX2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4( 7,I)= RD4( 7,I)+(FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*XMD8XY
         RD4( 8,I)= RD4( 8,I)+(FQD4(2,I)*ACY2-FQD3(2,I)      )*XMD8X
         RD4( 9,I)= RD4( 9,I)+(FQD4(3,I)     -FQD3(1,I)      )*XMD8XY
         RD4(10,I)= RD4(10,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8X
         RD4(11,I)= RD4(11,I)+(FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *                        +FQD2(1,I)*THREE)*XMD8
         RD4(12,I)= RD4(12,I)+(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*XMD8Y
         RD4(13,I)= RD4(13,I)+(FQD4(3,I)*ACY2-FQD3(1,I)*ACY2
     *                        -FQD3(3,I)+FQD2(1,I))*XMD8
         RD4(14,I)= RD4(14,I)+(FQD4(4,I)     -FQD3(2,I)*THREE)*XMD8Y
         RD4(15,I)= RD4(15,I)+(FQD4(5,I)     -FQD3(3,I)*SIX
     *                        +FQD2(1,I)*THREE)*XMD8
  405 CONTINUE
      DO 410 I=6,16
         FQWK( 1,I)=  FQD4(1,I)*AQX4-FQD3(1,I)*SIX*AQX2
     *               +FQD2(1,I)*THREE
         FQWK( 2,I)= (FQD4(1,I)*AQX2-FQD3(1,I)*THREE)*AQXY
         FQWK( 3,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)*THREE)*AQX
         FQWK( 4,I)=  FQD4(1,I)*X2Y2-FQD3(1,I)*AQX2-FQD3(1,I)*ACY2
     *               +FQD2(1,I)
         FQWK( 5,I)=-(FQD4(2,I)*AQX2-FQD3(2,I)      )*ACY
         FQWK( 6,I)=  FQD4(3,I)*AQX2-FQD3(1,I)*AQX2-FQD3(3,I)
     *               +FQD2(1,I)
         FQWK( 7,I)= (FQD4(1,I)*ACY2-FQD3(1,I)*THREE)*AQXY
         FQWK( 8,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)      )*AQX
         FQWK( 9,I)= (FQD4(3,I)     -FQD3(1,I)      )*AQXY
         FQWK(10,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*AQX
         FQWK(11,I)=  FQD4(1,I)*ACY4-FQD3(1,I)*SIX*ACY2
     *               +FQD2(1,I)*THREE
         FQWK(12,I)=-(FQD4(2,I)*ACY2-FQD3(2,I)*THREE)*ACY
         FQWK(13,I)=  FQD4(3,I)*ACY2-FQD3(1,I)*ACY2-FQD3(3,I)
     *               +FQD2(1,I)
         FQWK(14,I)=-(FQD4(4,I)     -FQD3(2,I)*THREE)*ACY
         FQWK(15,I)=  FQD4(5,I)     -FQD3(3,I)*SIX+FQD2(1,I)*THREE
  410 CONTINUE
      DO 415 I=6,7
         DO 415 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,6)*WORK(I+8)
  415 CONTINUE
      DO 420 I=8,9
         DO 420 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,7)*WORK(I+6)
  420 CONTINUE
      DO 425 I=10,11
         DO 425 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,8)*WORK(I+4)
  425 CONTINUE
      DO 430 I=12,13
         DO 430 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,9)*WORK(I+2)
  430 CONTINUE
      DO 435 I=14,17
         DO 435 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,10)*WORK(I-4)
  435 CONTINUE
      DO 440 I=18,21
         DO 440 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,11)*WORK(I-8)
  440 CONTINUE
      DO 445 I=22,25
         DO 445 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,12)*WORK(I-12)
  445 CONTINUE
      DO 450 I=26,29
         DO 450 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,13)*WORK(I-16)
  450 CONTINUE
      DO 455 I=30,33
         DO 455 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,14)*WORK(I-24)
  455 CONTINUE
      DO 460 I=34,37
         DO 460 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,15)*WORK(I-28)
  460 CONTINUE
      DO 465 I=38,42
         DO 465 J=1,15
            RD4(J,I)= RD4(J,I)+FQWK(J,16)*WORK(I-37)
  465 CONTINUE
C
      DO 510 I=1,4
        RD5( 1,I)= RD5( 1,I)+(FQD5(1,I)*AQX4-FQD4(1,I+5)*AQX2*TEN
     *                       +FQD3(1,I+5)*FIFT)*XMD8X
        RD5( 2,I)= RD5( 2,I)+(FQD5(1,I)*AQX4-FQD4(1,I+5)*AQX2*SIX
     *                       +FQD3(1,I+5)*THREE)*XMD8Y
        RD5( 3,I)= RD5( 3,I)+(FQD5(2,I)*AQX4-FQD4(2,I+5)*AQX2*SIX
     *                       +FQD3(2,I+5)*THREE)*XMD8
        RD5( 4,I)= RD5( 4,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+5)*ACY2*THREE
     *                       -FQD4(1,I+5)*AQX2+FQD3(1,I+5)*THREE)*XMD8X
        RD5( 5,I)= RD5( 5,I)+(FQD5(2,I)*AQX2-FQD4(2,I+5)*THREE)*XMD8XY
        RD5( 6,I)= RD5( 6,I)+(FQD5(3,I)*AQX2-FQD4(1,I+5)*AQX2
     *                       -FQD4(3,I+5)*THREE+FQD3(1,I+5)*THREE)*XMD8X
        RD5( 7,I)= RD5( 7,I)+(FQD5(1,I)*X2Y2-FQD4(1,I+5)*AQX2*THREE
     *                       -FQD4(1,I+5)*ACY2+FQD3(1,I+5)*THREE)*XMD8Y
        RD5( 8,I)= RD5( 8,I)+(FQD5(2,I)*X2Y2-FQD4(2,I+5)*AQX2
     *                       -FQD4(2,I+5)*ACY2+FQD3(2,I+5))*XMD8
        RD5( 9,I)= RD5( 9,I)+(FQD5(3,I)*AQX2-FQD4(1,I+5)*AQX2
     *                       -FQD4(3,I+5)+FQD3(1,I+5))*XMD8Y
        RD5(10,I)= RD5(10,I)+(FQD5(4,I)*AQX2-FQD4(2,I+5)*AQX2*THREE
     *                       -FQD4(4,I+5)+FQD3(2,I+5)*THREE)*XMD8
        RD5(11,I)= RD5(11,I)+(FQD5(1,I)*ACY4-FQD4(1,I+5)*ACY2*SIX
     *                       +FQD3(1,I+5)*THREE)*XMD8X
        RD5(12,I)= RD5(12,I)+(FQD5(2,I)*ACY2-FQD4(2,I+5)*THREE)*XMD8XY
        RD5(13,I)= RD5(13,I)+(FQD5(3,I)*ACY2-FQD4(1,I+5)*ACY2
     *                       -FQD4(3,I+5)+FQD3(1,I+5))*XMD8X
        RD5(14,I)= RD5(14,I)+(FQD5(4,I)-FQD4(2,I+5)*THREE)*XMD8XY
        RD5(15,I)= RD5(15,I)+(FQD5(5,I)-FQD4(3,I+5)*SIX
     *                       +FQD3(1,I+5)*THREE)*XMD8X
        RD5(16,I)= RD5(16,I)+(FQD5(1,I)*ACY4-FQD4(1,I+5)*ACY2*TEN
     *                       +FQD3(1,I+5)*FIFT)*XMD8Y
        RD5(17,I)= RD5(17,I)+(FQD5(2,I)*ACY4-FQD4(2,I+5)*ACY2*SIX
     *                       +FQD3(2,I+5)*THREE)*XMD8
        RD5(18,I)= RD5(18,I)+(FQD5(3,I)*ACY2-FQD4(1,I+5)*ACY2
     *                       -FQD4(3,I+5)*THREE+FQD3(1,I+5)*THREE)*XMD8Y
        RD5(19,I)= RD5(19,I)+(FQD5(4,I)*ACY2-FQD4(2,I+5)*ACY2*THREE
     *                       -FQD4(4,I+5)+FQD3(2,I+5)*THREE)*XMD8
        RD5(20,I)= RD5(20,I)+(FQD5(5,I)-FQD4(3,I+5)*SIX
     *                       +FQD3(1,I+5)*THREE)*XMD8Y
        RD5(21,I)= RD5(21,I)+(FQD5(6,I)-FQD4(4,I+5)*TEN
     *                       +FQD3(2,I+5)*FIFT)*XMD8
  510 CONTINUE
C
      DO 520 I=5,11
         FQWK( 1,I)=-(FQD5(1,I)*AQX4-FQD4(1,I+5)*AQX2*TEN
     *               +FQD3(1,I+5)*FIFT)*AQX
         FQWK( 2,I)=-(FQD5(1,I)*AQX4-FQD4(1,I+5)*AQX2*SIX
     *               +FQD3(1,I+5)*THREE)*ACY
         FQWK( 3,I)=  FQD5(2,I)*AQX4-FQD4(2,I+5)*AQX2*SIX
     *               +FQD3(2,I+5)*THREE
         FQWK( 4,I)=-(FQD5(1,I)*X2Y2-FQD4(1,I+5)*AQX2
     *               -FQD4(1,I+5)*ACY2*THREE+FQD3(1,I+5)*THREE)*AQX
         FQWK( 5,I)= (FQD5(2,I)*AQX2-FQD4(2,I+5)*THREE)*AQXY
         FQWK( 6,I)=-(FQD5(3,I)*AQX2-FQD4(1,I+5)*AQX2-FQD4(3,I+5)*THREE
     *               +FQD3(1,I+5)*THREE)*AQX
         FQWK( 7,I)=-(FQD5(1,I)*X2Y2-FQD4(1,I+5)*AQX2*THREE
     *               -FQD4(1,I+5)*ACY2+FQD3(1,I+5)*THREE)*ACY
         FQWK( 8,I)=  FQD5(2,I)*X2Y2-FQD4(2,I+5)*AQX2-FQD4(2,I+5)*ACY2
     *               +FQD3(2,I+5)
         FQWK( 9,I)=-(FQD5(3,I)*AQX2-FQD4(1,I+5)*AQX2-FQD4(3,I+5)
     *               +FQD3(1,I+5))*ACY
         FQWK(10,I)=  FQD5(4,I)*AQX2-FQD4(2,I+5)*AQX2*THREE-FQD4(4,I+5)
     *               +FQD3(2,I+5)*THREE
         FQWK(11,I)=-(FQD5(1,I)*ACY4-FQD4(1,I+5)*ACY2*SIX
     *               +FQD3(1,I+5)*THREE)*AQX
         FQWK(12,I)= (FQD5(2,I)*ACY2-FQD4(2,I+5)*THREE)*AQXY
         FQWK(13,I)=-(FQD5(3,I)*ACY2-FQD4(1,I+5)*ACY2-FQD4(3,I+5)
     *               +FQD3(1,I+5))*AQX
         FQWK(14,I)= (FQD5(4,I)     -FQD4(2,I+5)*THREE)*AQXY
         FQWK(15,I)=-(FQD5(5,I)     -FQD4(3,I+5)*SIX
     *               +FQD3(1,I+5)*THREE)*AQX
         FQWK(16,I)=-(FQD5(1,I)*ACY4-FQD4(1,I+5)*ACY2*TEN
     *               +FQD3(1,I+5)*FIFT)*ACY
         FQWK(17,I)=  FQD5(2,I)*ACY4-FQD4(2,I+5)*ACY2*SIX
     *               +FQD3(2,I+5)*THREE
         FQWK(18,I)=-(FQD5(3,I)*ACY2-FQD4(1,I+5)*ACY2-FQD4(3,I+5)*THREE
     *               +FQD3(1,I+5)*THREE)*ACY
         FQWK(19,I)=  FQD5(4,I)*ACY2-FQD4(2,I+5)*ACY2*THREE-FQD4(4,I+5)
     *               +FQD3(2,I+5)*THREE
         FQWK(20,I)=-(FQD5(5,I)-FQD4(3,I+5)*SIX+FQD3(1,I+5)*THREE)*ACY
         FQWK(21,I)=  FQD5(6,I)-FQD4(4,I+5)*TEN+FQD3(2,I+5)*FIFT
  520 CONTINUE
      DO 530 I=5,6
         DO 530 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,5)*WORK(I+9)
  530 CONTINUE
      DO 540 I=7,8
         DO 540 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,6)*WORK(I+7)
  540 CONTINUE
      DO 550 I=9,10
         DO 550 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,7)*WORK(I+5)
  550 CONTINUE
      DO 560 I=11,12
         DO 560 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,8)*WORK(I+3)
  560 CONTINUE
      DO 570 I=13,16
         DO 570 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,9)*WORK(I-3)
  570 CONTINUE
      DO 580 I=17,20
         DO 580 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,10)*WORK(I-7)
  580 CONTINUE
      DO 590 I=21,24
         DO 590 J=1,21
            RD5(J,I)= RD5(J,I)+FQWK(J,11)*WORK(I-15)
  590 CONTINUE
C
      DO 610 I=1,4
         RD6( 1,I)= RD6( 1,I)+(FQD6(1,I)*AQX6-FQD5(1,I+4)*AQX4*FIFT
     *             +FQD4(1,I+9)*AQX2*P45-FQD3(1,I+9)*FIFT)*XMD8
         RD6( 2,I)= RD6( 2,I)+(FQD6(1,I)*AQX4-FQD5(1,I+4)*AQX2*TEN
     *             +FQD4(1,I+9)*FIFT)*XMD8XY
         RD6( 3,I)= RD6( 3,I)+(FQD6(2,I)*AQX4-FQD5(2,I+4)*AQX2*TEN
     *             +FQD4(2,I+9)*FIFT)*XMD8X
         RD6( 4,I)= RD6( 4,I)+(FQD6(1,I)*X4Y2-FQD5(1,I+4)*AQX4
     *             -FQD5(1,I+4)*X2Y2*SIX+FQD4(1,I+9)*AQX2*SIX
     *             +FQD4(1,I+9)*ACY2*THREE-FQD3(1,I+9)*THREE)*XMD8
         RD6( 5,I)= RD6( 5,I)+(FQD6(2,I)*AQX4-FQD5(2,I+4)*AQX2*SIX
     *             +FQD4(2,I+9)*THREE)*XMD8Y
         RD6( 6,I)= RD6( 6,I)+(FQD6(3,I)*AQX4-FQD5(1,I+4)*AQX4
     *             -FQD5(3,I+4)*AQX2*SIX+FQD4(1,I+9)*AQX2*SIX
     *             +FQD4(3,I+9)*THREE-FQD3(1,I+9)*THREE)*XMD8
         RD6( 7,I)= RD6( 7,I)+(FQD6(1,I)*X2Y2-FQD5(1,I+4)*AQX2*THREE
     *             -FQD5(1,I+4)*ACY2*THREE+FQD4(1,I+9)*NINE)*XMD8XY
         RD6( 8,I)= RD6( 8,I)+(FQD6(2,I)*X2Y2-FQD5(2,I+4)*AQX2
     *             -FQD5(2,I+4)*ACY2*THREE+FQD4(2,I+9)*THREE)*XMD8X
         RD6( 9,I)= RD6( 9,I)+(FQD6(3,I)*AQX2-FQD5(1,I+4)*AQX2
     *             -FQD5(3,I+4)*THREE+FQD4(1,I+9)*THREE)*XMD8XY
         RD6(10,I)= RD6(10,I)+(FQD6(4,I)*AQX2-FQD5(2,I+4)*AQX2*THREE
     *             -FQD5(4,I+4)*THREE+FQD4(2,I+9)*NINE)*XMD8X
         RD6(11,I)= RD6(11,I)+(FQD6(1,I)*X2Y4-FQD5(1,I+4)*X2Y2*SIX
     *             -FQD5(1,I+4)*ACY4+FQD4(1,I+9)*AQX2*THREE
     *             +FQD4(1,I+9)*ACY2*SIX-FQD3(1,I+9)*THREE)*XMD8
         RD6(12,I)= RD6(12,I)+(FQD6(2,I)*X2Y2-FQD5(2,I+4)*AQX2*THREE
     *             -FQD5(2,I+4)*ACY2+FQD4(2,I+9)*THREE)*XMD8Y
         RD6(13,I)= RD6(13,I)+(FQD6(3,I)*X2Y2-FQD5(1,I+4)*X2Y2
     *             -FQD5(3,I+4)*AQX2-FQD5(3,I+4)*ACY2+FQD4(1,I+9)*AQX2
     *             +FQD4(1,I+9)*ACY2+FQD4(3,I+9)-FQD3(1,I+9))*XMD8
         RD6(14,I)= RD6(14,I)+(FQD6(4,I)*AQX2-FQD5(2,I+4)*AQX2*THREE
     *             -FQD5(4,I+4)+FQD4(2,I+9)*THREE)*XMD8Y
         RD6(15,I)= RD6(15,I)+(FQD6(5,I)*AQX2-FQD5(3,I+4)*AQX2*SIX
     *             -FQD5(5,I+4)+FQD4(1,I+9)*AQX2*THREE+FQD4(3,I+9)*SIX
     *             -FQD3(1,I+9)*THREE)*XMD8
         RD6(16,I)= RD6(16,I)+(FQD6(1,I)*ACY4-FQD5(1,I+4)*ACY2*TEN
     *             +FQD4(1,I+9)*FIFT)*XMD8XY
         RD6(17,I)= RD6(17,I)+(FQD6(2,I)*ACY4-FQD5(2,I+4)*ACY2*SIX
     *             +FQD4(2,I+9)*THREE)*XMD8X
         RD6(18,I)= RD6(18,I)+(FQD6(3,I)*ACY2-FQD5(1,I+4)*ACY2
     *             -FQD5(3,I+4)*THREE+FQD4(1,I+9)*THREE)*XMD8XY
         RD6(19,I)= RD6(19,I)+(FQD6(4,I)*ACY2-FQD5(2,I+4)*ACY2*THREE
     *             -FQD5(4,I+4)+FQD4(2,I+9)*THREE)*XMD8X
         RD6(20,I)= RD6(20,I)+(FQD6(5,I)-FQD5(3,I+4)*SIX
     *             +FQD4(1,I+9)*THREE)*XMD8XY
         RD6(21,I)= RD6(21,I)+(FQD6(6,I)-FQD5(4,I+4)*TEN
     *             +FQD4(2,I+9)*FIFT)*XMD8X
         RD6(22,I)= RD6(22,I)+(FQD6(1,I)*ACY6-FQD5(1,I+4)*ACY4*FIFT
     *             +FQD4(1,I+9)*ACY2*P45-FQD3(1,I+9)*FIFT)*XMD8
         RD6(23,I)= RD6(23,I)+(FQD6(2,I)*ACY4-FQD5(2,I+4)*ACY2*TEN
     *             +FQD4(2,I+9)*FIFT)*XMD8Y
         RD6(24,I)= RD6(24,I)+(FQD6(3,I)*ACY4-FQD5(1,I+4)*ACY4
     *             -FQD5(3,I+4)*ACY2*SIX+FQD4(1,I+9)*ACY2*SIX
     *             +FQD4(3,I+9)*THREE-FQD3(1,I+9)*THREE)*XMD8
         RD6(25,I)= RD6(25,I)+(FQD6(4,I)*ACY2-FQD5(2,I+4)*ACY2*THREE
     *             -FQD5(4,I+4)*THREE+FQD4(2,I+9)*NINE)*XMD8Y
         RD6(26,I)= RD6(26,I)+(FQD6(5,I)*ACY2-FQD5(3,I+4)*ACY2*SIX
     *             -FQD5(5,I+4)+FQD4(1,I+9)*ACY2*THREE
     *             +FQD4(3,I+9)*SIX-FQD3(1,I+9)*THREE)*XMD8
         RD6(27,I)= RD6(27,I)+(FQD6(6,I)-FQD5(4,I+4)*TEN
     *             +FQD4(2,I+9)*FIFT)*XMD8Y
         RD6(28,I)= RD6(28,I)+(FQD6(7,I)-FQD5(5,I+4)*FIFT
     *             +FQD4(3,I+9)*P45-FQD3(1,I+9)*FIFT)*XMD8
  610 CONTINUE
      DO 620 I=5,7
         FQWK( 1,I)=  FQD6(1,I)*AQX6-FQD5(1,I+4)*AQX4*FIFT
     *               +FQD4(1,I+9)*AQX2*P45-FQD3(1,I+9)*FIFT
         FQWK( 2,I)= (FQD6(1,I)*AQX4-FQD5(1,I+4)*AQX2*TEN
     *               +FQD4(1,I+9)*FIFT)*AQXY
         FQWK( 3,I)=-(FQD6(2,I)*AQX4-FQD5(2,I+4)*AQX2*TEN
     *               +FQD4(2,I+9)*FIFT)*AQX
         FQWK( 4,I)=  FQD6(1,I)*X4Y2-FQD5(1,I+4)*AQX4
     *               -FQD5(1,I+4)*X2Y2*SIX+FQD4(1,I+9)*AQX2*SIX
     *               +FQD4(1,I+9)*ACY2*THREE-FQD3(1,I+9)*THREE
         FQWK( 5,I)=-(FQD6(2,I)*AQX4-FQD5(2,I+4)*AQX2*SIX
     *               +FQD4(2,I+9)*THREE)*ACY
         FQWK( 6,I)=  FQD6(3,I)*AQX4-FQD5(1,I+4)*AQX4
     *               -FQD5(3,I+4)*AQX2*SIX+FQD4(1,I+9)*AQX2*SIX
     *               +FQD4(3,I+9)*THREE-FQD3(1,I+9)*THREE
         FQWK( 7,I)= (FQD6(1,I)*X2Y2-FQD5(1,I+4)*AQX2*THREE
     *               -FQD5(1,I+4)*ACY2*THREE+FQD4(1,I+9)*NINE)*AQXY
         FQWK( 8,I)=-(FQD6(2,I)*X2Y2-FQD5(2,I+4)*AQX2
     *               -FQD5(2,I+4)*ACY2*THREE+FQD4(2,I+9)*THREE)*AQX
         FQWK( 9,I)= (FQD6(3,I)*AQX2-FQD5(1,I+4)*AQX2-FQD5(3,I+4)*THREE
     *               +FQD4(1,I+9)*THREE)*AQXY
         FQWK(10,I)=-(FQD6(4,I)*AQX2-FQD5(2,I+4)*AQX2*THREE
     *               -FQD5(4,I+4)*THREE+FQD4(2,I+9)*NINE)*AQX
         FQWK(11,I)=  FQD6(1,I)*X2Y4-FQD5(1,I+4)*X2Y2*SIX
     *               -FQD5(1,I+4)*ACY4+FQD4(1,I+9)*AQX2*THREE
     *               +FQD4(1,I+9)*ACY2*SIX-FQD3(1,I+9)*THREE
         FQWK(12,I)=-(FQD6(2,I)*X2Y2-FQD5(2,I+4)*AQX2*THREE
     *               -FQD5(2,I+4)*ACY2+FQD4(2,I+9)*THREE)*ACY
         FQWK(13,I)=  FQD6(3,I)*X2Y2-FQD5(1,I+4)*X2Y2-FQD5(3,I+4)*AQX2
     *               -FQD5(3,I+4)*ACY2+FQD4(1,I+9)*AQX2+FQD4(1,I+9)*ACY2
     *               +FQD4(3,I+9)-FQD3(1,I+9)
         FQWK(14,I)=-(FQD6(4,I)*AQX2-FQD5(2,I+4)*AQX2*THREE-FQD5(4,I+4)
     *               +FQD4(2,I+9)*THREE)*ACY
         FQWK(15,I)=  FQD6(5,I)*AQX2-FQD5(3,I+4)*AQX2*SIX-FQD5(5,I+4)
     *               +FQD4(1,I+9)*AQX2*THREE+FQD4(3,I+9)*SIX
     *               -FQD3(1,I+9)*THREE
         FQWK(16,I)= (FQD6(1,I)*ACY4-FQD5(1,I+4)*ACY2*TEN
     *               +FQD4(1,I+9)*FIFT)*AQXY
         FQWK(17,I)=-(FQD6(2,I)*ACY4-FQD5(2,I+4)*ACY2*SIX
     *               +FQD4(2,I+9)*THREE)*AQX
         FQWK(18,I)= (FQD6(3,I)*ACY2-FQD5(1,I+4)*ACY2-FQD5(3,I+4)*THREE
     *               +FQD4(1,I+9)*THREE)*AQXY
         FQWK(19,I)=-(FQD6(4,I)*ACY2-FQD5(2,I+4)*ACY2*THREE-FQD5(4,I+4)
     *               +FQD4(2,I+9)*THREE)*AQX
         FQWK(20,I)= (FQD6(5,I)-FQD5(3,I+4)*SIX+FQD4(1,I+9)*THREE)*AQXY
         FQWK(21,I)=-(FQD6(6,I)-FQD5(4,I+4)*TEN+FQD4(2,I+9)*FIFT)*AQX
         FQWK(22,I)=  FQD6(1,I)*ACY6-FQD5(1,I+4)*ACY4*FIFT
     *               +FQD4(1,I+9)*ACY2*P45-FQD3(1,I+9)*FIFT
         FQWK(23,I)=-(FQD6(2,I)*ACY4-FQD5(2,I+4)*ACY2*TEN
     *               +FQD4(2,I+9)*FIFT)*ACY
         FQWK(24,I)=  FQD6(3,I)*ACY4-FQD5(1,I+4)*ACY4
     *               -FQD5(3,I+4)*ACY2*SIX+FQD4(1,I+9)*ACY2*SIX
     *               +FQD4(3,I+9)*THREE-FQD3(1,I+9)*THREE
         FQWK(25,I)=-(FQD6(4,I)*ACY2-FQD5(2,I+4)*ACY2*THREE
     *               -FQD5(4,I+4)*THREE+FQD4(2,I+9)*NINE)*ACY
         FQWK(26,I)=  FQD6(5,I)*ACY2-FQD5(3,I+4)*ACY2*SIX-FQD5(5,I+4)
     *               +FQD4(1,I+9)*ACY2*THREE+FQD4(3,I+9)*SIX
     *               -FQD3(1,I+9)*THREE
         FQWK(27,I)=-(FQD6(6,I)-FQD5(4,I+4)*TEN+FQD4(2,I+9)*FIFT)*ACY
         FQWK(28,I)=  FQD6(7,I)-FQD5(5,I+4)*FIFT+FQD4(3,I+9)*P45
     *               -FQD3(1,I+9)*FIFT
  620 CONTINUE
      DO 630 I=5,6
         DO 630 J=1,28
            RD6(J,I)= RD6(J,I)+FQWK(J,5)*WORK(I+9)
  630 CONTINUE
      DO 640 I=7,8
         DO 640 J=1,28
            RD6(J,I)= RD6(J,I)+FQWK(J,6)*WORK(I+7)
  640 CONTINUE
      DO 650 I=9,12
         DO 650 J=1,28
            RD6(J,I)= RD6(J,I)+FQWK(J,7)*WORK(I+1)
  650 CONTINUE
C
      DO 710 I=1,3
         FQWK( 1,I)=-(FQD7(1,I)*AQX6-FQD6(1,I+4)*AQX4*P21
     *               +FQD5(1,I+8)*AQX2*P105-FQD4(1,I+13)*P105)*AQX
         FQWK( 2,I)=-(FQD7(1,I)*AQX6-FQD6(1,I+4)*AQX4*FIFT
     *               +FQD5(1,I+8)*AQX2*P45-FQD4(1,I+13)*FIFT)*ACY
         FQWK( 3,I)=  FQD7(2,I)*AQX6-FQD6(2,I+4)*AQX4*FIFT
     *               +FQD5(2,I+8)*AQX2*P45-FQD4(2,I+13)*FIFT
         FQWK( 4,I)=-(FQD7(1,I)*X4Y2-FQD6(1,I+4)*AQX4
     *               -FQD6(1,I+4)*X2Y2*TEN+FQD5(1,I+8)*AQX2*TEN
     *               +FQD5(1,I+8)*ACY2*FIFT-FQD4(1,I+13)*FIFT)*AQX
         FQWK( 5,I)= (FQD7(2,I)*AQX4-FQD6(2,I+4)*AQX2*TEN
     *               +FQD5(2,I+8)*FIFT)*AQXY
         FQWK( 6,I)=-(FQD7(3,I)*AQX4-FQD6(1,I+4)*AQX4
     *               -FQD6(3,I+4)*AQX2*TEN+FQD5(1,I+8)*AQX2*TEN
     *               +FQD5(3,I+8)*FIFT-FQD4(1,I+13)*FIFT)*AQX
         FQWK( 7,I)=-(FQD7(1,I)*X4Y2-FQD6(1,I+4)*AQX4*THREE
     *               -FQD6(1,I+4)*X2Y2*SIX+FQD5(1,I+8)*AQX2*P18
     *               +FQD5(1,I+8)*ACY2*THREE-FQD4(1,I+13)*NINE)*ACY
         FQWK( 8,I)=  FQD7(2,I)*X4Y2-FQD6(2,I+4)*AQX4
     *               -FQD6(2,I+4)*X2Y2*SIX+FQD5(2,I+8)*AQX2*SIX
     *               +FQD5(2,I+8)*ACY2*THREE-FQD4(2,I+13)*THREE
         FQWK( 9,I)=-(FQD7(3,I)*AQX4-FQD6(1,I+4)*AQX4
     *               -FQD6(3,I+4)*AQX2*SIX+FQD5(1,I+8)*AQX2*SIX
     *               +FQD5(3,I+8)*THREE-FQD4(1,I+13)*THREE)*ACY
         FQWK(10,I)=  FQD7(4,I)*AQX4-FQD6(2,I+4)*AQX4*THREE
     *               -FQD6(4,I+4)*AQX2*SIX+FQD5(2,I+8)*AQX2*P18
     *               +FQD5(4,I+8)*THREE-FQD4(2,I+13)*NINE
         FQWK(11,I)=-(FQD7(1,I)*X2Y4-FQD6(1,I+4)*X2Y2*SIX
     *               -FQD6(1,I+4)*ACY4*THREE+FQD5(1,I+8)*AQX2*THREE
     *               +FQD5(1,I+8)*ACY2*P18-FQD4(1,I+13)*NINE)*AQX
         FQWK(12,I)= (FQD7(2,I)*X2Y2-FQD6(2,I+4)*AQX2*THREE
     *               -FQD6(2,I+4)*ACY2*THREE+FQD5(2,I+8)*NINE)*AQXY
         FQWK(13,I)=-(FQD7(3,I)*X2Y2-FQD6(1,I+4)*X2Y2-FQD6(3,I+4)*AQX2
     *               -FQD6(3,I+4)*ACY2*THREE+FQD5(1,I+8)*AQX2
     *               +FQD5(1,I+8)*ACY2*THREE+FQD5(3,I+8)*THREE
     *               -FQD4(1,I+13)*THREE)*AQX
         FQWK(14,I)= (FQD7(4,I)*AQX2-FQD6(2,I+4)*AQX2*THREE
     *               -FQD6(4,I+4)*THREE+FQD5(2,I+8)*NINE)*AQXY
         FQWK(15,I)=-(FQD7(5,I)*AQX2-FQD6(3,I+4)*AQX2*SIX
     *               -FQD6(5,I+4)*THREE+FQD5(1,I+8)*AQX2*THREE
     *               +FQD5(3,I+8)*P18-FQD4(1,I+13)*NINE)*AQX
         FQWK(16,I)=-(FQD7(1,I)*X2Y4-FQD6(1,I+4)*X2Y2*TEN
     *               -FQD6(1,I+4)*ACY4+FQD5(1,I+8)*AQX2*FIFT
     *               +FQD5(1,I+8)*ACY2*TEN-FQD4(1,I+13)*FIFT)*ACY
         FQWK(17,I)=  FQD7(2,I)*X2Y4-FQD6(2,I+4)*X2Y2*SIX
     *               -FQD6(2,I+4)*ACY4+FQD5(2,I+8)*AQX2*THREE
     *               +FQD5(2,I+8)*ACY2*SIX-FQD4(2,I+13)*THREE
         FQWK(18,I)=-(FQD7(3,I)*X2Y2-FQD6(1,I+4)*X2Y2
     *               -FQD6(3,I+4)*AQX2*THREE-FQD6(3,I+4)*ACY2
     *               +FQD5(1,I+8)*AQX2*THREE+FQD5(1,I+8)*ACY2
     *               +FQD5(3,I+8)*THREE-FQD4(1,I+13)*THREE)*ACY
         FQWK(19,I)=  FQD7(4,I)*X2Y2-FQD6(2,I+4)*X2Y2*THREE
     *               -FQD6(4,I+4)*AQX2-FQD6(4,I+4)*ACY2
     *               +FQD5(2,I+8)*AQX2*THREE+FQD5(2,I+8)*ACY2*THREE
     *               +FQD5(4,I+8)-FQD4(2,I+13)*THREE
         FQWK(20,I)=-(FQD7(5,I)*AQX2-FQD6(3,I+4)*AQX2*SIX-FQD6(5,I+4)
     *               +FQD5(1,I+8)*AQX2*THREE+FQD5(3,I+8)*SIX
     *               -FQD4(1,I+13)*THREE)*ACY
         FQWK(21,I)=  FQD7(6,I)*AQX2-FQD6(4,I+4)*AQX2*TEN-FQD6(6,I+4)
     *               +FQD5(2,I+8)*AQX2*FIFT+FQD5(4,I+8)*TEN
     *               -FQD4(2,I+13)*FIFT
         FQWK(22,I)=-(FQD7(1,I)*ACY6-FQD6(1,I+4)*ACY4*FIFT
     *               +FQD5(1,I+8)*ACY2*P45-FQD4(1,I+13)*FIFT)*AQX
         FQWK(23,I)= (FQD7(2,I)*ACY4-FQD6(2,I+4)*ACY2*TEN
     *               +FQD5(2,I+8)*FIFT)*AQXY
         FQWK(24,I)=-(FQD7(3,I)*ACY4-FQD6(1,I+4)*ACY4
     *               -FQD6(3,I+4)*ACY2*SIX+FQD5(1,I+8)*ACY2*SIX
     *               +FQD5(3,I+8)*THREE-FQD4(1,I+13)*THREE)*AQX
         FQWK(25,I)= (FQD7(4,I)*ACY2-FQD6(2,I+4)*ACY2*THREE
     *               -FQD6(4,I+4)*THREE+FQD5(2,I+8)*NINE)*AQXY
         FQWK(26,I)=-(FQD7(5,I)*ACY2-FQD6(3,I+4)*ACY2*SIX-FQD6(5,I+4)
     *               +FQD5(1,I+8)*ACY2*THREE+FQD5(3,I+8)*SIX
     *               -FQD4(1,I+13)*THREE)*AQX
         FQWK(27,I)= (FQD7(6,I)-FQD6(4,I+4)*TEN+FQD5(2,I+8)*FIFT)*AQXY
         FQWK(28,I)=-(FQD7(7,I)-FQD6(5,I+4)*FIFT+FQD5(3,I+8)*P45
     *               -FQD4(1,I+13)*FIFT)*AQX
         FQWK(29,I)=-(FQD7(1,I)*ACY6-FQD6(1,I+4)*ACY4*P21
     *               +FQD5(1,I+8)*ACY2*P105-FQD4(1,I+13)*P105)*ACY
         FQWK(30,I)=  FQD7(2,I)*ACY6-FQD6(2,I+4)*ACY4*FIFT
     *               +FQD5(2,I+8)*ACY2*P45-FQD4(2,I+13)*FIFT
         FQWK(31,I)=-(FQD7(3,I)*ACY4-FQD6(1,I+4)*ACY4
     *               -FQD6(3,I+4)*ACY2*TEN+FQD5(1,I+8)*ACY2*TEN
     *               +FQD5(3,I+8)*FIFT-FQD4(1,I+13)*FIFT)*ACY
         FQWK(32,I)=  FQD7(4,I)*ACY4-FQD6(2,I+4)*ACY4*THREE
     *               -FQD6(4,I+4)*ACY2*SIX+FQD5(2,I+8)*ACY2*P18
     *               +FQD5(4,I+8)*THREE-FQD4(2,I+13)*NINE
         FQWK(33,I)=-(FQD7(5,I)*ACY2-FQD6(3,I+4)*ACY2*SIX
     *               -FQD6(5,I+4)*THREE+FQD5(1,I+8)*ACY2*THREE
     *               +FQD5(3,I+8)*P18-FQD4(1,I+13)*NINE)*ACY
         FQWK(34,I)=  FQD7(6,I)*ACY2-FQD6(4,I+4)*ACY2*TEN-FQD6(6,I+4)
     *               +FQD5(2,I+8)*ACY2*FIFT+FQD5(4,I+8)*TEN
     *               -FQD4(2,I+13)*FIFT
         FQWK(35,I)=-(FQD7(7,I)-FQD6(5,I+4)*FIFT+FQD5(3,I+8)*P45
     *               -FQD4(1,I+13)*FIFT)*ACY
         FQWK(36,I)=  FQD7(8,I)-FQD6(6,I+4)*P21+FQD5(4,I+8)*P105
     *               -FQD4(2,I+13)*P105
  710 CONTINUE
      DO 720 J=1,36
         RD7(J,1)= RD7(J,1)+FQWK(J,1)*XMD8
  720 CONTINUE
      DO 730 J=1,36
         RD7(J,2)= RD7(J,2)+FQWK(J,2)*XMD8
  730 CONTINUE
      DO 740 I=3,4
         DO 740 J=1,36
            RD7(J,I)= RD7(J,I)+FQWK(J,3)*WORK(I+11)
  740 CONTINUE
C
      RD8( 1)= RD8( 1)+(FQD8(1)*AQX8-FQD7(1,3)*AQX6*P28
     *        +FQD6(1,7)*AQX4*P210-FQD5(1,11)*AQX2*P420
     *        +FQD4(1,16)*P105)*XMD8
      RD8( 2)= RD8( 2)+(FQD8(1)*AQX6-FQD7(1,3)*AQX4*P21
     *        +FQD6(1,7)*AQX2*P105-FQD5(1,11)*P105)*XMD8XY
      RD8( 3)= RD8( 3)+(FQD8(2)*AQX6-FQD7(2,3)*AQX4*P21
     *        +FQD6(2,7)*AQX2*P105-FQD5(2,11)*P105)*XMD8X
      RD8( 4)= RD8( 4)+(FQD8(1)*X6Y2-FQD7(1,3)*AQX6-FQD7(1,3)*X4Y2*FIFT
     *        +FQD6(1,7)*AQX4*FIFT+FQD6(1,7)*X2Y2*P45
     *        -FQD5(1,11)*AQX2*P45-FQD5(1,11)*ACY2*FIFT
     *        +FQD4(1,16)*FIFT)*XMD8
      RD8( 5)= RD8( 5)+(FQD8(2)*AQX6-FQD7(2,3)*AQX4*FIFT
     *        +FQD6(2,7)*AQX2*P45-FQD5(2,11)*FIFT)*XMD8Y
      RD8( 6)= RD8( 6)+(FQD8(3)*AQX6-FQD7(1,3)*AQX6-FQD7(3,3)*AQX4*FIFT
     *        +FQD6(1,7)*AQX4*FIFT+FQD6(3,7)*AQX2*P45
     *        -FQD5(1,11)*AQX2*P45-FQD5(3,11)*FIFT+FQD4(1,16)*FIFT)*XMD8
      RD8( 7)= RD8( 7)+(FQD8(1)*X4Y2-FQD7(1,3)*AQX4*THREE
     *        -FQD7(1,3)*X2Y2*TEN+FQD6(1,7)*AQX2*P30+FQD6(1,7)*ACY2*FIFT
     *        -FQD5(1,11)*P45)*XMD8XY
      RD8( 8)= RD8( 8)+(FQD8(2)*X4Y2-FQD7(2,3)*AQX4-FQD7(2,3)*X2Y2*TEN
     *        +FQD6(2,7)*AQX2*TEN+FQD6(2,7)*ACY2*FIFT
     *        -FQD5(2,11)*FIFT)*XMD8X
      RD8( 9)= RD8( 9)+(FQD8(3)*AQX4-FQD7(1,3)*AQX4-FQD7(3,3)*AQX2*TEN
     *         +FQD6(1,7)*AQX2*TEN+FQD6(3,7)*FIFT
     *         -FQD5(1,11)*FIFT)*XMD8XY
      RD8(10)= RD8(10)+(FQD8(4)*AQX4-FQD7(2,3)*AQX4*THREE
     *        -FQD7(4,3)*AQX2*TEN+FQD6(2,7)*AQX2*P30+FQD6(4,7)*FIFT
     *        -FQD5(2,11)*P45)*XMD8X
      RD8(11)= RD8(11)+(FQD8(1)*X4Y4-FQD7(1,3)*X4Y2*SIX
     *        -FQD7(1,3)*X2Y4*SIX+FQD6(1,7)*AQX4*THREE
     *        +FQD6(1,7)*X2Y2*P36+FQD6(1,7)*ACY4*THREE
     *        -FQD5(1,11)*AQX2*P18-FQD5(1,11)*ACY2*P18
     *        +FQD4(1,16)*NINE)*XMD8
      RD8(12)= RD8(12)+(FQD8(2)*X4Y2-FQD7(2,3)*AQX4*THREE
     *        -FQD7(2,3)*X2Y2*SIX+FQD6(2,7)*AQX2*P18
     *        +FQD6(2,7)*ACY2*THREE-FQD5(2,11)*NINE)*XMD8Y
      RD8(13)= RD8(13)+(FQD8(3)*X4Y2-FQD7(1,3)*X4Y2-FQD7(3,3)*AQX4
     *        -FQD7(3,3)*X2Y2*SIX+FQD6(1,7)*AQX4+FQD6(1,7)*X2Y2*SIX
     *        +FQD6(3,7)*AQX2*SIX+FQD6(3,7)*ACY2*THREE
     *        -FQD5(1,11)*AQX2*SIX-FQD5(1,11)*ACY2*THREE
     *        -FQD5(3,11)*THREE+FQD4(1,16)*THREE)*XMD8
      RD8(14)= RD8(14)+(FQD8(4)*AQX4-FQD7(2,3)*AQX4*THREE
     *        -FQD7(4,3)*AQX2*SIX+FQD6(2,7)*AQX2*P18+FQD6(4,7)*THREE
     *        -FQD5(2,11)*NINE)*XMD8Y
      RD8(15)= RD8(15)+(FQD8(5)*AQX4-FQD7(3,3)*AQX4*SIX
     *        -FQD7(5,3)*AQX2*SIX+FQD6(1,7)*AQX4*THREE
     *        +FQD6(3,7)*AQX2*P36+FQD6(5,7)*THREE-FQD5(1,11)*AQX2*P18
     *        -FQD5(3,11)*P18+FQD4(1,16)*NINE)*XMD8
      RD8(16)= RD8(16)+(FQD8(1)*X2Y4-FQD7(1,3)*X2Y2*TEN
     *        -FQD7(1,3)*ACY4*THREE+FQD6(1,7)*AQX2*FIFT
     *        +FQD6(1,7)*ACY2*P30-FQD5(1,11)*P45)*XMD8XY
      RD8(17)= RD8(17)+(FQD8(2)*X2Y4-FQD7(2,3)*X2Y2*SIX
     *        -FQD7(2,3)*ACY4*THREE+FQD6(2,7)*AQX2*THREE
     *        +FQD6(2,7)*ACY2*P18-FQD5(2,11)*NINE)*XMD8X
      RD8(18)= RD8(18)+(FQD8(3)*X2Y2-FQD7(1,3)*X2Y2-FQD7(3,3)*AQX2*THREE
     *        -FQD7(3,3)*ACY2*THREE+FQD6(1,7)*AQX2*THREE
     *        +FQD6(1,7)*ACY2*THREE+FQD6(3,7)*NINE
     *        -FQD5(1,11)*NINE)*XMD8XY
      RD8(19)= RD8(19)+(FQD8(4)*X2Y2-FQD7(2,3)*X2Y2*THREE-FQD7(4,3)*AQX2
     *        -FQD7(4,3)*ACY2*THREE+FQD6(2,7)*AQX2*THREE
     *        +FQD6(2,7)*ACY2*NINE+FQD6(4,7)*THREE
     *        -FQD5(2,11)*NINE)*XMD8X
      RD8(20)= RD8(20)+(FQD8(5)*AQX2-FQD7(3,3)*AQX2*SIX-FQD7(5,3)*THREE
     *        +FQD6(1,7)*AQX2*THREE+FQD6(3,7)*P18
     *        -FQD5(1,11)*NINE)*XMD8XY
      RD8(21)= RD8(21)+(FQD8(6)*AQX2-FQD7(4,3)*AQX2*TEN-FQD7(6,3)*THREE
     *        +FQD6(2,7)*AQX2*FIFT+FQD6(4,7)*P30-FQD5(2,11)*P45)*XMD8X
      RD8(22)= RD8(22)+(FQD8(1)*X2Y6-FQD7(1,3)*X2Y4*FIFT-FQD7(1,3)*ACY6
     *        +FQD6(1,7)*X2Y2*P45+FQD6(1,7)*ACY4*FIFT
     *        -FQD5(1,11)*AQX2*FIFT-FQD5(1,11)*ACY2*P45
     *        +FQD4(1,16)*FIFT)*XMD8
      RD8(23)= RD8(23)+(FQD8(2)*X2Y4-FQD7(2,3)*X2Y2*TEN-FQD7(2,3)*ACY4
     *        +FQD6(2,7)*AQX2*FIFT+FQD6(2,7)*ACY2*TEN
     *        -FQD5(2,11)*FIFT)*XMD8Y
      RD8(24)= RD8(24)+(FQD8(3)*X2Y4-FQD7(1,3)*X2Y4-FQD7(3,3)*X2Y2*SIX
     *        -FQD7(3,3)*ACY4+FQD6(1,7)*X2Y2*SIX+FQD6(1,7)*ACY4
     *        +FQD6(3,7)*AQX2*THREE+FQD6(3,7)*ACY2*SIX
     *        -FQD5(1,11)*AQX2*THREE-FQD5(1,11)*ACY2*SIX
     *        -FQD5(3,11)*THREE+FQD4(1,16)*THREE)*XMD8
      RD8(25)= RD8(25)+(FQD8(4)*X2Y2-FQD7(2,3)*X2Y2*THREE
     *        -FQD7(4,3)*AQX2*THREE-FQD7(4,3)*ACY2+FQD6(2,7)*AQX2*NINE
     *        +FQD6(2,7)*ACY2*THREE+FQD6(4,7)*THREE
     *        -FQD5(2,11)*NINE)*XMD8Y
      RD8(26)= RD8(26)+(FQD8(5)*X2Y2-FQD7(3,3)*X2Y2*SIX-FQD7(5,3)*AQX2
     *        -FQD7(5,3)*ACY2+FQD6(1,7)*X2Y2*THREE+FQD6(3,7)*AQX2*SIX
     *        +FQD6(3,7)*ACY2*SIX+FQD6(5,7)-FQD5(1,11)*AQX2*THREE
     *        -FQD5(1,11)*ACY2*THREE-FQD5(3,11)*SIX
     *        +FQD4(1,16)*THREE)*XMD8
      RD8(27)= RD8(27)+(FQD8(6)*AQX2-FQD7(4,3)*AQX2*TEN-FQD7(6,3)
     *         +FQD6(2,7)*AQX2*FIFT+FQD6(4,7)*TEN
     *         -FQD5(2,11)*FIFT)*XMD8Y
      RD8(28)= RD8(28)+(FQD8(7)*AQX2-FQD7(5,3)*AQX2*FIFT-FQD7(7,3)
     *        +FQD6(3,7)*AQX2*P45+FQD6(5,7)*FIFT-FQD5(1,11)*AQX2*FIFT
     *        -FQD5(3,11)*P45+FQD4(1,16)*FIFT)*XMD8
      RD8(29)= RD8(29)+(FQD8(1)*ACY6-FQD7(1,3)*ACY4*P21
     *        +FQD6(1,7)*ACY2*P105-FQD5(1,11)*P105)*XMD8XY
      RD8(30)= RD8(30)+(FQD8(2)*ACY6-FQD7(2,3)*ACY4*FIFT
     *        +FQD6(2,7)*ACY2*P45-FQD5(2,11)*FIFT)*XMD8X
      RD8(31)= RD8(31)+(FQD8(3)*ACY4-FQD7(1,3)*ACY4-FQD7(3,3)*ACY2*TEN
     *        +FQD6(1,7)*ACY2*TEN+FQD6(3,7)*FIFT-FQD5(1,11)*FIFT)*XMD8XY
      RD8(32)= RD8(32)+(FQD8(4)*ACY4-FQD7(2,3)*ACY4*THREE
     *        -FQD7(4,3)*ACY2*SIX+FQD6(2,7)*ACY2*P18+FQD6(4,7)*THREE
     *        -FQD5(2,11)*NINE)*XMD8X
      RD8(33)= RD8(33)+(FQD8(5)*ACY2-FQD7(3,3)*ACY2*SIX-FQD7(5,3)*THREE
     *        +FQD6(1,7)*ACY2*THREE+FQD6(3,7)*P18
     *        -FQD5(1,11)*NINE)*XMD8XY
      RD8(34)= RD8(34)+(FQD8(6)*ACY2-FQD7(4,3)*ACY2*TEN-FQD7(6,3)
     *        +FQD6(2,7)*ACY2*FIFT+FQD6(4,7)*TEN-FQD5(2,11)*FIFT)*XMD8X
      RD8(35)= RD8(35)+(FQD8(7)-FQD7(5,3)*FIFT+FQD6(3,7)*P45
     *        -FQD5(1,11)*FIFT)*XMD8XY
      RD8(36)= RD8(36)+(FQD8(8)-FQD7(6,3)*P21+FQD6(4,7)*P105
     *        -FQD5(2,11)*P105)*XMD8X
      RD8(37)= RD8(37)+(FQD8(1)*ACY8-FQD7(1,3)*ACY6*P28
     *        +FQD6(1,7)*ACY4*P210-FQD5(1,11)*ACY2*P420
     *        +FQD4(1,16)*P105)*XMD8
      RD8(38)= RD8(38)+(FQD8(2)*ACY6-FQD7(2,3)*ACY4*P21
     *        +FQD6(2,7)*ACY2*P105-FQD5(2,11)*P105)*XMD8Y
      RD8(39)= RD8(39)+(FQD8(3)*ACY6-FQD7(1,3)*ACY6-FQD7(3,3)*ACY4*FIFT
     *        +FQD6(1,7)*ACY4*FIFT+FQD6(3,7)*ACY2*P45
     *        -FQD5(1,11)*ACY2*P45-FQD5(3,11)*FIFT
     *        +FQD4(1,16)*FIFT)*XMD8
      RD8(40)= RD8(40)+(FQD8(4)*ACY4-FQD7(2,3)*ACY4*THREE
     *        -FQD7(4,3)*ACY2*TEN+FQD6(2,7)*ACY2*P30+FQD6(4,7)*FIFT
     *        -FQD5(2,11)*P45)*XMD8Y
      RD8(41)= RD8(41)+(FQD8(5)*ACY4-FQD7(3,3)*ACY4*SIX
     *        -FQD7(5,3)*ACY2*SIX+FQD6(1,7)*ACY4*THREE
     *        +FQD6(3,7)*ACY2*P36+FQD6(5,7)*THREE-FQD5(1,11)*ACY2*P18
     *        -FQD5(3,11)*P18+FQD4(1,16)*NINE)*XMD8
      RD8(42)= RD8(42)+(FQD8(6)*ACY2-FQD7(4,3)*ACY2*TEN-FQD7(6,3)*THREE
     *        +FQD6(2,7)*ACY2*FIFT+FQD6(4,7)*P30-FQD5(2,11)*P45)*XMD8Y
      RD8(43)= RD8(43)+(FQD8(7)*ACY2-FQD7(5,3)*ACY2*FIFT-FQD7(7,3)
     *        +FQD6(3,7)*ACY2*P45+FQD6(5,7)*FIFT-FQD5(1,11)*ACY2*FIFT
     *        -FQD5(3,11)*P45+FQD4(1,16)*FIFT)*XMD8
      RD8(44)= RD8(44)+(FQD8(8)-FQD7(6,3)*P21+FQD6(4,7)*P105
     *        -FQD5(2,11)*P105)*XMD8Y
      RD8(45)= RD8(45)+(FQD8(9)-FQD7(7,3)*P28+FQD6(5,7)*P210
     *        -FQD5(3,11)*P420+FQD4(1,16)*P105)*XMD8
      RETURN
      END
