
      subroutine colxs (ngfine,ngcoar)
c
c     *****************************************************************
c
c     this subroutine collapses group cross sections 
c
c     input:
c        ***             formal parameters
c        ngfine   i      number of groups in fine group structure,
c                        i.e., number of groups in initial set
c        ngcoar   i      number of groups in coarse group structure,
c                        i.e., number of groups in final set
c        ***             collapse data
c        ngf1     i      first fine group to be used in collapse
c        ngf2     i      last fine group to be used in collapse
c        nfng     i(*)   coarse group number corresponding to given 
c                        fine group          
c        wgt      r(*)   weighting for each fine group for the 
c                        corresponding coarse group
c        ***             target data
c        nrec     i      number of reactions for this target
c        crossf   r(*,*) fine group cross section values
c
c     output:
c        ***             target data
c        crossg   r(*,*) coarse group cross section values
c
c     *****************************************************************
c
      integer    ngfine,ngcoar
c
      include    'limit.h'
      include    'collap.h'
      include    'target.h'
      integer    itemp,jtemp,ktemp
c
c     if (no collapsing needed) then
      if (ngfine .eq. ngcoar) then
c
c        copy cross sections
         do 20 itemp = 1,nrec
            do 10 jtemp = 1,ngfine
10          crossg(itemp,jtemp) = crossf(itemp,jtemp)
20       continue
c
c     else (if need collapsing) then
      else
c
c        loop over reactions
         do 50 itemp = 1,nrec
c
c           zero cross sections
            do 30 jtemp = 1,ngcoar
30          crossg(itemp,jtemp) = 0.0
c
c           collapse cross sections
            do 40 jtemp = ngf1,ngf2
               ktemp = nfng(jtemp)
               crossg(itemp,ktemp) = crossg(itemp,ktemp) +
     1                               wgt(jtemp)*crossf(itemp,jtemp)
40          continue
c
c        end loop over reactions
50       continue
c
c     endif
      endif
c
c     return
      return
      end
