TABLE OF CONTENTS
::pwtk::nebi::getImage
SYNOPSIS
proc ::pwtk::nebi::getImage {index} {
USAGE
::pwtk::nebi::getImage index
PURPOSE
Return the ATOMIC_POSITIONS and TOTAL_CHARGE of the index-th image.
REMARK
::pwtk::nebi::getImage is not related to the "num_of_images" variable.
ARGUMENTS
- index -- index of image to return (index can be also "first" and "last"; the 1st image has the index of 1)
RETURN VALUE
The specs of the index-th image from the POSITIONS card, i.e.:
ATOMIC_POSITIONS (unit) AtmPos1 x1 y1 z1 [if_pos(1) if_pos(2) if_pos(3)] AtmPos2 x2 y2 z2 [if_pos(1) if_pos(2) if_pos(3)] AtmPos3 x3 y3 z3 [if_pos(1) if_pos(2) if_pos(3)] TOTAL_CHARGE tot_charge
The if_pos(:) data are returned only if they exist.
SOURCE
set nimages [getNImages] if { $nimages == 0 } { # no image specified ::pwtk::error "cannot get any image because POSITIONS/ATOMIC_POSITIONS card is undefined" 1 } set index [image_in_range_ $index $nimages] set iimage 0 set record 0 set image {} foreach line [split [::pwtk::input::cardGetContent POSITIONS] \n] { if { [regexp {IMAGE} $line] } { incr iimage set record 0 continue } if { [regexp {ATOMIC_POSITIONS} $line] } { if { $iimage == $index } { set record 1 } } if { $record } { append image $line\n } } return $image }