subroutine nbdep_coord_record(ibdy,zlen,zsinth,zcosth,zsinph,zcosph)
 
  use nbi_com
  use nbdep_debug
  use xstraln_calls
 
  !  record ibdy'th position of deposition track
 
  implicit none
  integer, intent(in) :: ibdy  ! which segment bdy position to record
  real(fp), intent(in) :: zlen     ! distance from track start point
  real(fp), intent(in) :: zsinth,zcosth  ! vert. angle sin & cos
  real(fp), intent(in) :: zsinph,zcosph  ! horiz. angle sin & cos
 
  !---------------------------------
  real(fp) zlnhor,zz,zx,zy,zr,zzhgt,zphi
  integer iwarn
  !---------------------------------
 
  if(nlsym2b) then
     zzhgt=plhgt
  else
     zzhgt=0.0_fp
  endif
 
  zz=ysta+zzhgt+zlen*zsinth
 
  zlnhor=zlen*zcosth
 
  zx=rsta-zcosph*zlnhor
  zy=zsinph*zlnhor
 
  zr=sqrt(zx*zx+zy*zy)
 
  if(zr.gt.0) then
     zphi=atan2(zy,zx)
  else
     zphi=0.0_fp
  endif
 
  lb_nbdep(ibdy)=zlen
  r_nbdep(ibdy)=zr
  y_nbdep(ibdy)=zz
  phi_nbdep(ibdy)=zphi
 
  call xs_fxget(0.01_fp,zphi,zr,zz,xi_nbdep(ibdy),th_nbdep(ibdy),iwarn)
 
end subroutine nbdep_coord_record
! 11sep2004 fgtok -s r8_precision.sub nubeam_test_r8.sub "r8con.csh conversion"
! 11sep2004 fgtok
