C====EXCHANGE POTENTIAL IN HARTREE-FOCK-==
C======== DIRAC EQUATIONS================
      SUBROUTINE EXCHR(ALFA,BET,H,NE5,AL0,IS,
     *ISIGM,IG,IQ,GAM,KK,ISIGM1,ISIGM2,ALM3,
     *R1,R2,R4,R5,R6,R8,R12,R13,R14,R15)
C==========================================
      REAL*8 ALFA,BET,H,P,GAMA,AL0,
     *     R1(*),R2(*),ALM3(*),GAM(*),
     *     R4(*),R5(*),R6(*),R8(NE5,*),
     *     R12(*),R13(*),R14(*),R15(*)
      INTEGER KK(*),ISIGM1(*),ISIGM2(*),IQ(*)
      NE=NE5-15
      IF(IG.LT.1) RETURN
      DO 3 IW=1,IG
      IA=0
      IF(ISIGM1(IW).EQ.ISIGM) IA=ISIGM2(IW)
      IF(ISIGM2(IW).EQ.ISIGM) IA=ISIGM1(IW)
C     GOTO 83
C1    IA=ISIGM2(IW)
C     GOTO 83
C2    IA=ISIGM1(IW)
C3    CONTINUE
      IF(IA.EQ. 0 ) GOTO 110
      CALL COLUMN(NE5,R8(1,IA),R5)
      CALL COLUMN(NE5,R8(1,IA+IS+IS+2),R14)
      CALL KSII(NE,AL0,R5(1),R14,R12)
      CALL COLUMN(NE5,R8(1,IA+IS+1),R14)
      DO 50 JJ=1,NE
      R6(JJ+1)=R5(JJ+2)*R2(JJ+2)*R12(JJ)*R13(JJ)
     *   +AL0**2*R14(JJ)*R15(JJ)
   50 CONTINUE
      CALL POT(ALFA,BET,H,R1,R6,KK(IW),NE5)
      GAMA=2.*GAM(IW)/(R5(2)*DFLOAT(IQ(ISIGM)))
      DO 51 JJ=1,NE
      R4(JJ+1)=R4(JJ+1)+(GAMA*R6(JJ+1)*R12(JJ)
     *     +ALM3(IA)/R5(2)*R1(JJ+2))*R5(JJ+2)
   51 CONTINUE
  110 CONTINUE
    3 CONTINUE
      P=H*H /12.
      DO 305 J=1,NE
      R4(J+1)=P*R1(J+2)*R4(J+1)*R13(J)
     *       /(ALFA*R1(J+2)+BET)**2
  305 CONTINUE
      RETURN
      END
