TABLE OF CONTENTS


::pwtk::pwo::crystal_axes

SYNOPSIS

proc ::pwtk::pwo::crystal_axes {pwo {index end}} {

PURPOSE

Return the crystal axes from the pw.x output file, taken from the following record:

         crystal axes: (cart. coord. in units of alat)
               a(1) = (  -0.500000   0.000000   0.500000 )  
               a(2) = (   0.000000   0.500000   0.500000 )  
               a(3) = (  -0.500000   0.500000   0.000000 )  

ARGUMENTS

RETURN VALUE

      a1x a1y a1z
      a2x a2y a2z
      a3x a3y a3z

SOURCE

    ::pwtk::fileMustExist $pwo "pw.x output"

    set result {}
    set fid [open $pwo r]
    while { ! [eof $fid] } {
        gets $fid line
        if { [regexp {^ +crystal axes: \(cart. coord. in units of alat\)} $line] } {
            set v1 [lindex [split [gets $fid] ()] 3]
            set v2 [lindex [split [gets $fid] ()] 3]
            set v3 [lindex [split [gets $fid] ()] 3]
            lappend result $v1\n$v2\n$v3
        }
    }
    close $fid
    return [lindex $result $index]
}