      SUBROUTINE FORMCD (C,IAUX,DTIME,LSTA,LCNT,KIND,B)

*** COMPUTE OBS. EQ. COEFFICIENTS FOR CRUSTAL DEFORMATION PARAMETERS

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      COMMON /STRUCT/ NSTA,NAUX,NUNK,IDIM,NSTAS,NOBS,NCON,NZ,NCD
      COMMON /CONST/ PI,PI2,RAD,RADSEC,TWOPI
      DIMENSION C(31),B(*),LSTA(3)
      DIMENSION WEI(2,2)

      IF (KIND.EQ.10) THEN
        N = 2
      ELSE
        N = 3
      ENDIF

      IF (IAUX.EQ.0) THEN
        INDEX = 6
      ELSE
        INDEX = 7
      ENDIF
        DO 40 LGRID = 1, LCNT

          CALL GETGLA(GLA, LSTA(LGRID), B)
          CALL GETGLO(GLO, LSTA(LGRID), B)

          CALL GRDPOS(GLO, GLA, IGRID, JGRID)
          CALL GRDWEI(GLO, GLA, IGRID, JGRID, WEI)

          DO 30 IGRD = IGRID, (IGRID + 1)
            DO 20 JGRD = JGRID, (JGRID + 1)
              DO 10 IVEC = 1, N
                INDEX = INDEX + 1   
                C(INDEX) = C(IVEC + (3 * (LGRID - 1))) * DTIME
     &                   * WEI(IGRD - IGRID + 1, JGRD - JGRID + 1)
   10         CONTINUE
   20       CONTINUE
   30     CONTINUE
   40   CONTINUE

      RETURN
      END
