TABLE OF CONTENTS
::pwtk::ATOMIC_POSITIONS_math_parser
SYNOPSIS
proc ::pwtk::pwi::ATOMIC_POSITIONS_math_parser {content} {
PURPOSE
Specially supplied math-parser for ATOMIC_POSITIONS card: to yield nicely formated output.
There can be 4 or 7 columns, but we math-parse only coordinates (columns 2,3,4).
SOURCE
set unit [::pwtk::input::cardGetFlags ATOMIC_POSITIONS] set parsedContent "" foreach line [split [::pwtk::skipEmptyLines $content] \n] { # check if we have path-calculation #set word [string tolower [lindex $line 0]] set word [lindex $line 0] switch -glob -- $word { first_image* - intermediate_image* - last_image* { # atomic positions specified using the old pw.x format append parsedContent [string toupper ${line}]\n append parsedContent ATOMIC_POSITIONS $unit\n } FIRST_IMAGE - INTERMEDIATE_IMAGE - LAST_IMAGE - ATOMIC_POSITIONS* { # atomic positions specified using the new neb.x format append parsedContent ${line}\n } default { set len [llength $line] if { $len != 4 && $len != 7 } { ::pwtk::error "wrong number of fields, $len, in ATOMIC_POSITIONS card, must be 4 or 7, while reading ATOMIC_POSITIONS $content" 1 } set atmSymb [lindex $line 0] set x [::pwtk::mathParser [lindex $line 1]] set y [::pwtk::mathParser [lindex $line 2]] set z [::pwtk::mathParser [lindex $line 3]] if { $len == 7 } { set ifx [lindex $line 4] set ify [lindex $line 5] set ifz [lindex $line 6] append parsedContent [format " %-4s %16.12f %16.12f %16.12f %1d %1d %1d\n" $atmSymb $x $y $z $ifx $ify $ifz] } else { append parsedContent [format " %-4s %16.12f %16.12f %16.12f\n" $atmSymb $x $y $z] } } } } return $parsedContent }