      subroutine copy_qmix2(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,fac,w

      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
      fac = 1.0
      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'
      w=1.0
      j=1
c      do j=1,ng
c       do i=1,nl
c          print*, qmix_in(i,1) , zt(i)
c       enddo
           do i=1,nl
              if(zt(i) .gt. 63.0) then
                 qmix_out(i,j) = qmix_in(i,j)*fac 
              elseif( zt(i)  .gt. 53.0 ) then

                 w = (zt(i) - 53.0) / 10.0
                  qmix_out(i,j) = qmix_in(i,j)*fac *w

c                print*, w, zt(i)
c                 w = log(qmix_in(i,j)*fac) *w
c                 qmix_out(i,j) = exp(w)

              else 

                  qmix_out(i,j) = 1.e-14
              endif

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

