TABLE OF CONTENTS


::pwtk::nebi::addImageCoor_fromPWO

SYNOPSIS

proc ::pwtk::nebi::addImageCoor_fromPWO {args} {

USAGE

   ::pwtk::nebi::addImageCoor_fromPWO ?-before | -after? imageIndex pwoFile ?pwoIndex?

PURPOSE

Add a new image's ATOMIC_POSITIONS from the PWO file to the POSITIONS card.

OPTIONS

ARGUMENTS

EXAMPLE

   ::pwtk::nebi::addImagePos_fromPWO -before 1 relax.out

SOURCE

    set argum   $args
    set nargmin 2
    set nargmax 3
    set usage   "?-before | -after? imageIndex pwoFile ?pwoIndex?"
    set options {
        {before "add image before the index-th image"}
        {after  "add image after the index-th image"}
    }
    ::pwtk::parseOpt_    
    lassign $args imageIndex pwoFile pwoIndex
    
    ::pwtk::fileMustExist $pwoFile "pw.x output"

    # if "nat" in the SYSTEM namelist is undefined, define it
    if { [::pwtk::input::namelistGetVarValue SYSTEM nat]  == "" } {
        SYSTEM " nat = [::pwtk::pwo::nat $pwoFile] "
    }

    set imageData [::pwtk::pwo::getAtmPos -k $pwoFile {*}$pwoIndex]
    if { $imageData eq "" } {
        pwtk::error "no coordinates found in the pw.x output file: $pwoFile" 1
    }
    if { $pwoIndex eq {} } {
        addImage {*}[lrange $argum 0 end-1] $imageData
    } else {
        addImage {*}[lrange $argum 0 end-2] $imageData
    }
}