
!******************** start file gphase.for ; group orbit ******************
!--------------------------------------------------------------
!  dmc garching oct 1985 - seperate phase angle generation routine
!
subroutine gphase
  !
  use nbi_com
  use nbi_random_pll
  !
  !
  !	first need to get orbit phase angle
  !	this section of code evaluates cos and sin of a random
  !	angle, using different techniques on the vax and on the
  !	cray
  !	rob goldston 12/15/82
  !
  !============
  implicit none
  integer :: idum
  !============
  real(fp) :: zrang
  !============
  zrang=nbrandm_pll(idum)*twopi		!@
  sinpho=sin(zrang)			!@
  cospho=cos(zrang)			!@
  !
  !@ 110	continue
  !@	zxposi=2.0*nbrandm_pll(idum)-1.0
  !@	zyposi=2.0*nbrandm_pll(idum)-1.0
  !@	zsqrad=zxposi*zxposi+zyposi*zyposi
  !@	if((zsqrad.gt.1.0).or.(zsqrad.lt.1.0e-15)) goto 110
  !@	zsqrad=1.0/zsqrad
  !@	sinpho=2.0*zxposi*zyposi*zsqrad
  !@	cospho=(zxposi*zxposi-zyposi*zyposi)*zsqrad
  !
  return
end subroutine gphase
!******************** end file gphase.for ; group orbit ******************
