TABLE OF CONTENTS


::pwtk::cube2bader

SYNOPSIS

proc ::pwtk::cube2bader {args} {

USAGE

   cube2bader [BADER_OPTIONS] CUBE_FILE

DESCRIPTION

Run the bader program on a supplied cube file. This routine requires the bader program: https://theory.cm.utexas.edu/henkelman/code/bader/

ARGUMENTS

SOURCE

    set cube [lindex $args end]
    ::pwtk::fileMustExist $cube CUBE

    set bader [getExecutable [::pwtk::getVar_ BADER] bader]
    if { $bader eq {} } {
        ::pwtk::error "cannot find a usable \"bader\" executable" 1
    }

    set head [regsub {.cube$} $cube {}]
    try {
        execute $bader {*}$args > ${head}_bader.log
    } on error err {
        ::pwtk::writeFile ${head}_bader.error $err
    }
    if { [file exists ACF.dat] } {
        print "Renaming *.dat files to ${head}_*.dat\nFor Bader atomic charges, see:  ${head}_ACF.dat"
        file rename -force ACF.dat ${head}_ACF.dat
        file rename -force AVF.dat ${head}_AVF.dat
        file rename -force BCF.dat ${head}_BCF.dat
    } else {
        ::pwtk::error "File ACF.dat does not exist. Likely, the bader run failed!" 
    }
}