TABLE OF CONTENTS


::pwtk::nebi::addImageCoor_fromCRD

SYNOPSIS

proc ::pwtk::nebi::addImageCoor_fromCRD {args} {

USAGE

   ::pwtk::nebi::addImageCoor_fromCRD ?-before | -after? imageIndex crdFile crdIndex

PURPOSE

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

OPTIONS

ARGUMENTS

EXAMPLE

   ::pwtk::nebi::addImageCoor_fromCRD -before 1 positions.crd 2

SOURCE

    set argum $args
    set narg  3
    set usage "?-before | -after? imageIndex crdFile crdIndex"
    set options {
        {before "add image before the index-th image"}
        {after  "add image after the index-th image"}
    }
    ::pwtk::parseOpt_
    lassign $args imageIndex crdFile crdIndex

    ::pwtk::fileMustExist $crdFile "neb.x CRD"

    # load the CRD file into the 'data' array
    positions2data__ data [::pwtk::skipEmptyLines [readFile $crdFile]]

    # if "nat" in the SYSTEM namelist is undefined, define it
    set nat [::pwtk::input::namelistGetVarValue SYSTEM nat]
    if { $nat eq {} } {
        SYSTEM " nat = $data(nat) "
    } elseif { $nat != $data(nat) } {
        ::pwtk::error "number of atoms in the $crdFile file is $data(nat), but should be $nat" 1
    }

    addImage {*}[lrange $argum 0 end-2] [data2image_ data $crdIndex]
}