C ===DIRECT POTENTIAL IN HARTREE-FOCK==========
C ===== DIRAC EQUATIONS========================
      SUBROUTINE DIRECR(ALFA,BET,H,NE5,AL0,
     *ISIGM,IS,IQ,NU,IG,
     *GAM,ISIGM1,ISIGM2,KK,
     *R1,R5,R6,R8,R9,R12,R13)
C================================================
      INTEGER IQ(IS),ISIGM1(*),KK(*),ISIGM2(*)
       REAL*8  ALFA,BET,H,R52,AL0,
     *  GAMA,GAM(*),
     *R1(*),R5(*),R6(*),R8(NE5,*),
     *  R9(*),R12(*),R13(*)
      NE=NE5-15
      IRA=IG+1
      IF (IRA.GT.NU) GOTO 35
      DO 40 J=IRA,NU
      IA=0
      IF(ISIGM.EQ.ISIGM1(J)) IA=ISIGM2(J)
      IF(ISIGM.EQ.ISIGM2(J)) IA=ISIGM1(J)
C     GOTO 43
C 42  IA=ISIGM1(J)
C     GOTO 43
C 41  IA=ISIGM2(J)
C 43  CONTINUE
      IF(IA.EQ.0) GOTO 40
      CALL COLUMN(NE5,R8(1,IA),R5)
      CALL COLUMN(NE5,R8(1,IA+IS+1),R13)
      R52=R5(2)
      DO 50 IW=1,NE
      R5(IW+1)=R5(IW+2)**2
  50  CONTINUE
      CALL COLUMN(NE5,R8(1,IA+IS+IS+2),R9)
      CALL KSII(NE,AL0,R5(1),R9,R12)
      DO 60 IW=1,NE
      R5(IW+1)=R5(IW+1)*
     *     R12(IW)**2+R13(IW)**2*AL0**2
 60   CONTINUE
      IW=KK(J)
      CALL POT(ALFA,BET,H,R1,R5,IW,NE5)
      GAMA=GAM(J)/(R52*DFLOAT(IQ(ISIGM)))
      IF(ISIGM.EQ.IA)  GAMA=2.*GAMA
C     GAMA=2.*GAMA
C     GOTO 63
C 63  CONTINUE
      DO 70 IW=1,NE
      R6(IW)=R6(IW)-GAMA*R5(IW+1)
  70  CONTINUE
C 45  CONTINUE
  40   CONTINUE
C 35  CONTINUE
  35  RETURN
      END
