votca 2026-dev
Loading...
Searching...
No Matches
bsecoupling.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_BSECOUPLING_H
22#define VOTCA_XTP_BSECOUPLING_H
23
24// Local VOTCA includes
25#include "couplingbase.h"
26#include "qmstate.h"
27
28namespace votca {
29namespace xtp {
30
38
39class BSECoupling : public CouplingBase {
40 public:
41 void Initialize(tools::Property& options) override;
42 std::string Identify() const { return "bsecoupling"; }
43
44 void Addoutput(tools::Property& type_summary, const Orbitals& orbitalsA,
45 const Orbitals& orbitalsB) const override;
46
54 void CalculateCouplings(const Orbitals& orbitalsA, const Orbitals& orbitalsB,
55 const Orbitals& orbitalsAB) override;
56
57 private:
69 struct Diagnostics {
70 double xi = 0.0;
71 double pt_rm_discrepancy = 0.0;
72 bool downfolding_safe = true;
73 };
74
75 void WriteToProperty(tools::Property& summary, const QMState& stateA,
76 const QMState& stateB) const;
77
87 static void WriteMatrixToProperty(tools::Property& prop,
88 const std::string& name,
89 const Eigen::MatrixXd& mat,
90 double conversion = 1.0);
91
92 double getSingletCouplingElement(Index levelA, Index levelB,
93 Index methodindex) const;
94
95 double getTripletCouplingElement(Index levelA, Index levelB,
96 Index methodindex) const;
97
98 Eigen::MatrixXd SetupCTStates(Index bseA_vtotal, Index bseB_vtotal,
99 Index bseAB_vtotal, Index bseAB_ctotal,
100 const Eigen::MatrixXd& A_AB,
101 const Eigen::MatrixXd& B_AB) const;
102
103 Eigen::MatrixXd ProjectFrenkelExcitons(const Eigen::MatrixXd& BSE_Coeffs,
104 const Eigen::MatrixXd& X_AB,
105 Index bseX_vtotal, Index bseX_ctotal,
106 Index bseAB_vtotal,
107 Index bseAB_ctotal) const;
108
121 template <class BSE_OPERATOR>
122 std::array<Eigen::MatrixXd, 2> ProjectExcitons(Eigen::MatrixXd& FE_AB,
123 Eigen::MatrixXd& CTStates,
125 Eigen::MatrixXd& J_dimer_out,
126 Eigen::MatrixXd& S_dimer_out,
127 Diagnostics& diag_out) const;
128
139 template <class BSE_OPERATOR>
140 Eigen::MatrixXd CalcJ_dimer(BSE_OPERATOR& H, Eigen::MatrixXd& projection,
141 Eigen::MatrixXd& J_dimer_out,
142 Eigen::MatrixXd& S_dimer_out) const;
143
159 Eigen::MatrixXd OrthogonalizeCTs(Eigen::MatrixXd& FE_AB,
160 Eigen::MatrixXd& CTStates) const;
161
162 Eigen::MatrixXd Fulldiag(const Eigen::MatrixXd& J_dimer) const;
163
164 Eigen::MatrixXd Perturbation(const Eigen::MatrixXd& J_dimer) const;
165
175 Diagnostics ComputeDiagnostics(const Eigen::MatrixXd& J_dimer,
176 const Eigen::MatrixXd& J_pert,
177 const Eigen::MatrixXd& J_diag) const;
178
179 // --- effective coupling results (existing) ---
180 std::array<Eigen::MatrixXd, 2> JAB_singlet; // [J_pert, J_diag]
181 std::array<Eigen::MatrixXd, 2> JAB_triplet;
182
183 // --- raw TB matrices (new) ---
184 // These are the pre-Lowdin J and S in the full FE+CT basis,
185 // suitable for assembling a TB Hamiltonian or feeding into SRG.
186 Eigen::MatrixXd J_dimer_singlet_;
187 Eigen::MatrixXd S_dimer_singlet_;
188 Eigen::MatrixXd J_dimer_triplet_;
189 Eigen::MatrixXd S_dimer_triplet_;
190
191 // --- diagnostics (new) ---
194
195 // --- monomer FE energies (new) ---
196 // Isolated monomer excitation energies in eV, stored per spin channel.
197 // These provide pairwise-consistent site energies for TB assembly:
198 // the same monomer calculation is used regardless of which dimer pair
199 // is being processed, unlike the dimer diagonal H_FE_FE[i,i] which
200 // varies with the partner. Environmental corrections (electrostatic
201 // embedding) should be added separately on top of these values.
206
210 // When true, write TB-specific output: monomer energies, transition
211 // dipoles, diagnostics, and raw H/S matrices. Default false for compact
212 // output in KMC/rate workflows that only need scalar couplings.
213 bool output_tb_ = false;
220};
221
222} // namespace xtp
223} // namespace votca
224
225#endif // VOTCA_XTP_BSECOUPLING_H
class to manage program options with xml serialization functionality
Definition property.h:55
Evaluates electronic coupling elements.
Definition bsecoupling.h:39
Eigen::VectorXd monomerA_energies_triplet_
Eigen::MatrixXd J_dimer_triplet_
double getSingletCouplingElement(Index levelA, Index levelB, Index methodindex) const
Eigen::VectorXd monomerB_energies_singlet_
double getTripletCouplingElement(Index levelA, Index levelB, Index methodindex) const
std::string Identify() const
Definition bsecoupling.h:42
void CalculateCouplings(const Orbitals &orbitalsA, const Orbitals &orbitalsB, const Orbitals &orbitalsAB) override
evaluates electronic couplings
void Addoutput(tools::Property &type_summary, const Orbitals &orbitalsA, const Orbitals &orbitalsB) const override
void WriteToProperty(tools::Property &summary, const QMState &stateA, const QMState &stateB) const
Diagnostics ComputeDiagnostics(const Eigen::MatrixXd &J_dimer, const Eigen::MatrixXd &J_pert, const Eigen::MatrixXd &J_diag) const
Compute diagnostics from raw J_dimer and the two effective coupling matrices.
std::array< Eigen::MatrixXd, 2 > JAB_triplet
Eigen::MatrixXd Perturbation(const Eigen::MatrixXd &J_dimer) const
Eigen::VectorXd monomerB_energies_triplet_
std::array< Eigen::MatrixXd, 2 > ProjectExcitons(Eigen::MatrixXd &FE_AB, Eigen::MatrixXd &CTStates, BSE_OPERATOR H, Eigen::MatrixXd &J_dimer_out, Eigen::MatrixXd &S_dimer_out, Diagnostics &diag_out) const
Compute J_pert and J_diag, and store raw J_dimer/S_dimer and diagnostics for later output.
void Initialize(tools::Property &options) override
Eigen::MatrixXd S_dimer_singlet_
Eigen::VectorXd monomerA_energies_singlet_
Eigen::MatrixXd S_dimer_triplet_
std::array< Eigen::MatrixXd, 2 > JAB_singlet
Eigen::MatrixXd ProjectFrenkelExcitons(const Eigen::MatrixXd &BSE_Coeffs, const Eigen::MatrixXd &X_AB, Index bseX_vtotal, Index bseX_ctotal, Index bseAB_vtotal, Index bseAB_ctotal) const
static void WriteMatrixToProperty(tools::Property &prop, const std::string &name, const Eigen::MatrixXd &mat, double conversion=1.0)
Write an Eigen matrix as rows of space-separated values into an XML property node....
Eigen::MatrixXd SetupCTStates(Index bseA_vtotal, Index bseB_vtotal, Index bseAB_vtotal, Index bseAB_ctotal, const Eigen::MatrixXd &A_AB, const Eigen::MatrixXd &B_AB) const
Eigen::MatrixXd Fulldiag(const Eigen::MatrixXd &J_dimer) const
Eigen::MatrixXd CalcJ_dimer(BSE_OPERATOR &H, Eigen::MatrixXd &projection, Eigen::MatrixXd &J_dimer_out, Eigen::MatrixXd &S_dimer_out) const
Form J_dimer and S_dimer from the projection, then Lowdin orthogonalize to produce J_ortho.
Eigen::MatrixXd OrthogonalizeCTs(Eigen::MatrixXd &FE_AB, Eigen::MatrixXd &CTStates) const
Merge FE and CT projection vectors into a single projection matrix without pre-orthogonalization.
Eigen::MatrixXd J_dimer_singlet_
Base Class to derive DFT and BSE coupling from.
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
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
Diagnostic quantities for assessing whether CT downfolding is safe.
Definition bsecoupling.h:69