! --------------------------------------------------------------  !
     subroutine x_rdat_p(msgtype,istat)
! -------------------------------------------------------------- !
! Purpose: This subroutine receives data from ct that will be 
!          be distributed to ms for atomic kinetic cal.
! -------------------------------------------------------------- !
     use x_gpvm_p
     use x_gdat

     implicit none

     integer :: i
     integer :: istat
     integer :: msgtype
     include 'fpvm3.h'
     external fbuff

     call pvmfrecv( mptid, msgtype, info )
     call pvmfunpack( integer4, istat, 1, 1, info )
     write(1,*) 'istat=',istat
     if(istat.eq.0) return 
     call pvmfunpack( integer4, rcv_p, 1, 1, info )
     call pvmfunpack( real8, r8_frm_p, rcv_p, 1, info )

      do i=1,rcv_p
         write(1,*) 'r8_frm_p(',i,')=',r8_frm_p(i)
         call fbuff ()
      enddo     

     end
