C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
trajectory::Trajectory Class Referenceabstract

The base class of the trajectory-bundle condensing the quintessential characteristics of any trajectory. More...

#include <Trajectory.h>

+ Inheritance diagram for trajectory::Trajectory:
+ Collaboration diagram for trajectory::Trajectory:

Public Member Functions

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
 
Getters
double getTime () const
 actual time instant
 
double getDtDid () const
 last perfomed timestep
 
Entire state i/o
cpputils::iarchivereadState (cpputils::iarchive &iar)
 read from an archive
 
cpputils::oarchivewriteState (cpputils::oarchive &oar) const
 write to an archive
 

Related Functions

(Note that these are not member functions.)

void run (Trajectory &trajectory, double time, double deltaT, unsigned sdf, const std::string &ofn, const std::string &initialFileName, int precision, bool displayInfo, bool firstStateDisplay, double autoStopEpsilon, unsigned autoStopRepetition, const std::string &parsedCommandLine)
 Running in deltaT mode (displays in equal time intervals) for a certain time. More...
 
void run (Trajectory &, long nDt, double deltaT, unsigned sdf, const std::string &ofn, const std::string &initialFileName, int precision, bool displayInfo, bool firstStateDisplay, double autoStopEpsilon, unsigned autoStopRepetition, const std::string &parsedCommandLine)
 Same as above but runs for a certain number of time intervals deltaT. More...
 
void run (Trajectory &, const ParsRun &p)
 Dispatcher. More...
 

Detailed Description

The base class of the trajectory-bundle condensing the quintessential characteristics of any trajectory.

See also
run(Trajectory&, double, double, unsigned, const std::string&, const std::string&, int, bool, bool) which manifests all the principal functionalities of this class

The i/o of the entire state is performed via Boost.Serialization, and is disabled if this library is not installed

Todo:
Consider the possibility of cloning Trajectories

Definition at line 194 of file Trajectory.h.

Member Function Documentation

std::ostream& trajectory::Trajectory::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.

Parameters
precisionthe precision (number of digits) of display

Friends And Related Function Documentation

void run ( Trajectory trajectory,
double  time,
double  deltaT,
unsigned  sdf,
const std::string &  ofn,
const std::string &  initialFileName,
int  precision,
bool  displayInfo,
bool  firstStateDisplay,
double  autoStopEpsilon,
unsigned  autoStopRepetition,
const std::string &  parsedCommandLine 
)
related

Running in deltaT mode (displays in equal time intervals) for a certain time.

This function manifests all the basic features of Adaptive and the whole idea behind the trajectory bundle.

A Trajectory can

Note
While the entire state can be huge (e.g. the state vector or density operator in the case of a quantum trajectory) the relevant information in an actual numerical experiment is usually much less (a set of quantum averages that doesn’t entirely define the state).

Furthermore, a Trajectory can

  • provide information about its time and last performed timestep
  • print a header summarizing its physical and numerical parameters together with a key to the set of relevant physical information displayed during the run
  • print a log at the end summarizing overall (e.g. time-averaged) physical and numerical data during the run
See also
Simulated for a full generic implementation of Trajectory together with a small tutorial
Todo:
Consider taking Trajectory by rvalue reference
Parameters
trajectorythe trajectory to run
timeend time
deltaTtime interval between two displays
sdfnumber of displays between two state displays
ofnname of the output file for displays — if empty, display to standard output; state displays into file named ofn.state
initialFileNamename of file containing initial condition state for the run
precisiongoverns the overall precision (number of digits) of outputs in displays
displayInfogoverns whether a header is displayed at the top of the output
firstStateDisplaygoverns whether the state is displayed at time zero (important if state display is costly)
autoStopEpsilonrelative precision for autostopping
autoStopRepetitionnumber of displayed lines repeated within relative precision before autostopping – 0 means no autostopping
void run ( Trajectory ,
long  nDt,
double  deltaT,
unsigned  sdf,
const std::string &  ofn,
const std::string &  initialFileName,
int  precision,
bool  displayInfo,
bool  firstStateDisplay,
double  autoStopEpsilon,
unsigned  autoStopRepetition,
const std::string &  parsedCommandLine 
)
related

Same as above but runs for a certain number of time intervals deltaT.

Rationale: This version of run exists to avoid the eventual tiny timestep at the end of the run that might occur with the above version. This is because e.g. in the case of deltaT=0.1, time=1, adding up 0.1 ten times numerically does not result in exactly 1.

For a demonstration, compare the output of

examples/HarmonicOscillatorComplex --dc 0 --Dt 0.1 --T 1

with

examples/HarmonicOscillatorComplex --dc 0 --Dt 0.1 --NDt 10
Parameters
nDtthe end time of the trajectory will be nDt*deltaT
void run ( Trajectory ,
const ParsRun p 
)
related

Dispatcher.

Runs

  • run(Trajectory&, long, double, unsigned, const std::string&, const std::string&, int, bool, bool) if p.NDt is nonzero and
  • run(Trajectory&, double, double, unsigned, const std::string&, const std::string&, int, bool, bool) otherwise
Note
This means that ParsRun::NDt takes precedence over ParsRun::T

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