Tutorial: Minimization with AENET + minsearch
This tutorial explains how to find the optimal N-N bond distance of an N2 dimer by combining a machine learning potential built with AENET and the minsearch (Nelder-Mead method) algorithm in ODAT-SE.
The sample files are located in sample/aenet_minsearch/.
Prerequisites
AENET’s
predict.xmust be installedA trained ANN potential file (
N.5t-5t.ann) must be prepared (see Tutorial: AENET Training Pipeline)
File Structure
sample/aenet_minsearch/
├── input.toml # ODAT-SE configuration file
├── predict.in # AENET prediction settings
├── template.xsf # Structure template
└── run_all.sh # Execution script
Description of input.toml
[base]
dimension = 1
output_dir = "output"
Sets the dimension of the parameter space to 1 (N-N bond distance only).
[solver]
name = "aenet"
[solver.config]
aenet_exec_file = "predict.x"
aenet_ann_potential = "N.5t-5t.ann"
[solver.param]
string_list = ["value_01"]
Specifies AENET as the solver, along with the path to predict.x and the ANN potential file.
string_list defines the placeholders in the template.
[algorithm]
name = "minsearch"
label_list = ["z"]
[algorithm.param]
min_list = [0.5]
max_list = [2.0]
initial_list = [1.25]
[algorithm.minimize]
initial_scale_list = [0.25]
xatol = 0.0001
fatol = 0.0001
maxiter = 100
Minsearch algorithm settings:
Parameter |
Description |
|---|---|
|
Search range: N-N distance 0.5 to 2.0 Angstrom |
|
Initial value: 1.25 Angstrom |
|
Scale of the initial simplex: 0.25 Angstrom |
|
Convergence threshold for parameters: 0.0001 Angstrom |
|
Convergence threshold for function value: 0.0001 eV/atom |
|
Maximum number of iterations: 100 |
Template File
template.xsf is the structure template for the N2 dimer:
ATOMS
N 0.0000000000 0.0000000000 0.0000000000
N 0.0000000000 0.0000000000 value_01
value_01 is the N-N bond distance to be optimized by minsearch.
How to Run
Using the execution script:
cd sample/aenet_minsearch
sh run_all.sh
Or run directly:
odatse-aenet input.toml
The Nelder-Mead optimization converges in 13 iterations (26 function evaluations) and completes in about 1 second.
Output
The calculation results are generated in the output/ directory:
output/res.txt: Optimization result (optimal parameters and objective function value)output/SimplexData.txt: Iteration history of the Nelder-Mead simplex
res.txt contains the optimized N-N bond distance and its corresponding energy (eV/atom).
Format of SimplexData.txt:
# step z fx
Each line represents the parameter values and function value at each step of the simplex.
Results
The Nelder-Mead optimization yields an optimal N-N bond distance of approximately 1.1 Angstrom.
Convergence of the N-N bond distance by the Nelder-Mead method. Top: N-N distance. Bottom: Energy (eV/atom).
To check the optimization result:
cat output/res.txt