Numerical gradient calculation by finite differences - provides gradient for methods for which analytic gradient is not available.
The interface implements a single unnamed method; 'method' keyword not necessary
The following examples, along with all other files needed to run them, can be found in the directory cuby4/interfaces/numerical_gradient/examples
#===============================================================================
# Numerical gradient example 1 - optimization with numerical gradient
#===============================================================================
# Optimize water molecule
job: optimize
opt_quality: 0.1
geometry: A24:water
# Use numerical gradient
interface: numerical_gradient
# This block is used to evaluate energy of each point needed for the
# construction of the gradient:
calculation:
interface: mopac
method: AM1
charge: 0
#===============================================================================
# Numerical gradient example 2 - comparison of analytical and numerical gradient
#===============================================================================
# Prints the difference between numerical and analytical gradient.
# Calculate and print gradient
job: gradient
# Water molecule from A24 database
geometry: A24:water
# Here, advanced YAML syntax is used to define the calculation setup once
# and use it at multiple places later
shared_calc: &calc
interface: mopac
method: pm6
charge: 0
# The Mixer interface is used to calculate the differnce
interface: mixer
mixer_weight_a: 1.0
mixer_weight_b: -1.0
# Numerical gradient calculation
calculation_a:
interface: numerical_gradient
calculation:
<<: *calc # This loads the named block defined above
# Analytical gradient directly from Mopac
calculation_b:
<<: *calc # This loads the named block defined above
mopac_precise: yes # Ask mopac to yield more accurate gradient