      subroutine adrts(nt,it,iadrt)
c
c----------------------------------------------------------
c    subroutine d'adressage des determinants des trous
c    (gener='MR..')
c
c    nt,it : nb de trous, numero des trous
c----------------------------------------------------------
c
      IMPLICIT REAL*8(A-H,O-X,Z),LOGICAL*1 (Y)
      PARAMETER (maxorbcas=16,maxsym=8)
      include 'maxorb.prm'
      common/sy2/nts(maxsym),ncs(maxsym),nps(maxsym)
     *,norbs(maxsym)
      common/sym/itsym(2*maxorb),its(maxsym,maxsym),nsym
      common /orb/ enuc,eref,norb,noca,nocb
     *,iorb(2*maxorb),ninac,nvirt,noca0
      common/sy3/itorbi(maxorb),isbrot(maxorb),itorbc(maxorb)
     *,itorbs(maxorb)
      common /prep2s/ icatts(maxsym,maxsym),icatps(maxsym,maxsym)
      common /prep2/ icatt(2,maxsym,maxsym,-1:1),
     *icatp(2,maxsym,maxsym,-1:1)
     *,itorb(maxorb*2),icatc(maxsym,maxsym,0:maxorbcas,0:maxorbcas)
      dimension idet1(2)
      dimension it(2)
      yw=.false.
      if(yw)print*,'dans adrts it',(it(k),k=1,nt)
 
      if(nt.eq.0) then
         iadrt=1
      else if(nt.eq.1) then
         iadrt=itorb(iorb(it(1)))
      else
         jt1=iorb(it(1))
         jt2=iorb(it(2))
         if(jt1.eq.jt2) then
            iadrt=itorbc(jt1)
         else
            it1=min(jt1,jt2)
            it2=max(jt1,jt2)
            if(yw)print*,'dans adrts it',it1,it2
            is1=itsym(it1)
            is2=itsym(it2)
            if(is1.eq.is2) then
               idet1(1)=itorb(it1)
               idet1(2)=itorb(it2)
               call rang2s(nts(is1),2,idet1,iadrt)
               iadrt=iadrt+icatts(is1,is1)
            else
               it1=itorb(it1)
               it2=itorb(it2)
               iadrt=it1+(it2-1)*nts(is1)
     *         +icatts(is1,is2)
            endif
         endif
      endif
      return
      end
 
