TABLE OF CONTENTS


::pwtk::atmPosToCoor

SYNOPSIS

proc ::pwtk::atmPosToCoor {atmPos} {

PURPOSE

Tranform the "atmPos" to "coor", where "atmPos" are:

      atmSymb x y z [if_pos(1) if_pos(2) if_pos(3)]
      ...

and "coor" are:

      atmSymb x y z
      ....

It also removes empty lines and other junks. So it returns only:

        AtmSymb1   x1 y1 z1   
        AtmSymb2   x2 y2 z2   
        AtmSymb3   x3 y3 z3   
        ....

SOURCE

    set pureCoor "" ; # $coor might be an empty string
    set nl ""
    foreach line [split $atmPos \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}[lrange $line 0 3]"
                set nl "\n"
            }
        }
    }
    return $pureCoor
}