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
quantumtrajectory::MCWF_Trajectory< RANK > Class Template Reference

Implements a single Monte Carlo wave-function trajectory. More...

#include <MCWF_Trajectory.h>

+ Inheritance diagram for quantumtrajectory::MCWF_Trajectory< RANK >:
+ Collaboration diagram for quantumtrajectory::MCWF_Trajectory< RANK >:

Public Types

typedef structure::Exact< RANK > Exact
 
typedef structure::Hamiltonian< RANK > Hamiltonian
 
typedef structure::Liouvillean< RANK > Liouvillean
 
typedef structure::Averaged< RANK > Averaged
 
typedef quantumdata::StateVector< RANK > StateVector
 
typedef StateVector::StateVectorLow StateVectorLow
 
- Public Types inherited from trajectory::Adaptive< quantumdata::Types< RANK >::StateVectorLow >
typedef evolved::Evolved< quantumdata::Types< RANK >::StateVectorLow > Evolved
 

Public Member Functions

template<typename SYS >
 MCWF_Trajectory (StateVector &psi, const SYS &sys, const mcwf::Pars &p, const StateVectorLow &scaleAbs=StateVectorLow())
 Templated constructor with the same idea as Master::Master. More...
 
void derivs (double, const StateVectorLow &, StateVectorLow &) const
 The actual function calculating the time derivative for ODE evolution. More...
 
Getters
const StateVectorgetPsi () const
 
const mcwf::LoggergetLogger () const
 
- Public Member Functions inherited from trajectory::Adaptive< quantumdata::Types< RANK >::StateVectorLow >
void step (double deltaT)
 corresponding to Evolved::step, it takes a single adaptive step More...
 
- Public Member Functions inherited from trajectory::AdaptiveIO< quantumdata::Types< RANK >::StateVectorLow >
 AdaptiveIO (Ptr)
 
cpputils::iarchivereadState (cpputils::iarchive &iar)
 Read in the EvolvedIO from a cpputils::iarchive. More...
 
cpputils::oarchivewriteState (cpputils::oarchive &oar) const
 Write the EvolvedIO to a cpputils::oarchive.
 
double getTime () const
 Returns the time of the underlying EvolvedIO.
 
- Public Member Functions inherited from trajectory::Trajectory
void evolve (double deltaT)
 Propagation for a time interval of exactly deltaT.
 
std::ostream & display (std::ostream &, int precision) const
 Displays a limited set of relevant physical and numerical information about the actual state of Trajectory at the actual time instant. More...
 
std::ostream & displayParameters (std::ostream &os) const
 print header
 
std::ostream & logOnEnd (std::ostream &os) const
 print a log at the end summarizing overall (e.g. time-averaged) physical and numerical data during the run
 
double getTime () const
 actual time instant
 
double getDtDid () const
 last perfomed timestep
 
cpputils::iarchivereadState (cpputils::iarchive &iar)
 read from an archive
 
cpputils::oarchivewriteState (cpputils::oarchive &oar) const
 write to an archive
 
- Public Member Functions inherited from trajectory::Averageable< const quantumdata::StateVector< RANK > & >
const const quantumdata::StateVector< RANK > & toBeAveraged () const
 returns the set of quantities condensed in a variable of type T that are “to be averaged”
 

Protected Member Functions

std::ostream & display_v (std::ostream &, int) const override
 Forwards to structure::Averaged::display.
 
std::ostream & displayKey_v (std::ostream &, size_t &) const override
 Forwards to structure::Averaged::displayKey.
 
cpputils::iarchivereadStateMore_v (cpputils::iarchive &iar) override
 Forwards to QuantumTrajectory::readStateMore_v (that involves setting t0) + serializes mcwf::Logger state.
 
cpputils::oarchivewriteStateMore_v (cpputils::oarchive &oar) const override
 Forwards to Base::writeStateMore_v + serializes mcwf::Logger state.
 
std::ostream & logOnEnd_v (std::ostream &os) const override
 calls mcwf::Logger::onEnd
 
