!******************** start file nbzero.for ; group nbzero *************
!
!***********************************************************
!
!	this subroutine zeroes the source arrays
!
!	upgrade to allow for bpcxin (cx from inside the plasma) as well
!	as bpcxot (cx from outside the plasma)
!	rob goldston  july 21, 1983
!
!   ** see also routines nbsv00, nb2_fp0, nbcx00 below **
!
subroutine nbzero
  !
  use nbi_com
  !
  !============
  implicit none
  integer :: i,ireact,isb,ien,ig,ib,ibs,ie,ij,inesc,ish,ixsi,j,iz
  !============
  bbntns=0.0_fp
  btntns(1:mzones,1:10)=0.0_fp
  btntrs(1:mzones,1:10)=0.0_fp
  btntws(1:mzones,1:10)=0.0_fp
  btntns(1:mzones,13:nreact)=0.0_fp
  btntrs(1:mzones,13:nreact)=0.0_fp
  btntws(1:mzones,13:nreact)=0.0_fp

  sbcx0s=0._fp
  sbcxris=0._fp
  sbcxrbs=0._fp
  sbcxres=0._fp
  sbcxrzs=0._fp
  sbcxrls=0._fp
  sorbes=0._fp
  sorbes_dep=0._fp
  sbedeps=0.0_fp
  sbiedeps=0.0_fp
  sbizdeps=0.0_fp
  sbildeps=0.0_fp
  sbbxdps=0.0_fp
  sbbidps=0.0_fp
  sbcxdpe=0.0_fp
  sbedepe=0.0_fp
  sbiedepe=0.0_fp
  sbizdepe=0.0_fp
  sbildepe=0.0_fp
  sbbxdpe=0.0_fp
  sbbidpe=0.0_fp
  tqrpls=0.0_fp
  !
  tirorbs=0.0_fp
  tirabds=0.0_fp
  tirfshs=0.0_fp
  tirrips=0.0_fp
  !
  pbephis=0.0_fp
  pbephis_dep=0.0_fp
  !
  tqbcxs=0.0_fp
  tqbcxs_dep=0.0_fp
  !
  tqjxbs=0.0_fp
  tqjxbs_dep=0.0_fp
  !  radial current sums
  tirtots=0.0_fp
  tirtots_dep=0.0_fp
  fpixbts=0.0_fp
  fpixbts_dep=0.0_fp
  !
  difbx=0.0_fp
  velbx=0.0_fp
  wgvdx=0.0_fp
  !
  pljbbms=0.0_fp
  pljbcct=0.0_fp
  pbis=0.0_fp
  pbes=0.0_fp
  pbcprss=0.0_fp
  pbdfbis=0.0_fp
  pbdfbes=0.0_fp
  pbths=0.0_fp
  pbthr2s=0.0_fp
  pbohs=0.0_fp
  !
  sorbths=0.0_fp
  ! stuff added for momentum transfer upgrades jan 1987
  tqbis=0._fp
  tqbes=0._fp
  tqbths=0._fp
  wtqbxfs=0._fp
  tqbxfs=0._fp
  tqrpls=0._fp
  tqohbs=0._fp
  tqdifbs=0.0_fp
  !
  bdenss=0.0_fp
  omegabs=0.0_fp
  ebapp2s=0.0_fp
  ebapl2s=0.0_fp
  !
  sbcxrxs=0.0_fp
  sinbn0s=0.0_fp
  sinb0is=0.0_fp
  sorbhs=0._fp
  sorbhs_dep=0._fp
  sorbn0s=0._fp
  sorbn0s_dep=0._fp
  sn0s3dh=0._fp
  !  zero 1st gen beam neut dens. arrays
  bn00t=0.0_fp
  bn00=0.0_fp
  vpvn00=0.0_fp
  !
  densfi=0.0_fp
  !  trapping fraction data (by energy range)
  btrape=0.0_fp
  wtrape=0.0_fp
        !  trapping fraction data (deposition & avg'd over slowing down pop.)
  btrap=0.0_fp
  wtrap=0.0_fp
  btrap0=0.0_fp
  wtrap0=0.0_fp
        !
  !  pitch & slowing down times
  taubsl=0.0_fp
  taubpa=0.0_fp
  tbtrap=-0.1_fp
  tbtrap0=-0.1_fp

  bpfshs=0.0_fp
  bxfshs=0.0_fp
  bphfshs=0.0_fp
  
  bprpls=0.0_fp
  bxrpls=0.0_fp
  bphrpls=0.0_fp
  
  bpcxins=0.0_fp
  bpcxots=0.0_fp
  bpcxi0s=0.0_fp
  bpcxx0s=0.0_fp
  bpcxers=0.0_fp
  bpcxris=0.0_fp
  bpcxrxs=0.0_fp
  bph0was=0.0_fp
  bphcxls=0.0_fp
  bphrcas=0.0_fp
  snbcxs=0.0_fp
  snbcxos=0.0_fp
  sbcxxs=0.0_fp
  pbaepms=0.0_fp
  !
  inesc=0
  btneut=0.0_fp
  rbneut=0.0_fp
  bbntot=0.0_fp
  btnta(1:nreact)=0.0_fp
  bbnta(1:nreact)=0.0_fp
  !
  !  dmc dec 2004 -- removing some old "single species sums"; replacing with
  !  species resolved sums...
  !
  bpshins=0._fp
  bpjxbs=0.0_fp
  bphjxbs=0.0_fp
  bphdeps=0.0_fp
  bphdepsgc=0.0_fp
  bpls=0.0_fp
  bphorbs=0.0_fp
  bxflws=0.0_fp
  bxflws_prompt=0.0_fp
  bpls_dep=0.0_fp
  bphorbs_dep=0.0_fp
  bxflws_dep=0.0_fp
  !
  bpjxbs_dep=0.0_fp
  bphjxbs_dep=0.0_fp
  pljbbm_nb=0.0_fp
  !
  !  momentum balance added jan 1987
  !
  bpshna=0.0_fp
  bpprma=0.0_fp
  !
  !  zero out fpp deposition array
  fbdepco=0.0_fp
  fbdepct=0.0_fp
  !
  !-----------------------------------------------------------------------
  !  dmc feb 1992 -- zero out sums for new scalar ptcl balance checks
  !
     !
  sfshine=0.0_fp
  sfdeprr=0.0_fp
  sfdepmc=0.0_fp
  sfdepba=0.0_fp
  !
  sfdepsc=0.0_fp
  sfdepiz=0.0_fp
  sfdepcx=0.0_fp
  sfdbbiz=0.0_fp
  sfdbbcx=0.0_fp
  !
  sfcx0mc=0.0_fp
  sfcxesc=0.0_fp
  sfcxrr=0.0_fp
  sfcxrmc=0.0_fp
  sfcxbal=0.0_fp
  !
  sforbrr=0.0_fp
  sfdtbmc=0.0_fp
  sforbal=0.0_fp
  !
  sfxrcsc=0.0_fp
  sfxrciz=0.0_fp
  sfxrccx=0.0_fp
  sfrbbiz=0.0_fp
  sfrbbcx=0.0_fp
  !
  snbxtot=0.0_fp
  snbxw0=0.0_fp
  snbxv0=0.0_fp
  snbxbb0=0.0_fp
  snbxbb1=0.0_fp
  snbcxos=0.0_fp
  !
  !  momentum & power terms too
  !
  bperrs=0.0_fp
  bpherrs=0.0_fp
  bphdfbs=0.0_fp
  !
  bpthsfs=0.0_fp
  bptdfbs=0.0_fp
  !
  !  dmc may 1993 -- zero out excited states model sums
  !
  excitr=0.0_fp
  excrie=0.0_fp
  excriz=0.0_fp
  excrii=0.0_fp
  excrcx=0.0_fp
  excrbb=0.0_fp
  excrbx=0.0_fp
  !
  excit0=0.0_fp
  exc0ie=0.0_fp
  exc0iz=0.0_fp
  exc0ii=0.0_fp
  exc0cx=0.0_fp
  exc0bb=0.0_fp
  exc0bx=0.0_fp
  if(nltrk_dep0) then
     if(allocated(track_nbsce)) then
        !
        !     clear neutral track arrays
        !
        track_nbsce=0.0_fp
        xntrack=0.0_fp
        track_rin=0.0_fp
        track_zin=0.0_fp
        track_phiin=0.0_fp
        track_rout=0.0_fp
        track_zout=0.0_fp
        track_phiout=0.0_fp

        track_time=0.0_fp
        track_einj=0.0_fp
        track_sinj=0.0_fp
     else
        write(nonlin,*) &
             ' %nbzero: track_nbsce(...) et al not allocated.'
     end if
  end if

  !
  !  jfs 23 aug 94  zero arrays for summing orbit time-step magn. factor
  do isb = 1, nsbeam
     do iz = 1, mzones
        wttmf (iz,isb) = 0._fp
     end do
  end do
  !
  !   nclass profiles
  !
  bdepb = 0._fp

  pbe_ien = 0._fp
  pbi_ien = 0._fp
  upb_ien = 0._fp
  !
  pbe_nb = 0._fp
  pbi_nb = 0._fp
  pbth_nb = 0._fp
  pbtot_nb = 0._fp
  bdepb_nb = 0._fp
  bdens_nb = 0._fp
  tqbco_nb = 0._fp
  tqbth_nb = 0._fp
  tqjxb_nb = 0._fp
  tqjxb_nb_dep = 0._fp
  tqtot_nb = 0._fp
  !
  wts_ien=0
  ein_ien=0
  dei_ien=0

  bnb_ien=0
  bnbs_ien=0
  pbes_ien=0
  pbis_ien=0
  upbs_ien=0
  !
  ! mg      fnb=0
  ! mg      fvdotb=0
  !
  !  mc unsmoothed profiles
  !
  mc_newdens=0
  mc_dens=0
  !
  !  mpi parallelization related sums
  !
  orb_code_error = 0
  dep_code_error = 0

  xnorbs = 0

  ewghtdep0 = 0
  ewghtdep = 0
  wghtdep = 0
  sdep_oa = 0.0_fp

  sfrac_survive = 0
  wfrac_survive = 0

  wkill = 0
  wnkill = 0

  xncx0_orb = 0.0_fp
  sorbhs_ntr = 0.0_fp
  sorbes_ntr = 0.0_fp
  tirtots_ntr = 0.0_fp
  fpixbts_ntr = 0.0_fp
  pbephis_ntr = 0.0_fp
  tqjxbs_ntr = 0.0_fp
  tqjxbnb_ntr = 0.0_fp
  bpjxbs_ntr = 0.0_fp
  bphjxbs_ntr = 0.0_fp
  sfcxmc1d = 0.0_fp
  snbx1d = 0.0_fp
  pbdepmc = 0.0_fp
  pbdepba = 0.0_fp
  bphshins = 0.0_fp
  bphinjs = 0.0_fp
  bphdpba = 0.0_fp
  return
end subroutine nbzero
!******************** end file nbzero.for ; group nbzero ***************
