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.

REMARK

This command is not related to the "num_of_images" variable!

ARGUMENTS

SOURCE

    set nimages [getNImages]
    if { $nimages == 0 } {
        # no image specified
        ::pwtk::error "cannot get image unit because POSITIONS/ATOMIC_POSITIONS card is undefined" 1
    }    

    set index [image_in_range_ $index $nimages]    

    set iimage 0
    set unit    {}
    
    foreach line [split [::pwtk::input::cardGetContent POSITIONS] \n] {
        if { [regexp {ATOMIC_POSITIONS} $line] } {
            incr iimage
            if { $iimage == $index } {
                if { [llength $line] > 1 } {
                    set unit [::pwtk::trimCardFlag [lrange $line 1 end]]
                }
                break
            }
        }
    }
    return $unit
}