      SUBROUTINE SCPMAT(COORD,NPOINT,MATRIX)                            SCPM001
C-----------------------------------------------------------------------SCPM002
C                                                                       SCPM003
C  SUBROUTINE SCPMAT  -  Calculate scalar products matrix from supplied SCPM004
C                        coordinates                                    SCPM005
C                                                                       SCPM006
C----------------------------------------------------------------------+SCPM007
                                                                        SCPM008
      INTEGER       IPT, NPOINT                                         SCPM009
      REAL          COORD(3,NPOINT), MATRIX(3,3), XXSUM, XYSUM, XZSUM,  SCPM010
     &              YYSUM, YZSUM, ZZSUM                                 SCPM011
                                                                        SCPM012
                                                                        SCPM013
C---- Initialise values                                                 SCPM014
      XXSUM = 0.0                                                       SCPM015
      XYSUM = 0.0                                                       SCPM016
      XZSUM = 0.0                                                       SCPM017
      YYSUM = 0.0                                                       SCPM018
      YZSUM = 0.0                                                       SCPM019
      ZZSUM = 0.0                                                       SCPM020
                                                                        SCPM021
C---- Loop through all the data points                                  SCPM022
      DO 500, IPT = 1, NPOINT                                           SCPM023
          XXSUM = XXSUM + COORD(1,IPT) * COORD(1,IPT)                   SCPM024
          XYSUM = XYSUM + COORD(1,IPT) * COORD(2,IPT)                   SCPM025
          XZSUM = XZSUM + COORD(1,IPT) * COORD(3,IPT)                   SCPM026
          YYSUM = YYSUM + COORD(2,IPT) * COORD(2,IPT)                   SCPM027
          YZSUM = YZSUM + COORD(2,IPT) * COORD(3,IPT)                   SCPM028
          ZZSUM = ZZSUM + COORD(3,IPT) * COORD(3,IPT)                   SCPM029
500   CONTINUE                                                          SCPM030
                                                                        SCPM031
C---- Form the scalar products matrix                                   SCPM032
      MATRIX(1,1) = XXSUM                                               SCPM033
      MATRIX(1,2) = XYSUM                                               SCPM034
      MATRIX(1,3) = XZSUM                                               SCPM035
      MATRIX(2,1) = XYSUM                                               SCPM036
      MATRIX(2,2) = YYSUM                                               SCPM037
      MATRIX(2,3) = YZSUM                                               SCPM038
      MATRIX(3,1) = XZSUM                                               SCPM039
      MATRIX(3,2) = YZSUM                                               SCPM040
      MATRIX(3,3) = ZZSUM                                               SCPM041
                                                                        SCPM042
      RETURN                                                            SCPM043
      END                                                               SCPM044
