TABLE OF CONTENTS
::pwtk::pwi::getAtmPos
SYNOPSIS
proc ::pwtk::pwi::getAtmPos {{path_allowed 0}} {
PURPOSE
Get atomic positions from the pw.x input data, i.e.:
AtmSy1 x1 y1 z1 [if_pos(1) if_pos(2) if_pos(3)] AtmSy2 x2 y2 z2 [if_pos(1) if_pos(2) if_pos(3)] ....
For path calculation it returns:
first_image AtmSy1 x1 y1 z1 [if_pos(1) if_pos(2) if_pos(3)] AtmSy2 x2 y2 z2 [if_pos(1) if_pos(2) if_pos(3)] ...
ARGUMENTS
- path_allowed -- calling getAtmPos for path calculation is allowed only if path_allowed is 1
SOURCE
set coor [::pwtk::input::cardGetContent ATOMIC_POSITIONS] set nl "" set new_coor "" foreach line [split $coor \n] { if { [string match -nocase {*first_image} $line] && ! $path_allowed} { ::pwtk::error "::pwtk::pwi::getAtmPos works only for non-path type input" } # purify the empty lines (check for syntax errors as well) set len [llength $line] # can be: atmSybm x y z # or: atmSymb x y z fx fy fz if { $path_allowed && [string match *_image* $line] } { append new_coor ${nl}${line} set nl "\n" } elseif { $len == 4 || $len == 7 } { append new_coor ${nl}${line} set nl "\n" } elseif { $len > 0 } { # it's not an empty line -> SYNTAX error pwtk::error "syntax error in ATOMIC_POSITIONS card, line = $line" } } return $new_coor }