      subroutine
     *ecrinfo(file,ifil,ifinfo,prog,nsym,isym,norb,ycl1,nb_ijcl
     *,nprint,noa,nb_ijcloc,label)
      IMPLICIT REAL(8)(A-H,O-X,Z),logical(1)(y)
      integer isym(nsym),frozen(8)
      character(100000) namel1
      character(1) :: cote=''''
      character(*) :: file,prog
      character(4),allocatable,dimension(:) :: atom
      character(4),allocatable,dimension(:) :: atom1
      character(8),dimension(noa) :: label
      double precision,allocatable,dimension(:,:) :: coorn
      integer,save,dimension(8,8) :: its=  reshape(
     *                                      (/ 1,2,3,4,5,6,7,8,
     *                                         2,1,4,3,6,5,8,7,
     *                                         3,4,1,2,7,8,5,6,
     *                                         4,3,2,1,8,7,6,5,
     *                                         5,6,7,8,1,2,3,4,
     *                                         6,5,8,7,2,1,4,3,
     *                                         7,8,5,6,3,4,1,2,
     *                                         8,7,6,5,4,3,2,1/),
     *                                         (/8,8/))
      call titre('Fabrication de la file Info#',40)
      open(ifil,file=file,status='unknown')
      rewind ifinfo
      call LECNAM('&COST_AO',namel1,ifinfo,ierr,0)
      call nameld(namel1,ENUC,'ENUC',8)
      call nameli(namel1,NATOM,'NATOM',4)
      call nameli(namel1,NSYM,'NSYM',4)
      allocate (atom(nsym*natom))
      allocate (atom1(nsym*natom))
      call namela(namel1,ATOM,'ATOM')
      allocate(coorn(3,natom*nsym))
      call reorinfo(atom,atom1,natom,coorn)
      !
      !
 1001 format(a,8(i4,','))
      write(ifil,'(a)') ' &cost_AO'
      write(ifil,'(a,i1)')' nsym=1'
      write(ifil,1001) ' isym=',noa
      write(ifil,'(a6,i5)')' norb=',noa
      write(ifil,'(a6)')' its=1'
!      do j=1,nsym
!      write(ifil,'(6x,8(i1,'',''))') (its(i,j),i=1,nsym),(0,i=nsym+1
!     &   ,8)
!      enddo
      write(ifil,'(a,f20.12)') ' enuc=',enuc
      write(ifil,'(a,i4)')' natom=',natom
      write(ifil,'(a)') ' atom='
      !write(6,1003) (cote,atom(k),cote,k=1,natom)
      write(ifil,1003) (cote,atom(k),cote,k=1,natom)
 1003 format(100(1x,5(a1,a4,a1,','),/))
      if(nprint>1)print*,'labels'
      if(nprint>1)print*,label
      write(ifil,'(a)')' label='
      if(nprint>1)print 1002,(cote,label(k),cote,k=1,noa)
      write(ifil,1002) (cote,label(k),cote,k=1,noa)
 1002 format(100(1x,5(a1,a8,a1,','),/))

      write(ifil,'(a)')' coor='
      if(nprint>1)write(6,'(a)')' coor='
      do l=1,natom
         write(ifil,'(3(f20.10,'',''))') coorn(:,l)
         if(nprint>1)write(6,'(3(f20.10,'',''))') coorn(:,l)
      enddo
      write(ifil,'(a)')' /'
      !
      !
      call LECNAM('&COST_MO',namel1,ifinfo,ierr,0)
      call nameli(namel1,norb,'NORB',4)
      call nameli(namel1,NOC,'NOC',4)
      call nameli(namel1,FROZEN,'FROZEN',4)
      call nameld(namel1,potnuc,'ENUC',8)
      write(ifil,'(a)') ' &cost_MO'
      write(6,'(a7,a6,i4,a5,i4)')' nsym=1',',norb='
     *,norb,',noc=',noc
      write(6,'(a7,i4,a2)') ' itsym=',norb,'*1'
      !write(6,'(1x,20(20(i1,'',''),/,1x))')(1,i=1,norb)
      write(ifil,'(a7,a6,i4,a5,i4)')' nsym=1',',norb='
     *,norb,',noc=',noc
      write(ifil,'(a7,i3,a)') ' itsym=',norb,'*1,'
!      write(ifil,'(1x,20(20(i1,'',''),/,1x))')(1,i=1,nnorb)
      write(ifil,'(a6,8(i3,'',''))') ' isym=',norb
      write(ifil,'(a8,8(i3,'',''))') ' frozen=',sum(frozen(1:nsym))
      write(ifil,'(a6,d20.12)')' enuc=',potnuc
      write(6,'(a6,d20.12)')' enuc=',potnuc
      write(ifil,'(a5,l1)')' ycl=',ycl1
      write(6,'(a5,l1)')' ycl=',ycl1
      write(ifil,'(a8,i7)')' n_ijcl=',nb_ijcl
      write(6,'(a8,i7)')' n_ijcl=',nb_ijcl
      write(6,'(a8,i7)')' nb_ijcloc=',nb_ijcloc
      write(ifil,'(a5)') ' /'
      write(6,'(a2)') ' /'
      close(ifil)
      deallocate(atom1)
      deallocate(atom)
      deallocate(coorn)
      return
      end
      
      
       subroutine ecrlocinfo
      use module
      IMPLICIT REAL(8)(A-H,O-X,Z),logical(1)(y)
      call titre('Fabrication de la file ijcllocinfo#',40)
      open(46,file=trim(prefix)//'ijcllocinfo',status='unknown')
      write(46,'(1x,a)') '&LOCINF'
      if(itest(1)==1) then
         write(46,'(1x,a)') "INTSY='SYM'"
         write(46,'(1x,a,i1)') "NSYM=",nsym
         write(46,'(1x,a)') "IMAGE="
         do is=1,nsym
            ifin=0
            do io=1,norb,15
               ideb=ifin+1
               ifin=min(ideb+14,norb)
               write(46,'( 15(i4,","))') image(ideb:ifin,is)
            enddo
         enddo
         write(46,'(1x,a)') "IMAGES="
         do is=1,nsym
            ifin=0
            do io=1,norb,20
               ideb=ifin+1
               ifin=min(ideb+19,norb)
               write(46,'( 20(i2,","))') images(ideb:ifin,is)
            enddo
         enddo
      else
         write(46,'(1x,a)') "INTSY='NOSYM'"
      endif
      write(46,'(a,l1,a,f20.8)') ' all_linked=',all_linked,',slid=',slid
      write(46,'(1x,a)') '/'
      close(46)
      return
      end
