|
occ
|
Rigid molecule crystal structure optimizer. More...
#include <crystal_optimizer.h>
Public Types | |
| using | IterationCallback = std::function< bool(int, double, double)> |
| Callback for iteration monitoring: callback(iter, energy, gradient_norm) -> continue? | |
Public Member Functions | |
| CrystalOptimizer (CrystalEnergySetup setup, const CrystalOptimizerSettings &settings={}) | |
| Construct optimizer for a crystal structure. | |
| CrystalOptimizer (const crystal::Crystal &crystal, std::vector< MultipoleSource > multipoles, const CrystalOptimizerSettings &settings={}) | |
| Legacy constructor from Crystal + MultipleSources. | |
| CrystalOptimizerResult | optimize () |
| Run optimization. | |
| CrystalOptimizerResult | optimize (IterationCallback callback) |
| Run optimization with iteration callback. | |
| Vec | get_parameters () const |
| Get current parameters as flat vector. | |
| void | set_parameters (const Vec ¶ms) |
| Set parameters from flat vector. | |
| const std::vector< MoleculeState > & | states () const |
| Get current molecular states (all Z UC molecules). | |
| const std::vector< MoleculeState > & | initial_states () const |
| Get initial molecular states (before optimization). | |
| crystal::Crystal | build_optimized_crystal () const |
| Build optimized crystal from current states. | |
| CrystalEnergyResult | compute_energy_gradient () |
| Compute energy and gradient at current state. | |
| void | reinitialize_states () |
| Re-sync optimizer's states from the energy calculator. | |
| CrystalEnergy & | energy_calculator () |
| Access underlying energy calculator. | |
| const CrystalEnergy & | energy_calculator () const |
| const CrystalOptimizerSettings & | settings () const |
| Access settings. | |
| const SymmetryMapping & | symmetry_mapping () const |
| Access symmetry mapping (valid when use_symmetry=true). | |
| int | num_parameters () const |
| Number of optimizable parameters. | |
Rigid molecule crystal structure optimizer.
Optimizes molecular positions and orientations to minimize the crystal lattice energy. Can operate in two modes:
| using occ::mults::CrystalOptimizer::IterationCallback = std::function<bool(int, double, double)> |
Callback for iteration monitoring: callback(iter, energy, gradient_norm) -> continue?
| occ::mults::CrystalOptimizer::CrystalOptimizer | ( | CrystalEnergySetup | setup, |
| const CrystalOptimizerSettings & | settings = {} |
||
| ) |
Construct optimizer for a crystal structure.
| crystal | Input crystal structure |
| multipoles | Body-frame multipoles for each unique molecule |
| settings | Optimization settings Construct from explicit molecule data. Preferred constructor. |
| occ::mults::CrystalOptimizer::CrystalOptimizer | ( | const crystal::Crystal & | crystal, |
| std::vector< MultipoleSource > | multipoles, | ||
| const CrystalOptimizerSettings & | settings = {} |
||
| ) |
Legacy constructor from Crystal + MultipleSources.
| crystal::Crystal occ::mults::CrystalOptimizer::build_optimized_crystal | ( | ) | const |
Build optimized crystal from current states.
| CrystalEnergyResult occ::mults::CrystalOptimizer::compute_energy_gradient | ( | ) |
Compute energy and gradient at current state.
|
inline |
Access underlying energy calculator.
|
inline |
| Vec occ::mults::CrystalOptimizer::get_parameters | ( | ) | const |
Get current parameters as flat vector.
|
inline |
Get initial molecular states (before optimization).
|
inline |
Number of optimizable parameters.
| CrystalOptimizerResult occ::mults::CrystalOptimizer::optimize | ( | ) |
Run optimization.
| CrystalOptimizerResult occ::mults::CrystalOptimizer::optimize | ( | IterationCallback | callback | ) |
Run optimization with iteration callback.
| callback | Called after each iteration |
| void occ::mults::CrystalOptimizer::reinitialize_states | ( | ) |
Re-sync optimizer's states from the energy calculator.
Call this after modifying the energy calculator externally (e.g., via CrystalEnergySetup).
| void occ::mults::CrystalOptimizer::set_parameters | ( | const Vec & | params | ) |
Set parameters from flat vector.
|
inline |
Access settings.
|
inline |
Get current molecular states (all Z UC molecules).
|
inline |
Access symmetry mapping (valid when use_symmetry=true).