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/

If the current ecutrho is smaller than the value of the -e option (or its default value if not specified),

pw.x specifics: an SCF calculations is performed. If the current ecutrho is smaller than the value of the -e option (or its default value, if not specified), then the ecutrho of the -e option is used (default = 1000 Ry), 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 pw.x --> pp.x --> bader sequence"
    
    input_pushpop {        
        # if ecutrho < $opt(e), increase it
        
        set ecutrho   [::pwtk::input::namelistGetVarValue SYSTEM ecutrho]
        ifset ecutrho [::pwtk::input::namelistGetVarValue SYSTEM ecutwfc]*4
        if { $opt(e) > $ecutrho }  {
            print "Increasing ecutrho to :   $opt(e) Ry\n"
            SYSTEM  [subst { ecutrho = $ecutrho }]
        }

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

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