Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LangmuirCore::FluxAgent Class Reference

A class to change the number of carriers in the system. More...

#include <fluxagent.h>

Public Member Functions

 FluxAgent (Agent::Type type, World &world, Grid &grid, QObject *parent=0)
 Create the flux agent. More...
 
 ~FluxAgent ()
 unregisters FluxAgent from the grid More...
 
void setPotential (double potential)
 set the FluxAgent's potential More...
 
double potential () const
 get the FluxAgent's potential More...
 
void setRate (double rate)
 set the FluxAgent's rate More...
 
void setRateSmartly (double rate, double dflt)
 set the FluxAgent's rate More...
 
double rate () const
 get the FluxAgent's rate More...
 
void setAttempts (unsigned long int value)
 set the FluxAgent's attempt counter More...
 
unsigned long int attempts () const
 get the FluxAgent's attempt counter More...
 
void setSuccesses (unsigned long int value)
 set the FluxAgent's success counter More...
 
unsigned long int successes () const
 get the FluxAgent's success counter More...
 
void storeLast ()
 set the value of last to the value of successes, and store the current step More...
 
unsigned long int successesSinceLast () const
 get the number of successes since storeLast() was called More...
 
unsigned long int attemptsSinceLast () const
 get the number of attempts since storeLast() was called More...
 
unsigned long int stepsSinceLast () const
 get the number of steps since storeLast() was called More...
 
double successProbability () const
 calculate and return the current probabilty of success More...
 
double successRate () const
 calculate and return the current rate of success More...
 
double successProbabilitySinceLast () const
 calculate and return the probabilty of success since storeLast() was called More...
 
double successRateSinceLast () const
 calculate and return the rate of success since storeLast() was called More...
 
void resetCounters ()
 set the attempt and success counters to zero More...
 
Grid::CubeFace face () const
 get the Grid:CubeFace this FluxAgent is assigned to More...
 
Gridgrid () const
 get the Grid this FluxAgent belongs to More...
 
- Public Member Functions inherited from LangmuirCore::Agent
 Agent (Type type, World &world, int site=0, QObject *parent=0)
 Create an Agent. More...
 
virtual ~Agent ()
 Destroy Agent. More...
 
const QVector< int > & getNeighbors () const
 Get Agent neighbor list. More...
 
void setNeighbors (QVector< int > neighbors)
 Set Agent neighbor list. More...
 
int getCurrentSite () const
 Get Agent current site. More...
 
int getFutureSite () const
 Get Agent future site. More...
 
void setCurrentSite (int site)
 Set Agent current site. More...
 
void setFutureSite (int site)
 Set Agent future site. More...
 
Type getType () const
 Get Agent::Type enum. More...
 
WorldgetWorld () const
 Get Langmuir::World reference. More...
 

Protected Member Functions

void initializeSite (int site)
 assign the FluxAgent to a specific site in the grid More...
 
void initializeSite (Grid::CubeFace cubeFace)
 assign the FluxAgent to a specific Grid::CubeFace More...
 
virtual bool shouldTransport (int site)
 decide if the FluxAgent should transport a carrier to/from a given site More...
 
virtual double energyChange (int site)
 The energy change associated with moving a carrier from the FluxAgent to a site. More...
 
QString faceToLetter ()
 convert the Grid::CubeFace to a single letter More...
 

Protected Attributes

unsigned long int m_attempts
 the number of times the FluxAgent has tried to transport. More...
 
unsigned long int m_successes
 the number of times the FluxAgent was successful in transporting. More...
 
unsigned long int m_lastSuccesses
 storage to note the number of successes at some step More...
 
unsigned long int m_lastAttempts
 storage to note the number of successes at some step More...
 
unsigned long int m_lastStep
 the step at which last was noted More...
 
double m_probability
 the constant probability used in the default behavoir of shouldTransport(). More...
 
double m_potential
 the potential that is (possibly) used when calculating an energy change More...
 
Gridm_grid
 the grid this FluxAgent resides in More...
 
Grid::CubeFace m_face
 the face of the grid this FluxAgent occupies More...
 
- Protected Attributes inherited from LangmuirCore::Agent
int m_site
 Current site the Agent occupies. More...
 
int m_fSite
 Future site the Agent will occupy. More...
 
Worldm_world
 Reference to World object. More...
 
QVector< int > m_neighbors
 List fo neighboring site ids. More...
 
Type m_type
 Agent Type enum. More...
 

Additional Inherited Members

- Public Types inherited from LangmuirCore::Agent
enum  Type {
  Empty = 0, Electron = 1, Hole = 2, Defect = 3,
  Source = 4, Drain = 5, SIZE = 6
}
 An identifier for the type of Agent. More...
 
- Static Public Member Functions inherited from LangmuirCore::Agent
static QString toQString (const Agent::Type e)
 Convert Agent type enum to QString. More...
 

Detailed Description

A class to change the number of carriers in the system.

A flux agent can inject carriers (Agent::Source) or accept carriers (Agent::Drain)

Constructor & Destructor Documentation

LangmuirCore::FluxAgent::FluxAgent ( Agent::Type  type,
World world,
Grid grid,
QObject *  parent = 0 
)

Create the flux agent.

Parameters
typeeither a Agent::Source or Agent::Drain
worldreference to world object
gridreference to grid
parentparent QObject
LangmuirCore::FluxAgent::~FluxAgent ( )

unregisters FluxAgent from the grid

Member Function Documentation

unsigned long int LangmuirCore::FluxAgent::attempts ( ) const

get the FluxAgent's attempt counter

unsigned long int LangmuirCore::FluxAgent::attemptsSinceLast ( ) const

get the number of attempts since storeLast() was called

