openpathsampling.analysis.tis.StandardTISAnalysis

class openpathsampling.analysis.tis.StandardTISAnalysis(network, steps=None, flux_method=None, scheme=None, ctp_method=None, max_lambda_calcs=None, combiners=None)[source]

Standard TIS analysis: flux, TCP, CTP.

This is what we call the “standard” TIS analysis. It splits the rate equation into a flux, a total crossing probability (calculated using ensemble crossing probability functions), and a conditional transition probability from the outermost interface.

Whenever possible, this code allows you to use default values.

For the flux, you must provide either a flux method or a move scheme (which will use the MinusMoveFlux).

For the conditional transition probability, you may optionally provide a ConditionalTransitionProbability object, otherwise the code will create one for the outermost interfaces of each transition.

For the total crossing probability, you must provide a dictionary for the max_lambda_calcs. The keys of this dictionary are the sampling transitions; the values can either be an EnsembleHistogrammer (such as a FullHistogramMaxLambdas) or a dictionary of histogram parameters, in which case the histogram parameters will be passed to FullHistogramMaxLambdas. In addition, you may optionally provide a dictionary for combiners, which maps the interface set within the sampling transitions to a combining function, such as WHAM. The default is to use WHAM.

Parameters
  • network (TISNetwork) – the network to analyze

  • steps (iterable of MCStep) – if given, the analysis is performed immediately using these steps; otherwise, the analysis can be performed later with calculate()

  • flux_method (flux calculation method) – the method to use to calculate the flux; typical classes are MinusMoveFlux and DictFlux. Optional, but if not given then scheme must be given.

  • scheme (MoveScheme) – used to create a MinusMoveFlux if flux_method is not provided. Not used if flux_method is given.

  • ctp_method (ConditionalTransitionProbability) – object for calculating the conditional transition probability (optional)

  • max_lambda_calcs (dict) – determines how the ensemble crossing probability histograms are build. Keys are sampling transitions, and values can be either EnsembleHistogrammer subclasses, or a list of histogram parameters to pass to FullHistogramMaxLambdas.

  • combiners (dict {InterfaceSet: combination method}) – links the interface set to the method that will be used to combine individual ensembles into the total crossing probability function. Default is to use WHAM.

__init__(network, steps=None, flux_method=None, scheme=None, ctp_method=None, max_lambda_calcs=None, combiners=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(network[, steps, flux_method, …])

Initialize self.

args()

Return a list of args of the __init__ function of a class

base()

Return the most parent class actually derived from StorableObject

calculate(steps)

Perform the analysis, using steps as input.

count_weaks()

Return number of objects subclassed from StorableObject still in memory

crossing_probability(ensemble)

Crossing probability function for a given ensemble

descendants()

Return a list of all subclassed objects

fix_name()

Set the objects name to be immutable.

flux(from_state[, through_interface])

Flux from a volume and through and interface.

from_dict(dct)

Reconstruct an object from a dictionary representaiton

from_weighted_trajectories(input_dict)

Calculate results from weighted trajectories dictionary.

get_uuid()

idx(store)

Return the index which is used for the object in the given store.

named(name)

Name an unnamed object.

objects()

Returns a dictionary of all storable objects

rate(from_state, to_state)

Rate for the transition between two states

rate_matrix([steps])

Calculate the rate matrix.

reverse_uuid()

ruuid(uid)

set_observer(active)

(De-)Activate observing creation of storable objects

state_fluxes(from_state)

All fluxes associated with a given initial state.

to_dict()

Convert object into a dictionary representation

transition_probability(from_state, to_state)

Transition probability between two states.

Attributes

ACTIVE_LONG

CREATION_COUNT

INSTANCE_UUID

base_cls

Return the base class

base_cls_name

Return the name of the base class

cls

Return the class name as a string

conditional_transition_probability

conditional transition probabilities

default_name

Return the default name.

flux_matrix

float}: keys are (state, interface); values are the associated flux

is_named

True if this object has a custom name.

name

Return the current name of the object.

observe_objects

total_crossing_probability

total crossing probability

transition_probability_matrix

matrix of transition probabilities

classmethod args()

Return a list of args of the __init__ function of a class

Returns

the list of argument names. No information about defaults is included.

Return type

list of str

classmethod base()

Return the most parent class actually derived from StorableObject

Important to determine which store should be used for storage

Returns

the base class

Return type

type

property base_cls

Return the base class

Returns

the base class

Return type

type

See also

base()

property base_cls_name

Return the name of the base class

Returns

the string representation of the base class

Return type

str

calculate(steps)

Perform the analysis, using steps as input.

Parameters

steps (iterable of MCStep) – the steps to use as input for this analysis

property cls

Return the class name as a string

Returns

the class name

Return type

str

property conditional_transition_probability

