TABLE OF CONTENTS


::pwtk::restartPW_fromPWIandPWO

SYNOPSIS

proc ::pwtk::restartPW_fromPWIandPWO {args} {

USAGE

restartPW_fromPWIandPWO ?options? head ?pwi? ?pwo?

DESCRIPTION

Load the input data from the specified pw.x input and output files and restart the pw.x calculation. From the output file only the latest atomic-positions and cell-paramaters (if exist) will be used.

OPTIONS

ARGUMENTS

SOURCE

    # parse options
    
    set options {
        {true_restart.arg  1  "perform true restart with restart_mode = 'restart'"}
        {clear.arg         1  "use the input variables from the specified input file"}
    }
    array set opt [::cmdline::getoptions args $options [list [lindex [info level 0] 0] options:]]    

    foreach op {true_restart clear} {
        # e.g., .true. --> true
        set opt($op) [string trim $opt($op) .]
        
        if { ! [string is boolean $opt($op)] } {
            ::pwtk::error "wrong value for option -$opt, expected boolean but got:  $opt($op)" 1
        }
    }

    if { [llength $args] < 1 } {
        ::pwtk::error "Usage: restartPW_fromPWIandPWO ?options? head ?pwi? ?pwo?" 1
    }

    # assign head, pwi, pwo
    
    set head [lindex $args 0]
    set pwi  [lindex $args 1]
    set pwo  [lindex $args 2]

    if { $pwi == {} } { set pwi $head.in }
    if { $pwo == {} } { set pwo $head.out }    

    # do the job
    
    input_pushpop {
    
        ::pwtk::pwi::load_fromPWI $pwi $opt(clear)
        ::pwtk::pwi::CELL_PARAMETERS_and_ATOMIC_POSITIONS_fromPWO $pwo
    
        if { $opt(true_restart) } {
            rerunPW $head
        } else {
            CONTROL " restart_mode = "
            runPW -append $head
        }
    }
}