      subroutine cd01(in,jn,kn,ln,a,esp1)
      IMPLICIT REAL*8(A-H,O-X,Z),LOGICAL*1 (Y)
      parameter(maxsym=8,maxorbcas=16)
      include 'maxorb.prm'
c
c
c    |-*-*-*-*-*-*-*-|-*-*-*-*-*-*-*-|
c    |     esp1
c
      common/dim/iadri ; integer(8) iadri
      dimension esp1(iadri*2)
      common /cs/ noac,nelac,numac(maxorbcas),itype(maxorb),is0,ms2
      common /icd1/ispin(2)
      common/sgn/ksgn(maxorb+maxorb),isgn0,intsgn
      character*1 syspin
      common/sysp1/syspin
      common/test/itest(100)
      common/g2/lg2,ig2,lg2p,ig2p,lg2m,ig2m,ng2,yg2,yga2
      yw=.false.
c
c---------------------------------------------------
c      integrales sans echange
c---------------------------------------------------
c
      if(itest(59).eq.3) then
         if(in.ne.kn.and.(itype(in).ne.2.or.itype(kn).ne.2))return
         if(jn.ne.ln.and.(itype(jn).ne.2.or.itype(ln).ne.2))return
      endif
      if(yga2) then
         if(yw)print*,'CD01',in,jn,kn,ln
c         if(in.eq.kn.or.jn.eq.ln) return
      endif
      if(yw)write(6,'(a20,4i4)')'int sans echange',in,jn,kn,ln
      ispint=1
      intsgn=1
      ispin(1)=1
      ispin(2)=-1
c
c--   changement de signe pour les int <ijil> si i est inactive
      if(in.eq.kn.and.itype(in).eq.1) a=-a
      if(jn.eq.ln.and.itype(jn).eq.1) a=-a
c
      if(syspin.eq.'0') then
         if(yga2)a=1.d0
         call cd02r(in,jn,kn,ln,a,esp1)
c         if(yga2) call disin1(lg2,ig2,56,in,jn,kn,ln,a,1)
         if(in.ne.kn.and.jn.ne.ln) then
            if(yga2)a=1.d0
            call cd02r(kn,jn,in,ln,a,esp1)
c            if(yga2) call disin1(lg2,ig2,56,kn,jn,in,ln,a,1)
         endif
         if(ln.ne.kn.or.in.ne.jn) then
            if(in.ne.ln.or.jn.ne.kn) then
               if(yga2)a=1.d0
               call cd02r(ln,kn,jn,in,a,esp1)
c               if(yga2) call disin1(lg2,ig2,56,ln,kn,jn,in,a,1)
               if(in.ne.kn.and.jn.ne.ln) then
                  if(yga2)a=1.d0
                  call cd02r(jn,kn,ln,in,a,esp1)
c                  if(yga2) call disin1(lg2,ig2,56,jn,kn,ln,in,a,1)
               endif
            endif
         endif
      else
         if(in.eq.jn.and.kn.eq.ln) a=a/2
         call cd02r(in,jn,kn,ln,a,esp1)
         if(in.ne.kn.and.jn.ne.ln)call cd02r(kn,jn,in,ln,a,esp1)
      endif
      return
      end
