TABLE OF CONTENTS


::pwtk::pw_pp_bader

SYNOPSIS

proc ::pwtk::pw_pp_bader {args} {

USAGE

   pw_pp_bader  ?-e ECUTRHO?  ?-p PLOT_NUM?  HEAD

DESCRIPTION

Calculate Bader charges by running pw.x, pp.x, and bader codes. This workflow requires the bader program: https://theory.cm.utexas.edu/henkelman/code/bader/

pw.x specifics: an SCF calculation is performed. If the value of the SYSTEM ecutrho variable is smaller than the value of the -e option (or its default value of 1000 Ry, if not specified), then the ECUTRHO of the -e option is used, i.e.:

        CONTROL { calculation = 'scf' }
        SYSTEM  " ecutrho = $ecutrho "

pp.x specifics: a CUBE file is created with PLOT_NUM value specified by the -p option (default = 17)

OPTIONS

ARGUMENTS

SOURCE

    set narg 1
    set usage "?-e ECUTRHO?  ?-p PLOT_NUM?  HEAD"
    set options {
        {e.arg 1000.0 "ecutrho for pw.x calculation"}
        {p.arg 17     "plot_num for pp.x calculation"}            
    }
    parseOpt_
    checkOTypeStrict_ e $opt(e) double number
    checkOTypeStrict_ p $opt(p) integer

    set head $args
    
    printTitle BADER "Calculating Bader charges using the pw.x --> pp.x --> bader workflow"
    
    input_pushpop {        
        # if ecutrho < $opt(e), increase it
        
        set ecutrho   [::pwtk::input::namelistGetVarValue SYSTEM ecutrho]
        ifset ecutrho [::pwtk::input::namelistGetVarValue SYSTEM ecutwfc]*4

        if { ![string is double $ecutrho] || $opt(e) > $ecutrho }  {
            print "Increasing ecutrho to :   $opt(e) Ry\n"
            SYSTEM  [subst { ecutrho = $opt(e) }]
        }

        # pw.x
        CONTROL { calculation = 'scf' }
        input_clear IONS CELL
        runPW scf.$head

        ::pwtk::pp_bader -p $opt(p) $head
    }
}