TABLE OF CONTENTS
::pwtk::job_done
SYNOPSIS
proc ::pwtk::job_done {outputFile} {
PURPOSE
Check if a given QE output-file corresponds to a normally finished job (it searches for "JOB DONE." string) and checks that there is no error in the output-file.
RETURN VALUE
The return valueis 1 if output file corresponds to a normally finished job, and zero otherwise.
ARGUMENTS
- outputFile -- name of the output file
SOURCE
try { set fid [open $outputFile r] } on error errVar { return 0 } # if job is completed normaly, the the last record in the output # file is: # # =----------------------------... # JOB DONE. # =----------------------------... set ind 0 set marker -1000; # BEWARE: do not set marker to 0 or else the check at the end will fail while { ! [eof $fid] } { # gets $fid line incr ind if { [regexp -- {^=--------------+=$} $line] } { gets $fid line incr ind if { [string match {*JOB DONE.*} $line] } { gets $fid line incr ind if { [regexp -- {^=--------------+=$} $line] } { set marker $ind } } } } close $fid # if this block is the last: # # =----------------------------... # JOB DONE. # =----------------------------... # # then $marker+1 == $ind; but let's use some safety offset ! # # check also that there is no error in the $outputFile if { $marker + 30 > $ind && ![::pwtk::checkForError $outputFile {} 0 1]} { return 1 } else { return 0 } }