TABLE OF CONTENTS
::pwtk::nebi::getImageUnit
SYNOPSIS
proc ::pwtk::nebi::getImageUnit {index} {
PURPOSE
Return the unit of the requested explicitly specified image with "ATOMIC_POSITIONS (unit)" in the neb.x input.
BEWARE that genImageUnit is not related to num_of_images variable!
ARGUMENTS
- index -- index of image to query (index can be also "first" and "last"; the 1st image has index of 1)
SOURCE
set nimages [getNImages] switch -nocase -- $index { first - begin - 1st { set index 1 } last - end { set index $nimages } } if { $index < 1 || $index > $nimages } { ::pwtk::error "image index $index is out of range, should be within \[1, $nimages\]" 1 } set nimages 0 set unit {} foreach line [split [::pwtk::input::cardGetContent POSITIONS] \n] { if { [regexp {ATOMIC_POSITIONS} $line] } { incr nimages if { $nimages == $index } { if { [llength $line] > 1 } { set unit [string trim [lindex $line end] ()] } break } } } return $unit }