OccEvent#
- class libcasm.occ_events.OccEvent(
- self: OccEvent,
- trajectories: list[list[OccPosition]] = [],
Bases:
pybind11_object
OccEvent represents an occupation event, for example the change in occupation due to a diffusive hop or molecular re-orientation. The occupation change is represented by occupant trajectories.
Example, 1NN A-Va exchange in an FCC prim:
import libcasm.xtal as xtal from libcasm.xtal.prims import FCC as FCC_prim from libcasm.occ_events import OccPosition, OccEvent prim = FCC_prim(r=1.0, occ_dof=["A", "B", "Va"]) site1 = xtal.IntegralSiteCoordinate(sublattice=0, unitcell=[0, 0, 0]) site2 = xtal.IntegralSiteCoordinate(sublattice=0, unitcell=[1, 0, 0]) A_occ_index = 0 Va_occ_index = 2 A_initial_pos = OccPosition.molecule(site1, A_occ_index) A_final_pos = OccPosition.molecule(site2, A_occ_index) Va_initial_pos = OccPosition.molecule(site2, Va_occ_index) Va_final_pos = OccPosition.molecule(site1, Va_occ_index) occ_event = OccEvent([ [A_initial_pos, A_final_pos], [Va_initial_pos, Va_final_pos] ])
Special Methods
The multiplication operator
X = lhs * rhs
can be used to applylibcasm.xtal.OccEventRep
to OccEvent:X=OccEvent
,lhs=OccEventRep
,rhs=OccEvent
: Copy and transform the trajectories, returning the OccEvent of transformed trajectories. This transforms the sites involved, and also the occupation indices (for anisotropic occupants, or for sublattices with different allowed occupation lists) and atom positions (for molecular occupants).
Translate an OccEvent using operators
+
,-
,+=
,-=
:import numpy as np from libcasm.occ_events import OccEvent # event: OccEvent translation = np.array([0, 0, 1]) # translate via `+=`: event += translation # translate via `-=`: event -= translation # copy & translate via `+`: translated_event = event + translation # copy & translate via `-`: translated_event = event - translation
Additional methods:
Sort OccEvent by lexicographical order of trajectories using
<
,<=
,>
,>=
, and compare using==
and!=
for site in cluster
: Iterate over sites (IntegralSiteCoordinate
) in the cluster.if site in cluster
: Check if a cluster contains a site.len(cluster)
: Get the number of sites in a cluster.site = cluster[i]
: Get the i-th site in a cluster (indices start at 0).OccEvent may be copied with
OccEvent.copy
, copy.copy, or copy.deepcopy.
Constructor
- Parameters:
trajectories (List[List[OccPosition]]=[]) – The occupant trajectories. Usage: trajectories[i_occupant][0] is the initial position of the i-th occupant, and trajectories[i_occupant][1] is the final position of the i-th occupant. Most methods currently support trajectories of length 2 only (an initial position and a final position).
Methods
The cluster of sites involved in the OccEvent.
Returns a copy of the OccEvent.
Return a copy of the event with reversed trajectories
Return a copy of the event with sorted trajectories
Occupant indices on each site in the cluster, in the final positions.
Construct an OccEvent from a Python dict
Occupant indices on each site in the cluster, in the initial positions.
Reverse event trajectories
The number of trajectories.
Sort event trajectories
Put event into standardized form with regard to permutation/reversal
Represent the OccEvent as a Python dict
Return the event trajectories