TABLE OF CONTENTS


::pwtk::pdos_spin

SYNOPSIS

proc ::pwtk::pdos_spin {pdosFile} {

DESCRIPTION

Query if $pdosFile corresponds to spin-polarized case.

RETURN VALUE

1 -- if spin-polarized 0 -- otherwise

SOURCE

    ::pwtk::fileMustExist $pdosFile PDOS
    
    set fid [open $pdosFile r]
    gets $fid line
    close $fid

    # format of projwfc.x pdos_atm header:
    #
    #   # [ik] E   (eV) ldosup(E) ldosdw(E) ...
    #   1 [k]  2+k 3+k  4+k       5+k
    #
    # format sumpdos.x header:
    #
    #   # [ik] E   (eV) pdosup(E) pdosdw(E) ...
    #   1 [k]  2+k 3+k  4+k       5+k
    
    set spin 0
    set kresolved 0
    if { [lindex $line 1] == "ik" } {
        set kresolved 1
    }
    if { [lindex $line 3+$kresolved] == "ldosup(E)" || [lindex $line 3+$kresolved] == "pdosup(E)" } {
        set spin 1
    }
    return $spin
}