TABLE OF CONTENTS


::pwtk::re_spin_neb

SYNOPSIS

proc ::pwtk::re_spin_neb {args} {

USAGE

   ::pwtk::re_spin_neb ?-path_thr THRESHOLD?  ?-artn?  HEAD  IND_MAGATM_LIST  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.

The magnetic specs of the new spin-polarized calculation are specified via the SPINNEB script (see ::pwtk::SPINNEB).

After the NEB calculation, 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).

OPTIONS

ARGUMENTS

The structure of the 'IND_MAGATM_LIST' list is the following:

     set IND_MAGATM_LIST {
         atom-index1 atom-symbol1
         atom-index2 atom-symbol2
         ...
     }

where:

SIDE EFFECTS

The whole "machinery" is evaluated inside ::pwtk::input::pushpop {}. For the ::pwtk::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 (OLD_NEBI), it is used instead of the one in OLD_NEBI.

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 SPIN_NEB "Running \"spin\" NEB leveraging the previous NEB calculation"

    set narg 4    
    set options {
        {path_thr.arg {} "path_thr for neb.x calculation"}
        {artn            "refine the neb.x calculated activation energy with the ARTn plugin"}
    }
    set usage "?-path_thr THRESHOLD?  ?-artn?  HEAD  IND_MAGATM_LIST  OLD_NEBI  OLD_PATH"
    ::pwtk::parseOpt_
    ::pwtk::checkOType_ -path_thr $opt(path_thr) {number posreal} "positive real number"

    lassign $args head indAtmList 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} $indAtmList {
            print "* replacing atom $ind with the new type:  $atm"
            ::pwtk::nebi::substituteAtom $ind $atm
        }

        # initialize the new-path file from the old_path

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

        # if CI_scheme eq {}, let "auto" be the default
        
        set mode [::pwtk::input::namelistGetVarValue PATH CI_scheme trim]
        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

        neb_plot $head

        if { $opt(artn) } {
            neb_refine_artn $head
        }
    }
}