TABLE OF CONTENTS


::pwtk::nebi::POSITIONS_fromAXSF

SYNOPSIS

proc ::pwtk::nebi::POSITIONS_fromAXSF {args} {

USAGE

   POSITIONS_fromAXSF [-ifpos] axsfFile

OPTIONS

PURPOSE

Load the neb.x POSITIONS from the AXSF file.

ARGUMENTS

SOURCE

    set options {
        {ifpos  "copy if_pos(:) fields from current (old) coordinates"}
    }
    array set opt [::cmdline::getoptions args $options [list [lindex [info level 0] 0] options:]]

    if { [llength $args] > 1 } {
        pwtk::error "wrong usage: should be ::pwtk::nebi::POSITIONS_fromAXSF \[-ifpos] axsfFile, but got:\n
::pwtk::nebi::POSITIONS_fromAXSF $args" 1
    }
    
    # parse AXSF-file
    set axsfFile [lindex $args 0]   
    ::pwtk::fileMustExist $axsfFile AXSF

    set nimages [::pwtk::xsf::getAnimsteps $axsfFile]
        
    for {set i 1} {$i <= $nimages} {incr i} {
        set atmPos($i) [::pwtk::atmPosToCoor [::pwtk::xsf::getPrimCoor $axsfFile $i]]
        if { $i == 1 } {
            if { $opt(ifpos) } {
                # transform coor to atmPos
                set atmPos($i) [::pwtk::coorToAtmPos $atmPos($i) [::pwtk::nebi::getImageAtmPos first]]
            }
            # now clear old POSITIONS
            ::pwtk::input::clear POSITIONS
            set image FIRST_IMAGE
        } elseif { $i == $nimages } {
            set image LAST_IMAGE
        } else {
            set image INTERMEDIATE_IMAGE
        }
        append positions "$image\nATOMIC_POSITIONS angstrom\n$atmPos($i)\n"
    }
    if { [info exists positions] } {
        POSITIONS $positions
    }
}