4 #ifndef CPPQEDELEMENTS_FREES_MODE__H_INCLUDED
5 #define CPPQEDELEMENTS_FREES_MODE__H_INCLUDED
11 #include "QM_PictureFwd.h"
12 #include "StateVectorFwd.h"
20 #include <boost/shared_ptr.hpp>
25 const std::string keyTitle=
"Mode";
30 typedef boost::shared_ptr<const ModeBase> Ptr;
35 inline const Tridiagonal xop(Ptr
mode) {
return tridiagPlusHC(aop(mode))/sqrt(2.);}
50 const StateVector fock(
size_t n,
size_t dim,
double phase=0);
56 template<
typename AveragingType,
typename... AveragingConstructorParameters>
57 const Ptr
make(
const Pars &, QM_Picture, AveragingConstructorParameters&&... );
59 template<
typename AveragingType,
typename... AveragingConstructorParameters>
60 const Ptr
make(
const ParsLossy &, QM_Picture, AveragingConstructorParameters&&... );
62 template<
typename AveragingType,
typename... AveragingConstructorParameters>
63 const Ptr
make(
const ParsPumped &, QM_Picture, AveragingConstructorParameters&&... );
65 template<
typename AveragingType,
typename... AveragingConstructorParameters>
66 const Ptr
make(
const ParsPumpedLossy&, QM_Picture, AveragingConstructorParameters&&... );
69 const Ptr
make(
const Pars &, QM_Picture);
70 const Ptr
make(
const ParsLossy &, QM_Picture);
71 const Ptr
make(
const ParsPumped &, QM_Picture);
72 const Ptr
make(
const ParsPumpedLossy&, QM_Picture);
80 inline std::ostream& isFiniteTempStream(std::ostream& os,
double , boost::mpl::false_)
81 {
return os <<std::endl;}
82 inline std::ostream& isFiniteTempStream(std::ostream& os,
double nTh, boost::mpl:: true_)
83 {
return os<<
" Finite temperature.\n# nTh="<<nTh<<std::endl;}
86 inline double finiteTemperatureHamiltonianDecay(
const ParsLossy& p, boost::mpl::false_) {
return p.kappa ;}
87 inline double finiteTemperatureHamiltonianDecay(
const ParsLossy& p, boost::mpl:: true_) {
return p.kappa*(2.*p.nTh+1);}
101 const dcomp& get_zI()
const {
return zI_;}
104 void updateU(Time)
const;
106 bool applicableInMaster_v()
const {
return !bool(real(zI_));}
113 namespace details {
struct EmptyBase {}; }
115 template<
bool IS_TIME_DEPENDENT>
118 public mpl::if_c<IS_TIME_DEPENDENT,Exact,details::EmptyBase>::type
124 Hamiltonian(
const dcomp& zSch,
const dcomp& eta,
size_t, mpl::bool_<IS_TIME_DEPENDENT> =mpl::false_());
129 const dcomp& get_zSch()
const {
return zSch_;}
130 const dcomp& get_zI ()
const {
return Exact::get_zI();}
132 const dcomp& get_eta()
const {
return eta_;}
145 template<
bool TEMPERATURE,
bool IS_ALTERNATIVE=false>
class Liouvillean;
156 template<
bool IS_ALTERNATIVE>
158 :
protected boost::mpl::false_,
176 class LiouvilleanFiniteTemperatureBase
179 LiouvilleanFiniteTemperatureBase(
double kappa,
double nTh) : kappa_(kappa), nTh_(nTh) {}
186 const double kappa_, nTh_;
193 template<
bool IS_ALTERNATIVE>
195 :
private details::LiouvilleanFiniteTemperatureBase,
196 protected boost::mpl::true_,
202 Liouvillean(
double kappa,
double nTh,
const std::string& kT=keyTitle)
203 : details::LiouvilleanFiniteTemperatureBase(kappa,nTh), Base(kT,{
"excitation loss",
"excitation absorption"}) {}
206 void doActWithJ(
NoTime,
StateVectorLow& psi, LindbladNo<0>)
const {details:: aJump(psi,kappa_*(nTh_+1));}
207 void doActWithJ(
NoTime,
StateVectorLow& psi, LindbladNo<1>)
const {details::aDagJump(psi,kappa_* nTh_ );}
209 double rate(
NoTime,
const LazyDensityOperator& matrix, LindbladNo<0>)
const {
return rate0(matrix,boost::mpl::bool_<IS_ALTERNATIVE>());}
210 double rate(
NoTime,
const LazyDensityOperator& matrix, LindbladNo<1>)
const {
return rate1(matrix,boost::mpl::bool_<IS_ALTERNATIVE>());}
222 Averaged(
const KeyLabels& follow=KeyLabels(),
const KeyLabels& precede=KeyLabels());
229 const ClonedPtr do_clone()
const {
return new Averaged(*
this);}
237 AveragedQuadratures(
const KeyLabels& follow=KeyLabels(),
const KeyLabels& precede=KeyLabels());
249 template<
typename Base>
253 typedef typename Base::Averages Averages;
254 typedef typename Base::KeyLabels KeyLabels;
260 void process_v( Averages&)
const;
282 const std::string& keyTitle=mode::keyTitle);
284 ModeBase(
size_t dim,
const ComplexFreqs& complexFreqs,
const std::string& keyTitle=mode::keyTitle) :
ModeBase(dim,emptyRF,complexFreqs,keyTitle) {}
285 ModeBase(
size_t dim, RealFreqsInitializer rf, ComplexFreqsInitializer cf={},
const std::string& keyTitle=mode::keyTitle)
287 ModeBase(
size_t dim, ComplexFreqsInitializer cf,
const std::string& keyTitle=mode::keyTitle) :
ModeBase(dim,RealFreqsInitializer(),cf,keyTitle) {}
288 ModeBase(
size_t dim,
RF rf,
CF cf=
CF(),
const std::string& keyTitle=mode::keyTitle)
289 :
ModeBase(dim,RealFreqsInitializer{rf}, cf==
CF() ? ComplexFreqsInitializer{} : ComplexFreqsInitializer{cf},keyTitle) {}
290 ModeBase(
size_t dim,
CF cf,
const std::string& keyTitle=mode::keyTitle) :
ModeBase(dim,ComplexFreqsInitializer{cf},keyTitle) {}
291 ModeBase(
size_t dim, RealFreqsInitializer rf,
CF cf,
const std::string& keyTitle=mode::keyTitle) :
ModeBase(dim,rf,{cf},keyTitle) {}
292 ModeBase(
size_t dim,
RF rf, ComplexFreqsInitializer cf,
const std::string& keyTitle=mode::keyTitle) :
ModeBase(dim,{rf},cf,keyTitle) {}
304 template<
typename AveragingType>
309 template<
typename... AveragingConstructorParameters>
310 Mode(
const mode::Pars&, AveragingConstructorParameters&&... );
316 template<
typename AveragingType>
318 struct ModeUIP :
Mode<AveragingType>
320 template<
typename... AveragingConstructorParameters>
321 ModeUIP(
const mode::Pars& p, AveragingConstructorParameters&&... a) :
Mode<AveragingType>(p,a...) {}
331 template<
typename AveragingType>
336 template<
typename... AveragingConstructorParameters>
337 ModeSch(
const mode::Pars&, AveragingConstructorParameters&&... );
346 template<
typename AveragingType>
351 template<
typename... AveragingConstructorParameters>
352 PumpedMode(
const mode::ParsPumped&, AveragingConstructorParameters&&... );
358 template<
typename AveragingType>
359 struct PumpedModeUIP :
PumpedMode<AveragingType>
361 template<
typename... AveragingConstructorParameters>
362 PumpedModeUIP(
const mode::ParsPumped& p, AveragingConstructorParameters&&... a) :
PumpedMode<AveragingType>(p,a...) {}
372 template<
typename AveragingType>
377 template<
typename... AveragingConstructorParameters>
378 PumpedModeSch(
const mode::ParsPumped&, AveragingConstructorParameters&&... );
388 template<
bool TEMPERATURE,
typename AveragingType>
393 template<
typename... AveragingConstructorParameters>
394 LossyMode(
const mode::ParsLossy&, AveragingConstructorParameters&&... );
403 template<
bool TEMPERATURE,
typename AveragingType>
408 template<
typename... AveragingConstructorParameters>
409 LossyModeUIP(
const mode::ParsLossy&, AveragingConstructorParameters&&... );
418 template<
bool TEMPERATURE,
typename AveragingType>
423 template<
typename... AveragingConstructorParameters>
424 LossyModeSch(
const mode::ParsLossy&, AveragingConstructorParameters&&... );
434 template<
bool TEMPERATURE,
typename AveragingType>
439 template<
typename... AveragingConstructorParameters>
440 PumpedLossyMode(
const mode::ParsPumpedLossy&, AveragingConstructorParameters&&... );
448 template<
bool TEMPERATURE,
typename AveragingType>
453 template<
typename... AveragingConstructorParameters>
454 PumpedLossyModeUIP(
const mode::ParsPumpedLossy&, AveragingConstructorParameters&&... );
462 template<
bool TEMPERATURE,
typename AveragingType>
467 template<
typename... AveragingConstructorParameters>
468 PumpedLossyModeSch(
const mode::ParsPumpedLossy&, AveragingConstructorParameters&&... );
476 template<
bool TEMPERATURE,
typename AveragingType=mode::Averaged>
481 template<
typename... AveragingConstructorParameters>
504 void doActWithJ (OneTime, StateVectorLow& )
const;
505 double rate (OneTime,
const LazyDensityOperator&)
const;
507 const Averages average_v(OneTime,
const LazyDensityOperator&)
const;
513 #endif // CPPQEDELEMENTS_FREES_MODE__H_INCLUDED
Combines LossyModeUIP and PumpedMode.
std::tuple< std::string, dcomp, double > CF
quantumdata::Types< 1 >::StateVectorLow StateVectorLow
Implements a free mode, that is, in a fully exact way, that is .
const StateVector coherent(const dcomp &alpha, size_t cutoff)
Coherent state.
std::list< CF > ComplexFreqs
Contains helpers for the Mode bundle.
const StateVector init(const Pars &)
Dispatcher for initial condition.
Implements a mode damped with rate , that is , in a fully exact way, that is , and ...
Same as Mode, but without exact propagation.
std::list< RF > RealFreqs
Implements a pumped mode, that is in interaction picture defined by the first term.
Diagonals::T_numtype Diagonal
Same as LossyMode, but in Schrödinger picture.
Combines LossyMode with pumping in full (non-unitary) interaction picture.
Same as LossyMode, but in unitary interaction picture, defined only by the part of the Hamiltonian...
std::tuple< std::string, double, double > RF
std::complex< double > dcomp
Same as PumpedMode, without exact propagation.
const Ptr make(const IA &ia)
Combines LossyModeSch and PumpedModeSch.
LiouvilleanAveragedCommon::DArray1D Averages