      subroutine maxdett
c------------------------------------------------------------------
c    Calcul du nombre de determinants par categorie des trous
c
c------------------------------------------------------------------
c    sortie : tableau maxp(nt,ist,ispt) = nb de det. d'une
c             categorie des trous
c------------------------------------------------------------------
      IMPLICIT REAL*8(A-H,O-X,Z),LOGICAL*1 (Y)
      PARAMETER (maxorb=500,maxsym=8,NSPt=3,MNEL=5,maxorbcas=16)
      common /cs/ noac,nelac,numac(maxorbcas),itype(maxorb),is0,ms2
      common/sy2/nts(maxsym),ncs(maxsym),nps(maxsym)
     *,norbs(maxsym)
      common /prep/ nca0,ncb0,ic0(maxorbcas),icamun(maxorb+maxorb)
     *,numt(maxorb),nump(maxorb),nv
     *,gener,yoc(maxorb+maxorb),yrefc(maxorbcas),yac(maxorb)
     *,ygmono,ygddci,ygddc2,ygcas,ygtous
      character*4 gener
      common/sym/itsym(2*maxorb),its(maxsym,maxsym),nsym
      common/cas_spin/isz0
      common /orb/ enuc,eref,norb,noca,nocb
     *,iorb(2*maxorb),ninac,nvirt,noca0
      common/maxdettrou/maxt(2,maxsym,maxsym,0:1)
      yw=.false.
c----- 1 electron alpha (ou 1 beta)
      do ist=1,nsym
         maxt(1,ist,ist,1)=nts(ist)
      enddo
c----- 2 electrons alpha (ou 2 beta)
      do 1 ist=1,nsym
      do 11 is1=1,nsym
      is2=its(ist,is1)
      if(is1.ne.is2)then
         if(is2.lt.is1) goto 11
         maxt(2,ist,is1,1)=nts(is1)*nts(is2)
      else
         maxt(2,ist,is1,1)=nts(is1)*(nts(is1)-1)/2
      endif
 11   continue
 1    continue
c----- 1 electron alpha et 1 beta
      do 2 ist=1,nsym
      do is1=1,nsym
         is2=its(ist,is1)
         maxt(2,ist,is1,0)=nts(is1)*nts(is2)
      enddo
 2    continue
c     write(6,*)'maxt(1,ist,ist,1)',(maxt(1,ist,ist,1),ist=1,nsym)
      return
      end
