chombo-discharge
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KMCSingleStateReaction< State, T > Class Template Reference

Reaction type for advancing a KMCSingleState for Kinetic Monte Carlo. More...

#include <CD_KMCSingleStateReaction.H>

Public Member Functions

 KMCSingleStateReaction ()=default
 Disallowed constructor. Use the full constructor.
 
 KMCSingleStateReaction (const KMCSingleStateReaction &)=default
 Copy constructor (uses default).
 
 KMCSingleStateReaction (const std::list< size_t > &a_reactants, const std::list< size_t > &a_products) noexcept
 Full constructor, sets reactants and products. More...
 
virtual ~KMCSingleStateReaction ()
 Destructor.
 
Real & rate () const noexcept
 Get modifiable reaction rate. More...
 
population (const size_t &a_reactant, const State &a_state) const noexcept
 Get the population of the reactant in the input state. More...
 
Real propensity (const State &a_state) const noexcept
 Compute the propensity function for this reaction type. More...
 
computeCriticalNumberOfReactions (const State &a_state) const noexcept
 Compute the number of times the reaction can fire before exhausting one of the reactants. More...
 
std::list< size_t > getReactants () const noexcept
 Get the reactants involved in the reaction. More...
 
getStateChange (const size_t a_reactant) const noexcept
 Get the state change due to a change in the input reactant species. More...
 
void advanceState (State &a_state, const T &a_numReactions) const noexcept
 Advance the incoming state with the number of reactions. More...
 

Protected Member Functions

void computeStateChanges () noexcept
 Compute state change.
 

Protected Attributes

Real m_rate
 Reaction rate.
 
Real m_propensityFactor
 Factor for the case where two or more particles of the same species react. More...
 
std::list< size_t > m_reactants
 Reactants.
 
std::list< size_t > m_products
 Products.
 
std::map< size_t, T > m_stateChange
 State change for reactants/products.
 

Detailed Description

template<typename State = KMCSingleState<long long>, typename T = long long>
class KMCSingleStateReaction< State, T >

Reaction type for advancing a KMCSingleState for Kinetic Monte Carlo.

Note
T is the integer type used for the state.

Constructor & Destructor Documentation

◆ KMCSingleStateReaction()

template<typename State , typename T >
KMCSingleStateReaction< State, T >::KMCSingleStateReaction ( const std::list< size_t > &  a_reactants,
const std::list< size_t > &  a_products 
)
inlinenoexcept

Full constructor, sets reactants and products.

For a reaction X_0 -> X_0 + X_0 we have a_reactants = [0] and a_products [0,0]

Parameters
[in]a_reactantsSpecies on the left-hand side of the reaction.
[in]a_productsSpecies on the right-hand side of the reaction.

Member Function Documentation

◆ advanceState()

template<typename State , typename T >
void KMCSingleStateReaction< State, T >::advanceState ( State &  a_state,
const T &  a_numReactions 
) const
inlinenoexcept

Advance the incoming state with the number of reactions.

Parameters
[in]a_stateState vector
[in]a_numReactionsNumber of reactions.

◆ computeCriticalNumberOfReactions()

template<typename State , typename T >
T KMCSingleStateReaction< State, T >::computeCriticalNumberOfReactions ( const State &  a_state) const
inlinenoexcept

Compute the number of times the reaction can fire before exhausting one of the reactants.

Parameters
[in]a_stateState vector

◆ getReactants()

template<typename State , typename T >
std::list< size_t > KMCSingleStateReaction< State, T >::getReactants
inlinenoexcept

Get the reactants involved in the reaction.

Returns
m_reactants

◆ getStateChange()

template<typename State , typename T >
T KMCSingleStateReaction< State, T >::getStateChange ( const size_t  a_reactant) const
inlinenoexcept

Get the state change due to a change in the input reactant species.

Parameters
[in]a_rectantReactant species.

◆ population()

template<typename State , typename T >
T KMCSingleStateReaction< State, T >::population ( const size_t &  a_reactant,
const State &  a_state 
) const
inlinenoexcept

Get the population of the reactant in the input state.

Parameters
[in]a_reactantReactant
[in]a_stateState

◆ propensity()

template<typename State , typename T >
Real KMCSingleStateReaction< State, T >::propensity ( const State &  a_state) const
inlinenoexcept

Compute the propensity function for this reaction type.

Parameters
[in]a_stateState vector
Note
User should set the rate before calling this routine.

◆ rate()

template<typename State , typename T >
Real & KMCSingleStateReaction< State, T >::rate
inlinenoexcept

Get modifiable reaction rate.

Returns
m_rate

Member Data Documentation

◆ m_propensityFactor

template<typename State = KMCSingleState<long long>, typename T = long long>
Real KMCSingleStateReaction< State, T >::m_propensityFactor
protected

Factor for the case where two or more particles of the same species react.

For reactions X + X -> null the propensity is k * X * (X-1)/2 because there are X * (X-1)/2 unique pairs of particles in the cell.


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