base package¶
Submodules¶
base.basin module¶
base.events module¶
Defines the EventBase class.
The EventBase class is defined here as a template-class to derive events that can be stored in user_events.py.
The class defines methods that will throw an error if implemented wrongly, or are not implemented, in the derived classes.
See also
Module
user_events
- class base.events.EventBase(params={}, name='no-name')[source]¶
Bases:
object
Template class for events.
Stores a list of parameters related to reaction events.
The class is only used as a parent, and is in this sense purely abstract.
- params¶
Parameter dict dumped at the beginning of the log.
- Type:
dict
- alpha¶
The slowing down factor that is adsjusted when the reaction is accelerated. This factor is set to 1 upon instantiation and varies periodically during simulation. (See Module: NeighborKMC.base.basin)
- Type:
int
- diffev¶
Is the event a diffusion event. This can be used to make special rules for diffusion events.
- Type:
bool
- do_event(system, site, other_site)[source]¶
Template method to perform the event.
Method needs to be overridden in user_events.py. Should change system site coverages by changing system.sites[i_site].covered and system.sites[other_site].covered.
- Parameters:
system (System) – The system, which the simulation is performed on.
i_site (int) – Index of site in the system.sites list.
i_other (int) – Index of other/neighbor site in the system.sites list.
- get_involve_other()[source]¶
Template method to decide if neighboring atoms are effected by event.
Method needs to be overridden in user_events.py. Should return True if event effects neighboring atoms and False if not (e.g. single atom adsorption).
- get_rate(system, site, other_site)[source]¶
Template method to determine the rate constant.
Method needs to be overridden in user_events.py. Should return the reaction rate on site number i_site, and i_other for multi-site reactions.
- Parameters:
system (System) – The system, which the simulation is performed on.
i_site (int) – Index of site in the system.sites list.
i_other (int) – Index of other/neighbor site in the system.sites list.
- Returns:
Rate constant of event – The rate-constant given the current occupation patterns around the site-pair i_site and i_other.
- Return type:
float
- possible(system, site, other_site)[source]¶
Template method to determine if event is possible.
Method needs to be overridden in user_events.py. Should return True if an event is possible on site number i_site and possible a neighbor site i_other, given the current site occupations.
- Parameters:
system (System) – The system, which the simulation is performed on.
i_site (int) – Index of site in the system.sites list.
i_other (int) – Index of other/neighbor site in the system.sites list.
- Returns:
possible – True if event is possible on site-pair i_site and i_other. False if event is impossible on site-pair i_site and i_other.
- Return type:
bool
base.kmc module¶
base.logging module¶
base.sites module¶
Defines the SiteBase Class.
This class is used as a parent for the Site class defined in user_sites.py.
See also
Module
user_sites
- class base.sites.SiteBase(stype=0, covered=0, ind=[], lattice_pos=None)[source]¶
Bases:
object
Class that templates site objects.
Assigns a site type (stype) to the site, the species covers the site (covered), atomic indices that constitute the site (ind), and the sites that are nearest-neighbors (neighbors).
- stype¶
The site type. The user must decide what that implies. Example: 0 ~ (111)-facet-ontop, 1 ~ edge-ontop …
- Type:
int
- covered¶
The species that covers the site. The user must decide what the integer implies. Example: 0 ~ empty-site, 1 ~ Oxygen covered, 2 ~ CO covered.
- Type:
int
- ind¶
The atomic-indices c.f. an ase.Atoms object that constitute the site. This is convenient to define for later visualization purposes.
- Type:
list(int)
- lattice_pos¶
The lattice position of the site. Can be used for systems that obey periodic boundary conditions, and to determine neighbor-lists.
- Type:
list(int)
base.system module¶
Defines the SystemBase class.
The module defines a class used to template the System class defined in user_system.
See also
Module
sites
Module
user_sites
- class base.system.SystemBase(sites, atoms=None)[source]¶
Bases:
object
Defines a system class to perform kMC.
Method assigns an ASE.Atoms object (atoms) to the object and assigns a list of sites (sites).
A neighbor list (neighbors) is initialized from the sites, which is checked for inconsistencies by the method verify_nlist().
- atoms¶
Can be passed to connect an ASE atoms object to the system.
- Type:
ase.atoms
- find_nn_recurse(sim, update_sites, recursion=0)[source]¶
Deep search of first nearest neighbors.
Calculates the first nearest neighbors for a list of site_indices (update_sites).
For example, when passing update_sites = [0,1,2], the method returns [0,1,2,N neighbor 0 of site 0, Neighbor 1 of site 0, …, Neighbor 0 of site 1, …].
The method is calling itself recursively until the lattice is updated, c.f. the locality of nearest neighbor interactions.
- Parameters:
update_sites (list(int)) – The site indices to return neighborlist of.
recursion (int) – The recursive level of which function was called, because the method calls itself, for example in base.kmc.frm_update().
- Returns:
out – An update to the list update_sites where the neighbors to update_sites are added.
- Return type:
list(int)
See also
kmc.NeighborKMC.frm_update
- get_coverages(N_species)[source]¶
Gets the site-occupations at the present moment.
- Returns:
cov list(list(float)) (a list of site-occupations for each species)
and all sites. Thus to find the coverage of species
i on site number j one calls ret[i][j].
- get_ncovs(i_site)[source]¶
Gets the coverage on nearest neighbor sites.
Retrieves and returns the occupations of the nearest neighbor sites to the site with index i_site in self.sites.
- Parameters:
i_site (int) – Index of the site in self.sites.
- Returns:
covs – List of species occupying the nearest neighbor sites.
- Return type:
list(int)
Module contents¶
Base classes used to template and run behind the scenes.