program rped real,allocatable::w(:),p(:,:) character*80 s80 if(iargc().lt.3)then write(6,*)'Usage: rped n1 n2 n (wmin) (wmax) (dw)' stop endif call getarg(1,s80) read(s80,*)n1 call getarg(2,s80) read(s80,*)n2 call getarg(3,s80) read(s80,*)n open(9,file='POT_all.LST',status='old') m=0 2 read(9,*,end=98,err=98)a m=m+1 goto 2 98 write(6,*)m,' lines' allocate(w(m),p(m,n)) rewind 9 do 3 i=1,m 3 read(9,*)w(i),w(i),(p(i,j),j=1,n) close(9) c n1 negative: extract mode |n1|: if(n1.lt.0)then open(9,file='t.txt') write(9,90)(p(-n1,j),j=1,n) 90 format(e11.3) close(9) write(6,*)'t.txt' stop endif c n2 negative: make histograms: c dw: increment within wmin wmax if(n2.lt.0)then call getarg(4,s80) read(s80,*)wmin call getarg(5,s80) read(s80,*)wmax call getarg(6,s80) read(s80,*)dw open(9,file='h.txt') write(6,67) 67 format(' interval wmin wmax sum counts') wi=wmin-dw 5 wi=wi+dw wa=wi+dw ic=0 s=0. do 6 j=1,m if(w(j).ge.wi.and.w(j).lt.wa)then do 7 k=n1,-n2 ic=ic+1 7 s=s+p(j,k) endif 6 continue if(ic.ne.0)s=s/real(ic) write(6,65)i,wi,wa,s,ic 65 format(i6,2f10.2,e12.3,i6) write(9,66)(wi+wa)/2.,s 66 format(e12.3,e12.3) if(wa.lt.wmax)goto 5 close(9) write(6,*)'h.txt' stop endif do 4 i=1,m s=0. st=0. pm=0. jm=1 pmt=0. jmt=1 do 41 j=n1,n2 if(p(i,j).gt.pm)then jm=j pm=p(i,j) endif 41 s=s+p(i,j) do 42 j=1,n if(p(i,j).gt.pmt)then jmt=j pmt=p(i,j) endif 42 st=st+p(i,j) 4 write(6,60)i,w(i),s,jm,pm,st,jmt,pmt 60 format(i6,f10.2,e11.3,' max',i6,e11.3,' tot s j max:', 1f3.0,i6,f8.4) end