|
AvogadroLibs 2.0.0
|
Worker object that runs EnergyCalculator computations on a dedicated QThread. More...
#include <avogadro/qtgui/calcworker.h>
Public Slots | |
| void | initCalculator (Avogadro::Calc::EnergyCalculator *calculator, Avogadro::Core::Molecule molSnapshot, Eigen::VectorXd mask, std::vector< Avogadro::Core::Constraint > constraints) |
| void | runOptimizeChunk (Eigen::VectorXd positions, Avogadro::Calc::OptimizationOptions options) |
| void | runEvaluate (Eigen::VectorXd positions, bool computeGradient) |
| void | runGradient (Eigen::VectorXd positions) |
| void | cancel () |
Signals | |
| void | optimizeFinished (Eigen::VectorXd positions, Eigen::VectorXd gradient, double energy, bool converged) |
| void | evaluateFinished (Eigen::VectorXd gradient, double energy) |
| void | calculatorReady () |
Public Member Functions | |
| CalcWorker (QObject *parent=nullptr) | |
The worker owns a cloned EnergyCalculator and a Core::Molecule snapshot. All heavy computation (energy, gradient, optimization steps) happens on the worker thread; results are delivered back to the main thread via queued signal/slot connections.
Typical usage:
|
signal |
Emitted after each optimization chunk completes.
| positions | The updated coordinate vector. |
| gradient | The gradient at the new positions. |
| energy | The energy at the new positions. |
| converged | True if optimization could not continue. |
|
signal |
Emitted after a one-shot energy/gradient evaluation.
| gradient | The gradient vector (empty if not requested). |
| energy | The computed energy. |
|
signal |
Emitted when the calculator has been initialized on the worker thread.
|
slot |
Initialize the calculator on the worker thread. This MUST be called via queued connection so that setMolecule() runs on the worker thread (required for QProcess affinity in ScriptEnergy/OBMMEnergy).
Takes ownership of calculator.
|
slot |
Run a chunk of optimization iterations.
|
slot |
Run a one-shot energy and optionally gradient evaluation.
|
slot |
Run a one-shot gradient evaluation.
|
slot |
Request cancellation of the current computation. Thread-safe: can be called from any thread.