1HDR   CRBE82/M9SMS(XINTGN)   CRBE.LIB.M9SMS                               82168
      SUBROUTINE XINTGN(KK)                                             00000100
      COMMON/INFO/ANS(500,8),SPECT(500,4,10),NFLAG(500),NC(500),NSPEC   00002500
      COMMON/RATIO/IDUM,D(1500,8)                                       00002600
      REAL GT(500),A(1500),R(1500),O(1500),UU(1500)                     00003300
      EQUIVALENCE (A(1),D(1,1)),(GT(1),ANS(1,1))                        00003400
      DO  70 J=2,8                                                      00003700
      IF(KK.LT.3) GO TO 20                                              00004200
      IF(J.NE.6) GO TO 50                                               00004300
      L=0                                                               00004400
      DO 10  I=1,KK                                                     00005400
      IF(D(I,6).EQ.0.0.AND.D(I,7).EQ.0.0.AND. D(I,8).EQ.0.0) GO TO 10   00005600
      L=L+1                                                             00005700
      D(L,1)=D(I,1)                                                     00005800
      D(L,6)=D(I,6)                                                     00005900
      D(L,7)=D(I,7)                                                     00006000
      D(L,8)=D(I,8)                                                     00006100
  10  CONTINUE                                                          00006200
      IF(L.GT.3)  GO TO 40                                              00006700
  20  DO 30  K=J,8                                                      00006800
      DO 30  L=1,NSPEC                                                  00006900
  30  ANS(L,K)=0.0                                                      00007000
      RETURN                                                            00007100
  40  KK=L                                                              00007200
  50  WRITE(6,2000) J,KK                                                00007600
 2000 FORMAT('0 FOR ANS(I,',I1,')',I5,' VALUES WERE USED IN SPLINE')    00007700
      MM=0                                                              00008100
      DO 60  I=1,KK                                                     00008900
      O(I)=D(I,J)                                                       00009000
      IF(I.EQ.1.OR.J.LT.4) GO TO 60                                     00009100
  55  DIF=O(I-1)-O(I)                                                   00009400
      IF(ABS(DIF).LT.180.) GO TO 60                                     00009500
      IF(DIF.LT.0.0) O(I)=O(I)-360.                                     00009600
      IF(DIF.GT.0.0) O(I)=O(I)+360.                                     00009700
      GO TO 55                                                          00009800
  60  CONTINUE                                                          00009900
      DO  70 K=1,NSPEC                                                  00010500
      X=GT(K)                                                           00010600
      CALL SPLINE(X,A,O,KK,MM,T,1,V,1,U,R,UU)                           00011200
      MM=2                                                              00011600
      ANS(K,J)=T                                                        00011900
      IF(J.NE.4.AND.J.LT.6) GO TO  70                                   00012000
  65  IF(ABS(ANS(K,J)).LE.180.) GO TO 70                                00012400
      IF(ANS(K,J).GT.180.) ANS(K,J)=ANS(K,J)-360.                       00012500
      IF(ANS(K,J).LT.-180.)ANS(K,J)=ANS(K,J)+360.                       00012600
      GO TO 65                                                          00012700
  70  CONTINUE                                                          00012800
      RETURN                                                            00012900
      END                                                               00013000
