TABLE OF CONTENTS


::pwtk::pwo::dipole

SYNOPSIS

proc ::pwtk::pwo::dipole {file {index end} {unit debye}} {

PURPOSE

Extract an index-th dipole from pw.x output that is printed when tefield = .true.; Index can be "end" or digital number (first reported dipole in the output has an index of 0).

ARGUMENTS

SOURCE

    pwtk::lineread line $file {
        if { [regexp {    Dipole     } $line] } {
            switch -nocase $unit {
                debye {
                    # report Dipole in Debye units
                    lappend dipList [lindex $line 4]
                }
                default {
                    # report dipole in Ry au units
                    lappend dipList [lindex $line 1]
                }
            }
        }
    }
    if { ! [info exists dipList] } {
        ::pwtk::error "no \"    Dipole     \" string found in output file: $file"
        set dipList {}
    }
    return [lindex $dipList $index]
}