Scine::Readuct  6.0.0
This is the SCINE module ReaDuct.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
ReactionPathCostCalculator.h
Go to the documentation of this file.
1 
8 #ifndef READUCT_ELEMENTARYSTEPOPTIMIZATION_COSTCALCULATORS_REACTIONPATHCOSTCALCULATOR_H
9 #define READUCT_ELEMENTARYSTEPOPTIMIZATION_COSTCALCULATORS_REACTIONPATHCOSTCALCULATOR_H
10 
11 #include "../MSVCCompatibility.h"
12 #include <Eigen/Core>
13 #include <memory>
14 
15 namespace Scine {
16 namespace Utils {
17 namespace BSplines {
18 class BSpline;
19 }
20 } // namespace Utils
21 namespace Readuct {
22 namespace ElementaryStepOptimization {
23 struct EnergiesAndGradientsAlongSpline;
24 
25 namespace CostBasedOptimization {
26 
39 class SCINE_DLLEXPORT ReactionPathCostCalculator {
40  public:
41  std::unique_ptr<ReactionPathCostCalculator> clone() const;
42 
46  virtual ~ReactionPathCostCalculator() = default;
47 
53  bool energiesRequired() const;
54 
61  void calculateCost(const Utils::BSplines::BSpline& spline, const EnergiesAndGradientsAlongSpline& energyValues);
62 
68  double getCost() const;
69 
74  Eigen::MatrixXd getCostDerivatives() const;
75 
76  private:
77  virtual std::unique_ptr<ReactionPathCostCalculator> cloneImpl() const = 0;
78  virtual bool energiesRequiredImpl() const = 0;
79  virtual void calculateCostImpl(const Utils::BSplines::BSpline& spline,
80  const EnergiesAndGradientsAlongSpline& energyValues) = 0;
81  virtual double getCostImpl() const = 0;
82  virtual Eigen::MatrixXd getCostDerivativesImpl() const = 0;
83 };
84 
85 inline std::unique_ptr<ReactionPathCostCalculator> ReactionPathCostCalculator::clone() const {
86  return cloneImpl();
87 }
88 
90  return energiesRequiredImpl();
91 }
92 
94  const EnergiesAndGradientsAlongSpline& energyValues) {
95  calculateCostImpl(spline, energyValues);
96 }
97 
98 inline double ReactionPathCostCalculator::getCost() const {
99  return getCostImpl();
100 }
101 
102 inline Eigen::MatrixXd ReactionPathCostCalculator::getCostDerivatives() const {
103  return getCostDerivativesImpl();
104 }
105 
106 } // namespace CostBasedOptimization
107 
108 } // namespace ElementaryStepOptimization
109 
110 } // namespace Readuct
111 } // namespace Scine
112 #endif // READUCT_ELEMENTARYSTEPOPTIMIZATION_COSTCALCULATORS_REACTIONPATHCOSTCALCULATOR_H
Interface for the cost calculation of reaction paths.
Definition: ReactionPathCostCalculator.h:39
double getCost() const
Get the cost associated with a given spline (after it has been evaluated).
Definition: ReactionPathCostCalculator.h:98
bool energiesRequired() const
Whether energies (and their gradients) are required in the cost calculation.
Definition: ReactionPathCostCalculator.h:89
Eigen::MatrixXd getCostDerivatives() const
Get the cost derivatives associated with a given spline.
Definition: ReactionPathCostCalculator.h:102
void calculateCost(const Utils::BSplines::BSpline &spline, const EnergiesAndGradientsAlongSpline &energyValues)
Evaluate the cost associated with a given spline.
Definition: ReactionPathCostCalculator.h:93