virtual double LangmuirCore::FluxAgent::energyChange ( int  site)
protectedvirtual

The energy change associated with moving a carrier from the FluxAgent to a site.

Parameters
sitethe site involved
Returns
the energy change

Reimplemented in LangmuirCore::ExcitonSourceAgent, LangmuirCore::HoleSourceAgent, LangmuirCore::ElectronSourceAgent, LangmuirCore::RecombinationAgent, LangmuirCore::HoleDrainAgent, and LangmuirCore::ElectronDrainAgent.

Grid::CubeFace LangmuirCore::FluxAgent::face ( ) const

get the Grid:CubeFace this FluxAgent is assigned to

QString LangmuirCore::FluxAgent::faceToLetter ( )
protected

convert the Grid::CubeFace to a single letter

For example, Grid::Left would return L. This is used in the output file titles.

Grid& LangmuirCore::FluxAgent::grid ( ) const

get the Grid this FluxAgent belongs to

void LangmuirCore::FluxAgent::initializeSite ( int  site)
protected

assign the FluxAgent to a specific site in the grid

Parameters
sitethe site in the grid
void LangmuirCore::FluxAgent::initializeSite ( Grid::CubeFace  cubeFace)
protected

assign the FluxAgent to a specific Grid::CubeFace

Parameters
cubeFacethe face of a cubic grid; for example Grid::Left

When assigning to a specific Grid::CubeFace, the FluxAgent is considered to be a special agent, and thus resides in the sites reserved by the grid for special agents.

double LangmuirCore::FluxAgent::potential ( ) const

get the FluxAgent's potential

double LangmuirCore::FluxAgent::rate ( ) const

get the FluxAgent's rate

void LangmuirCore::FluxAgent::resetCounters ( )

set the attempt and success counters to zero

void LangmuirCore::FluxAgent::setAttempts ( unsigned long int  value)

set the FluxAgent's attempt counter

Parameters
valuethe value of the attempt counter
Warning
also calls storeLast()
void LangmuirCore::FluxAgent::setPotential ( double  potential)

set the FluxAgent's potential

Parameters
potentialthe value of the potential
void LangmuirCore::FluxAgent::setRate ( double  rate)

set the FluxAgent's rate

Parameters
ratethe value of the rate
void LangmuirCore::FluxAgent::setRateSmartly ( double  rate,
double  dflt 
)

set the FluxAgent's rate

Parameters
ratethe value of the rate
dfltthe default value to set the rate to

If rate is negative, uses the default rate instead

void LangmuirCore::FluxAgent::setSuccesses ( unsigned long int  value)

set the FluxAgent's success counter

Parameters
valuethe value of the counter
Warning
also calls storeLast()
virtual bool LangmuirCore::FluxAgent::shouldTransport ( int  site)
protectedvirtual

decide if the FluxAgent should transport a carrier to/from a given site

Parameters
sitethe site involved
Returns
true if the FluxAgent should transport to/from the site

The default behavoir is for the FluxAgent to use a simple constant probabilty to make this decision. However, classes derived from FluxAgent can reimplement this function. For example, one might want to use a Metropolis criterion to make this decision.

Reimplemented in LangmuirCore::ExcitonSourceAgent, and LangmuirCore::SourceAgent.

unsigned long int LangmuirCore::FluxAgent::stepsSinceLast ( ) const

get the number of steps since storeLast() was called

void LangmuirCore::FluxAgent::storeLast ( )

set the value of last to the value of successes, and store the current step

unsigned long int LangmuirCore::FluxAgent::successes ( ) const

get the FluxAgent's success counter

unsigned long int LangmuirCore::FluxAgent::successesSinceLast ( ) const

get the number of successes since storeLast() was called

double LangmuirCore::FluxAgent::successProbability ( ) const

calculate and return the current probabilty of success

This is the number of successes divided by the number of attempts (x100). Ideally, this number should approach probability() as the simulation progresses, if shouldTransport() uses the simple constant probability method.

double LangmuirCore::FluxAgent::successProbabilitySinceLast ( ) const

calculate and return the probabilty of success since storeLast() was called

This is the number of successesSinceLast() divided by the number of attemptsSinceLast() (x100).

double LangmuirCore::FluxAgent::successRate ( ) const

calculate and return the current rate of success

This is the number of successes divided by the number of simulation steps. The current is related to the rate.

double LangmuirCore::FluxAgent::successRateSinceLast ( ) const

calculate and return the rate of success since storeLast() was called

This is the number of successesSinceLast() divided by the number of stepsSinceLast(). The current is related to the rate.

Member Data Documentation

unsigned long int LangmuirCore::FluxAgent::m_attempts
protected

the number of times the FluxAgent has tried to transport.

Grid::CubeFace LangmuirCore::FluxAgent::m_face
protected

the face of the grid this FluxAgent occupies

It may be Grid::NoFace is the FluxAgent occupies an actual site.

Grid& LangmuirCore::FluxAgent::m_grid
protected

the grid this FluxAgent resides in

unsigned long int LangmuirCore::FluxAgent::m_lastAttempts
protected

storage to note the number of successes at some step

unsigned long int LangmuirCore::FluxAgent::m_lastStep
protected

the step at which last was noted

unsigned long int LangmuirCore::FluxAgent::m_lastSuccesses
protected

storage to note the number of successes at some step

double LangmuirCore::FluxAgent::m_potential
protected

the potential that is (possibly) used when calculating an energy change

The energy change can be used in the shouldTransport() function.

double LangmuirCore::FluxAgent::m_probability
protected

the constant probability used in the default behavoir of shouldTransport().

unsigned long int LangmuirCore::FluxAgent::m_successes
protected

the number of times the FluxAgent was successful in transporting.


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