RealTimeTransport 1.0.0
Real-time simulation of quantum transport processes
Loading...
Searching...
No Matches
Model.h
Go to the documentation of this file.
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///
8/// \file Model.h
9///
10/// \brief Generic model interface.
11///
12
13#ifndef REAL_TIME_TRANSPORT_MODEL_H
14#define REAL_TIME_TRANSPORT_MODEL_H
15
17
18#include <memory>
19
20#include <SciCore/Definitions.h>
21
22namespace RealTimeTransport
23{
24
25///
26/// \defgroup Models 1. Models
27///
28/// \brief Contains classes and methods related to the implementation of different models.
29///
30/// This page describes classes and methods related to the implementation of different models. A model is defined by
31/// a class that inherits from the abstract \ref Model class. This requires one to implement several functions, which
32/// provide, for example, the Hamiltonian, the field operators and information about the block structure
33/// of the memory kernel.
34///
35/// Models should be instantiated using the \ref createModel function, which automatically takes care of the involved
36/// memory management.
37///
38/// \{
39///
40
41///
42/// @brief Abstract class representing a model.
43///
44/// This class defines the abstract interface from which all models need to inherit.
45///
47{
48 public:
49 /// @brief Type of ordinary operators.
51
52 /// @brief Type of vectorized operators.
54
55 /// @brief Type of adjoint of vectorized operators.
57
58 /// @brief Type of superoperators.
60
61 Model() noexcept;
62 virtual ~Model() noexcept;
63
64 ///
65 /// @brief Equality comparison operator.
66 ///
67 bool operator==(const Model& other) const;
68
69 ///
70 /// @brief Inequality comparison operator.
71 ///
72 bool operator!=(const Model& other) const;
73
74 ///
75 /// @brief Returns the dimension of the Hilbert space.
76 ///
77 virtual int dimHilbertSpace() const noexcept = 0;
78
79 ///
80 /// @brief Returns the number of single particle states (including spin).
81 ///
82 virtual int numStates() const noexcept = 0;
83
84 ///
85 /// @brief Returns the number of channels in each reservoir (e.g. spin).
86 ///
87 virtual int numChannels() const noexcept = 0;
88
89 ///
90 /// @brief Returns the number of reservoirs the system is connected to.
91 ///
92 virtual int numReservoirs() const = 0;
93
94 ///
95 /// @brief Returns the Hamiltonian.
96 ///
97 virtual OperatorType H() const = 0;
98
99 ///
100 /// @brief Returns the parity operator.
101 ///
102 virtual OperatorType P() const;
103
104 ///
105 /// @brief Returns the annihilation operator of the single particle state indexed by l.
106 ///
107 virtual OperatorType d(int l) const = 0;
108
109 ///
110 /// @brief Returns the coupling coefficient in the tunneling Hamiltonian, given by \f$\sqrt{\lambda}_{r \nu} t_{r \nu l}\f$.
111 ///
112 virtual SciCore::Complex coupling(int r, int nu, int l) const = 0;
113
114 ///
115 /// @brief Returns the temperatures of the reservoirs the system is connected to.
116 ///
117 virtual const SciCore::RealVector& temperatures() const noexcept = 0;
118
119 ///
120 /// @brief Returns the chemical potentials of the reservoirs the system is connected to.
121 ///
122 virtual const SciCore::RealVector& chemicalPotentials() const noexcept = 0;
123
124 ///
125 /// @brief Vectorizes an operator into its supervector form.
126 ///
128
129 ///
130 /// @brief Transforms a supervector back into operator form.
131 ///
133
134 ///
135 /// @brief The memory kernel and propagator are block diagonal.
136 /// This function returns a reference to a vector containing the dimensions of these blocks.
137 ///
138 virtual const std::vector<int>& blockDimensions() const noexcept = 0;
139
140 ///
141 /// @brief Returns a deep copy of the model.
142 ///
143 virtual std::unique_ptr<Model> copy() const = 0;
144
145 ///
146 /// @brief Returns true if other is the same as *this, otherwise false.
147 ///
148 virtual bool isEqual(const Model& other) const = 0;
149};
150
151///
152/// @brief Creates and returns a memory managed Model object.
153///
154/// @param params List of parameters to pass to the constructor.
155///
156template <typename ConcreteModelType, typename... Params>
157 requires std::is_base_of_v<Model, ConcreteModelType>
158std::unique_ptr<Model> createModel(Params&&... params)
159{
160 return std::make_unique<ConcreteModelType>(std::forward<Params>(params)...);
161}
162
163/// \} // end of Models
164
165} // namespace RealTimeTransport
166
167#endif // REAL_TIME_TRANSPORT_MODEL_H
#define REALTIMETRANSPORT_EXPORT
Definition RealTimeTransport_export.h:15
Abstract class representing a model.
Definition Model.h:47
virtual int numStates() const noexcept=0
Returns the number of single particle states (including spin).
virtual bool isEqual(const Model &other) const =0
Returns true if other is the same as *this, otherwise false.
virtual OperatorType operatorize(const SupervectorType &supervector) const
Transforms a supervector back into operator form.
virtual OperatorType P() const
Returns the parity operator.
virtual const SciCore::RealVector & temperatures() const noexcept=0
Returns the temperatures of the reservoirs the system is connected to.
virtual OperatorType d(int l) const =0
Returns the annihilation operator of the single particle state indexed by l.
virtual std::unique_ptr< Model > copy() const =0
Returns a deep copy of the model.
bool operator!=(const Model &other) const
Inequality comparison operator.
virtual const SciCore::RealVector & chemicalPotentials() const noexcept=0
Returns the chemical potentials of the reservoirs the system is connected to.
virtual SupervectorType vectorize(const OperatorType &op) const
Vectorizes an operator into its supervector form.
virtual int dimHilbertSpace() const noexcept=0
Returns the dimension of the Hilbert space.
virtual int numReservoirs() const =0
Returns the number of reservoirs the system is connected to.
virtual OperatorType H() const =0
Returns the Hamiltonian.
virtual int numChannels() const noexcept=0
Returns the number of channels in each reservoir (e.g. spin).
bool operator==(const Model &other) const
Equality comparison operator.
virtual const std::vector< int > & blockDimensions() const noexcept=0
The memory kernel and propagator are block diagonal. This function returns a reference to a vector co...
virtual SciCore::Complex coupling(int r, int nu, int l) const =0
Returns the coupling coefficient in the tunneling Hamiltonian, given by .