      function AABACD(IOCCA1, IOCCB1, IOCCA2, IOCCB2, NMOS)
      implicit double precision (A-H,O-Z)
      include 'SIZES'
      include 'MOP6FILE'
      dimension IOCCA1(NMOS), IOCCB1(NMOS), IOCCA2(NMOS), IOCCB2(NMOS)
***********************************************************************
*
* AABACD EVALUATES THE C.I. MATRIX ELEMENT FOR TWO MICROSTATES DIFFERING
*       BY TWO ALPHA MOS. ONE MICROSTATE HAS ALPHA ELECTRONS IN
*       M.O.S PSI(I) AND PSI(J) FOR WHICH THE OTHER MICROSTATE HAS
*       ELECTRONS IN PSI(K) AND PSI(L)
*
***********************************************************************
      common /XYIJKL/ XY(NMECI,NMECI,NMECI,NMECI)
      IJ=0
      do 10 I=1,NMOS
   10 if (IOCCA1(I) .LT. IOCCA2(I)) go to 20
   20 do 30 J=I+1,NMOS
         if (IOCCA1(J) .LT. IOCCA2(J)) go to 40
   30 IJ=IJ+IOCCA2(J)+IOCCB2(J)
   40 do 50 K=1,NMOS
   50 if (IOCCA1(K) .GT. IOCCA2(K)) go to 60
   60 do 70 L=K+1,NMOS
         if (IOCCA1(L) .GT. IOCCA2(L)) go to 80
   70 IJ=IJ+IOCCA1(L)+IOCCB1(L)
   80 IJ=IJ+IOCCB2(I)+IOCCB1(K)
      SUM=(XY(I,K,J,L)-XY(I,L,K,J))
      if (MOD(IJ,2).EQ.1) SUM=-SUM
      AABACD=SUM
      return
      end
