TABLE OF CONTENTS


::pwtk::purifyVec

SYNOPSIS

proc ::pwtk::purifyVec {vec} {

PURPOSE

Returns purified lattice vectors in such a way that empty lines and other junks (such as PRIMVEC or CELL_PARAMETERS keywords) are removed. Only lines with precisely 3 fields survive, so it returns:

     ax ay az
     bx by bz
     cx cy cz

SOURCE

    set pureVec "" ; # $vec might be an empty string
    set nl ""
    foreach line [split $vec \n] {
        if { [llength $line] == 3 \
                 && [::pwtk::is_double [lindex $line 0]] \
                 && [::pwtk::is_double [lindex $line 1]] \
                 && [::pwtk::is_double [lindex $line 2]] } {        
            append pureVec ${nl}${line}
            set nl "\n"
        }
    }
    return $pureVec
}