CUBY logo

optimize_parameters

Optimizer intended for fitting parameters. Uses RFO/BFGS optimizer with numerical gradients. Minimizes result of a calculation interfaced as follows:

Initial values of the parameters as well as various settings are provided from commandline, type "optimize_parameters -h" to get list of options.

Example

Optimization of damping function in empirical dispersion correction in SCC-DFTB. (Only an example, it will hardly yield usable results.)

Template input file, containing the necessary setup, with placeholders instead of the parameters (templete.yaml):

interface: dftb
dftb_dispersion: no # Do not use the default dispersion

# Empirical dispersion, optimization of damping function
modifiers: dispersion
dispersion_para: "%sr%, %alpha%"

Script that creates actual input file with parameters read as arguments, runs the calculation and prints the value to be minimized (step.sh):

#!/bin/bash

# Use sed to replace placeholders with actual values
sed -e "s/%sr%/$1/" -e "s/%alpha%/$2/" template.yaml > input.yaml

# Run calculation, extract RMSE from the output
# -l switch is used to print the results with more decimal places
cuby_dataset -l input.yaml S22 | awk '/RMSE/ {print }'

To run this example, type:

optimize_parameters -d 0.005 -p "1.5, 23.0" ./step.sh