TABLE OF CONTENTS


::pwtk::pwo::getXSFPrimVec

SYNOPSIS

proc ::pwtk::pwo::getXSFPrimVec {flag pwoFile {anim_index ""}} {

DESCRIPTION

Return the XSF-formatted lattice vectors (PRIMVEC section) from the pw.x output file, i.e.:

      PRIMVEC
        ax ay az
        bx by bz
        cx cy cz

ARGUMENTS

SOURCE

    set output [::fileutil::tempfile xsf.]
    
    set  pwo2xsf [::pwtk::getExecutable [::pwtk::getVar_ PWO2XSF]]
    if { $pwo2xsf eq {} } {
        ::pwtk::error "cannot find the PWO-to-XSF (aka pwo2xsf.sh) converter" 1
    }

    exec -- $pwo2xsf $flag $pwoFile > $output
    
    set xsf    [split [::pwtk::readFile $output] \n]
    set ind    [lsearch $xsf *PRIMVEC*]

    set    vec "PRIMVEC $anim_index\n"
    append vec "[join  [lrange $xsf [expr {$ind + 1}] [expr {$ind + 3}]] \n]"
    return $vec
}