votca 2024.2-dev
Loading...
Searching...
No Matches
transition_densities.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2022 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// Local VOTCA includes
22
23namespace votca {
24namespace xtp {
25
27
28 // Check on dftbasis
30 throw std::runtime_error("Different DFT basis for the two input file.");
31 } else {
35 << TimeStamp() << " Data was created with basis set "
36 << orbitals1_.getDFTbasisName() << std::flush;
37 }
38
39 // check BSE indices
41 throw std::runtime_error("Different BSE vmin for the two input file.");
42 } else {
44 }
45
47 throw std::runtime_error("Different BSE vmax for the two input file.");
48 } else {
50 }
51
53 throw std::runtime_error("Different BSE cmin for the two input file.");
54 } else {
56 }
57
59 throw std::runtime_error("Different BSE cmax for the two input file.");
60 } else {
62 }
63
66
71
76}
77
78Eigen::MatrixXd TransitionDensities::Matrix(QMState state1, QMState state2) {
79
80 // get the resonant part of exciton1
81 Eigen::VectorXd BSEcoeffs1_res =
83
84 // get the resonant part of exciton2
85 Eigen::VectorXd BSEcoeffs2_res =
87
88 // view BSEcoeffs as matrix
89 Eigen::Map<const Eigen::MatrixXd> exciton1_res(BSEcoeffs1_res.data(),
91
92 Eigen::Map<const Eigen::MatrixXd> exciton2_res(BSEcoeffs2_res.data(),
94
95 Eigen::MatrixXd AuxMat_vv = exciton1_res.transpose() * exciton2_res;
96 Eigen::MatrixXd AuxMat_cc = exciton1_res * exciton2_res.transpose();
97
98 // subtract the antiresonant part, if applicable
99 if (!orbitals1_.getTDAApprox()) {
100 Eigen::VectorXd BSEcoeffs1_antires =
102
103 Eigen::Map<const Eigen::MatrixXd> exciton1_antires(
104 BSEcoeffs1_antires.data(), bse_ctotal_, bse_vtotal_);
105
106 Eigen::VectorXd BSEcoeffs2_antires =
108
109 Eigen::Map<const Eigen::MatrixXd> exciton2_antires(
110 BSEcoeffs2_antires.data(), bse_ctotal_, bse_vtotal_);
111
112 AuxMat_vv -= exciton1_antires.transpose() * exciton2_antires;
113 AuxMat_cc -= exciton1_antires * exciton2_antires.transpose();
114 }
115
116 Eigen::MatrixXd transition_dmat =
117 virtlevels1_ * AuxMat_cc * virtlevels2_.transpose() -
118 occlevels1_ * AuxMat_vv * occlevels2_.transpose();
119
120 return transition_dmat;
121}
122
123} // namespace xtp
124} // namespace votca
const Eigen::MatrixXd & eigenvectors2() const
Definition eigensystem.h:36
const Eigen::MatrixXd & eigenvectors() const
Definition eigensystem.h:33
Index getBSEvmax() const
Definition orbitals.h:286
Index getBSEcmin() const
Definition orbitals.h:288
const tools::EigenSystem & BSESinglets() const
Definition orbitals.h:334
Index getBSEcmax() const
Definition orbitals.h:290
bool getTDAApprox() const
Definition orbitals.h:269
Index getBSEvmin() const
Definition orbitals.h:284
Index getBasisSetSize() const
Definition orbitals.h:64
const tools::EigenSystem & MOs() const
Definition orbitals.h:122
const std::string & getDFTbasisName() const
Definition orbitals.h:202
const AOBasis & getDftBasis() const
Definition orbitals.h:208
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Definition qmstate.h:132
Index StateIdx() const
Definition qmstate.h:154
Timestamp returns the current time as a string Example: cout << TimeStamp()
Definition logger.h:224
Eigen::MatrixXd Matrix(QMState state1, QMState state2)
#define XTP_LOG(level, log)
Definition logger.h:40
base class for all analysis tools
Definition basebead.h:33