Debian Codegraph @

avogadro/calc/energyoptimizer.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_CALC_ENERGYOPTIMIZER_H
7 #define AVOGADRO_CALC_ENERGYOPTIMIZER_H
8
9 #include "avogadrocalcexport.h"
10
11 #include <Eigen/Core>
12
13 #include <cstddef>
14
15 namespace Avogadro::Calc {
16
17 class EnergyCalculator;
18
19 enum class OptimizationAlgorithm
20 {
21 Lbfgs
22 };
23
24 struct AVOGADROCALC_EXPORT OptimizationOptions
25 {
26 OptimizationAlgorithm algorithm = OptimizationAlgorithm::Lbfgs;
27 size_t chunkIterations = 5;
28 };
29
30 /**
31 * Run a bounded number of optimization iterations on the current position
32 * vector.
33 *
34 * @return true if the selected algorithm was executed, false if options are
35 * invalid or unsupported.
36 */
37 AVOGADROCALC_EXPORT bool optimizeSteps(
38 EnergyCalculator& method, Eigen::VectorXd& positions,
39 const OptimizationOptions& options = OptimizationOptions{});
40
41 } // namespace Avogadro::Calc
42
43 #endif // AVOGADRO_CALC_ENERGYOPTIMIZER_H