subroutine rfxqlo_xpsi(id_xphi,id_q,xpsi_name,id_xpsi,ierr)

  !  using an xplasma sqrt(Phi/Philim) grid (id_xphi) and
  !  a q profile (id_q) construct a function sqrt(Psi/Psilim) with
  !  name (xpsi_name) and return its xplasma id (id_xpsi)

  implicit NONE

  integer, intent(in) :: id_xphi    ! xplasma id: x=sqrt(Phi/Philim) grid
  integer, intent(in) :: id_q       ! xplasma id: q(x) profile
  character*(*), intent(in) :: xpsi_name    ! name for sqrt(Psi/Psilim)

  integer, intent(out) :: id_xpsi   ! id of sqrt(Psi/Psilim) profile created.
  integer, intent(out) :: ierr      ! status code, 0=OK

  !-----------------------------
  !  DMC Apr 2007:  actual code moved to old_xplasma/equigs_xpsi.f90
  !  to enable access indirectly from "geqxpl" which has been modified with
  !  an option to write TORIC equigs files.
  !-----------------------------

  call equigs_xpsi(id_xphi,id_q,xpsi_name,id_xpsi,ierr)

end subroutine rfxqlo_xpsi
