      subroutine lircom
      IMPLICIT DOUBLE PRECISION (A-H,O-x,Z),logical*1(y)
      parameter (maxsym=8,maxat=1024)
      integer c_open,c_read
      common /filc/jrc_oneint,jrc_comfile,jrc_traone,jrc_traint
      character*80 blan40,filorb
      common/pr/nprint,mprint(10),filorb,blan40
      common/version/molcas,i_rec,i_at,i_orb,i_coo,y64
      character*80000 c
      dimension ic(20000),ac(10000)
      equivalence (c,ic(1))
      equivalence (c,ac(1))
      character*4 atom0(maxat)
      dimension multat(maxat),ncouch(maxat)
      print*,'entree molcost',molcas
c
c     set the pointers
c
      if(molcas.eq.4) then
         return
      else
         i_at=0
         i_at=1089836
         i_contr=10076
      endif
 
c
c     read the atoms in data
c
      natom0=0
      do
         krc=c_lseek(jrc_comfile,i_at)
         krc=c_read(jrc_comfile,c,8)
         ii=ichar(c(1:1))
         if(ii.ge.65.and.ii.le.122) then
            natom0=natom0+1
            i_at=i_at+8
            atom0(natom0)=c(1:4)
         else
            exit
         endif
      enddo
      print*,'Atoms'
      print'(10a5)',atom0(1:natom0)
c
c     read the basis set
c
      print*,'Basis set'
      nbbas=0
      iattot=0
      ii=42076
      krc=c_lseek(jrc_comfile,ii)
      do k=1,maxat
         krc=c_read(jrc_comfile,c,4)
         nbbas=nbbas+1
         multat(nbbas)=ic(1)
         print*,'multat',nbbas,multat(nbbas)
         iattot=iattot+multat(nbbas)
         if(iattot.eq.natom0) exit
      enddo
      ii=58076
      krc=c_lseek(jrc_comfile,ii)
      do k=1,nbbas
         krc=c_read(jrc_comfile,c,4)
         ncouch(k)=ic(1)
         print*,'ncouch',k,ncouch(k)
      enddo
      i_contr=10076
      i_prim=2076
      i_exp=1233840
      do k=1,nbbas
         do l=1,ncouch(k)
            krc=c_lseek(jrc_comfile,i_prim)
            krc=c_read(jrc_comfile,c,4)
            i_prim=i_prim+4
            iprim=ic(1)
c            print*,'iprim',iprim
            krc=c_lseek(jrc_comfile,i_contr)
            krc=c_read(jrc_comfile,c,4)
            icontr=ic(1)
            i_contr=i_contr+4
            print*,'iprim,icontr',iprim,icontr
            krc=c_lseek(jrc_comfile,i_exp)
            krc=c_read(jrc_comfile,c,iprim*8)
            do i=1,iprim
               print'(f15.8)', ac(i)
            enddo
            krc=c_read(jrc_comfile,c,iprim*8*icontr)
            krc=c_read(jrc_comfile,c,iprim*8*icontr)
            do i=1,iprim
               print'(10f10.6)', (ac(i+ll*iprim),ll=0,icontr-1)
            enddo
            i_exp=i_exp+(iprim+iprim*icontr*2)*8
         enddo
         i_exp=i_exp+multat(k)*3*8
      enddo
      return
      end
 
