TABLE OF CONTENTS


::pwtk::pwo::efermi

SYNOPSIS

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

PURPOSE

Extract index-th Fermi energy (or the highest occupied level) from the pw.x output file. Index can be "end" or digital number (first energy has an index of 0).

ARGUMENTS

SOURCE

    pwtk::lineread line $file {
        if { [regexp {highest occupied level} $line] } {
            
            lappend efList [lindex $line end]
            
        } elseif { [regexp {highest occupied, lowest unoccupied level} $line] } {
            
            lappend efList [lindex $line end-1]
            
        } elseif { [regexp {Fermi energy is} $line] } {
            
            lappend efList [lindex $line end-1]
        }
    }
    
    if { ! [info exists efList] } {
        ::pwtk::error "no Fermi energy or highest occupied level line found in output file: $file"
        set efList {}
    }
    return [lindex $efList $index]
}