      SUBROUTINE CMPIND
C
      INCLUDE "parmwave"
C
      PARAMETER(MWAVEP=MWAVE+1,
     1          MDIM=(MWAVE+1)*(MWAVE+1)*2*IROMB+
     2               (MWAVE+1)*(MWAVE+2)*(1-IROMB))
C
      COMMON/COMIND/ INDXNN(MDIM),INDXMM(MDIM)
C
C  INDXNN(MDIM) :  1-D INDEX OF CONVERTING INPUT FORM SPHER COEFF ARRAY
C                  TO TRANSPOSED FORM ARRAY
C  INDXMM(MDIM) :  1-D INDEX OF CONVERTING TRANSPOSED FORM SPHER COEFF
C                  ARRAY TO INPUT FORM SPHERICAL COEFF ARRAY
C
      IF(IROMB.EQ.0) THEN
      L=0
      DO 10 M=1,MWAVEP
      NEND=MWAVEP-M+1
      DO 10 NN=1,NEND
      N=NN+M-1
      L=L+2
      INDX=(MWAVEP*(N-M)-(N-M)*(N-M-1)/2+M)*2-1
      INDXNN(L-1)=INDX
      INDXNN(L  )=INDX+1
   10 CONTINUE
C
      L=0
      DO 20 NN=1,MWAVEP
      LLN=MWAVEP-NN+1
      DO 20 LL=1,LLN
      N=LL+NN-1
      M=LL
      INDX=(M*MWAVEP-(MWAVEP-N)-(M-1)*M/2)*2-1
      L=L+2
      INDXMM(L-1)=INDX
      INDXMM(L  )=INDX+1
   20 CONTINUE
      RETURN
      ENDIF
C
      IF(IROMB.EQ.1) THEN
      L=0
      DO 30 M=1,MWAVEP
      DO 30 NN=1,MWAVEP
      N=NN+M-1
      INDX=((N-M)*MWAVEP+M)*2-1
      L=L+2
      INDXNN(L-1)=INDX
      INDXNN(L  )=INDX+1
   30 CONTINUE
C
      L=0
      DO 40 NN=1,MWAVEP
      DO 40 LL=1,MWAVEP
      N=LL+NN-1
      M=LL
      INDX=(MWAVEP*(M-1)+N-M+1)*2-1
      L=L+2
      INDXMM(L-1)=INDX
      INDXMM(L  )=INDX+1
   40 CONTINUE
      RETURN
      ENDIF
C
      END
