TABLE OF CONTENTS
::pwtk::pwi::incrVacuum
SYNOPSIS
proc ::pwtk::pwi::incrVacuum {zBohr} {
ARGUMENTS
- zBohr ... the vacuum increasing length (in Bohr)
PURPOSE
Increase the vacuum thickness by $zBohr in the Z direction, implying that the Z component of the 3rd lattice vectors is modified.
Vacuum can be reduced by specifying a negative value for $zBohr.
SOURCE
if { $zBohr >= 0 } { ::pwtk::print ++++ "Increasing vacuum by $zBohr bohr" } else { ::pwtk::print ++++ "Decreasing vacuum by [regsub -- ^- $zBohr {}] bohr" } set unit [::pwtk::input::cardGetFlags CELL_PARAMETERS trim] set cell_param [::pwtk::input::cardGetContent CELL_PARAMETERS] set dZ 0.0 switch -glob -nocase -- $unit { *alat* { set dZ [expr $zBohr/[::pwtk::pwi::alat]] } *bohr* { set dZ $zBohr } *angstrom* { set dZ [expr $::pwtk::bohr2angs*$zBohr] } default { ::pwtk::error "unknown unit \"$unit\" in CELL_PARAMETERS, must be one of alat, bohr, or angstrom" } } set Zold [lindex $cell_param end] set Znew [expr $Zold + $dZ] lset cell_param end $Znew CELL_PARAMETERS $unit [::pwtk::m2cell $cell_param] ::pwtk::print " Old Z = [format %8.4f $Zold] $unit New Z = [format %8.4f $Znew] $unit New cell parameters:\n" ::pwtk::input::cardPrint CELL_PARAMETERS return $Znew }