TABLE OF CONTENTS


64-stopOnError

DESCRIPTION

This example shows how to prevent PWTK aborting if an error occurs during a calculation. By default, PWTK aborts if an error occurs. The reason for this is that often calculations depend on preceding calculations.

However, if the calculations are independent, it makes sense not to abort if a calculation fails. The respective PWTK behaviour can be controlled with ::pwtk::stopOnError

EXAMPLE SOURCE FILE

stopOnError.pwtk

SOURCE

import Si.pwtk

# with ::pwtk::stopOnError instruct PWTK not to abort if a calculation fails

stopOnError off;  # to active stopOnError mode, use:  stopOnError on 

print "The following calculation fails but PWTK does not abort because
stopOnError is off.\n"

input_pushpop {
    CONTROL { calculation = 'xxx' }
    runPW xxx.Si
}

print "But the next calculation runs just fine.\n"
runPW scf.Si