!******************** start file nbcx00.for ; group nbzero ******************
!------------------------------------------------------------------
!  nbcx00
!
!  set or clear information used in beam-beam stopping of nth generation
!  beam neutrals -- similar to nbsv00 but used for nth gen (cx)
!  fast neutrals instead of 1st gen (beam deposition) beam neutrals.
!
!  calling argument icall=0:  clear all quantities
!                        =1:  copy quantities current->past timestep
!                             clear current timestep quantities
!
!  during orbitting, the beam cx routines use the previous timestep
!  data while accumulating the current timestep data
!
subroutine nbcx00(icall)
  !
  use nbi_com
  !
  !============
  implicit none
  integer :: icall,isb,j,iz
  !============
  real(fp) :: zfac
  !============
  zfac=real(icall)
  !
  !  1d quantities
  !
  bn0cx=0.0_fp
  be0cx=0.0_fp
  bv0cx=0.0_fp
  !
  !  2d quantities (beam dist fcn zone grid)
  !
  do isb=1,nsbeam
     do iz=1,nfbzns
        bn0x2p(iz,isb)=zfac*bn0cx2(iz,isb)
        bn0cx2(iz,isb)=0.0_fp
        be0x2p(iz,isb)=zfac*be0cx2(iz,isb)
        be0cx2(iz,isb)=0.0_fp
        bv0x2p(iz,isb)=zfac*bv0cx2(iz,isb)
        bv0cx2(iz,isb)=0.0_fp
        bvrhox2p(iz,isb)=zfac*bvrhocx2(iz,isb)
        bvrhocx2(iz,isb)=0.0_fp
        bvthx2p(iz,isb)=zfac*bvthcx2(iz,isb)
        bvthcx2(iz,isb)=0.0_fp
        bvpllx2p(iz,isb)=zfac*bvpllcx2(iz,isb)
        bvpllcx2(iz,isb)=0.0_fp
        balpha_gyrop(iz,isb)=zfac*balpha_gyro(iz,isb)
        balpha_gyro(iz,isb)=0.0_fp
        be20cx2(iz,isb)=0.0_fp
     end do
  end do
  !
  return
end subroutine nbcx00
!******************** end file nbcx00.for ; group nbzero ******************
