      SUBROUTINE INTGL (NCH)
C *** SEE R H LANDAU, PROGRAM LPOTT, 1981
      IMPLICIT  REAL*8   (A-H,O-Z)
      COMMON /ENPAUL/ PF,AK,AKD,CSKKD,XI,E,XON
      COMMON /ENINT/ A,B,LPAULI
      COMMON /DEINT/ ANS
      COMMON /ENQAV/ XIP
      REAL*8 X(32),W(32),SUM,DUM,AMPI,AMPISQ,AMN,EK,K,KSQ
      REAL*8 AMU,CONST,WON,XX(16),WW(16)
C     REAL DLOG
C     REAL SQRT
      COMPLEX*16 ANS,CI
C     COMPLEX CMPLX
      LOGICAL LIN,LPAULI,L1,L2
      DATA LIN,CI/.FALSE.,(0.0,1.0)/
      IF (LIN) GO TO 10
      LIN = .TRUE.
      NHF = 16
C     RHL CHANGE OF POINTS SO CAN RUN CEX AT OSU
      NHF = 4
      MESH = NHF
      CALL GAUSS (MESH,012,-1.d0,1.d0,XX,WW)
C     HERE WE HAVE SET UP MESH ON (-1,+1)
      AMPI = 137.3/197.33E0
      AMPISQ = AMPI**2
      AMN = 938.91/197.33E0
      PI = 3.14159265
 10   CONTINUE
C
C     SCALE QUAD PTS..
      ALONG = (B-A)/2.0
      AMID = (A+B)/2.0
      DO 20 I=1,MESH
         X(I) = XX(I)*ALONG+AMID
         W(I) = WW(I)*ALONG
 20   CONTINUE
C
C     NOW TEST IF WE HAVE A SINGULARITY..
      IF (E.LT.0.0) GO TO 110
      L1 = XON.GT.A
      L2 = XON.LT.B
      IF (L1.AND.L2) GO TO 30
      GO TO 110
C
 30   CONTINUE
C     HERE WE HAVE A POLE IN THE INTEGRAL //////  1ST DO PRINCIPAL VALUE
      WON = XON**2
      WON = SQRT(AMPISQ+WON)
      AMU = AMN*WON/(AMN+WON)
      CONST = XON*AMU*G(XON,NCH)**2
      IF (LPAULI) CONST = CONST*QAV(XON)
C
C     CHANGED VERSION WITH REDISTRIBUTED QUADRATURE POINTS FOR THIS CAS
      DXON = XON
      IF (XON.LT.AMID) GO TO 60
      BPR = B
      APR = 2.*DXON-BPR
      ALPR = (BPR-APR)/2.
      ARST = A
      BRST = APR
      ALRST = (BRST-ARST)/2.
      AMRST = (ARST+BRST)/2.
      DO 40 I=1,MESH
         X(I) = XX(I)*ALRST+AMRST
         W(I) = WW(I)*ALRST
 40   CONTINUE
      DO 50 I=1,MESH
         II = I+MESH
         X(II) = XX(I)*ALPR+DXON
         W(II) = WW(I)*ALPR
 50   CONTINUE
      GO TO 90
 60   CONTINUE
      APR = A
      BPR = 2.*DXON-APR
      ALPR = (BPR-APR)/2.
      ARST = BPR
      BRST = B
      ALRST = (BRST-ARST)/2.
      AMRST = (ARST+BRST)/2.
      DO 70 I=1,MESH
         X(I) = XX(I)*ALPR+DXON
         W(I) = WW(I)*ALPR
 70   CONTINUE
      DO 80 I=1,MESH
         II = I+MESH
         X(II) = XX(I)*ALRST+AMRST
         W(II) = WW(I)*ALRST
 80   CONTINUE
 90   NMESH = 2*MESH
      SUM = 0.0E0
      NMESH = 2*MESH
      DO 100 I=1,NMESH
         K = X(I)
         KSQ = K*K
         Y = K
         EK = SQRT(AMPISQ+KSQ)-AMPI+KSQ/(2.0*AMN)
         DUM = KSQ*G(Y,NCH)**2
         IF (LPAULI) DUM = DUM*QAV(Y)
         DUM = DUM/(E-EK)
         DUM = DUM-CONST/(XON-K)
         SUM = SUM+W(I)*DUM
 100  CONTINUE
C
C     ADD THE CORRECTION INTEGRAL..
      DUM = XON-A
      DUM = DUM/(B-XON)
      Y = SUM+LOG(DUM)*CONST
C
C     AND FINALLY THE POLE TERM..
      Y1 = -PI*CONST
      ANS = CMPLX(Y,Y1)
      RETURN
C
C     HERE THERE IS NO SINGULARITY..
 110  CONTINUE
      SUM = 0.0
      DO 120 I=1,MESH
         K = X(I)
         KSQ = K**2
         Y = K
         EK = SQRT(AMPISQ+KSQ)-AMPI+KSQ/(2.0*AMN)
         DUM = KSQ*G(Y,NCH)**2
         IF (LPAULI) DUM = DUM*QAV(Y)
         SUM = SUM+W(I)*DUM/(E-EK)
 120  CONTINUE
      Y = SUM
      XZERO=0.D0
      ANS = CMPLX(Y,XZERO)
      RETURN
      END
