      subroutine copy_qmix(qmix_in, qg_in ,ml_in, mgs_in,
     &                         qmix_out, qg_out, ml_out, mgs_out,
     &                         nl, ng, zt)
      implicit none
cccccccccccccccccccccccccccccccccccccccccccccccccccccccc
      integer*4  ml_out, ml_in, mgs_in, mgs_out, nl, ng
     
      real*4 qmix_in, qmix_out,zt, qg_in, qg_out

      dimension qmix_in(ml_in, mgs_in), qg_in(2,ml_in,mgs_in), 
     &   qmix_out(ml_out, mgs_out), qg_out(2,ml_out,mgs_out),
     &   zt(ml_in)
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
      integer i,j
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
      if( nl .gt. ml_out) then
        print*,'copy_qmix: dimension error : nl > ML_OUT',nl,ml_out
        stop
      endif
      if( ng .gt. mgs_out)
     &      stop 'copy_qmix: dimension error : ng > MGS_OUT'

      do j=1,ng
           do i=1,nl
              qmix_out(i,j) = qmix_in(i,j)
              qg_out(1,i,j) = qg_in(1,i,j)
              qg_out(2,i,j) = qg_in(2,i,j)
c      print*, qmix_out(i,j), zt(i) 
           enddo
c       print*,'&'
      enddo
c        stop 'check it out '
      return
      end
