TABLE OF CONTENTS
::pwtk::pwi::deleteAtoms
SYNOPSIS
proc ::pwtk::pwi::deleteAtoms {deleteList} {
PURPOSE
Delete requested atoms from ATOMIC_POSITIONS card.
ARGUMENTS
- deleteList -- list of indices of atoms to delete; index of the first atom is 1 (list of atoms can also have a symbolic compact syntax supported by ::pwtk::parseRangeString)
SOURCE
set natoms [::pwtk::pwi::getNAtoms] set sortedList [lsort -integer -decreasing [::pwtk::parseRangeString $deleteList $natoms]] set atmPosList [split [::pwtk::purifyCoor [::pwtk::input::cardGetContent ATOMIC_POSITIONS]] \n] if { $atmPosList eq {} && $deleteList ne {} } { ::pwtk::error "atomic structure is empty: cannot delete atoms [join $sortedList {, }]" 1 } # check that indices are in range foreach index $sortedList { ::pwtk::int_in_range1_ $index $natoms } # delete atoms foreach del $sortedList { set d2 [expr {$del - 2}] set atmPosList "[lrange $atmPosList 0 $d2] [lrange $atmPosList $del end]" } ::pwtk::input::cardContent ATOMIC_POSITIONS [::pwtk::purifyCoor [join $atmPosList \n]] ::pwtk::pwi::setNAtoms }