C To convert CD_data from ascii format to SELCON3 c Input INTERACTIVE -- File has wavelength, CDDATA c character*12 ifil character*4 name,ntitle(10) dimension cd(100),str(5) c write(*,845) 845 format(/80('_')/) write(*,849) 849 format(/' This PROGRAM creates the input for SELCON3'// 1 ' Some of the input values are INPUT interactively'/ 2 ' The CD data is read from a file with two values per line'/ 3 ' First value is the wavelength, second CD data '/ 4 ' The wavelength is in the same order as range: say 260-180'// 5 ' COPY the TEST.DAT file Created to file: INPUT which', 6 ' SELCON3 Reads'/) write(*,845) write(*,851) 851 format(/' Do you want to create a new TEST.DAT file?',// 1 ' If You Want to CREATE a NEW TEST.DAT file, TYPE 0',/ 2 ' If you want to APPEND the existing TEST.DAT file', 3 ' TYPE 1'/) read(*,*)ifile OPEN (unit=7,file='test.dat') c if (ifile.EQ.0) write(*,674) if (Ifile.NE.0) then write(*,673) 89 read(7,100,end=90) goto 89 90 continue BACKSPACE (7) endif 673 FORMAT(//' Data will be appended to existing TEST.DAT ') 674 FORMAT(//' Any existing TEST.DAT will be overwritten ') c c Initial Stuff: Title, Range, Skipping lines etc. c write(*,845) write(*,91) 91 format(//' Enter TITLE for your data - 40 characters'//) read(*, 100) ntitle write(*,701) ntitle 701 format(' TITLE:',2x,10a4) write(*,845) c write(*,522) 522 format(//' The number of lines to be skipped in CD file'/ 1 ' Enter the number of CD values per nm'/ 2 ' IF the DATA is .. 240nm, 241nm, 242nm etc. enter 1'/ 3 ' IF the DATA is .. 240nm, 240.5nm, 241nm etc. enter 2'/ 4 ' IF the DATA is .. 240nm, 240.2nm, 240.4nm etc. enter 5'//) read(*,*)resln iskip = int(resln) write(*,703)iskip 703 format(/' Number of lines per nm in CD datafile',i4) write(*,845) write(*,524) 524 format(//' INPUT INITIAL wavelength: '/) read(*,*)wav1 wavini = wav1 write(*,845) write(*,526) 526 format(//' INPUT FINAL wavelength: '/) read(*,*)wav2 wavfin = wav2 write(*,706)wav1,wav2 706 format(' Wavelength Range: ',2f7.1,' nm') write(*,845) c write(*,528) 528 format(//' Is the CD data in Molar Ellipticity Units?'// 1 ' IF IT IS TYPE 1; IF NOT TYPE 0'// 2 ' If YOU TYPE 1 DATA WILL BE CONVERTED TO DELTA(e)'//) read(*,*)Delt write(*,845) if(Delt.EQ.0.0) write(*,622) if(Delt.NE.0.0) write(*,623) 622 format(' CD DATA IS ALREADY IN DELTA(e) UNITS.', 1 ' NO CONVERSION DONE') 623 format(' CD DATA IS IN MOLAR ELLIPTICITY UNITS.'//, 1 ' IT WILL BE CONVERTED TO DELTA(e) UNITS.'//) IF(Delt.EQ.0.0)Factor = 1.0 IF(Delt.NE.0.0)Factor = 3300.0 c c INPUT FILE c write(*,845) write(*, 116) 116 format(//' ASCII-file name (CD data)-MAX of 12 letters'/) read(*,109) ifil write(*,708) ifil 708 format(' CD data is contained in File:', a12) OPEN(unit=3,file=ifil) rewind(3) nsec = 6 c c And, loop for successive sets of data written to TEST.DAT c write(*,845) if(wav1.GT.wav2) ncd = int(wav1-wav2) + 1 if(wav1.LT.wav2) ncd = int(wav2-wav1) + 1 103 format(3f12.4) write(*,845) write(*,142)resln,iskip,ifil 142 format(//' Step Resolution in JASCO file was',f6.2, 1 /' If it is not betn .05 and 1.0, collect data in this range', 2 /' Every ',i3,'-1 lines will be skipped in ',a12/) 109 format(a12) index=0 do 10 j=1,ncd index=index+1 read(3,*,end=202,err=203)wave,cd(index) write(*,*)index, j, wave, cd(index) cd(index)=(cd(index))/Factor do 20 i=1,iskip-1 read(3,100,end=10) 20 continue 10 continue c c write out to TEST.DAT write(7,631) 631 format('# '/ # '# PRINT Basis_1 Basis_2 Basis_3 SEGMENT'/ 1 ' 0 1 0 0 1'/ 2 '# '/ 3 '# 1 Title Line ') write(7,100)ntitle c write(7,632) 632 format('# '/ # '# WL_Begin WL_End Factor ') Fact = 1.0 If(wav1.GT.wav2) write(7,103)wav1,wav2,Fact If(wav2.GT.wav1) write(7,103)wav2,wav1,Fact c write(7,633) 633 format('# '/ # '# CDDATA (Long->Short Wavelength; 260 - 178 LIMITS ') If(wav1.GT.wav2) write(7,400)(cd(i),i=1,ncd) If(wav2.GT.wav1) write(7,400)(cd(i),i=ncd,1,-1) c write(7,634) 634 format('# '/ # '# IGuess Str1 Str2 Str3 Str4 Str5 Str6'/ 1 ' 0 ') write(*,845) write(*,709) 709 format(' The INPUT file for SELCON is'/) write(*,845) write(*,631) write(*,100)ntitle write(*,632) If(wav1.GT.wav2) write(*,103)wav1,wav2,Fact If(wav2.GT.wav1) write(*,103)wav2,wav1,Fact write(*,633) If(wav1.GT.wav2) write(*,400)(cd(i),i=1,ncd) If(wav2.GT.wav1) write(*,400)(cd(i),i=ncd,1,-1) write(*,634) c go to 933 201 write(*,301) 301 format(' END OF FILE: ',a12,' CHECK INPUT -JASCO- file') stop 202 write(*,302)ifil,wav1,wav2,resln 302 format(//' END OF FILE: ',a12,' CHECK input parameters',/ 1 /' Wavelength range AND Step resolution', 2 /' Current values are: Range -',2f6.1,' Step Rsln-',f4.1) stop 203 write(*,303)ifil 303 format(' Error in reading CD data from ',a12,' check input') stop 933 continue 100 format(10a4) 400 format(10f8.3) end