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

A class to inject charges. More...

#include <sourceagent.h>

Public Member Functions

 SourceAgent (World &world, Grid &grid, QObject *parent=0)
 create a SourceAgent More...
 
bool tryToSeed ()
 seed a charge at a random site More...
 
bool tryToSeed (int site)
 seed a charge at a specific site More...
 
bool tryToInject ()
 attempt to inject a carrier More...
 
- Public Member Functions inherited from LangmuirCore::FluxAgent
 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

virtual int chooseSite ()
 choose a site to inject to More...
 
virtual bool validToInject (int site)=0
 checks to see if a carrier can actually be injected at the requested site More...
 
virtual void inject (int site)=0
 actually injects carrier. More...
 
virtual bool shouldTransport (int site)
 decides if charge should be injected using a constant probability More...
 
int randomSiteID ()
 choose a random site ID More...
 
int randomNeighborSiteID ()
 choose a random site ID from the neighborlist. More...
 
- Protected Member Functions inherited from LangmuirCore::FluxAgent
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 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...
 

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...
 
- Protected Attributes inherited from LangmuirCore::FluxAgent
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...
 

Detailed Description

A class to inject charges.

Constructor & Destructor Documentation

LangmuirCore::SourceAgent::SourceAgent ( World world,
Grid grid,
QObject *  parent = 0 
)

create a SourceAgent

Member Function Documentation

virtual int LangmuirCore::SourceAgent::chooseSite ( )
protectedvirtual

choose a site to inject to

By default, choose a site from the SourceAgent's neighborlist. The Grid::CubeFace used to construct the SourceAgent determines the neighborlist.

Reimplemented in LangmuirCore::ExcitonSourceAgent.

virtual void LangmuirCore::SourceAgent::inject ( int  site)
protectedpure virtual

actually injects carrier.

Warning
this function assumes that injecting a charge at the requested site is allowed

Creates a new carrier. Does not perform checks. Forcefully injects charge. Don't call this function unless you know what you are doing.

Implemented in LangmuirCore::ExcitonSourceAgent, LangmuirCore::HoleSourceAgent, and LangmuirCore::ElectronSourceAgent.

int LangmuirCore::SourceAgent::randomNeighborSiteID ( )
protected

choose a random site ID from the neighborlist.

int LangmuirCore::SourceAgent::randomSiteID ( )
protected

choose a random site ID

It can be any possible site in the grid.

virtual bool LangmuirCore::SourceAgent::shouldTransport ( int  site)
protectedvirtual

decides if charge should be injected using a constant probability

Parameters
sitethe site involved

If SimulationParameters::sourceMetropolis is true, then use the metropolis criterion with an energy change to decide if charge should be injected.

Reimplemented from LangmuirCore::FluxAgent.

Reimplemented in LangmuirCore::ExcitonSourceAgent.

bool LangmuirCore::SourceAgent::tryToInject ( )

attempt to inject a carrier

This is the main transport method of a SourceAgent. This function uses chooseSite(), shouldTransport() and validToInject() to inject the charge. It is not garunteed that a charge will be injected.

bool LangmuirCore::SourceAgent::tryToSeed ( )

seed a charge at a random site

Warning
does not call shouldTransport()

Attempts to seed a charge at a random site, without calling shouldTransport(). However, validToInject() is still called. This function is used when randomly placing charges in the system.

bool LangmuirCore::SourceAgent::tryToSeed ( int  site)

seed a charge at a specific site

Warning
does not call shouldTransport()

Attempts to seed a charge at a specific site, without calling shouldTransport(). However, validToInject() is still called. This function is used when placing charges at specific places. For example, when sometimes the checkpoint file has information on where charges are/were, and these need to be placed.

virtual bool LangmuirCore::SourceAgent::validToInject ( int  site)
protectedpure virtual

checks to see if a carrier can actually be injected at the requested site

For example, if the site contains a defect, or a carrier is already present at the site, then it is not valid to inject the carrier at this site.

Implemented in LangmuirCore::ExcitonSourceAgent, LangmuirCore::HoleSourceAgent, and LangmuirCore::ElectronSourceAgent.


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