      IMPLICIT REAL*8 (A-H,O-Z)
      CHARACTER*2 NP
      INTEGER KA(2,10),KS(11,10)
      DIMENSION VA(3,20),BOL(10),JBO(2,10)
      DIMENSION KB(3),KKM(3,100),ND(12)
      OPEN(3,FILE='generator',iostat=ISO,STATUS='OLD')
      WRITE(6,*) ISO
      IF(ISO.NE.0) STOP
      READ(5,*) NUMBER,NNC
      IF(NUMBER.EQ.0) STOP
      CALL TSPNGE(NUMBER,NNC,3)
      READ(5,*) A,B,C
      READ(5,*) CA,CB,CC
      CALL TSLATC(A,B,C,CA,CB,CC)
      READ(5,*) NA,NKA
      READ(5,*) ((KA(J,I),J=1,2),I=1,NKA)
      NN=11
      DO 3 I=1,NA
    3 READ(5,*) (VA(J,I),J=1,3)
      DO 2 I=1,NKA
      READ(5,*) (KS(J,I),J=1,7)
   21 CONTINUE
    2 CONTINUE
      CALL TSCRST(VA,KA,NKA,NA,KS)
      READ(5,*) NBO,((JBO(J,I),J=1,2),I=1,NBO)
      READ(5,*) (BOL(I),I=1,NBO)
      CALL TSBOGN(JBO,BOL,NBO,0)
      JF=6
      CALL TSBOVR(JF)
      READ(5,*) NX,NY,NZ
      CALL TSKPGN(NX,NY,NZ,KKM,ICC,NK)
      WRITE(2,*) NK,ICC
      REWIND 1
      DO 10 K=1,NK
      NKB=K
      KX=KKM(1,K)
      KY=KKM(2,K)
      KZ=KKM(3,K)
      CALL TSNMKP(KX,KY,KZ,ICC,NP)
      CALL TSKFBZ(KX,KY,KZ,ICC,INDZB)
      KB(1)=KKM(1,K)
      KB(2)=KKM(2,K)
      KB(3)=KKM(3,K)
      WRITE(6,600) NP,KX,KY,KZ,ICC,INDZB
  600 FORMAT(//' NAME OF K-POINT ',A2,3I3,'/',I3
     &        ,' IN OR ON B.Z',I2)
      WRITE(2,*) NP,KB
      CALL TSIREP(KB,ICC,0)
      CALL TSIRNR(NR,NH,ND)
      DO 13 I=1,NR
      IR=I
      CALL TSBASE(IR,1)
      CALL TSBSDS
      CALL TSBOCF(KB,ICC,NKB,IR,1,6)
   13 CONTINUE
   10 CONTINUE
      STOP
      END

