program qcheck logical normal,converged character*80 s e=1. ee=0. if(normal('FRES.OUT',e))then if(normal('G98.OUT',e))then if(converged('QGRAD.OUT'))then if(normal('FREE.OUT',ee))then if(abs(e-ee).lt.1.0e-6)then call system('pwd > t_') open(8,file='t_') read(8,80)s 80 format(a80) close(8) call ss(s,i,j) do 1 ii=i,j 1 write(6,602)s(ii:ii) 602 format(a1,$) write(6,600) 600 format(' Job OK') else write(6,601)e,ee 601 format(2f15.6,' different energies at G.OUT and FREE.OUT') endif endif endif endif endif end function normal(f,e) character*(*) f character*80 s logical normal call system('cat '//f//' > t') open(8,file='t') i=0 e=0. 1 read(8,80,end=88,err=88)s 80 format(a80) if(s(2:31).eq.'Normal termination of Gaussian')i=1 if(s(2:11).eq.'SCF Done: ')then do 2 k=1,len(s) 2 if(s(k:k).eq.'=')read(s(k+1:k+16),*)e endif goto 1 88 close(8) if(i.eq.1)then write(6,*)f//' done ',e else write(6,*)f//' defective' stop endif normal=.true. return end function converged(f) character*(*) f character*80 s logical converged call system('cat '//f//' > t') open(8,file='t') i=0 j=0 1 read(8,80,end=88,err=88)s 80 format(a80) if(s(19:24).eq.'Step -')then read(8,80,end=88,err=88)s read(s(16:22),*)j endif if(s(1:9).eq.'Converged')i=1 goto 1 88 close(8) if(i.eq.1.and.j.gt.1)then write(6,*)f//' done ',j,' steps' else write(6,*)f//' defective ',j,' steps' stop endif converged=.true. return end subroutine ss(s,i,j) character*(*) s do 1 i=1,len(s) 1 if(s(i:i).ne.' ')goto 2 2 do 3 j=len(s),1,-1 3 if(s(j:j).ne.' ')goto 4 4 return end