C   ====== ACCELERATION OF THE CONVERGENCY===
C==========OF EXCHANGE POTENTIAL CALCULATION====
      SUBROUTINE ACCOBM(R2,R5,ALM4,
     *ALM5,ALM6,NE5,IP,KF)
      REAL*8 R2(*),R5(*),ALM4,
     *ALM5,ALM6,U,V,A1,B,C1
      NE=NE5-15
      U=0.0
      V=U
      A1=U
      DO 22 J=1,NE
      B=R2(J+2)-R5(J+2)
      IF(DABS(B).LE.DABS(A1)) GOTO 22
      A1=B
      U=R2(J+2)
      V=R5(J+2)
      JJ=J+2
   22 CONTINUE
      ALM6=A1
      IF(DABS(U).GT.1.0) ALM6=ALM6/U
      IF(KF.NE.1) GOTO 200
      ALM4=ALM6
      ALM5=ALM6
200   CONTINUE
      IF(DSIGN(1.D 00,ALM5-ALM4).
     * NE.DSIGN(1.D 00,ALM6
     *-ALM5).AND.DABS(ALM4).GT.DABS(ALM5)) GOTO 56
      C1=0.0
      GOTO 577
   56 C1=(ALM6-ALM5)/(ALM6-2.*ALM5+ALM4)
   57 CONTINUE
      DO 307 IW=1,NE
      R2(IW+2)=C1*R5(IW+2)+(1.-C1)*R2(IW+2)
  307 CONTINUE
577   ALM4=ALM5
      ALM5=ALM6
      IF(IP.EQ.-1) R2(1)=C1*R5(1)+(1.-C1)*R2(1)
      WRITE( *,98)ALM6,R2(1)
C     WRITE( 6,98)ALM6,R2(1)
 98   FORMAT('=ACC= MISMATCH',E15.8, ' E',E15.8)
      RETURN
      END