- Protected Member Functions inherited from quantumtrajectory::QuantumTrajectory< RANK, trajectory::Stochastic< quantumdata::Types< RANK >::StateVectorLow, const quantumdata::StateVector< RANK > & > >
 QuantumTrajectory (typename structure::QuantumSystem< RANK >::Ptr qs, bool isNoisy, ArgumentPack &&...argumentPack)
 Constructor forwarding to BASE and QuantumSystemWrapper.
 
const QuantumSystemWrapper getQSW () const
 
cpputils::iarchivereadStateMore_v (cpputils::iarchive &iar) override
 Forwards to BASE, but also sets t0.
 
double getT0 () const
 The time instant of the beginning of the current time step. More...
 
void setT0 (double t0) const
 The time instant of the beginning of the current time step. More...
 
void setT0 () const
 The time instant of the beginning of the current time step. Sets to the current time.
 
void checkDimension (const CONSTRUCT &construct) const
 Check the dimensions of the stored quantum system against construct More...
 
- Protected Member Functions inherited from trajectory::Stochastic< quantumdata::Types< RANK >::StateVectorLow, const quantumdata::StateVector< RANK > & >
std::ostream & displayParameters_v (std::ostream &) const override
 
 Stochastic (quantumdata::Types< RANK >::StateVectorLow &, typename Evolved::Derivs, double dtInit, double epsRel, double epsAbs, const quantumdata::Types< RANK >::StateVectorLow &scaleAbs, const evolved::Maker< quantumdata::Types< RANK >::StateVectorLow > &, unsigned long seed, bool noise, const randomized::Maker &)
 Straightforward constructor combining the construction of Adaptive and randomized::Randomized.
 
 Stochastic (quantumdata::Types< RANK >::StateVectorLow &, typename Evolved::Derivs, double dtInit, const quantumdata::Types< RANK >::StateVectorLow &scaleAbs, const ParsStochastic &, const evolved::Maker< quantumdata::Types< RANK >::StateVectorLow > &, const randomized::Maker &)
 
const RandomizedPtr getRandomized () const
 
bool isNoisy () const
 
cpputils::oarchivewriteStateMore_v (cpputils::oarchive &oar) const override
 hook into Trajectory::writeState
 
- Protected Member Functions inherited from trajectory::Adaptive< quantumdata::Types< RANK >::StateVectorLow >
 Adaptive (quantumdata::Types< RANK >::StateVectorLow &, typename Evolved::Derivs, double, double, double, const quantumdata::Types< RANK >::StateVectorLow &, const evolved::Maker< quantumdata::Types< RANK >::StateVectorLow > &)
 Constructor taking the same parameters as needed to operate evolved::Maker.
 
 Adaptive (quantumdata::Types< RANK >::StateVectorLow &, typename Evolved::Derivs, double, const ParsEvolved &, const quantumdata::Types< RANK >::StateVectorLow &, const evolved::Maker< quantumdata::Types< RANK >::StateVectorLow > &)
 
const std::string trajectoryID () const
 redirected to a pure virtual, this is needed for serialization of trajectory metadata
 
std::ostream & displayParameters_v (std::ostream &) const override
 
const ConstPtr getEvolved () const
 
const Ptr getEvolved ()
 
double getDtTry () const
 
- Protected Member Functions inherited from trajectory::AdaptiveIO< quantumdata::Types< RANK >::StateVectorLow >
const Ptr getEvolvedIO () const
 note: not the same const-correctness as in Adaptive
 

Additional Inherited Members

- Protected Types inherited from quantumtrajectory::QuantumTrajectory< RANK, trajectory::Stochastic< quantumdata::Types< RANK >::StateVectorLow, const quantumdata::StateVector< RANK > & > >
typedef structure::QuantumSystemWrapper< RANK, true > QuantumSystemWrapper
 
- Protected Types inherited from trajectory::Adaptive< quantumdata::Types< RANK >::StateVectorLow >
typedef Evolved::ConstPtr ConstPtr
 
typedef Evolved::Ptr Ptr
 
- Protected Attributes inherited from trajectory::AdaptiveIO< quantumdata::Types< RANK >::StateVectorLow >
SerializationMetadata meta_
 

Detailed Description

template<int RANK>
class quantumtrajectory::MCWF_Trajectory< RANK >

