      subroutine outci(ci)
c****************************************************************
c
c  purpose : to write the current matrix to a data file, inserting
c             zeros at boundry edges.
c
c****************************************************************
c
      include 'ctparm.inc'
      include 'ctgeom.inc'
      include 'mmiounit.inc'

      complex ci(1), cvalue
      integer ipatch, numbas, ibasnum, ipos
      integer iget_num_basis, iget_matrix_position

      do ipatch=1,nfaces
        numbas = iget_num_basis(ipatch)
        do ibasnum=1,numbas
          ipos = iget_matrix_position(ipatch,ibasnum)
          if(ipos .eq. 0) then
      	    cvalue = cmplx(0.,0.)
          else
            cvalue = ci(ipos)
          endif
        
          write(irw3,100) ipatch, ibasnum, cvalue
        end do
      end do

100   format(i5,i5,2e15.6)
          

      return
      end
