TABLE OF CONTENTS


::pwtk::re_spin_neb

SYNOPSIS

proc ::pwtk::re_spin_neb {args} {

USAGE

   re_spin_neb ?-path_thr THRESHOLD?  head  indAtmMagList  old_nebi  old_path

PURPOSE

Perform a spin-polarized neb.x calculation from the previous nonmagnetic NEB calculation, such that neb.x is restarted from the nonmagnetic "path" file (hence, the prefix re in re_spin_neb, i.e., re = restart)

Motivation: in many cases, such as chemical reactions on magnetic surfaces, structures may be reasonably predicted with nonmagnetic calculation, hence nonmagnetic + magnetic NEB may result in an overall faster calculation.

OPTIONS

ARGUMENTS

SIDE EFFECTS

The whole "machinery" is evaluated inside input_pushpop {}. For the re_spin_neb, the input data are loaded from the $old_nebi neb.x input file, but the "outdir" from the $old_nebi is ignored.

The following settings are used for the new spin-polarized NEB calculation:

1.

      outdir_postfix $head
      CONTROL " prefix = '$head' "
      SYSTEM  { nspin = 2 }

2. If the ATOMIC_SPECIES card exists prior to loading the old neb.x input, it is used instead of the one in the old neb.x input file.

3. If 1+2 are not sufficient for a given re_spin_neb calculation, then further tuning can be achieved with the SPINNEB script, which is executed the last before running the new neb.x calculation.

SOURCE

    printTitle spinNEB "running the spin neb.x calculations leveraging the previous NEB calculation"

    set narg 4    
    set options {
        {path_thr.arg {} "path_thr for neb.x calculation"}
    }
    set usage "?-path_thr threshold?  head  indAtmMagList  old_nebi  old_path"
    ::pwtk::parseOpt_
    ::pwtk::checkOType_ -path_thr $opt(path_thr) {number posreal} "positive real number"

    lassign $args head indAtmMagList old_nebi old_path

    print "* old neb.x input file:  $old_nebi
* old neb.x path file:   $old_path\n"

    ::pwtk::fileMustExist $old_nebi {neb.x input}
    ::pwtk::fileMustExist $old_path {neb.x path}

    ::pwtk::input::pushpop {

        # load an old neb.x input file and turn the spin-polarized setup on

        # if ATOMIC_SPECIES exist prior to loading the neb.x input
        # file, they are kept because they may contain correct
        # spin-polarized atomic species
        #
        # otherwise rely on SPINNEB script to amend the situation
        
        set oldSpecies [::pwtk::input::cardGetContent ATOMIC_SPECIES]
        #
        load_fromNEBI $old_nebi
        #
        CONTROL [subst {
            prefix = '$head'
            outdir =
        }]
        SYSTEM  { nspin = 2 }
                 
        ifnotempty oldSpecies {
            ATOMIC_SPECIES $oldSpecies
        }
        outdir_postfix spin.$head

        # evaluate the SPINNEB script
        
        set spinneb [::pwtk::input::scriptGet SPINNEB]
        ifnotempty spinneb {
            print "* SPINNEB script :\n$spinneb\n"
            
            eval $spinneb
        }

        # replace atoms with magnetic-atoms and set their starting_magnetization
        
        foreach {ind atm mag} $indAtmMagList {
            print "* replacing atom $ind with the new type:  $atm, starting_magnetization($atm) = $mag
"
            ::pwtk::nebi::substituteAtom $ind $atm
            SYSTEM "starting_magnetization($atm) = $mag"
        }

        # initialize the new-path file from the old_path

        writeFile $head.path [::pwtk::path::initialize $old_path]

        # the CI_cheme is taken either from the old NEB calc or SPINNEB
        
        set mode [::pwtk::input::namelistGetVarValue PATH CI_scheme trim]

        # if mode eq {}, let "auto" be the default
        ifset mode auto
        
        # run the neb.x calculation in restart mode
        
        PATH [subst {
            restart_mode = 'restart'
            CI_scheme  = [squote $mode]
        }]
        ifnotempty opt(path_thr) {
            PATH " path_thr = $opt(path_thr) "
        }
        runNEB neb.$head.$mode
    }
}