TABLE OF CONTENTS


::pwtk::flo::run

SYNOPSIS

proc ::pwtk::flo::run {head {ion_dynamics bfgs}} {

PURPOSE

Perform the FLO (first_last_opt) type PATH calculations, which consists of the following:

     1. pw.x relax calculation to optimize the 1st image
     2. pw.x relax calculation to optimize the last image
     3. neb.x path calculation with optimized 1st and last image

See also ::pwtk::flo for more information on FLO.

ARGUMENTS

SOURCE

    printTitle_ "Performing the First-Last-Optimize (FLO) path calculation."

    set restart_mode [::pwtk::input::namelistGetVarValue PATH restart_mode trim]
    set name         [regsub {^neb.} $head {}]

    # do some checks ...

    if { ${restart_mode} == "restart" } {
        ::pwtk::error "PATH { restart_mode = 'restart' } is incompatible with FLO" 1
    }
    
    # first create the input files
    # (look into ::pwtk::flo::input_files proc for the input file names)

    ::pwtk::input::pushpop {        
        set outdir [::pwtk::outdir_query -hard]
        set ion_dynamics [::pwtk::squote $ion_dynamics]

        CONTROL " calculation  = 'relax'  
                  restart_mode = 'from_scratch' 
                  outdir       = '[file join $outdir relax.IS]' "
        IONS    " ion_dynamics = $ion_dynamics "
        
        # optimize the first image

        ATOMIC_POSITIONS [::pwtk::nebi::getImageUnit first] [::pwtk::nebi::getImageAtmPos first]
        ::pwtk::pwi::setNAtoms
        
        print_ "Optimizing the first image (IS) with pw.x using the $ion_dynamics algorithm ...\n"
        runPW relax.IS.$name

        # optimize the last image
        
        CONTROL " outdir = '[file join $outdir relax.FS]' "
        ATOMIC_POSITIONS [::pwtk::nebi::getImageUnit last] [::pwtk::nebi::getImageAtmPos -if_pos last]

        print_ "Optimizing the last image (FS) with pw.x using the $ion_dynamics algorithm ...\n"
        runPW relax.FS.$name
    }

    # fill-in the optimized coordinates
    print_ "Using the optimized coordinates for the first and last images"
    
    CONTROL { calculation =  restart_mode = }
    input_clear IONS

    ::pwtk::nebi::replaceImage first [::pwtk::pwo::getAtmPos relax.IS.$name.out]
    ::pwtk::nebi::replaceImage last  [::pwtk::atmPosToCoor [::pwtk::pwo::getAtmPos relax.FS.$name.out]]
        
    print_ "Running the neb.x calculation ...\n"
    runNEB $head.in    
}