TABLE OF CONTENTS


::pwtk::purifyCoor

SYNOPSIS

proc ::pwtk::purifyCoor {coor} {

PURPOSE

Return purified Coor or AtmPos (AtmSymb x y z [ix] [iy] [iz]) in such a way that empty lines and other junk (such as PRIMCOORD or ATOMIC_POSITIONS keywords) are removed. Only lines with 4 or 7 fields survive, so it returns:

        AtmSymb1   x1 y1 z1   [if_pos(1) if_pos(2) if_pos(3)]
        AtmSymb2   x2 y2 z2   [if_pos(1) if_pos(2) if_pos(3)]
        AtmSymb3   x3 y3 z3   [if_pos(1) if_pos(2) if_pos(3)]
        ....

SOURCE

    set pureCoor "" ; # $coor might be an empty string
    set nl ""
    foreach line [split $coor \n] {
        if { [llength $line] == 4 || [llength $line] == 7 } {
            # additional check to prevent constructs like ATOMIC_POSITIONS { alat }
            if { [::pwtk::is_double [lindex $line 1]] } {                
                append pureCoor ${nl}${line}
                set nl "\n"
            }
        }
    }
    return $pureCoor
}