votca 2026-dev
Loading...
Searching...
No Matches
votca::xtp::KMCEngine Class Reference

Kinetic Monte Carlo of carriers with site exclusion on a ToFGraph. More...

#include <kmcengine.h>

Collaboration diagram for votca::xtp::KMCEngine:

Classes

struct  Pulse
class  Observer
struct  DecaySettings
struct  Limits
struct  RunStatus

Public Types

using Random = KMCRandom

Public Member Functions

 KMCEngine (const ToFGraph &graph, const WaitingTimeStrategy &strategy)
void setDecay (const DecaySettings &decay)
 per-site decay; rates must be >= 0 and finite, one per site
RunStatus Run (const std::vector< double > &injection_times, Random &random, Observer &observer, const Limits &limits) const

Static Public Member Functions

static std::vector< double > InjectionTimes (const std::vector< Pulse > &pulses, Random &random)
static Pulse::Shape ShapeFromString (const std::string &name)

Private Attributes

const ToFGraph & graph_
const WaitingTimeStrategy & strategy_
DecaySettings decay_

Detailed Description

Kinetic Monte Carlo of carriers with site exclusion on a ToFGraph.

Every carrier has its own clock: the pluggable WaitingTimeStrategy gives the time of its next candidate event and, at that time, the hop (KMCWaitingTime.h has the exactness argument). The engine processes the earliest pending event (a min-heap over carriers, merged with the scheduled injections); a candidate hop into an occupied site, or a strategy returning -1, is a null event: time has advanced, the carrier draws a new candidate time. Exclusion therefore never shortens waiting times. Only the clock of the acting carrier changes at an event.

Strategies: ExponentialWaitingTime (static rates), ThinningWaitingTime (time-dependent rates with upper bounds), and the template IntegratedRateInversion (periodic rates).

Carriers enter at scheduled injection times on a free connected source site (uniform) and leave at a sink. Optionally they also decay with a per-site rate (setDecay): a second, exponential clock competing with the hops, redrawn after every event of the carrier (exact, as the decay is memoryless); a decayed carrier can be replaced at once by a new one on a free source site (constant number of carriers). Observers receive every injection, accepted hop, absorption and decay.

Runs are independent and reproducible: the random numbers of a run depend only on (seed, run index), not on threads or the order of runs.

Definition at line 67 of file kmcengine.h.

Member Typedef Documentation

◆ Random

Definition at line 69 of file kmcengine.h.

Constructor & Destructor Documentation

◆ KMCEngine()

votca::xtp::KMCEngine::KMCEngine ( const ToFGraph & graph,
const WaitingTimeStrategy & strategy )
inline

strategy must be prepared (WaitingTimeStrategy::Prepare) for rates on this graph and outlive the engine

Definition at line 140 of file kmcengine.h.

Member Function Documentation

◆ InjectionTimes()

std::vector< double > votca::xtp::KMCEngine::InjectionTimes ( const std::vector< Pulse > & pulses,
Random & random )
static

injection times of all carriers of the pulses, sorted; finite-width pulses draw the times of their carriers from the shape (Gaussian truncated to t >= 0)

Definition at line 79 of file kmcengine.cc.

◆ Run()

KMCEngine::RunStatus votca::xtp::KMCEngine::Run ( const std::vector< double > & injection_times,
Random & random,
Observer & observer,
const Limits & limits ) const

one run; injection_times sorted; carriers are numbered in order of injection (scheduled ones and replacements, including injections that were blocked)

Definition at line 120 of file kmcengine.cc.

◆ setDecay()

void votca::xtp::KMCEngine::setDecay ( const DecaySettings & decay)

per-site decay; rates must be >= 0 and finite, one per site

Definition at line 103 of file kmcengine.cc.

◆ ShapeFromString()

KMCEngine::Pulse::Shape votca::xtp::KMCEngine::ShapeFromString ( const std::string & name)
static

Definition at line 67 of file kmcengine.cc.

Member Data Documentation

◆ decay_

DecaySettings votca::xtp::KMCEngine::decay_
private

Definition at line 155 of file kmcengine.h.

◆ graph_

const ToFGraph& votca::xtp::KMCEngine::graph_
private

Definition at line 153 of file kmcengine.h.

◆ strategy_

const WaitingTimeStrategy& votca::xtp::KMCEngine::strategy_
private

Definition at line 154 of file kmcengine.h.


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