votca 2026-dev
Loading...
Searching...
No Matches
bse.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#pragma once
21#ifndef VOTCA_XTP_BSE_H
22#define VOTCA_XTP_BSE_H
23
24// Local VOTCA includes
25#include "logger.h"
26#include "orbitals.h"
27#include "qmstate.h"
28#include "threecenter.h"
29
30namespace votca {
31namespace xtp {
32struct BSE_Population;
33template <Index cqp, Index cx, Index cd, Index cd2>
34class BSE_OPERATOR;
37template <class T>
38class QMFragment;
39
40class BSE {
41
42 public:
43 // BSE(Logger& log, TCMatrix_gwbse& Mmn, const Eigen::MatrixXd& Hqp_in)
44 // : log_(log), Mmn_(Mmn), Hqp_in_(Hqp_in){};
45 BSE(Logger& log, TCMatrix_gwbse& Mmn) : log_(log), Mmn_(Mmn) {};
46
47 struct options {
48 bool useTDA;
56 Index nmax; // number of eigenvectors to calculat
58 std::string davidson_tolerance;
59 std::string davidson_update;
61 double min_print_weight; // minimium contribution for state to print it
65 };
66
67 void configure(const options& opt, const Eigen::VectorXd& RPAEnergies,
68 const Eigen::MatrixXd& Hqp_in);
69
71 const options& opt, const Eigen::VectorXd& RPAEnergies,
72 const Eigen::MatrixXd& Hqp_in, const Eigen::VectorXd& epsilon_0_inv);
73
74 void Solve_singlets(Orbitals& orb) const;
75 void Solve_triplets(Orbitals& orb) const;
76
77 Eigen::MatrixXd getHqp() const { return Hqp_; };
78
81
82 void Analyze_singlets(std::vector<QMFragment<BSE_Population> > fragments,
83 const Orbitals& orb) const;
84 void Analyze_triplets(std::vector<QMFragment<BSE_Population> > fragments,
85 const Orbitals& orb) const;
86
88
89 private:
91
92 struct Interaction {
93 Eigen::VectorXd exchange_contrib;
94 Eigen::VectorXd direct_contrib;
95 Eigen::VectorXd qp_contrib;
96 };
97
99 Eigen::VectorXd direct_term;
100 Eigen::VectorXd cross_term;
101 };
102
109
112
113 Eigen::VectorXd epsilon_0_inv_;
114
116 Eigen::MatrixXd Hqp_;
117
120
123
124 void PrintWeights(const Eigen::VectorXd& weights) const;
125
126 template <typename BSE_OPERATOR>
128
129 template <typename BSE_OPERATOR>
131
132 template <typename BSE_OPERATOR_ApB, typename BSE_OPERATOR_AmB>
134 BSE_OPERATOR_AmB&) const;
135
136 template <typename BSE_OPERATOR_A, typename BSE_OPERATOR_B>
138 BSE_OPERATOR_B& Bop) const;
139
140 void printFragInfo(const std::vector<QMFragment<BSE_Population> >& frags,
141 Index state) const;
142 void printWeights(Index i_bse, double weight) const;
143 void SetupDirectInteractionOperator(const Eigen::VectorXd& DFTenergies,
144 double energy);
145
146 Eigen::MatrixXd AdjustHqpSize(const Eigen::MatrixXd& Hqp_in,
147 const Eigen::VectorXd& RPAInputEnergies);
148
150 const Orbitals& orb) const;
151 template <typename BSE_OPERATOR>
153 const Orbitals& orb,
154 const BSE_OPERATOR& H) const;
155
156 template <typename BSE_OPERATOR>
158 const QMState& state, const Orbitals& orb, const BSE_OPERATOR& H) const;
159
161 Orbitals& orb) const;
163 const Orbitals& orb) const;
164
165 std::string StateEnergiesHeader(const QMStateType& type) const;
166 std::string StateShortLabel(const QMStateType& type) const;
167 std::string StateDynamicLabel(const QMStateType& type) const;
168 double ExchangePrefactor(const QMStateType& type) const;
169};
170} // namespace xtp
171} // namespace votca
172
173#endif // VOTCA_XTP_BSE_H
void Solve_singlets(Orbitals &orb) const
Definition bse.cc:224
BSE(Logger &log, TCMatrix_gwbse &Mmn)
Definition bse.h:45
Eigen::MatrixXd getHqp() const
Definition bse.h:77
void printFragInfo(const std::vector< QMFragment< BSE_Population > > &frags, Index state) const
Definition bse.cc:362
void PrintWeights(const Eigen::VectorXd &weights) const
Definition bse.cc:378
void printWeights(Index i_bse, double weight) const
std::string StateDynamicLabel(const QMStateType &type) const
Definition bse.cc:125
double dyn_tolerance_
Definition bse.h:111
void configure_with_precomputed_screening(const options &opt, const Eigen::VectorXd &RPAEnergies, const Eigen::MatrixXd &Hqp_in, const Eigen::VectorXd &epsilon_0_inv)
Definition bse.cc:61
void Analyze_singlets(std::vector< QMFragment< BSE_Population > > fragments, const Orbitals &orb) const
Definition bse.cc:394
tools::EigenSystem Solve_triplets_BTDA() const
Definition bse.cc:305
TripletOperator_TDA getTripletOperator_TDA() const
Definition bse.cc:259
SingletOperator_TDA getSingletOperator_TDA() const
Definition bse.cc:252
ExpectationValues ExpectationValue_Operator_State(const QMState &state, const Orbitals &orb, const BSE_OPERATOR &H) const
Definition bse.cc:523
options opt_
Definition bse.h:90
tools::EigenSystem Solve_singlets_BTDA() const
Definition bse.cc:295
Index bse_vmax_
Definition bse.h:104
Index bse_cmin_
Definition bse.h:105
void Perturbative_DynamicalScreening(const QMStateType &type, Orbitals &orb)
Definition bse.cc:610
void Analyze_triplets(std::vector< QMFragment< BSE_Population > > fragments, const Orbitals &orb) const
Definition bse.cc:448
void SetupDirectInteractionOperator(const Eigen::VectorXd &DFTenergies, double energy)
Definition bse.cc:188
void configure(const options &opt, const Eigen::VectorXd &RPAEnergies, const Eigen::MatrixXd &Hqp_in)
Definition bse.cc:43
Eigen::MatrixXd Hqp_
Definition bse.h:116
tools::EigenSystem & GetBSEEigenSystem(const QMStateType &type, Orbitals &orb) const
Definition bse.cc:80
Eigen::VectorXd epsilon_0_inv_
Definition bse.h:113
ExpectationValues ExpectationValue_Operator(const QMStateType &type, const Orbitals &orb, const BSE_OPERATOR &H) const
Definition bse.cc:501
Interaction Analyze_eh_interaction(const QMStateType &type, const Orbitals &orb) const
Definition bse.cc:565
Index bse_ctotal_
Definition bse.h:108
double ExchangePrefactor(const QMStateType &type) const
Definition bse.cc:136
TCMatrix_gwbse & Mmn_
Definition bse.h:115
Index bse_size_
Definition bse.h:106
tools::EigenSystem Solve_singlets_TDA() const
Definition bse.cc:243
void configureBSEOperator(BSE_OPERATOR &H) const
Definition bse.cc:207
Index max_dyn_iter_
Definition bse.h:110
tools::EigenSystem solve_hermitian(BSE_OPERATOR &h) const
Definition bse.cc:267
tools::EigenSystem Solve_nonhermitian(BSE_OPERATOR_ApB &apb, BSE_OPERATOR_AmB &) const
void Solve_triplets(Orbitals &orb) const
Definition bse.cc:234
Logger & log_
Definition bse.h:103
tools::EigenSystem Solve_nonhermitian_Davidson(BSE_OPERATOR_A &Aop, BSE_OPERATOR_B &Bop) const
Definition bse.cc:316
Eigen::MatrixXd AdjustHqpSize(const Eigen::MatrixXd &Hqp_in, const Eigen::VectorXd &RPAInputEnergies)
Definition bse.cc:147
Index bse_vtotal_
Definition bse.h:107
std::string StateShortLabel(const QMStateType &type) const
Definition bse.cc:115
tools::EigenSystem Solve_triplets_TDA() const
Definition bse.cc:217
std::string StateEnergiesHeader(const QMStateType &type) const
Definition bse.cc:104
Logger is used for thread-safe output of messages.
Definition logger.h:164
Container for molecular orbitals and derived one-particle data.
Definition orbitals.h:47
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Definition qmstate.h:135
BSE_OPERATOR< 1, 2, 1, 0 > SingletOperator_TDA
Definition bse.h:35
BSE_OPERATOR< 1, 0, 1, 0 > TripletOperator_TDA
Definition bse.h:36
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
Eigen::VectorXd direct_term
Definition bse.h:99
Eigen::VectorXd cross_term
Definition bse.h:100
Eigen::VectorXd qp_contrib
Definition bse.h:95
Eigen::VectorXd exchange_contrib
Definition bse.h:93
Eigen::VectorXd direct_contrib
Definition bse.h:94
std::string davidson_tolerance
Definition bse.h:58
std::string davidson_update
Definition bse.h:59
double min_print_weight
Definition bse.h:61
std::string davidson_correction
Definition bse.h:57