TABLE OF CONTENTS
::pwtk::restart_fromIO
SYNOPSIS
proc ::pwtk::restart_fromIO {engine args} {
USAGE
restart_fromIO engine [OPTIONS] HEAD ?FILE.in? ?FILE.out? more specifically: restart_fromIO pw.x|cp.x ?-true_restart 0|1? ?-clear 0|1? ?-cell? HEAD ?FILE.in? ?FILE.out?
PURPOSE
Restart calculation from the I/O files, where:
- engine = pw.x or cp.x (or pw | cp)
- args = [OPTIONS] HEAD ?FILE.in? ?FILE.out?
This command restarts a calculation from the specified input and output files, i.e., input data are read from the input file, whereas CELL_PARAMETERS and ATOMIC_POSITIONS are loaded from the output file; CELL_PARAMETERS are loaded only if found in the output file.
OPTIONS
- -true_restart 0|1 -- if 1, perform true restart with restart_mode = 'restart' (allowed values: 0|1, default = 0). If "-true_restart 0" then only the latest cell-parameters and atomic positions from the output file are re-used.
- -clear 0|1 -- clear the currently defined pw.x input variables, i.e., just use the input variables from the specified input file (allowed values: 0|1, default = 1)
- -cell -- use the CELL_PARAMETERS from the pw.x output file; by default, CELL_PARAMETERS are used from the pw.x output only for calculation = 'vc-relax', but with this option, their use is enforced for all calculations
ARGUMENTS
- engine -- pw.x or cp.x (or pw or cp)
- HEAD -- rootname for the I/O files
- FILE.in -- (optional) input file to restart from (default: HEAD.in)
- FILE.out -- (optional) output file to restart from (default: [headname FILE.in].out)
SIDE EFFECTS
None. Data loading and calculation is performed within input_pushpop { ... }
RETURN VALUE
The name of the new output file.
SOURCE
# check the engine argument engine_ # parse options set nargmin 1 set nargmax 3 set usage "engine ?-true_restart 0|1? ?-clear 0|1? head ?file.in? ?file.out?" set options { {true_restart.arg 0 "perform true restart with restart_mode = 'restart'"} {clear.arg 1 "use just the input variables from the specified input file"} {cell "enforce the use of CELL_PARAMETERS from the pw.x output file"} } parseOpt_ checkOTypeStrict_ -true_restart $opt(true_restart) boolean checkOTypeStrict_ -clear $opt(clear) boolean # assign head, inp, out lassign $args head inp out ifset inp $head.in ifset out [::pwtk::headname $inp].out # check if $inp & $out exist; if not try with $type.$inp & $type.$out set calc [::pwtk::input::namelistGetVarValue CONTROL -nocase calculation trim] if { ! [file exists $inp] && [file exists $calc.$inp] } { set head $calc.[regsub "^$calc\." $head {}] set inp $calc.$inp } if { ! [file exists $out] && [file exists $calc.$out] } { set out $calc.$out } # do the job input_pushpop { ::pwtk::print [procName] "Loading input data from $inp" switch -nocase -- $engine { pw - pw.x { ::pwtk::pwi::load_fromPWI $inp $opt(clear) } cp - cp.x { ::pwtk::cpi::load_fromCPI $inp $opt(clear) } } if { [regexp ^vc- $calc] || $opt(cell) } { ::pwtk::print [procName] "Loading CELL_PARAMETERS & ATOMIC_POSITIONS from $out\n" ::pwtk::pwi::CELL_PARAMETERS_and_ATOMIC_POSITIONS_fromPWO $out } else { ::pwtk::print [procName] "Loading ATOMIC_POSITIONS from $out\n" ::pwtk::pwi::ATOMIC_POSITIONS_fromPWO $out } if { $opt(true_restart) } { re$runCmd $head } else { CONTROL " restart_mode = " $runCmd -append $head } } return $head.out }