Scine::Sparrow  5.0.0
Library for fast and agile quantum chemical calculations with semiempirical methods.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
TDDFTBSigmaVectorEvaluator.h
Go to the documentation of this file.
1 
7 #ifndef SPARROW_TDDFTBSIGMAVECTOREVALUATOR_H
8 #define SPARROW_TDDFTBSIGMAVECTOREVALUATOR_H
9 
14 
15 namespace Scine {
16 namespace Sparrow {
17 
18 template<Utils::Reference restrictedness>
19 class OrderedInput;
20 
21 enum class TDDFTBType { TDDFTB, TDA };
22 
48 template<Utils::Reference restrictedness>
50  public:
56  TDDFTBSigmaVectorEvaluator(std::shared_ptr<Eigen::MatrixXd> gammaMatrix, std::shared_ptr<Eigen::VectorXd> spinConstants,
57  const OrderedInput<restrictedness>& orderedInput,
58  Utils::SpinTransition spinBlock = Utils::SpinTransition::Singlet,
59  TDDFTBType type = TDDFTBType::TDDFTB);
60  ~TDDFTBSigmaVectorEvaluator() final = default;
61 
68  auto evaluate(const Eigen::MatrixXd& guessVectors) const -> const Eigen::MatrixXd& final;
69 
70  private:
74  void calculateAtomicEnergyWeightedTransitionCharges(const Eigen::MatrixXd& transitionCharges);
78  auto calculateXBI(const Eigen::VectorXd& guessVector) const -> Eigen::MatrixXd;
82  auto calculateYAI(const Eigen::VectorXd& XBI) const -> Eigen::MatrixXd;
86  auto calculateAtomicContraction(const Eigen::MatrixXd& YAIMatrix) const -> Eigen::VectorXd;
90  template<typename Derived, typename OtherDerived>
91  void fillAdditionalSigmaMatrixTerms(const Eigen::MatrixBase<Derived>& sigmaBlock,
92  const Eigen::MatrixBase<OtherDerived>& guessVector) const;
96  void collapsed(int newSubspaceDimension) final;
100  auto factor() const -> double;
101 
106  void check() const;
107  const OrderedInput<restrictedness>& input_;
108  std::shared_ptr<Eigen::MatrixXd> gammaMatrix_;
109  std::shared_ptr<Eigen::VectorXd> spinConstantsVector_;
110  const bool isTDA_;
111  Utils::SpinTransition spinBlock_{Utils::SpinTransition::Singlet};
112  Eigen::MatrixXd energyWeightedAtomicTransitionCharges_;
113  // Caching variable declared mutable in order not to influence the API design.
114  mutable Eigen::MatrixXd currentSigmaMatrix_;
115 };
116 
117 template<>
119  return isTDA_ ? 2.0 : 4.0;
120 }
121 template<>
122 inline auto TDDFTBSigmaVectorEvaluator<Utils::Reference::Unrestricted>::factor() const -> double {
123  return isTDA_ ? 1.0 : 2.0;
124 }
125 } // namespace Sparrow
126 } // namespace Scine
127 
128 #endif // SPARROW_TDDFTBSIGMAVECTOREVALUATOR_H
TDDFTBSigmaVectorEvaluator(std::shared_ptr< Eigen::MatrixXd > gammaMatrix, std::shared_ptr< Eigen::VectorXd > spinConstants, const OrderedInput< restrictedness > &orderedInput, Utils::SpinTransition spinBlock=Utils::SpinTransition::Singlet, TDDFTBType type=TDDFTBType::TDDFTB)
Constructor taking a OrderedInput&lt;restrictedness&gt; object.
Definition: TDDFTBSigmaVectorEvaluator.cpp:26
Ordered input for the TDDFTB eigenvalue solver. Contains quantities in increasing energetic order...
Definition: OrderedInput.h:69
Definition: TDDFTBSigmaVectorEvaluator.h:49
auto evaluate(const Eigen::MatrixXd &guessVectors) const -> const Eigen::MatrixXd &final
Calculates one sigma vector per input guess vector.
Definition: TDDFTBSigmaVectorEvaluator.cpp:40