TABLE OF CONTENTS


::pwtk::pwi::getAtmPosSegment

SYNOPSIS

proc ::pwtk::pwi::getAtmPosSegment {atomList} {

PURPOSE

Get requested segment of atoms as specified by $atomList from ATOMIC_POSITIONS card.

ARGUMENTS

SOURCE

    set atmPosL  [split [::pwtk::input::cardGetContent ATOMIC_POSITIONS] \n]
    set nat      [getNAtoms]
    set atomList [::pwtk::parseRangeString $atomList $nat]
    set result ""
    
    foreach atom $atomList {
        # check if in range
        if { $atom > $nat || $atom < 1 } {
            ::pwtk::error "atom index, $atom, out of range, should be within \[1, $nat\]"
        } else {
            # ok, add this atom
            lappend result [lindex $atmPosL $atom-1]
        }
    }
    
    return [join $result \n]
}