      SUBROUTINE CLMOIO(ICORE,MAXCOR,NOCCO,NVRTO,IUHF)
C
C THIS ROUTINE CALCULATES THE ADDRESSES OF THE VARIOUS LISTS
C  IN THE MOINTS FILE.  
C
C THIS ROUTINE IS CALLED IN INTPRC TO INITIALIZE THE MOINTS FILE
C AND TO CREATE ALL THE INTEGRAL AND AMPLITUDE LISTS ON MOINTS
C (AT LEAST THE STANDARD LISTS)
C
CEND
      IMPLICIT INTEGER(A-H,O-Z)
      DOUBLE PRECISION DSPPCT
      LOGICAL DOALL,ABIJ,NOABCD
      COMMON /FLAGS/ IFLAGS(100)
      COMMON /LISTS/ MOIO(10,500),MOIOWD(10,500),MOIOSZ(10,500),
     &               MOIODS(10,500),MOIOFL(10,500)
      COMMON /MACHSP/ IINTLN,IFLTLN,IINTFP,IALONE,IBITWD
      COMMON /FILES/ LUOUT,MOINTS
      COMMON /FILSPC/ ILNBUF,IPRCLN,IPRCWD
      COMMON /SYMINF/ NSTART,NIRREP,IRREPA(255),IRREPB(255),
     &DIRPRD(8,8)
      COMMON /CONTROL/ IPRNT,IXXX,IXXX2
      COMMON /DOINTS/ DOALL,ABIJ,NOABCD
      DIMENSION NOCCO(2),NVRTO(2),ICORE(MAXCOR)
      IX1(I)=(I*(I-1))/2
      IX2(I)=(I*(I+1))/2
      NOCCA=NOCCO(1)
      NOCCB=NOCCO(2)
      NVRTA=NVRTO(1)
      NVRTB=NVRTO(2)
      NINT=0
      NAMP=0
      IMODE=1
      IMODE3=1
      CALL IZERO(MOIO,8000)
      NFULL=NOCCA*NOCCB*NVRTA*NVRTB
C***********************************************************************
C PHHH INTEGRALS.
C
      IF(.NOT.ABIJ)THEN
       CALL INIPCK(1,3,16,7,IMODE,0,1)
       IF(IUHF.NE.0)THEN
        CALL INIPCK(1,4,17,8,IMODE,0,1)
        CALL INIPCK(1,14,11,9,IMODE,0,1)
       ENDIF
       CALL INIPCK(1,14,18,10,IMODE,0,1)
C***********************************************************************
C PHPH INTEGRALS.
C
       CALL INIPCK(1,9,9,23,IMODE,0,1)
       IF(IUHF.NE.0)CALL INIPCK(1,10,10,24,IMODE,0,1)
       CALL INIPCK(1,11,11,25,IMODE,0,1)
       IF(IUHF.NE.0)CALL INIPCK(1,12,12,26,IMODE,0,1)
C***********************************************************************
C PPPH INTEGRALS.
C
       CALL INIPCK(1,1,9,27,IMODE,0,1)
       IF(IUHF.NE.0)THEN
        CALL INIPCK(1,2,10,28,IMODE,0,1)
        CALL INIPCK(1,13,18,29,IMODE,0,1)
       ENDIF
       CALL INIPCK(1,13,11,30,IMODE,0,1)
      ENDIF
C**********************************************************************
C PPPP INTEGRALS.  AA TYPE ARE STORED SYMMETRY PACKED SO WE NEED
C  TO GET THE APPROPRIATE SYMMETRY INFORMATION FIRST.  THESE AND
C  THE HHHH INTEGRALS ARE DONE ONLY IF THE CALCLEVEL IS HIGHER THAN
C  MBPT(2).
C
      IF(.NOT.NOABCD)THEN
       IF(IUHF.NE.0)THEN
        CALL INIPCK(1,1,1,231,IMODE3,0,1)
        CALL INIPCK(1,2,2,232,IMODE3,0,1)
        CALL INIPCK(1,13,13,233,IMODE3,0,1)
       ELSE
