TABLE OF CONTENTS


::pwtk::fast_neb

SYNOPSIS

proc ::pwtk::fast_neb {args} {

USAGE

   ::pwtk::fast_neb ?-noCI_thr THRESHOLD?  ?-fast_thr THRESHOLD?  ?-CI_thr THRESHOLD?  ?-CI CI_LIST?  ?-onlyCI?  ?-artn?  auto|manual  HEAD

PURPOSE

Perform a composite "fast-preliminary + full-precision" NEB calculation, where the fast-preliminary calculation consists of no-CI + CI NEB calculation (CI = climbing-image). To omit the no-CI calculation, use the -onlyCI option.

The 'full-precision' calculation starts from the 'fast-preliminary' results and involves only the CI calculation.

After the NEB calculations are finished, the activation energy can be refined with the ARTn plugin by specifying the -artn option (it requires QE compiled with the ARTn plugin enabled). For ARTn, if the ARTN_PARAMETERS namelist is undefined or empty, PWTK uses its default (stored in $::pwtk::default_ARTN_PARAMETERS).

The purpose of 'fast_neb' is to speedup the NEB calculation. The preliminary NEB is peformed with the reduced precision as set by the FASTNEB script (see ::pwtk::FASTNEB).

OPTIONS

ARGUMENTS

SIDE EFFECTS

"prefix" and outdir_postfix are set to HEAD, whereas all other modifications are popped away after complition because both calculations are performed with input_pushpop.

SOURCE

    variable noCI_path_thr
    variable neb_options

    set narg 2
    set usage "?-noCI_thr THRESHOLD?  ?-fast_thr THRESHOLD?  ?-CI_thr THRESHOLD?  ?-CI CI_LIST?  ?-onlyCI?  ?-artn?  auto|manual  HEAD"
    set options [concat $neb_options {
        {fast_thr.arg {}  "CI path-threshold for the preliminary fast CI-NEB calculation"}
        {CI.arg       {}  "list of climbing images for the CLIMBING_IMAGES card"}
    }]
    ::pwtk::parseOpt_
    ::pwtk::checkOType_ -noCI_thr $opt(noCI_thr) {number posreal} "positive real number"
    ::pwtk::checkOType_ -fast_thr $opt(fast_thr) {number posreal} "positive real number"
    ::pwtk::checkOType_ -CI_thr   $opt(CI_thr)   {number posreal} "positive real number"
    ::pwtk::checkOType_ -CI       $opt(CI)    {numberlist posint} "list of positive integer numbers"

    set mode [string trim [lindex $args 0] ']
    set head [lindex $args 1]

    printTitle FAST_NEB "Composite NEB calculation with CI_scheme = $mode"

    switch -exact $mode {
        auto - manual {}
        default {
            error "unknown CI_scheme \"$CI_scheme\", must be auto or manual"
        }
    }
    set onlyCI ""
    if { $opt(onlyCI) } { set onlyCI "-onlyCI" }

    set fastneb [::pwtk::input::scriptGet FASTNEB]

    if { $fastneb == {} } {
        ::pwtk::error "Cannot perform fast_neb calculation, FASTNEB script is missing" 1
    }
    
    ::pwtk::input::pushpop {        
        print "Preliminary NEB calculations with a lower accuracy:
   * calculation will be performed in subdirectory:  ./fastneb.$head.d/
   * path_thr = $opt(fast_thr)
   * FASTNEB script :
$fastneb
"        
    
        eval_in_dir fastneb.$head.d {
            # the recipe for a speedup is specified in the FASTNEB script
            eval $fastneb
        
            # perform a fast_neb calculation
            if { $mode eq "auto" } {
                auto_neb -noCI_thr $opt(noCI_thr) -CI_thr $opt(fast_thr) {*}$onlyCI $head
            } else {
                manual_neb -noCI_thr $opt(noCI_thr) -CI_thr $opt(fast_thr) -CI $opt(CI) {*}$onlyCI $head
            }
        
            # create the "initialized" path file in ../
            
            # BEWARE: take care of the PWTK restart mode, i.e., write
            # the "initialized" path file when restart is off, but if
            # restart=on, then write it only if fastneb.$head.path is
            # newer than ../$head.path
            
            set write 0
            if { ! [file exists ../$head.path] || ! [restart] } {
                set write 1
            } elseif { [file exists ../$head.path] && [file atime $head.path] > [file atime ../$head.path] } {
                set write 1
            }    
            if { $write } {
                # we need to initialize the PATH file and set the
                # fixAtoms if_pos(*) fields to those corresponding to
                # the currently stored POSITIONS supercard

                writeFile ../$head.path [::pwtk::nebi::fixAtoms_inPATH [::pwtk::path::initialize $head.path]]
            }
        }; # eval_in_dir
    }; # ::pwtk::input::pushpop

    # what is the path_thr (needed for printout)
    set path_thr $opt(CI_thr)
    ::pwtk::ifempty path_thr {
        set path_thr [::pwtk::input::namelistGetVarValue PATH path_thr]
    }
    
    print "Performing the full precision CI-NEB calculation
   * restoring original input data
   * calculation will be performed in ./
   * path_thr = $path_thr\n"

    # perform the CI-NEB calculation in restart-mode
    
    outdir_postfix $head
    CONTROL " prefix = '$head' "

    ::pwtk::input::pushpop {
        PATH [subst {
            restart_mode = 'restart'
            CI_scheme    = [squote $mode]
        }]
        ::pwtk::ifnotempty opt(CI_thr) {
            PATH " path_thr = $opt(CI_thr) "
        }

        if { $mode == "manual" && $opt(CI) != {} } {
            CLIMBING_IMAGES $opt(CI)
        }
        runNEB neb.$head.$mode

        neb_plot $head

        # ARTn refinement of the activation energy
        if { $opt(artn) } {
            neb_refine_artn $head
        }
    }
}