C++QEDCore  2.100.2 (v2 Milestone 10 Development branch)
a framework for simulating open quantum dynamics – core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MCWF_Trajectory.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 #ifndef CPPQEDCORE_QUANTUMTRAJECTORY_MCWF_TRAJECTORY_H_INCLUDED
4 #define CPPQEDCORE_QUANTUMTRAJECTORY_MCWF_TRAJECTORY_H_INCLUDED
5 
6 #include "MCWF_TrajectoryFwd.h"
7 
8 #include "StateVectorFwd.h"
9 
10 #include "MCWF_TrajectoryLogger.h"
11 #include "QuantumTrajectory.h"
12 #include "Structure.h"
13 
14 #include "StochasticTrajectory.h"
15 
16 #include <boost/tuple/tuple.hpp>
17 
18 
19 namespace quantumtrajectory {
20 
21 
22 #define BASE_class trajectory::Stochastic<typename quantumdata::Types<RANK>::StateVectorLow, const quantumdata::StateVector<RANK>&>
23 
24 
26 
59 template<int RANK>
60 class MCWF_Trajectory : public QuantumTrajectory<RANK,BASE_class>
61 {
62 public:
67 
69 
70  typedef typename StateVector::StateVectorLow StateVectorLow;
71 
72 private:
74  typedef BASE_class Base;
75 
76 #undef BASE_class
77 
78  typedef boost::tuple<int,StateVectorLow> IndexSVL_tuple;
79 
80 public:
82 
83  template<typename SYS>
84  MCWF_Trajectory(StateVector& psi,
85  const SYS& sys,
86  const mcwf::Pars& p,
87  const StateVectorLow& scaleAbs=StateVectorLow()
88  );
89 
91 
92  void derivs(double, const StateVectorLow&, StateVectorLow&) const;
93 
95 
96  const StateVector& getPsi() const {return psi_;}
97 
98  const mcwf::Logger& getLogger() const {return logger_;}
100 
101  using Base::getTime;
102 
103 protected:
104  using Base::getEvolved; using Base::getDtTry; using QuantumTrajectory::getQSW;
105 
106  std::ostream& display_v(std::ostream&, int ) const override;
107  std::ostream& displayKey_v(std::ostream&, size_t&) const override;
108 
112  cpputils::oarchive& writeStateMore_v(cpputils::oarchive& oar) const override {return Base::writeStateMore_v(oar) & logger_;}
113 
114  std::ostream& logOnEnd_v(std::ostream& os) const override {return logger_.onEnd(os);}
115 
116 private:
117  typedef std::vector<IndexSVL_tuple> IndexSVL_tuples;
118  typedef typename Liouvillean::Rates Rates;
119 
120  void step_v(double) override; // performs one single adaptive-stepsize MCWF step of specified maximal length
121 
122  std::ostream& displayParameters_v(std::ostream&) const override;
123 
124  const StateVector& toBeAveraged_v() const override {return psi_;}
125 
126  const std::string trajectoryID_v() const override {return "MCWF_Trajectory";}
127 
128  double coherentTimeDevelopment( double Dt);
129  const IndexSVL_tuples calculateSpecialRates ( Rates* rates, double t) const;
130 
131  bool manageTimeStep (const Rates& rates, evolved::TimeStepBookkeeper*, bool logControl=true);
132 
133  void performJump (const Rates&, const IndexSVL_tuples&, double); // LOGICALLY non-const
134  // helpers to step---we are deliberately avoiding the normal technique of defining such helpers, because in that case the whole MCWF_Trajectory has to be passed
135 
136  StateVector& psi_;
137 
138  const double dpLimit_, overshootTolerance_;
139 
140  mutable mcwf::Logger logger_;
141 
142 };
143 
144 
145 } // quantumtrajectory
146 
147 
148 #endif // CPPQEDCORE_QUANTUMTRAJECTORY_MCWF_TRAJECTORY_H_INCLUDED
std::ostream & onEnd(std::ostream &) const
displays summary log information at the end (called by MCWF_Trajectory::logOnEnd_v) ...
The interface every system that needs transformation between two quantum mechanical pictures must pre...
Definition: Exact.h:57
Class hosting common code of MCWF_Trajectory and Master.
std::ostream & display_v(std::ostream &, int) const override
Forwards to structure::Averaged::display.
Represents a trajectory that has both adaptive ODE evolution and noise.
Defines class of the same name.
State vector of arbitrary arity.
Definition: StateVector.h:58
Defines structur::QuantumSystemWrapper.
cpputils::oarchive & writeStateMore_v(cpputils::oarchive &oar) const override
hook into Trajectory::writeState
double getTime() const
actual time instant
Definition: Trajectory.h:206
Comprises modules representing trajectory drivers for simulating quantum systems. ...
Definition: DO_Display.h:12
boost::archive::binary_oarchive oarchive
delegated to Boost.Serialization
Definition: Archive.h:74
Essentially an aggregate of data fields for logging during a MCWF_Trajectory run. ...
Defines class of the same name.
The interface every system having (possibly non-Hermitian) Hamiltonian time-evolution must present to...
Definition: Hamiltonian.h:27
cpputils::iarchive & readStateMore_v(cpputils::iarchive &iar) override
Forwards to BASE, but also sets t0.
Implements a single Monte Carlo wave-function trajectory.
std::ostream & logOnEnd_v(std::ostream &os) const override
calls mcwf::Logger::onEnd
The interface every system that calculates and displays quantum averages must present towards the tra...
Definition: Averaged.h:84
Bookkeeps the timestep-data of Evolved.
Definition: Evolved.h:52
boost::archive::binary_iarchive iarchive
delegated to Boost.Serialization
Definition: Archive.h:73
void derivs(double, const StateVectorLow &, StateVectorLow &) const
The actual function calculating the time derivative for ODE evolution.
MCWF_Trajectory(StateVector &psi, const SYS &sys, const mcwf::Pars &p, const StateVectorLow &scaleAbs=StateVectorLow())
Templated constructor with the same idea as Master::Master.
std::ostream & displayKey_v(std::ostream &, size_t &) const override
Forwards to structure::Averaged::displayKey.
The interface every system having Liouvillean time-evolution must present towards the trajectory driv...
Definition: Liouvillean.h:37
cpputils::iarchive & readStateMore_v(cpputils::iarchive &iar) override
Forwards to QuantumTrajectory::readStateMore_v (that involves setting t0) + serializes mcwf::Logger s...
cpputils::oarchive & writeStateMore_v(cpputils::oarchive &oar) const override
Forwards to Base::writeStateMore_v + serializes mcwf::Logger state.
Aggregate of parameters pertaining to MCWF simulations.
Defines classes related to stochastic evolution.
Base::DArray1D Rates
The 1D real array for storing the jump rates.
Definition: Liouvillean.h:55