Implements a single Monte Carlo wave-function trajectory.

In the framework, a single Monte Carlo wave-function step at time $t$ (at which point, if the system inherits from structure::Exact, the Schrödinger- and interaction pictures coincide) is implemented as a sequence of the following stages:

  1. Coherent time development is applied:
    1. If the system time evolution has Hamiltonian part, it is evolved with an adaptive-size step (cf. evolved::Evolved). This takes the system into $t+\Delta t$.
    2. The exact part (if any) of the time evolution is applied, making that the Schrödinger and interaction pictures coincide again at $t+\Delta t$.
    3. The state vector is renormalized.
  2. If the system is not Liouvillean, the timestep ends here, reducing to a simple ODE evolution. Otherwise:
    1. The rates (probabilities per unit time) corresponding to all jump operators are calculated. If some rates are found negative (“special jump”, cf. explanation at structure::Liouvillean::probabilities, then $J_\text{at}\ket\Psi$ is calculated (and tabulated) instead, and the rate is calculated as $\delta r_\text{at}=\norm{J_\text{at}\ket\Psi}^2$.
      See also
      The notion of “special jumps” in the framework
    2. First, it is verified whether the total jump probability is not too big. This is performed on two levels:
      1. The total jump rate $\delta r$ is calculated.
      2. If $\delta r\delta t>\delta p_\text{limit}'$, the step is retraced: both the state vector and the state of the ODE stepper are restored to cached values at the beginning of the timestep, and phase I. is performed anew with a smaller stepsize $\delta p_\text{limit}/\delta r$. With this, we ensure that $\delta p_\text{limit}$ (the parameter mcwf::Pars::dpLimit) is likely not to be overshot in the next try.
        Note
        It is assumed that $\delta p_\text{limit}'>\delta p_\text{limit}$, their ratio being a parameter (mcwf::Pars::overshootTolerance) of the MCWF stepper.
      3. If just $\delta r\delta t_\text{next}>\delta p_\text{limit}$ (where $\Delta t_\text{next}$ is a guess for the next timestep given by the ODE stepper), the coherent step is accepted, but the timestep to try next is modified, to reduce the likeliness of overshoot: $\delta t_\text{next}\longrightarrow\delta p_\text{limit}/\delta r$.
        See also
        The discussion at Sec. An adaptive MCWF method.
    3. After a successful coherent step resulting in an acceptable $\delta r$, the possible occurence of a quantum jump is considered: It is randomly decided which (if any) of the jumps to perform. If it is found to be a special jump, then the tabulated $J_\text{at}\ket\Psi$ is taken.
Template Parameters
RANKarity of the Hilbert space
Note
In phase 2.b.ii, another approach would be not to trace back the whole step, but make a coherent step backwards to an intermediate time instant found by linear interpolation. This has several drawbacks, however, the most significant being that in the ODE stepper, it is not clear what to take as the timestep to try at the point when the direction of time is reversed. (Although in evolved::Evolved it is simply taken to be the timestep done in the last step…)
Todo:
factor out template-parameter independent code

Definition at line 60 of file MCWF_Trajectory.h.

Constructor & Destructor Documentation

template<int RANK>
template<typename SYS >
quantumtrajectory::MCWF_Trajectory< RANK >::MCWF_Trajectory ( StateVector psi,
const SYS &  sys,
const mcwf::Pars p,
const StateVectorLow &  scaleAbs = StateVectorLow() 
)

Templated constructor with the same idea as Master::Master.

Template Parameters
SYSthe physical system – can be any type convertible to structure::QuantumSystem::Ptr via cpputils::sharedPointerize
Parameters
psithe state vector to be evolved
sysobject representing the quantum system
pparameters of the evolution
scaleAbshas the same role as scaleAbs in Master::Master

Member Function Documentation

template<int RANK>
void quantumtrajectory::MCWF_Trajectory< RANK >::derivs ( double  ,
const StateVectorLow &  ,
StateVectorLow &   
) const

The actual function calculating the time derivative for ODE evolution.

Implemented via structure::Hamiltonian::addContribution


The documentation for this class was generated from the following file: