      subroutine totave (mcangs, chnst, sx2, sx, ntot)                  TOTA001
c                                                                       TOTA002
      include 'brkcln.par'                                              TOTA003
c                                                                       TOTA004
      real     mcangs(nmnang,maxres), sx2, sx                           TOTA005
c                                                                       TOTA006
c     real     ave                                                      TOTA007
c                                                                       TOTA008
      integer  j, ntot, chnst                                           TOTA009
c                                                                       TOTA010
      logical xney                                                      TOTA011
c                                                                       TOTA012
      sx  = 0.0                                                         TOTA013
      sx2 = 0.0                                                         TOTA014
      do 11 j = 1, chnst                                                TOTA015
      if (xney(mcangs(1,j),null)) then                                  TOTA016
         sx2 = sx2 + (mcangs(1,j) * mcangs(1,j))                        TOTA017
         sx = sx + mcangs(1,j)                                          TOTA018
         ntot = ntot + 1                                                TOTA019
      end if                                                            TOTA020
   11 continue                                                          TOTA021
      end                                                               TOTA022
