event_base¶
This module defines the Event class, which encapsulates the information required to represent a migration event in a lattice-based simulation, such as those used in kinetic Monte Carlo (kMC) studies.
The Event class focuses purely on defining which sites are involved in the hop and providing the local environment indices. All energy calculations are now handled by the model classes.
- class kmcpy.event.base.Event(mobile_ion_indices, local_env_indices)[source]¶
Represents a migration event in a lattice-based simulation.
The Event class focuses purely on defining which sites are involved in the hop and providing the local environment indices. All calculations are now handled by the model classes.
- mobile_ion_indices¶
Compact active-site indices of the mobile ions involved in the event
- Type:
tuple
- local_env_indices¶
Compact active-site indices of the neighboring sites in the supercell
- Type:
tuple
- class kmcpy.event.base.EventLib[source]¶
A library of events, which can be used to store and manage multiple Event objects.
- events¶
List of Event objects
- Type:
list
- event_dependencies¶
2D list where event_dependencies[i] contains indices of events that depend on event i (need to be updated when event i is executed). Dependencies are determined based on shared active-site indices.
- Type:
list
- site_to_events¶
Mapping from active-site index to list of event indices that involve that site
- Type:
dict
Note: All indices (mobile_ion_indices and local_env_indices) are active-site indices, despite the misleading name of local_env_indices.
- clear_event_dependencies()[source]¶
Clear the event dependency matrix cache. Call this if events are modified.
- generate_event_dependencies()[source]¶
Generate the event dependency matrix and store it in the class.
For each event, find all other events that share active sites and thus have dependencies. When an event is executed, all dependent events need to be updated. The dependency matrix is stored as self.event_dependencies.
Note: All indices (mobile_ion_indices and local_env_indices) are active-site indices.
- Returns:
- 2D list where event_dependencies[i] contains indices of events that
depend on event i (need to be updated when event i is executed).
- Return type:
list
- get_dependency_statistics()[source]¶
Get statistics about the event dependency matrix for analysis.
- Returns:
Dictionary containing dependency matrix statistics.
- Return type:
dict
- get_dependent_events(event_index)[source]¶
Get all event indices that depend on the given event (need to be updated when it’s executed).
- Parameters:
event_index (int) – Index of the event that was executed.
- Returns:
List of event indices that depend on the given event.
- Return type:
list
- get_events_involving_site(site_index)[source]¶
Get all events that involve a specific site.
- Parameters:
site_index (int) – The site index to search for.
- Returns:
List of event indices that involve the given site.
- Return type:
list