CUBY logo

optimize_parameters

Difference between revisions from 2010/12/06 12:36 and 2010/12/06 12:35.
Optimizer intended for fitting parameters. Uses RFO/BFGS optimizer with numerical gradients.  Minimizes result of a calculation interfaced as follows:
* optimize_parameters calls a script, passing current parameters as commandline arguments.
* the output of the script (must be a single number) is read

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%//" -e "s/%alpha%//" template.yaml > input.yaml
sed -e "s/%sr%/^/" -e "s/%alpha%/^/" 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}}