TABLE OF CONTENTS


::pwtk::pwo::totene

SYNOPSIS

proc ::pwtk::pwo::totene {file {index end}} {

PURPOSE

Extract an index-th converged total-energy from pw.x output; the converged energy is the one having the "!" as the first line character. Index can be "end" or digital number (first energy has an index of 0).

ARGUMENTS

SOURCE

    pwtk::lineread line $file {
        if { [regexp {^!} $line] } {
            lappend eneList [lindex $line 4]
        }
    }
    if { ! [info exists eneList] } {
        ::pwtk::error "no ^! (i.e. total energy) line found in output file: $file"
        set eneList {}
    }
    return [lindex $eneList $index]
}