subroutine bb_extrp(ierr)
! extrapolate  radial profile outputs of monte carlo calculation 
! for avg relative energy for beam-beam reactions and
! rms or relative energy for beam-beam reactions )"temperature"
  use nbi_com
!============
! idecl:  explicitize implicit integer declarations:
  implicit none
  integer ien,ib,j,ierr,isb,isb2
!============
  ierr=0
  do ien=1,3
     do ib=1,nbeam
        do isb=1,nsbeam
           call chk_extrapolate(ebb_relx_co(lcentr:ledge,ien,ib,isb),xi(lcentr:ledge,2),nzones)
           if(ierr.ne.0) return
           call chk_extrapolate(rms_ebbx_co(lcentr:ledge,ien,ib,isb),xi(lcentr:ledge,2),nzones)
           if(ierr.ne.0) return
           call chk_extrapolate(ebb_relx_cnt(lcentr:ledge,ien,ib,isb),xi(lcentr:ledge,2),nzones)
           if(ierr.ne.0) return
           call chk_extrapolate(rms_ebbx_cnt(lcentr:ledge,ien,ib,isb),xi(lcentr:ledge,2),nzones)
           if(ierr.ne.0) return
           call chk_extrapolate(ebb_relx_fn(lcentr:ledge,ien,ib,isb),xi(lcentr:ledge,2),nzones)
           if(ierr.ne.0) return
           call chk_extrapolate(rms_ebbx_fn(lcentr:ledge,ien,ib,isb),xi(lcentr:ledge,2),nzones)
           if(ierr.ne.0) return
        enddo
     enddo
  enddo
  return
end subroutine bb_extrp
!------------------------------------------------------------
    
