MarkovChain¶
- class MarkovChain(configuration, configuration_energy, events=None, energy_tolerance=None, distance_tolerance=None, filename=None, object_id=None)¶
 Construct a markov chain from a list of
HTSTEventobjects.- Parameters:
 configuration (BulkConfiguration) – The configuration for the first state of the Markov chain.
configuration_energy (PhysicalQuantity of type energy) – The energy of the configuration.
events (list of type
HTSTEvent) – A list of HTSTEvent objects used to construct the Markov chain. By default an empty Markov chain will be made. Default: Nonedistance_tolerance (PhysicalQuantity of type length) – This is the distance tolerance used to compare geometries. Default:
0.1*Angstromenergy_tolerance (PhysicalQuantity of type energy) – This energy tolerance is used to determine if two structures are different based upon energy alone. Configurations that are closer than this tolerance undergo a full geometry comparison. Default: 0.02*eV
- addConnection(connection, event)¶
 Add a new connection to the Markov chain. This is a potentially dangerous method to call since it intentionally bypasses the geometry comparison routines.
- Parameters:
 connection (a pair of ints) – A tuple of integers representing the reactant and product state ids respectively.
event (HTSTEvent) – The event to add.
- addEvent(event)¶
 Add an event to the Markov chain.
- Parameters:
 event (HTSTEvent) – A event to be added to the Markov chain.
- Returns:
 The id of the product state
- Return type:
 int
- addStateTime(state_id, dt)¶
 Increase the amount of MD time simulation in a state.
- Parameters:
 state_id (int) – The id of the state to add time to.
dt (A PhysicalQuantity with time units) – The amount of time to add.
- getSaddleConfiguration(initial_state_id, final_state_id)¶
 - Parameters:
 initial_state_id (int) – The id of the initial state.
final_state_id (int) – The id of the final state.
- Returns:
 The saddle configuration between two states.
- Return type:
 
- getSaddleEnergy(initial_state_id, final_state_id)¶
 - Parameters:
 initial_state_id (int) – The id of the initial state.
final_state_id (int) – The id of the final state.
- Returns:
 The energy of the saddle point.
- Return type:
 PhysicalQuantity of type energy
- getState(state_id)¶
 - Parameters:
 state_id (int) – The state id.
- Returns:
 The requested state.
- Return type:
 MarkovState
- getStateConfidence(state_id, kmc_temperature)¶
 Return the confidence of the requested state. The confidence represents an estimate of the probability that a KMC step chooses the correct event. For example, a confidence of 0.99 means that there is a 1% chance that the KMC simulation picked the wrong event in a single step.
- Parameters:
 state_id (int) – The id of the state.
kmc_temperature (PhysicalQuantity of type temperature) – The temperature of the KMC simulation.
- Returns:
 The confidence.
- Return type:
 float
- getStateConfiguration(state_id)¶
 - Parameters:
 state_id (int) – The id of the state.
- Returns:
 The configuration associated with a state.
- Return type:
 
- getStateEnergy(state_id)¶
 - Parameters:
 state_id (int) – The id of the state.
- Returns:
 The energy of a state.
- Return type:
 PhysicalQuantity of type energy
- getStateEvents(state_id)¶
 Return the HTSTEvents that connect to state_id.
- Parameters:
 state_id (int) – The state_id of the state.
- Returns:
 A dictionary that maps (reactant_id, product_id) pairs to HTSTEvents.
- Return type:
 OrderedDict
- getStateTime(state_id)¶
 - Parameters:
 state_id (int) – The id of the state.
- Returns:
 The total amount of MD time simulation in the state.
- Return type:
 PhysicalQuantity of type time
- getStates()¶
 - Returns:
 A list of the states in the Markov chain.
- Return type:
 list of type MarkovState
- incrementObservationCount(initial_state_id, final_state_id)¶
 Increment the number of times that a transition from the initial state to the final state has occurred.
- Parameters:
 initial_state_id (int) – The initial state.
final_state_id (int) – The final state.
- isConnected(state_id_1, state_id_2)¶
 Determine if two states are connected by an event.
- Parameters:
 state_id_1 (int) – The id of the first state.
state_id_2 (int) – The id of the second state.
- Returns:
 True if connected otherwise False.
- Return type:
 bool
- metatext()¶
 - Returns:
 The metatext of the object or None if no metatext is set.
- Return type:
 str | None
- nlprint(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)¶
 Print out the Markov chain in DOT graph format.
- Parameters:
 stream (file-like object) – The stream to write the DOT graph to. Default: sys.stdout
- observationCount(initial_state_id, final_state_id)¶
 - Parameters:
 initial_state_id (int) – The initial state.
final_state_id (int) – The final state.
- Returns:
 Return the number of times that a transition from the initial state to the final state has occurred.
- Return type:
 int
- rateMatrix(temperature)¶
 Calculate the right handed (rows sum to the total escape rate for a state) rate matrix at a given temperature.
- Parameters:
 temperature (PhysicalQuantity of type temperature) – The temperature to calculate the rates at.
- Returns:
 The rate matrix.
- Return type:
 PhysicalQuantity of type frequency
- setMetatext(text)¶
 Set a given metatext string on the object.
- Parameters:
 text (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.
Notes¶
MarkovChain objects are normally passed to the
AdaptiveKineticMonteCarlo class.