subroutine rfxqlo_ion_dflts(zions)
  !  get default settings for instance of rfxqlo_ion compound data type
  use rfxqlo_types
  implicit NONE
  type (rfxqlo_ion), intent(out) :: zions

  zions%n_ions = 0

  zions%a_ions = 0
  zions%z_ions = 0
  zions%name_ions = " "

  zions%xnam_ni=" "
  zions%xnam_ti=" "
  zions%xnam_tpll=" "

  zions%id_ni=0
  zions%id_ti=0
  zions%id_tpll=0

end subroutine rfxqlo_ion_dflts

subroutine rfxqlo_ion_set(zions,ierr)
  !  define ion settings for rfxqlo module
  use rfxqlo_private
  implicit NONE
  type (rfxqlo_ion), intent(in) :: zions
  integer, intent(out) :: ierr     ! 0: OK; 1: error

  ierr=0
  have_ions = .TRUE.
  rfx_ions = zions

end subroutine rfxqlo_ion_set

subroutine rfxqlo_ion_get(zions,ierr)
  !  fetch ion settings from rfxqlo module
  use rfxqlo_private
  implicit NONE
  type (rfxqlo_ion), intent(out) :: zions
  integer, intent(out) :: ierr     ! 0: OK; 1: error

  ierr=0
  if(.not.have_ions) then
     ierr=1
     write(lunmsg,*) &
          ' ?rfxqlo_ion: ion settings have not been provided', &
          ' to rfxqlo module.'
  else
     zions = rfx_ions
  endif

end subroutine rfxqlo_ion_get
