RealTimeTransport 1.0.0
Real-time simulation of quantum transport processes
Loading...
Searching...
No Matches
ConductanceDiagrams.h
1//
2// This Source Code Form is subject to the terms of the Mozilla Public
3// License, v. 2.0. If a copy of the MPL was not distributed with this
4// file, You can obtain one at https://mozilla.org/MPL/2.0/.
5//
6
7#ifndef REAL_TIME_TRANSPORT_RENORMALIZED_PT_CONDUCTANCE_DIAGRAMS_H
8#define REAL_TIME_TRANSPORT_RENORMALIZED_PT_CONDUCTANCE_DIAGRAMS_H
9
10#include "../BlockMatrices/BlockDiagonalCheb.h"
11#include "../BlockMatrices/BlockDiagonalMatrix.h"
12#include "../BlockMatrices/BlockMatrix.h"
13#include "../BlockMatrices/BlockVector.h"
14#include "../Model.h"
15
16#include <SciCore/ChebAdaptive.h>
17#include <SciCore/Utility.h>
18
19#include <Eigen/QR>
20
21#include <functional>
22
23namespace RealTimeTransport::RenormalizedPT::Detail
24{
25
26//
27// Compute dρ/dμ by solving dΣ/dμ ρ + Σ dρ/dμ = 0, where ρ denotes the stationary state
28// and Σ the memory kernel at zero-freqeuncy. It must be enforced that Tr dρ/dμ = 0.
29//
30template <typename MemoryKernelT>
31Model::SupervectorType compute_d_dmu_rhoStat(
32 const MemoryKernelT& memoryKernel,
33 const BlockDiagonalCheb& d_dmu_memoryKernel,
34 const Model::SupervectorType& rhoStat,
35 const Model::SuperRowVectorType& idRow,
36 int block)
37{
38 using namespace SciCore;
39 using Supervector = Model::SupervectorType;
40
41 Supervector returnValue = Supervector::Zero(idRow.size());
42 Real tMax = memoryKernel.tMax();
43 const std::vector<int>& blockDims = memoryKernel.model()->blockDimensions();
44
45 // FIXME this only uses the block structure if block==0, otherwise the full equation is solved
46 if (block < 0 || block > 0)
47 {
48 BlockDiagonalMatrix d_dmu_SigmaZeroFreq = d_dmu_memoryKernel.integrate()(tMax);
49 Supervector b = -(d_dmu_SigmaZeroFreq * rhoStat);
50 Matrix A = memoryKernel.zeroFrequency().toDense();
51 A.row(A.rows() - 1) = idRow;
52 b[A.rows() - 1] = 0.0;
53 returnValue = A.colPivHouseholderQr().solve(b);
54 }
55 else if (block == 0)
56 {
57 if (rhoStat.tail(rhoStat.size() - blockDims[block]).isZero() == false)
58 {
59 throw Error("Stationary state does not have the required structure");
60 }
61
62 if (idRow.tail(idRow.size() - blockDims[block]).isZero() == false)
63 {
64 throw Error("Inconsistent block structure");
65 }
66
67 Matrix A = memoryKernel.zeroFrequency()(block);
68 Matrix d_dmu_SigmaZeroFreq = d_dmu_memoryKernel.block(block).integrate()(tMax);
69 Supervector b = -(d_dmu_SigmaZeroFreq * rhoStat.segment(0, blockDims[block]));
70
71 A.row(A.rows() - 1) = idRow.segment(0, blockDims[block]);
72 b[A.rows() - 1] = 0.0;
73 returnValue.head(blockDims[block]) = A.colPivHouseholderQr().solve(b);
74 }
75 else
76 {
77 throw Error("Logic error");
78 }
79
80 truncToZero(returnValue, std::numeric_limits<Real>::epsilon());
81 return returnValue;
82}
83
84// ______/______
85// | |
86// | |
87// 0===========0
88//
89SciCore::Matrix d_dmu_diagram_1(
90 int blockIndex,
91 SciCore::Real t,
92 int r,
93 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
94 const std::vector<BlockMatrix>& superfermion,
95 const Model* model);
96
97//
98// __
99// ___/__|______
100// | | |
101// | | |
102// 0=====0=====0
103// t τ s
104// i2 i1 \bar{i2}
105//
106// Computes the column col of the above diagram with middle index i1
107BlockVector d_dmu_effectiveVertexDiagram1_col(
108 int i1,
109 int col,
110 SciCore::Real t_minus_tau,
111 SciCore::Real tau_minus_s,
112 int r,
113 SciCore::Real epsAbs,
114 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
115 const std::vector<BlockMatrix>& superfermion,
116 const Model* model);
117
118// ______/______
119// | |
120// | |
121// 0===========O <-- effectiveVertex
122//
123// +
124// _____________
125// | |
126// | |
127// 0===========d/dμ(O) <-- derivative effectiveVertex
128//
129SciCore::Matrix d_dmu_diagram_2(
130 int blockIndex,
131 SciCore::Real t,
132 int r,
133 SciCore::Real epsAbs,
134 SciCore::Real epsRel,
135 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
136 const std::function<BlockVector(int, int, SciCore::Real, SciCore::Real)>& computeD_col,
137 const std::function<BlockVector(int, int, SciCore::Real, SciCore::Real, int)>& compute_d_dmu_D_col,
138 const std::vector<BlockMatrix>& superfermion,
139 const Model* model);
140
141// ____________/____________
142// | _________ |
143// | | | |
144// 0-------0-------0-------0
145//
146// +
147// _________________________
148// | ____/____ |
149// | | | |
150// 0-------0-------0-------0
151//
152SciCore::Matrix d_dmu_diagram_2_2(
153 int blockIndex,
154 SciCore::Real t,
155 int r,
156 SciCore::Real epsAbs,
157 SciCore::Real epsRel,
158 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
159 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computeDiagram_1,
160 const std::function<BlockDiagonalMatrix(SciCore::Real)>& compute_d_dmu_diagram_1,
161 const std::vector<BlockMatrix>& superfermion,
162 const Model* model);
163
164// ______/______
165// | |
166// | |
167// X===========0
168//
169Model::SuperRowVectorType d_dmu_currentDiagram_1(
170 SciCore::Real t,
171 int rI,
172 int rmu,
173 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
174 const std::vector<Model::SuperRowVectorType>& Tr_superfermionAnnihilation,
175 const std::vector<BlockMatrix>& superfermion,
176 const std::vector<int>& blockStartIndices,
177 const Model* model);
178
179// ______/______
180// | |
181// | |
182// X===========O <-- effectiveVertex
183//
184// +
185// _____________
186// | |
187// | |
188// X===========d/dμ(O) <-- derivative effectiveVertex
189//
190Model::SuperRowVectorType d_dmu_currentDiagram_2(
191 SciCore::Real t,
192 int rI,
193 int rmu,
194 SciCore::Real epsAbs,
195 SciCore::Real epsRel,
196 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
197 const std::function<BlockVector(int, int, SciCore::Real, SciCore::Real)>& computeD_col,
198 const std::function<BlockVector(int, int, SciCore::Real, SciCore::Real, int)>& compute_d_dmu_D_col,
199 const std::vector<Model::SuperRowVectorType>& Tr_superfermionAnnihilation,
200 const std::vector<int>& blockStartIndices,
201 int block,
202 const Model* model);
203
204// ____________/____________
205// | _________ |
206// | | | |
207// X-------0-------0-------0
208//
209// +
210// _________________________
211// | ____/____ |
212// | | | |
213// X-------0-------0-------0
214//
215Model::SuperRowVectorType d_dmu_currentDiagram_2_2(
216 SciCore::Real t,
217 int rI,
218 int rmu,
219 SciCore::Real epsAbs,
220 SciCore::Real epsRel,
221 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
222 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computeDiagram_1,
223 const std::function<BlockDiagonalMatrix(SciCore::Real)>& compute_d_dmu_diagram_1,
224 const std::vector<BlockMatrix>& superfermion,
225 const std::vector<Model::SuperRowVectorType>& Tr_superfermionAnnihilation,
226 const std::vector<int>& blockStartIndices,
227 const Model* model);
228
229} // namespace RealTimeTransport::RenormalizedPT::Detail
230
231#endif // REAL_TIME_TRANSPORT_RENORMALIZED_PT_CONDUCTANCE_DIAGRAMS_H
Represents a block diagonal matrix.
Definition BlockDiagonalMatrix.h:33
Abstract class representing a model.
Definition Model.h:47