program oim2wts c home brew version by ADR c July 2000, vii 03 c edited to be able to eliminate 0,0,0 points if so desired ! updated iv 07 c CODE:: implicit none character fname*80 character header*132 character sharp*1 real d1,d2,d3,xc,yc,qualcy real pi,eul1,eul2,eul3 integer i,iheader,ijk,hcount,nnline logical keep_exact_zero,not_exact_zero integer iq_zero c CODE:: pi = 3.14159265 nnline = 0 write(*,*) 'input file name [e.g. your_data.ang]?' read(*,'(a)') fname open(2,file=fname,status='old') hcount=0 ! hcount : number of header lines (from TSL software) 301 continue read (2,"(a)",end = 302) header c print*,header if (header(1:1).eq.'#') then hcount=hcount+1 goto 301 else nnline=nnline+1 goto 301 endif 302 continue close (2) print*,'Number of header lines = ',hcount write (*,*) 'number of (data) lines=', nnline write (*,*) open (2, file=fname, status='old') do i = 1,hcount read(2,*) enddo c skip the header lines write(*,*) 'name for output [e.g. your_data.wts]?' read(*,'(a)') fname open(3,file=fname,status='unknown') c$$$ print*,'How many header lines?' c$$$ read(*,*) iheader c$$$ if(iheader.gt.0) then c$$$ do 20, i=1,iheader c$$$ read(2,*) c$$$ 20 continue c$$$ endif print*,'Ignore orientations at exact zero [1=yes]?' print*,'This eliminates bad points in some scans' read(*,*) iq_zero keep_exact_zero = .TRUE. if(iq_zero.eq.1) keep_exact_zero = .FALSE. write(3,41) fname 41 format(a," from oim2wts [vii 00]") header='Evm F11 F12 F13 F21 ' header=header//'F22 F23 F31 F32 F33 nstate' write(3,"(a)") header header=' 1.000 2.356 0.000 0.000 0.000 1.000 0.000 ' header=header//'0.000 0.000 0.417 2' write(3,"(a)") header header='Bunge:Psi Theta phi ,gr.wt., tau, taus;' header=header//'taumodes/tau; XYZ= 1 2 3' write(3,'(a)') header c write(*,*) 'max of 1 million points - can be easily increased' do 110, ijk=1,10000000 read(2,*,end=115) d1,d2,d3,xc,yc,qualcy c print*, d1,d2,d3 eul1=d1*180./pi if(eul1.lt.0.) eul1=eul1+360. eul2=d2*180./pi if(eul2.lt.0.) eul2=eul2+360. eul3=d3*180./pi if(eul3.lt.0.) eul3=eul3+360. not_exact_zero = .TRUE. if(eul1.eq.0. .and. eul2.eq.0. .and. eul3.eq.0.) then not_exact_zero = .FALSE. endif if(keep_exact_zero.or.not_exact_zero) then write(3,50) eul1,eul2,eul3,1.0 endif 110 continue c 40 format(3(f8.3,1x),2(f9.3,1x),f7.1,f8.3,i3,i7) 50 format(6f8.2,24f6.2) c 115 continue c close(2) close(3) call exit end