TABLE OF CONTENTS


61-remedy

DESCRIPTION

This example shows how to use the PWTK remedy feature, which is a simple mechanism that is activated when a calculation fails, for example, in case of an SCF convergence failure.

EXAMPLE SOURCE FILE

remedy.pwtk

SOURCE

# import the pw.x input data from Mn-in-NiO100.pwtk
import Mn-in-NiO100.pwtk


# a small "electron_maxstep" is used purposely so that pw.x fails to
# converge the 1st time as to activate the "remedy" mechanism

ELECTRONS {
    electron_maxstep = 15  conv_thr = 1e-10   mixing_beta = 0.9
}


# A remedy script is specified with ::pwtk::remedy
#
# The remedy script is a PWTK script that is executed when calculation
# fails. With the remedy script, we typically modify the input
# data. In the example below, the number of electronic iterations is
# increased and the mixing parameter is reduced. Also, the 1st
# calculation is reused with restart_mode = 'restart'
#
# The logic of the remedy mechanism is the following:
#    1. perform a calculation
#    2. if calculation fails:
#          * execute the remedy script
#          * run the calculation again

remedy pw.x {
    # increase the number of electronic iterations 
    ELECTRONS {
        electron_maxstep = 100
        mixing_beta = 0.5
    }
    # reuse the previous run
    CONTROL {
        restart_mode = 'restart'
    }
}

# run the SCF pw.x calculation: in this example, the 1st SCF
# calculation fails to converge, which activates the remedy mechanism
# that first executes the remedy script and then re-runs the pw.x
# calculation, which converges

runPW scf.Mn-in-NiO100-1x1-3L