      subroutine init_stor
      use mod_dolo
      IMPLICIT REAL*8(A-H,O-X,Z),logical*1(y)
      common/sym/ nsym,isym(maxsym),isymt(0:maxsym)
      character(80) bb
      allocatable occscf(:)
      yw=.false.
      if(yw) then
         print*,'entree init_stor'
         print*,'norb',norb
         print*,'isym',isym
         print*,'isymt',isymt
         print*,'orbi',orbi
         print*,'fermi0',fermi0
      endif
!
!-------------------------
! Allocations
!-------------------------
!
      allocate(work2(norb,norb*gap))
      allocate(flo(norb,norb*gap))
      allocate(focc(norb*gap))
      allocate(flab(norb*gap))
      allocate(occscf(norb*gap))
      allocate(fsym(norb*gap))
      allocate(fdat0(norb*gap))
      allocate(fdat1(norb*gap))
      allocate(fly(norb*gap))
      allocate(focvir(norb*gap))
      allocate(fsigpi(norb*gap))
      allocate(glabel(norb*gap))
      allocate(orig(norb*gap))
      allocate(ftype(norb*gap))
      allocate(atoms_in_LO(norb*gap,max_atoms_in_LO))
      flab=' '
      fdat1=0
      orig=' '
      ftype=' '
      fsigpi(:)=' '
!
      allocate(ywk(norb*gap))
      allocate(iwk(norb*gap))
      allocate(iwk2(norb*gap))
      allocate(fnat(norb*gap))
      flo=0.d0
      fly=.false.
      fsym=0
!
!--------------------------------------
! Read SCF occupation
!--------------------------------------
!
      open(11,file=scforb,status='old')
      ind=0
      do while (ind==0)
         read(11,'(a)') bb
         if(bb(1:1)/='#') ind=index(bb,'OCC')
      enddo
      ifin=0
      do is=1,nsym
         if(isym(is)==0) cycle
         ideb=ifin+1
         ifin=ifin+isym(is)
         read(11,1000) occscf(ideb:ifin)
      enddo
 1000 format(4d18.12)
      if(yw)print*, 'SCF occupation'
      if(yw)print'(10f8.4)',occscf
      close(11)
!
!-------------------------
! compute number of inactive, active, virtual MO's
!-------------------------
!
      ninacs=0
      noacts=0
      nvirts=0
      kk=0
      do is=1,nsym
         do k=1,isym(is)
            kk=kk+1
            if(abs(occscf(kk)-2.d0)<1.d-8) then
               ninacs(is)=ninacs(is)+1
            else if(abs(occscf(kk))<1.d-8) then
               nvirts(is)=nvirts(is)+1
            else
               noacts(is)=noacts(is)+1
            endif
         enddo
      enddo
      if(yw) then
         print*,'ninacs',ninacs
         print*,'noacts',noacts
         print*,'nvirts',nvirts
      endif
      return
      end
