      function BABBBC(IOCCA1, IOCCB1, IOCCB2, NMOS)
      implicit double precision (A-H,O-Z)
      include 'SIZES'
      include 'MOP6FILE'
      dimension IOCCA1(NMOS), IOCCB1(NMOS), IOCCB2(NMOS)
***********************************************************************
*
* BABBBC EVALUATES THE C.I. MATRIX ELEMENT FOR TWO MICROSTATES DIFFERING
*       BY ONE BETA ELECTRON. THAT IS, ONE MICROSTATE HAS A BETA
*       ELECTRON IN PSI(I) AND THE OTHER MICROSTATE HAS AN ELECTRON IN
*       PSI(J).
***********************************************************************
      common /XYIJKL/ XY(NMECI,NMECI,NMECI,NMECI)
      common /BASEOC/ OCCA(NMECI)
      do 10 I=1,NMOS
   10 if (IOCCB1(I).NE.IOCCB2(I)) go to 20
   20 IJ=0
      do 30 J=I+1,NMOS
         if (IOCCB1(J).NE.IOCCB2(J)) go to 40
   30 IJ=IJ+IOCCA1(J)+IOCCB1(J)
   40 IJ=IJ+IOCCA1(J)
C
C   THE UNPAIRED M.O.S ARE I AND J
      SUM=0.D0
      do 50 K=1,NMOS
   50 SUM=SUM+ (XY(I,J,K,K)-XY(I,K,J,K))*(IOCCB1(K)-OCCA(K)) +
     1          XY(I,J,K,K)             *(IOCCA1(K)-OCCA(K))
      if (MOD(IJ,2).EQ.1) SUM=-SUM
      BABBBC=SUM
      return
      end
