      DIMENSION D(100),THETA(100),DLOG(100)
      DIMENSION LOG(12),NAME(12),ITITLE(20)
      DATA YES/'Y'/,IBL/' '/,ICOM/','/
      ITP1 = 10
      WRITE(108,110)
  110 FORMAT(//'THIS IS A PROGRAM TO SET UP A DECK',
     1/'FOR PLOTTING VALUES OF LOG(D) FROM',
     2/'TWO THETA VALUES.  THESE VALUES THEN CAN',
     3/'BE USED TO DETERMINE THE CRYSTAL SYSTEM,',
     4/'USING THE BUNN CHARTS'/////)
      WRITE(108,101)
  101 FORMAT(//' TYPE THE FIRST TWO WORDS IN YOUR LOGON CODE'/
     1' WITH COMMA---E.G. E-CLASS,7800'/)
      READ(105,108)LOG
  108 FORMAT(12A1)
  102 FORMAT(20A4)
      WRITE(108,103)
  103 FORMAT(/' TYPE YOUR LAST NAME'/)
      READ(105,108)   NAME
      N3 = 0
      N1 = 0
      N2 = 0
      IC = 0
      DO 55 I = 1,12
      IF(LOG(I).EQ.ICOM) IC = IC + 1
      IF(IC .GE. 2) GO TO 54
      IF(LOG(I).NE.IBL) N2 = N2 + 1
   54 IF(NAME(I).NE.IBL) N1 = N1 + 1
  55  CONTINUE
      WRITE(ITP1,104)N2,(LOG(I),I=1,N2),N1,(NAME(I),I=1,N1)
  104 FORMAT('!JOB ',NA1,'(',NA1,')'/
     1'!ASSIGN M:SI,(FILE,FOBUNN,FPOWDER)'/
     3'!FORTRAN BC,GO'/
     8'!ASSIGN F:10,(DEVICE,CRA03)'/
     4'!ASSIGN M:PL,(DEVICE,PLA06)'/
     5'!LOAD (GO),(UNSAT,(DPLOTLIB))'/
     6'!RUN'/
     7'!DATA'/)
      WRITE(108,130)
  130 FORMAT(/'ENTER LAMBDA IN G10.7 FORMAT (IF LAMBDA FOR'/,
     1'COPPER  IS WANTED HIT RETURN)'/)
      READ(105,201)(WAVE)
      IF(WAVE.EQ.0.)WAVE=1.54050
      WRITE(108,131)
  131 FORMAT(/'ENTER VALUES FOR TWO THETA IN G10.6 FORMAT'/,
     1'AFTER LAST VALUE ENTER A ZERO(0.0)'/)
      DO 1 I=1,100
      READ(105,201)(THETA(I))
      IF(THETA(I).EQ.0.)GO TO 2
    1 CONTINUE
    2 I=I-1
      RAD=3.141593/180.
      DO 3 J=1,I
      THETA(J)=RAD*THETA(J)
      D(J)=((WAVE)/(2*(SIN(THETA(J)/2.))))
    3 DLOG(J)=(ALOG10(D(J)))/.025
      WRITE(10,203)I
  203 FORMAT(I)
      WRITE(10,202)(DLOG(J),J=1,I)
  201 FORMAT(G)
  202 FORMAT(2X,6F10.6)
   25 WRITE(ITP1,27)
   27 FORMAT('!EOD')
      WRITE(108,120)
  120 FORMAT(///' AS SOON AS TERMINAL RETURNS A ! TYPE'/
     1,' "BATCH FID" WHERE FID IS THE NAME YOU ASSIGNED TO'/
     2,' YOUR OUTPUT FILE. YOUR JOB WILL BE RUN SHORTLY.'/
     3,' PICK UP YOUR RESULTS AT THE COMPUTER CENTER.'/
     4,' DON''T FORGET - THIS TIME YOU HAVE A PLOT TO GO'/
     5,' WITH YOUR REGULAR BATCH PRINTOUT.'///)
      STOP
      END
