PAPRECA hybrid off-lattice kMC/MD simulator  2.0.0 (17 September 2024)
PAPRECA::Event Class Reference

Parent class for PAPRECA events. More...

#include <event.h>

Inheritance diagram for PAPRECA::Event:

Public Member Functions

 Event ()
 
 Event (const double &rate_in, const std::string &type_in)
 
virtual ~Event ()
 
void assignRate (const double &rate_in)
 
void assignType (const std::string &type_in)
 
const double & getRate () const
 
void setRate (const double &rate_in)
 
const std::string & getType () const
 

Static Public Member Functions

static void fillRatesArr (double *event_rates, const std::vector< Event * > &events)
 
static void fillRatesVec (std::vector< double > &event_rates, const std::vector< Event * > &events)
 
static std::vector< double > getRatesVec (const std::vector< Event * > &events)
 
static double getSumOfRates (const std::vector< Event * > &events)
 
static void deleteAndClearLocalEvents (LAMMPS_NS::LAMMPS *lmp, std::vector< Event * > &events_local)
 

Protected Attributes

double rate
 
std::string type
 

Detailed Description

Parent class for PAPRECA events.

DISCLAIMER: PAPRECA::Event objects are not to be confused with PredefinedEventList objects. For more information about PredefinedEvent objects please refer to the relevant header and/or the documentation (event_list.h and event_list.cpp). PAPRECA::Event objects are the events discovered and (potentially) executed by the kMC algorithm. Every MPI proc can (and will) discover different PAPRECA::Event objects. The types of PAPRECA::Event supported by the initial version of this software are: PAPRECA::BondBreak, PAPRECA::BondForm, PAPRECA::Deposition (i.e., adsorption), PAPRECA::DiffusionHop, and PAPRECA::MonoatomicDesorption. It should be straightforward to extend the software to include new PAPRECA:Event types. A new child PAPRECA::Event class can be developed to enable the discovery of new classes of events. New event style implementations should be placed in this header.

Constructor & Destructor Documentation

◆ Event() [1/2]

PAPRECA::Event::Event ( )

◆ Event() [2/2]

PAPRECA::Event::Event ( const double &  rate_in,
const std::string &  type_in 
)

◆ ~Event()

PAPRECA::Event::~Event ( )
virtual

Member Function Documentation

◆ assignRate()

void PAPRECA::Event::assignRate ( const double &  rate_in)

◆ assignType()

void PAPRECA::Event::assignType ( const std::string &  type_in)

◆ deleteAndClearLocalEvents()

void PAPRECA::Event::deleteAndClearLocalEvents ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< Event * > &  events_local 
)
static

Deletes all local events (different on each MPI process) and clears the events_local vector of PAPRECA::Event objects.

Parameters
[in]lmppointer to LAMMPS object.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.

◆ fillRatesArr()

void PAPRECA::Event::fillRatesArr ( double *  event_rates,
const std::vector< Event * > &  events 
)
static

Receives a vector of pointers to event objects, and fills a (previously-initialized) double array with the rates of events.

Parameters
[in]event_ratespreviously-initialized array of doubles.
[in]eventsvector to pointers of PAPRECA::Event objects (and/or objects of children of PAPRECA::Event).
See also
Event::fillRatesVec()
Note
This function assumes that the event_rates array was properly initialized (i.e., has as many elements as the number of events in the vector of pointers to PAPRECA::Event objects. Incorrectly initializing the array of doubles will lead to segmentation faults.

◆ fillRatesVec()

void PAPRECA::Event::fillRatesVec ( std::vector< double > &  event_rates,
const std::vector< Event * > &  events 
)
static

Same as Event::fillRatesArr() but fills a vector of doubles instead of an array of doubles.

Parameters
[in]event_ratesvector of doubles storing the rates of events.
[in]eventsvector to pointers of PAPRECA::Event objects (and/or objects of children of PAPRECA::Event).
See also
Event::fillRatesArr()
Note
Even though a vector is used here, the present function can still lead to segmentation faults, since it uses C-style array access (i.e., event_rates[i]) instead of C++-style push_back functions. The use of C-style array access was mandatory to facilitate the communicator of data between MPI processes.

◆ getRate()

const double & PAPRECA::Event::getRate ( ) const

◆ getRatesVec()

std::vector< double > PAPRECA::Event::getRatesVec ( const std::vector< Event * > &  events)
static

Receives a vector of pointer to PAPRECA::Event objects and returns a vector of doubles of their corresponding rates.

Parameters
[in]eventsvector to pointers of PAPRECA::Event objects (and/or objects of children of PAPRECA::Event).
Returns
vector of double rates of the input events.

◆ getSumOfRates()

double PAPRECA::Event::getSumOfRates ( const std::vector< Event * > &  events)
static

◆ getType()

const std::string & PAPRECA::Event::getType ( ) const

◆ setRate()

void PAPRECA::Event::setRate ( const double &  rate_in)

Member Data Documentation

◆ rate

double PAPRECA::Event::rate
protected

◆ type

std::string PAPRECA::Event::type
protected

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