13#ifndef CD_KMCSINGLESTATEREACTIONIMPLEM_H
14#define CD_KMCSINGLESTATEREACTIONIMPLEM_H
18#include <CD_NamespaceHeader.H>
20template <
typename State,
typename T>
22 const std::list<size_t>& a_products) noexcept
28template <
typename State,
typename T>
32template <
typename State,
typename T>
72 std::map<size_t, size_t> reactantNumbers;
74 if (reactantNumbers.find(r) == reactantNumbers.end()) {
75 reactantNumbers.emplace(r, 1);
82 for (
const auto& rn : reactantNumbers) {
87template <
typename State,
typename T>
94template <
typename State,
typename T>
98 return a_state[a_reactant];
101template <
typename State,
typename T>
118template <
typename State,
typename T>
122 T Lj = std::numeric_limits<T>::max();
126 const size_t rI = s.first;
127 const T nuIJ = s.second;
130 Lj = std::min(Lj, a_state[rI] / std::abs(nuIJ));
137template <
typename State,
typename T>
138inline const std::list<size_t>&
144template <
typename State,
typename T>
157template <
typename State,
typename T>
162 a_state[s.first] += a_numReactions * s.second;
166#include <CD_NamespaceFooter.H>
Declaration of a simple reaction type for advancing "single states" in Kinetic Monte Carlo codes.
virtual ~KMCSingleStateReaction()
Destructor.
Definition CD_KMCSingleStateReactionImplem.H:29
std::map< size_t, T > m_stateChange
State change for reactants/products.
Definition CD_KMCSingleStateReaction.H:144
std::list< size_t > m_products
Products.
Definition CD_KMCSingleStateReaction.H:139
Real propensity(const State &a_state) const noexcept
Compute the propensity function for this reaction type.
Definition CD_KMCSingleStateReactionImplem.H:103
std::list< size_t > m_reactants
Reactants.
Definition CD_KMCSingleStateReaction.H:134
Real m_propensityFactor
Factor for the case where two or more particles of the same species react.
Definition CD_KMCSingleStateReaction.H:129
T getStateChange(const size_t a_particleReactant) const noexcept
Get the state change due to a change in the input reactant species.
Definition CD_KMCSingleStateReactionImplem.H:146
Real m_rate
Reaction rate.
Definition CD_KMCSingleStateReaction.H:122
void computeStateChanges() noexcept
Compute state change vectors from the reactant/product lists.
Definition CD_KMCSingleStateReactionImplem.H:34
static T population(const size_t &a_reactant, const State &a_state) noexcept
Get the population of the reactant in the input state.
Definition CD_KMCSingleStateReactionImplem.H:96
T computeCriticalNumberOfReactions(const State &a_state) const noexcept
Compute the number of times the reaction can fire before exhausting one of the reactants.
Definition CD_KMCSingleStateReactionImplem.H:120
void advanceState(State &a_state, const T &a_numReactions) const noexcept
Advance the incoming state with the number of reactions.
Definition CD_KMCSingleStateReactionImplem.H:159
KMCSingleStateReaction()=default
Default constructor.
const std::list< size_t > & getReactants() const noexcept
Get the reactants involved in the reaction.
Definition CD_KMCSingleStateReactionImplem.H:139
Real & rate() const noexcept
Get modifiable reaction rate.
Definition CD_KMCSingleStateReactionImplem.H:89