conditional transition probabilities

rows are ensemble names, columns are state names

Type

pandas.DataFrame

static count_weaks()

Return number of objects subclassed from StorableObject still in memory

This includes objects not yet recycled by the garbage collector.

Returns

dict of str – the dictionary which assigns the base class name of each references objects the integer number of objects still present

Return type

int

crossing_probability(ensemble)[source]

Crossing probability function for a given ensemble

Parameters

ensemble (Ensemble) – the ensemble for which the crossing probability is desired

Returns

crossing probability function for the given ensemble

Return type

LookupFunction

property default_name

Return the default name.

Usually derived from the objects class

Returns

the default name

Return type

str

classmethod descendants()

Return a list of all subclassed objects

Returns

list of subclasses of a storable object

Return type

list of type

fix_name()

Set the objects name to be immutable.

Usually called after load and save to fix the stored state.

flux(from_state, through_interface=None)

Flux from a volume and through and interface.

Shortcut to be used after the actual calculation has been performed.

Parameters
  • from_state (Volume) – the volume the flux should start from

  • through_interface (Volume) – the interface the flux should cross; default is None which uses the from_state volume

Returns

the flux out of the given state and through the given interface

Return type

float or Quantity

property flux_matrix

float}: keys are (state, interface); values are the associated flux

Type

dict of {(Volume, Volume)

classmethod from_dict(dct)

Reconstruct an object from a dictionary representaiton

Parameters

dct (dict) – the dictionary containing a state representaion of the class.

Returns

the reconstructed storable object

Return type

openpathsampling.netcdfplus.StorableObject

from_weighted_trajectories(input_dict)[source]

Calculate results from weighted trajectories dictionary.

Parameters

input_dict (dict of {Ensemble: collections.Counter}) – ensemble as key, and a counter mapping each trajectory associated with that ensemble to its counter of time spent in the ensemble (output of steps_to_weighted_trajectories)

Returns

dictionary with all the results

Return type

dict

idx(store)

Return the index which is used for the object in the given store.

Once you store a storable object in a store it gets assigned a unique number that can be used to retrieve the object back from the store. This function will ask the given store if the object is stored if so what the used index is.

Parameters

store (openpathsampling.netcdfplus.ObjectStore) – the store in which to ask for the index

Returns

the integer index for the object of it exists or None else

Return type

int or None

property is_named

True if this object has a custom name.

This distinguishes default algorithmic names from assigned names.

property name

Return the current name of the object.

If no name has been set a default generated name is returned.

Returns

the name of the object

Return type

str

named(name)

Name an unnamed object.

This only renames the object if it does not yet have a name. It can be used to chain the naming onto the object creation. It should also be used when naming things algorithmically: directly setting the .name attribute could override a user-defined name.

Parameters

name (str) – the name to be used for the object. Can only be set once

Examples

>>> import openpathsampling as p
>>> full = p.FullVolume().named('myFullVolume')
static objects()

Returns a dictionary of all storable objects

Returns

dict of str – a dictionary of all subclassed objects from StorableObject. The name points to the class

Return type

type

rate(from_state, to_state)

Rate for the transition between two states

Parameters
  • from_state (Volume) – initial state in the transition

  • to_state (Volume) – final state in the transition

Returns

rate for the from_state->`to_state` transition

Return type

float or Quantity

rate_matrix(steps=None)

Calculate the rate matrix.

Parameters

steps (iterable of MCStep) – the steps from a simulation to use for calculating the rate. If None (default), then use the existing cached results.

Returns

the rate matrix

Return type

TransitionDictResults

static set_observer(active)

(De-)Activate observing creation of storable objects

This can be used to track which storable objects are still alive and hence look for memory leaks and inspect caching. Use openpathsampling.netcdfplus.base.StorableObject.count_weaks() to get the current summary of created objects

Parameters

active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.

state_fluxes(from_state)

All fluxes associated with a given initial state.

Shortcut to be used after the actual calculation has been performed.

Parameters

from_state (Volume) – the volume the fluxes should start from

Returns

dictionary of (state, interface) to the associated flux – same as the flux dictionary given be flux_matrix(), but only including the cases with the desired state volume

Return type

dict of 2-tuple of Volume to float

to_dict()

Convert object into a dictionary representation

Used to convert the dictionary into JSON string for serialization

Returns

the dictionary representing the (immutable) state of the object

Return type

dict

property total_crossing_probability

total crossing probability

Type

LookupFunction

transition_probability(from_state, to_state)

Transition probability between two states.

Parameters
  • from_state (Volume) – initial state in the transition

  • to_state (Volume) – final state in the transition

Returns

transition probability for the from_state->`to_state` transition

Return type

float

property transition_probability_matrix

matrix of transition probabilities

Type

TransitionDictResults