TABLE OF CONTENTS


::pwtk::getAtmPosSegment

SYNOPSIS

proc ::pwtk::getAtmPosSegment {atomList atmPos} {

PURPOSE

Get requested segment of atoms as specified by "atomList" from the supplied atomic-positions "atmPos".

ARGUMENTS

SOURCE

    set nat      [getNAtoms $atmPos]
    set atomList [::pwtk::parseRangeString $atomList $nat]
    set atmPosL  [split [purifyCoor $atmPos] \n]
    
    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\]" 1
        } else {
            # ok, add this atom
            lappend result [lindex $atmPosL $atom-1]
        }
    }    
    return [join $result \n]
}