TABLE OF CONTENTS
::pwtk::nebi::addImageCoor_fromXSF
SYNOPSIS
proc ::pwtk::nebi::addImageCoor_fromXSF {args} {
USAGE
::pwtk::nebi::addImageCoor_fromXSF ?-before | -after? imageIndex xsfFile ?xsfIndex?
PURPOSE
Add a new image's atomic Coor (aka ATOMIC_POSITIONS) from the XSF file to the POSITIONS card.
OPTIONS
- -before ... add a new image positions before the index-th image
- -after ... add a new image positions after the index-th image
ARGUMENTS
- imageIndex --- the image's index
- xsfFile --- the XSF file from where to load the image's atomic coordinates
- xsfIndex --- (optional) the index of structure in the XSF file (default = 1)
EXAMPLE
::pwtk::nebi::addImageCoor_fromXSF -before 1 file.xsf
SOURCE
set argum $args set nargmin 2 set nargmax 3 set usage "?-before | -after? imageIndex xsfFile ?xsfIndex?" set options { {before "add image before the index-th image"} {after "add image after the index-th image"} } ::pwtk::parseOpt_ lassign $args imageIndex xsfFile xsfIndex ::pwtk::fileMustExist $xsfFile xsfFile ::pwtk::ifset xsfIndex 1 set xsfIndex [image_in_range_ $xsfIndex [::pwtk::xsf::getAnimsteps $xsfFile]] # if "nat" in the SYSTEM namelist is undefined, define it if { [::pwtk::input::namelistGetVarValue SYSTEM nat] == "" } { SYSTEM " nat = [::pwtk::xsf::getNAtoms $xsfFile] " } set unit [::pwtk::xsf::getPrimCoorUnit $xsfFile] set coor [::pwtk::atmPosToCoor [::pwtk::purifyCoor [::pwtk::xsf::getPrimCoor $xsfFile $xsfIndex]]] if { $coor eq "" } { pwtk::error "no coordinates found in the XSF file: $xsfFile" 1 } set imageData "ATOMIC_POSITIONS $unit\n$coor" if { [llength $args] == 2 } { addImage {*}[lrange $argum 0 end-1] $imageData } else { addImage {*}[lrange $argum 0 end-2] $imageData } }