      subroutine cd05(i,j,k,l,a,ind3,bint,yint,nbint)
      IMPLICIT REAL*8(A-H,O-X,Z),logical*1(y)
      parameter(maxsym=8,maxorbcas=16)
      include 'maxorb.prm'
      common/calch/nind,maxrec70,nfil70,numfil70(4),nomfil70(4)
      character*5 nomfil70
      character*1 ind3(nind,nbint),cbid
      common/dim/iadri ; integer(8) iadri
c
c-----------------------------------------
c     stockage des int du type <i k j k>
c-----------------------------------------
c
      common /cs/ noac,nelac,numac(maxorbcas),itype(maxorb),is0,ms2
      common/l40/ hmono(maxorb*(maxorb+1)/2),aj(maxorb*(maxorb+1)/2)
     *,ak(maxorb*(maxorb+1)/2),f(maxorb*(maxorb+1)/2),e0
     *,ajk(maxorb*(maxorb+1)/2),escf
      dimension bint(nbint),yint(nbint)
      common /orb/ enuc,eref,norb,noca,nocb
     *,iorb(2*maxorb),ninac,nvirt,noca0
      yw=.false.
c     if(yw)write(6,*)'yint',(yint(kk),kk=1,200)
c     if(yw)write(6,*)'yintx',(yintx(kk),kk=1,200)
      if(i.eq.k) then
         if(j.eq.l) return
         mini=min(j,l)
         maxi=max0(j,l)
         icom=i
         goto 1
      endif
      if(j.eq.l) then
         mini=min(i,k)
         maxi=max0(i,k)
         icom=j
         goto 1
      endif
      return
 1    continue
      mm=maxi*(maxi-1)/2+mini
      call adri(icom,mini,maxi,iadr)
      if(yw)write(6,'(a21,10i5)')'cd05 adr i,j,k,l,iadr',i,j,k,l,iadr
     *,icom,mini,maxi
      if(yint(iadr)) then
         write(6,'(a15,5i5)')'cd05 deja',i,j,k,l,iadr
         stop
      endif
      bint(iadr)=a
      yint(iadr)=.true.
c      if(norb.le.255) then
c         ind3(1,iadr)=char(icom)
c         ind3(2,iadr)=char(mini)
c         ind3(3,iadr)=char(maxi)
c      else
c         call icorr0(icom,jj,ind3(1,iadr),jjj)
c         call icorr0(mini,kk,ind3(2,iadr),kkk)
c         call icorr0(maxi,ll,ind3(3,iadr),lll)
c         jkl=jjj+kkk*4+lll*16
c         ind3(4,iadr)=char(jkl)
c      endif
      if(yw)print'(a,i7,3i4,f12.8)','DIRECTE',iadr,icom,mini,maxi,a
      call encod(icom,mini,maxi,ibid,ind3(1,iadr),
     *ind3(2,iadr),ind3(3,iadr),cbid,ind3(nind,iadr),3)
      if(itype(icom).eq.1) f(mm)=f(mm)+a+a
      return
      end
       subroutine cd0563(icom,j,k,a,ind3,bint,yint,nbint)
      IMPLICIT REAL*8(A-H,O-X,Z),logical*1(y)
      parameter(maxsym=8,maxorbcas=16)
      include 'maxorb.prm'
      common/calch/nind,maxrec70,nfil70,numfil70(4),nomfil70(4)
      character*5 nomfil70
      character*1 ind3(nind,nbint),cbid
      common/dim/iadri ; integer(8) iadri
c
c-----------------------------------------
c     stockage des int du type <i k j k>
c-----------------------------------------
c
      common /cs/ noac,nelac,numac(maxorbcas),itype(maxorb),is0,ms2
      common/l40/ hmono(maxorb*(maxorb+1)/2),aj(maxorb*(maxorb+1)/2)
     *,ak(maxorb*(maxorb+1)/2),f(maxorb*(maxorb+1)/2),e0
     *,ajk(maxorb*(maxorb+1)/2),escf
      dimension bint(nbint),yint(nbint)
      common /orb/ enuc,eref,norb,noca,nocb
     *,iorb(2*maxorb),ninac,nvirt,noca0
      yw=.false.
c     if(yw)write(6,*)'yint',(yint(kk),kk=1,200)
c     if(yw)write(6,*)'yintx',(yintx(kk),kk=1,200)
      mini=k
      maxi=j
      mm=maxi*(maxi-1)/2+mini
       !print*,'icom,mini,maxi',icom,mini,maxi
      call adri(icom,mini,maxi,iadr)
      if(yw)write(6,'(a21,10i5)')'cd05 adr i,j,k,iadr',i,j,k,iadr
     *,icom,mini,maxi
      if(yint(iadr)) then
         write(6,'(a15,5i5)')'cd05 deja',j,k,iadr
         stop
      endif
      bint(iadr)=a
      yint(iadr)=.true.
      if(yw)print'(a,i7,3i4,f12.8)','DIRECTE',iadr,icom,mini,maxi,a
      call encod(icom,mini,maxi,ibid,ind3(1,iadr),
     *ind3(2,iadr),ind3(3,iadr),cbid,ind3(nind,iadr),3)
      if(itype(icom).eq.1) f(mm)=f(mm)+a+a
      return
      end
 