C
C  CURRENTLY WE ARE USING FOR GRADIENT RUNS A DIFFERENT THAN IN
C  ENERGY CALCULATIONS
C
        IF(IFLAGS(3).NE.0.OR.IFLAGS(18).NE.0.OR.
     &     IFLAGS(19).NE.0) THEN
         CALL INIPCK(1,13,13,233,IMODE3,0,1)
        ELSE 
         CALL INIPCK(1,5,13,233,IMODE3,0,1)
        ENDIF
       ENDIF
      ENDIF
C**********************************************************************
C HHHH INTEGRALS.  AA TYPE ARE STORED SYMMETRY PACKED SO WE NEED
C  TO GET THE APPROPRIATE SYMMETRY INFORMATION FIRST.
C
      IF(.NOT.ABIJ)THEN
       IF(IUHF.NE.0)THEN
        CALL INIPCK(1,3,3,11,IMODE,0,1)
        CALL INIPCK(1,4,4,12,IMODE,0,1)
       ENDIF
       CALL INIPCK(1,14,14,13,IMODE,0,1)
      ENDIF
C***********************************************************************
C DENOMINATOR ARRAYS
C
      CALL INIPCK(1,1,3,48,IMODE,0,1)
      CALL INIPCK(1,13,14,50,IMODE,0,1)
      IF(IUHF.NE.0)CALL INIPCK(1,2,4,49,IMODE,0,1)
      IF(IFLAGS(21).NE.3)THEN
       CALL INIPCK(1,1,3,64,IMODE,0,1)
       CALL INIPCK(1,13,14,66,IMODE,0,1)
       IF(IUHF.NE.0)CALL INIPCK(1,2,4,65,IMODE,0,1)
      ENDIF
C***********************************************************************
C PPHH INTEGRALS.  THESE SIT NEXT TO T AMPLITUDES ON DISK.
C
      CALL INIPCK(1,1,3,14,IMODE,0,1)
      IF(IUHF.NE.0)THEN
       CALL INIPCK(1,2,4,15,IMODE,0,1)
       CALL INIPCK(1,10,9,17,IMODE,0,1)
       CALL INIPCK(1,10,10,20,IMODE,0,1)
       CALL INIPCK(1,12,11,22,IMODE,0,1)
      ENDIF
      CALL INIPCK(1,13,14,16,IMODE,0,1)
      CALL INIPCK(1,9,10,18,IMODE,0,1)
      CALL INIPCK(1,9,9,19,IMODE,0,1)
      CALL INIPCK(1,11,12,21,IMODE,0,1)
C
C***********************************************************************
C T2 AMPLITUDES (START ON PHYSICAL RECORD BOUNDARY)
C
      CALL INIPCK(1,13,14,46,IMODE,-1,1)
      CALL INIPCK(1,1,3,44,IMODE,0,1)
      IF(IUHF.NE.0)CALL INIPCK(1,2,4,45,IMODE,0,1)
C
C ONLY NEED THE REST FOR POST-MBPT(2) STUFF.
C
      IF(IFLAGS(2).GT.1)THEN
       CALL INIPCK(1,9,9,34,IMODE,0,1)
       CALL INIPCK(1,9,10,37,IMODE,0,1)
       CALL INIPCK(1,11,12,39,IMODE,0,1)
       IF(IUHF.NE.0)THEN
        CALL INIPCK(1,10,9,36,IMODE,0,1)
        CALL INIPCK(1,12,11,38,IMODE,0,1)
        CALL INIPCK(1,10,10,35,IMODE,0,1)
       ENDIF
      ENDIF
      IF(IFLAGS(1).GT.100)CALL FILSUM(IUHF)
      RETURN
      END
