RealTimeTransport 1.0.0
Real-time simulation of quantum transport processes
Loading...
Searching...
No Matches
ComputePropagator.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_COMPUTE_PROPAGATOR_H
8#define REAL_TIME_TRANSPORT_COMPUTE_PROPAGATOR_H
9
10#include <SciCore/IDECheb.h>
11
12#include "BlockMatrices/BlockDiagonalCheb.h"
13#include "Propagator.h"
14
15namespace RealTimeTransport
16{
17
18template <typename MemoryKernelT>
19SciCore::ChebAdaptive<SciCore::Matrix> computePropagatorBlock(const MemoryKernelT& memoryKernel, int blockIndex)
20{
21 using namespace SciCore;
22
23 Real t0 = 0;
24 Real tMax = memoryKernel.tMax();
25 Real safety = 0.01;
26 Real epsAbs = safety * memoryKernel.errorGoal();
27 Real epsRel = 0;
28 int nMinCheb = 3 * 16;
29
30 return computePropagatorIde(
31 memoryKernel.LInfty()(blockIndex), memoryKernel.K().block(blockIndex), t0, tMax, epsAbs, epsRel, nMinCheb);
32}
33
34template <typename MemoryKernelT>
35BlockDiagonalCheb computePropagatorTemplate(const MemoryKernelT& memoryKernel, int block)
36{
37 using namespace SciCore;
38
39 std::vector<ChebAdaptive<Matrix>> blocks;
40
41 int numBlocks = memoryKernel.model()->blockDimensions().size();
42 blocks.reserve(numBlocks);
43
44 // Compute all blocks
45 if (block < 0)
46 {
47 for (int i = 0; i < numBlocks; ++i)
48 {
49 blocks.emplace_back(computePropagatorBlock(memoryKernel, i));
50 }
51 }
52 // Compute only one specific block, set all other blocks to zero
53 else
54 {
55 for (int i = 0; i < numBlocks; ++i)
56 {
57 if (i == block)
58 {
59 blocks.emplace_back(computePropagatorBlock(memoryKernel, i));
60 }
61 else
62 {
63 blocks.emplace_back(ChebAdaptive<Matrix>(
64 [&](Real) -> Matrix {
65 return Matrix::Zero(
66 memoryKernel.model()->blockDimensions()[i], memoryKernel.model()->blockDimensions()[i]);
67 },
68 0.0, memoryKernel.tMax(), memoryKernel.errorGoal(), 0.0, 0.0));
69 }
70 }
71 }
72
73 return BlockDiagonalCheb(std::move(blocks));
74}
75
76// For t=0...model.tCrit() computes the propagator in a numerically stable way
77SciCore::Cheb<SciCore::Matrix> computePropagatorMinusOneBlock(
78 const SciCore::Matrix& minusILInfty,
79 const SciCore::ChebAdaptive<SciCore::Matrix>& minusIK,
80 SciCore::Real errorGoal,
81 SciCore::Real tCrit);
82
83BlockDiagonalCheb computePropagatorMinusOne(
84 const BlockDiagonalMatrix& minusILInfty,
85 const BlockDiagonalCheb& minusIK,
86 SciCore::Real errorGoal,
87 SciCore::Real tCrit);
88
89} // namespace RealTimeTransport
90
91#endif // REAL_TIME_TRANSPORT_COMPUTE_PROPAGATOR_H
This class represents a parameter dependent block diagonal matrix.
Definition BlockDiagonalCheb.h:54
Represents a block diagonal matrix.
Definition BlockDiagonalMatrix.h:33