      subroutine reoitp(n,nc,ntp)
      use module
      IMPLICIT REAL(8)(A-H,O-X,Z),logical(1)(y)
      integer,allocatable,dimension(:) :: itptmp
      dimension ntptmp(0:100),ntp(0:nc)
      yw=.false.
      allocate(itptmp(size(itp1)))
      if(yw)print'(a,27i6)','ntp',ntp(1:nc)
      if(yw)print*,'ntp',ntp(1:nc)
      nn=0
      ntp(0)=0
      do k=1,nc
         ntp(k)=ntp(k)+ntp(k-1)
      enddo
      if(yw)print'(a,27i6)','ntp',ntp(1:nc)
      if(yw)print'(a,27i6)','ltp1',ltp1(1:n)
      ntptmp=0
      do k=1,n
         kk=ltp1(k)
         if(yw)print*,'k,kk',k,kk,n
         ntptmp(kk)=ntptmp(kk)+1
         if(yw)print*,'ntptmp(kk)',ntptmp(kk)
         if(yw)print*,'ntp(kk-1)',ntp(kk-1)
         if(yw)print*,ntptmp(kk)+ntp(kk-1)
         itptmp(ntptmp(kk)+ntp(kk-1))=itp1(k)
      enddo
      itp1(1:n)=itptmp(1:n)
      ntptmp=0
      do k=1,n
         kk=ltp1(k)
         ntptmp(kk)=ntptmp(kk)+1
         itptmp(ntptmp(kk)+ntp(kk-1))=itp2(k)
      enddo
      itp2(1:n)=itptmp(1:n)
      deallocate(itptmp)
      if(yw)print'(a,27i3)','ntp',ntp(1:nc)
      if(yw)print'(a,27i3)','ntptmp',ntptmp(1:nc)
      if(yw)print'(a,27i3)','itp1(1:n)',itp1(1:n)
      if(yw)print'(a,27i3)','itp2(1:n)',itp2(1:n)
      !ntp=ntp+1
      return
      end
      
         
      

