program zasort c ****************************************************************** c read a list of material names, such as h1, be9, monat, or u235, c from standard input, sort them into za order, and write the c new list out on the standard output. c ****************************************************************** character*6 name character*2 zz(500) character*4 aaa(500) character zsave*2,asave*4,zzz*2 character*2 zlist(100) data zlist/'h','he','li','be','b','c','n','o','f','ne', x 'na','mg','al','si','p','s','cl','ar','k','ca','sc','ti', x 'v','cr','mn','fe','co','ni','cu','zn','ga','ge','as','se', x 'br','kr','rb','sr','y','zr','nb','mo','tc','ru','rh','pd', x 'ag','cd','in','sn','sb','te','i','xe','cs','ba','la','ce', x 'pr','nd','pm','sm','eu','gd','tb','dy','ho','er','tm','yb', x 'lu','hf','ta','w','re','os','ir','pt','au','hg','tl','pb', x 'bi','po','at','rn','fr','ra','ac','th','pa','u','np','pu', x 'am','cm','bk','cf','es','fm'/ c c ***read in the material names i=0 100 i=i+1 read(5,'(a)',end=120) name l=index(name,'nat') if (l.ne.0) then zz(i)=name(1:l-1) aaa(i)=name(l:6) else do 105 j=1,3 m=j ic=ichar(name(j:j)) if (ic.ge.48.and.ic.le.57) go to 110 105 continue 110 zz(i)=name(1:m-1) aaa(i)=name(m:6) endif go to 100 120 nname=i-1 c c ***sort them into za order do 160 i=1,nname-1 do 150 j=i+1,nname do 130 k=1,100 if (zz(i).eq.zlist(k)) iz=k if (zz(j).eq.zlist(k)) jz=k 130 continue if (jz.ge.iz) go to 150 zsave=zz(i) asave=aaa(i) zz(i)=zz(j) aaa(i)=aaa(j) zz(j)=zsave aaa(j)=asave 150 continue 160 continue do 180 i=1,nname-1 do 170 j=i+1,nname if (zz(i).ne.zz(j)) go to 170 if (aaa(j).ge.aaa(i)) go to 170 zsave=zz(i) asave=aaa(i) zz(i)=zz(j) aaa(i)=aaa(j) zz(j)=zsave aaa(j)=asave 170 continue 180 continue c c ***write out the sorted list do 190 i=1,nname zzz=zz(i) l=2 if (zzz(2:2).eq.' ') l=1 write(6,'(a)') zzz(1:l)//aaa(i) 190 continue end