C++QEDElements  2.100.2 (v2 Milestone 10 Development branch)
a framework for simulating open quantum dynamics – generic elements
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
Particle_.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
3 // -*- C++ -*-
4 #ifndef CPPQEDELEMENTS_FREES_PARTICLE__H_INCLUDED
5 #define CPPQEDELEMENTS_FREES_PARTICLE__H_INCLUDED
6 
7 #include "Particle_Fwd.h"
8 
9 #include "ParsParticle.h"
10 
11 #include "QM_PictureFwd.h"
12 #include "StateVectorFwd.h"
13 
14 #include "ModeFunction.h"
15 #include "ElementAveraged.h"
16 #include "Exception.h"
17 #include "Free.h"
18 #include "FreeExact.h"
19 #include "TridiagonalHamiltonian.h"
20 
21 #include <boost/shared_ptr.hpp>
22 
23 namespace particle {
24 
25 using namespace structure::freesystem; using structure::NoTime;
26 
27 
28 typedef boost::shared_ptr<const ParticleBase> Ptr;
29 
30 typedef boost::shared_ptr<const PumpedParticleBase> PtrPumped;
31 
33 
34 const Tridiagonal expINKX(particle::Ptr, ptrdiff_t);
35 
36 inline const Tridiagonal sinNKX(particle::Ptr particle, ptrdiff_t nK) {return (expINKX(particle,nK)-expINKX(particle,-nK))/(2.*DCOMP_I);}
37 inline const Tridiagonal cosNKX(particle::Ptr particle, ptrdiff_t nK) {return (expINKX(particle,nK)+expINKX(particle,-nK))/ 2. ;}
38 
39 const Tridiagonal mfNKX (particle::Ptr, const ModeFunction&);
40 const Tridiagonal mfNKX_AbsSqr(particle::Ptr, const ModeFunction&);
41 
43 
48 const Tridiagonal mfComposition(particle::Ptr particle,
49  const ModeFunction& modeFunction1,
50  const ModeFunction& modeFunction2);
51 
52 
53 const StateVector wavePacket(const InitialCondition&, const Spatial&, bool kFlag=true);
54 const StateVector wavePacket(const Pars &, bool kFlag=true);
55 const StateVector wavePacket(const ParsPumped&, bool kFlag=true);
56 
57 const StateVector hoState(int n, const InitialCondition&, const Spatial&, bool kFlag=true/*, bool exactRenorm=true*/);
58 const StateVector hoState(const Pars &, bool Kflag=true);
59 const StateVector hoState(const ParsPumped&, bool Kflag=true);
60 
61 const StateVector init(const Pars&);
62 
63 Ptr make(const Pars&, QM_Picture);
64 
65 PtrPumped makePumped(const ParsPumped&, QM_Picture);
66 
67 
68 namespace details {
69 
70 typedef boost::tuple<const Spatial&, double> Storage;
71 
72 } // details
73 
74 
75 class Exact : public structure::FreeExact<false>, private details::Storage
76 {
77 public:
78  Exact(const Spatial&, double omrec);
79 
80  using details::Storage::get;
81 
82 private:
83  void updateU(structure::OneTime) const;
84 
85  bool applicableInMaster_v() const {return true;}
86 
87  const Diagonal factorExponents_;
88 
89 };
90 
91 
92 namespace details { struct EmptyBase {}; }
93 
94 
95 template<bool IS_TIME_DEPENDENT>
97  : public quantumoperator::TridiagonalHamiltonian<1,IS_TIME_DEPENDENT>,
98  public mpl::if_c<IS_TIME_DEPENDENT,Exact,details::EmptyBase>::type
99 {
100 public:
102 
103  Hamiltonian(const Spatial&, double omrec, double vClass, const ModeFunction&);
104  Hamiltonian(const Spatial&, double omrec, mpl::bool_<IS_TIME_DEPENDENT> =mpl::false_());
105 
106 };
107 
108 
109 // Spatial is a tool to facilitate state vector representations in both X and K space, where the two are canonically conjugate operators, so that [X,K]=i, and hence the two representations are linked with ffTransform.
110 
111 class Spatial
112 {
113 public:
114  typedef DArray<1> Array;
115 
116  explicit Spatial(size_t, double deltaK=1);
117 
118  size_t getFinesse () const {return fin_;}
119  size_t getDimension() const {return x_.size();}
120 
121  // x and k space coordinates, respectively
122  double x(size_t i) const {return x_(i);}
123  double k(size_t i) const {return k_(i);}
124 
125  const Array& getX() const {return x_;}
126  const Array& getK() const {return k_;}
127 
128  void header(std::ostream&) const;
129 
130 private:
131  const size_t fin_; // = log2 (number of dimensions)
132 
133  const double xMax_, deltaX_, kMax_, deltaK_;
134 
135  const Array x_, k_;
136 
137 };
138 
139 
140 class Averaged
141  : public structure::ElementAveraged<1>
142 {
143 public:
145 
146  Averaged(const Spatial&);
147 
148  const Spatial& getSpace() const {return space_;}
149 
150 private:
151  const Averages average_v(NoTime, const LazyDensityOperator&) const;
152  void process_v( Averages&) const;
153 
154  const Spatial space_;
155 
156 };
157 
158 
159 
160 } // particle
161 
162 
163 
165 //
166 // Highest level
167 //
169 
170 
172  : public structure::Free, public particle::Averaged
173 {
174 protected:
175  explicit ParticleBase(size_t fin, const RealFreqs& =emptyRF, const ComplexFreqs& =emptyCF);
176 
177 };
178 
179 
181  : public ParticleBase
182 {
183 public:
184  double getV_Class() const {return vClass_;}
185 
186  const ModeFunction& getMF() const {return mf_;}
187 
188 protected:
189  PumpedParticleBase(size_t fin, double vClass, const ModeFunction&,
190  const RealFreqs& =emptyRF, const ComplexFreqs& =emptyCF);
191 
192 private:
193  const double vClass_;
194  const ModeFunction mf_ ;
195 
196 };
197 
198 
199 class Particle
200  : public ParticleBase, public particle::Exact
201 {
202 public:
203  explicit Particle(const particle::Pars&);
204 
205 };
206 
207 
209  : public ParticleBase, public particle::Hamiltonian<false>
210 {
211 public:
212  explicit ParticleSch(const particle::Pars&);
213 
214 };
215 
216 
218  : public PumpedParticleBase, public particle::Hamiltonian<true>
219 {
220 public:
221  explicit PumpedParticle(const particle::ParsPumped&);
222 };
223 
224 
226  : public PumpedParticleBase, public particle::Hamiltonian<false>
227 {
228 public:
229  explicit PumpedParticleSch(const particle::ParsPumped&);
230 };
231 
232 
233 #endif // CPPQEDELEMENTS_FREES_PARTICLE__H_INCLUDED
boost::shared_ptr< const Base > Ptr
const dcomp DCOMP_I(0, 1)
std::list< CF > ComplexFreqs
blitz::Array< double, RANK > DArray
const StateVector init(const Pars &)
Dispatcher for initial condition.
Definition: Qbit_.h:84
std::list< RF > RealFreqs
const Ptr make(const IA &ia)