subroutine nubeam_workpath_retrieve(zpath)

  !  retrieve nubeam_workpath (used for file naming)

  use nbi_com
  implicit none

  character*(*), intent(out) :: zpath


  zpath = workpath

end subroutine nubeam_workpath_retrieve

subroutine nubeam_workpath_reset(zpath)

  !  reset nubeam_workpath (used for file naming)
  !  might be reset when debugging, to work in the same directory as
  !  the files.  but, if this is done, the workpath should be restored
  !  before state is saved:
  !
  !     (restore state)
  !
  !     call nubeam_workpath_retrieve(save_path)
  !     call nubeam_workpath_reset(my_path)
  !
  !     (do calculation)
  !
  !     call nubeam_workpath_reset(save_path)
  !
  !     (save  state)
  !
  !  this call should be done prior to start of nubeam step calculation
  !  (not part way through).


  !  retrieve nubeam_workpath (used for file naming)

  use nbi_com
  implicit none

  character*(*), intent(in) :: zpath

  workpath = zpath

end subroutine nubeam_workpath_reset
!++++++++++++++++++++++++++++++++

subroutine nubeam_runid_set(zpath)

  !  set runid# (used for file naming)

  use nbi_com
  implicit none

  character*(*), intent(in) :: zpath


   runid = zpath 

end subroutine nubeam_runid_set
!++++++++++++++++++++++++++++++++

subroutine nubeam_rf_set(iorbrzv_option)

  !  set  rz -orbit integrator if rf mc operater on

  use nbi_com
  implicit none
  integer,intent(in) :: iorbrzv_option

   orbrzv_option=iorbrzv_option

 end subroutine nubeam_rf_set
!++++++++++++++++++++++++++++++++

subroutine nubeam_rf_retrieve(iorbrzv_option,iorbrzv_rf_option)

  !  retrieve rz -orbit integrator

  use nbi_com
  implicit none
  integer,intent(out) :: iorbrzv_option,iorbrzv_rf_option

   iorbrzv_option=orbrzv_option
   iorbrzv_rf_option=orbrzv_rf_option

 end subroutine nubeam_rf_retrieve
!++++++++++++++++++++++++++++++++

subroutine nubeam_mib_retrieve(mmib)

  !  retrieve mib# (number of beams)

  use nbi_com
  implicit none

  integer, intent(out) :: mmib


   mmib=mib 

end subroutine nubeam_mib_retrieve
!++++++++++++++++++++++++++++++++

subroutine nubeam_frac_retrieve( nbeam_set,ffulla_rtr,fhalfa_rtr)

  !  retrieve energy for a given beam#

  use nbi_com
  implicit none

  integer, intent(in) :: nbeam_set !beam#
  real*8, intent(out) :: ffulla_rtr,fhalfa_rtr

  ffulla_rtr=ffulla(nbeam_set)
  fhalfa_rtr= fhalfa(nbeam_set)

end subroutine nubeam_frac_retrieve
!++++++++++++++++++++++++++++++++

subroutine nubeam_levnbidep_retrieve(mmib)

  !  retrieve lev_nbidep -- atomic physics deposition model
  
  use nbi_com
  implicit none
  
  integer, intent(out) :: mmib
  
  
  mmib=lev_nbidep
  
end subroutine nubeam_levnbidep_retrieve
!++++++++++++++++++++++++++++++++
subroutine nubeam_levmodhalo_retrieve(mmib)
  
  !  retrieve levmod_halo -- switch to halo model
  
  use nbi_com
  implicit none
  
  integer, intent(out) :: mmib
  
  
  mmib=levmod_halo
  
end subroutine nubeam_levmodhalo_retrieve
!++++++++++++++++++++++++++++++++
subroutine nubeam_nbsfinish_set(nbs_finish)

  !  set nbs_finish control# (used for beam fast ion birth source files)

  use nbi_mpi_com
  implicit none

  integer, intent(inout) :: nbs_finish
  integer :: mpierr

  
#ifdef __MPI
  call mpi_bcast(nbs_finish,1,MPI_INTEGER,0,nbi_comm,mpierr)
#endif
  
end subroutine nubeam_nbsfinish_set
