API Functions¶
CollectiveVariable¶
-
class
collectivevariable.
CallableCV
(name, cv_callable, cv_time_reversible=False, cv_requires_lists=False, cv_wrap_numpy_array=False, cv_scalarize_numpy_singletons=False, **kwargs)[source]¶ Bases:
collectivevariable.CollectiveVariable
Turn any callable object into a storable CollectiveVariable.
-
_callable_dict
¶ The ChainDict that will call the actual function in case non of the preceding ChainDicts have returned data
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
CollectiveVariable
(name, cv_time_reversible=False)[source]¶ Bases:
openpathsampling.netcdfplus.attribute.PseudoAttribute
Wrapper for a function that acts on snapshots or iterables of snapshots
Parameters: - name (string) – A descriptive name of the collectivevariable. It is used in the string representation.
- cv_time_reversible (bool) – If True (default) the CV assumes that reversed snapshots have the same value. This is the default case when CVs do not depend on momenta reversal. This will speed up computation of CVs by about a factor of two. In rare cases you might want to set this to False
-
name
¶
-
cv_time_reversible
¶
-
_cache_dict
¶ openpathsampling.chaindict.ChainDict
– The ChainDict that will cache calculated values for fast access
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
class
collectivevariable.
CoordinateFunctionCV
(name, f, cv_requires_lists=False, cv_wrap_numpy_array=False, cv_scalarize_numpy_singletons=False, **kwargs)[source]¶ Bases:
collectivevariable.FunctionCV
Turn any function into a CollectiveVariable.
-
cv_callable
¶
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
CoordinateGeneratorCV
(name, generator, cv_requires_lists=False, cv_wrap_numpy_array=False, cv_scalarize_numpy_singletons=False, **kwargs)[source]¶ Bases:
collectivevariable.GeneratorCV
Turn a callable class or function generating a callable object into a CV
The class instance will be called with snapshots. The instance itself will be created using the given **kwargs.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
FunctionCV
(name, f, cv_time_reversible=False, cv_requires_lists=False, cv_wrap_numpy_array=False, cv_scalarize_numpy_singletons=False, **kwargs)[source]¶ Bases:
collectivevariable.CallableCV
Turn any function into a CollectiveVariable.
-
cv_callable
¶
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
GeneratorCV
(name, generator, cv_time_reversible=False, cv_requires_lists=False, cv_wrap_numpy_array=False, cv_scalarize_numpy_singletons=False, **kwargs)[source]¶ Bases:
collectivevariable.CallableCV
Turn a callable class or function generating a callable object into a CV
The class instance will be called with snapshots. The instance itself will be created using the given **kwargs.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
InVolumeCV
(name, volume)[source]¶ Bases:
collectivevariable.CollectiveVariable
Turn a Volume into a collective variable
-
name
¶
-
volume
¶
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
MDTrajFunctionCV
(name, f, topology, cv_requires_lists=True, cv_wrap_numpy_array=True, cv_scalarize_numpy_singletons=True, **kwargs)[source]¶ Bases:
collectivevariable.CoordinateFunctionCV
Make CollectiveVariable from f that takes mdtraj.trajectory as input.
This is identical to FunctionCV except that the function is called with an
mdtraj.Trajectory
object instead of theopenpathsampling.Trajectory
one using f(traj.to_mdtraj(), **kwargs)Examples
>>> # To create an order parameter which calculates the dihedral formed >>> # by atoms [7,9,15,17] (psi in Ala dipeptide): >>> import mdtraj as md >>> traj = 'peng.Trajectory()' >>> psi_atoms = [7,9,15,17] >>> psi_orderparam = FunctionCV("psi", md.compute_dihedrals, >>> indices=[[2,4,6,8]]) >>> print psi_orderparam( traj )
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
MSMBFeaturizerCV
(name, featurizer, topology, cv_wrap_numpy_array=True, cv_scalarize_numpy_singletons=True, **kwargs)[source]¶ Bases:
collectivevariable.CoordinateGeneratorCV
A CollectiveVariable that uses an MSMBuilder3 featurizer
-
scalarize_numpy_singletons
¶
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
-
class
collectivevariable.
PyEMMAFeaturizerCV
(name, featurizer, topology, **kwargs)[source]¶ Bases:
collectivevariable.MSMBFeaturizerCV
Make a CV from a function that takes mdtraj.trajectory as input.
This is identical to CoordinateGeneratorCV except that the function is called with an mdraj.Trajetory object instead of the openpathsampling.Trajectory one using fnc(traj.to_mdtraj(), **kwargs)
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cache_all
()¶ Sync this CV with attached storages
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
passing_chain
¶ Return a list of chaindicts in order they will be tried.
Returns: the list of chaindicts in order they are called Return type: list of openpathsampling.chaindict.ChainDict
-
set_cache_store
(value_store)¶ Attach store variables to the collective variables.
If used the collective variable will automatically sync values with the store and load from it if necessary. If the CV is created with diskcache_enabled = True. This will be done during CV creation.
Parameters: value_store ( openpathsampling.netcdfplus.ObjectStore
) – the store / variable that holds the output values / objects
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
str_chain
()¶ Return a string representation of the chain of dicts called.
Returns: the string representation Return type: str
-
sync
()¶ Sync this CV with the attached storages
-
Dynamics Engines¶
-
class
engines.
BaseSnapshot
(topology=None)[source]¶ Bases:
openpathsampling.netcdfplus.base.StorableObject
Simulation snapshot. Contains references to a configuration and momentum
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__neg__
()[source]¶ Access the reversed snapshot using -
Returns: the reversed copy Return type: BaseSnapshot
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
copy
()[source]¶ Returns a shallow copy of the instance itself. The contained configuration and momenta are not copied.
Returns: the shallow copy Return type: openpathsampling.BaseSnapshot
Notes
Shallow here means that content will not be copied but only referenced. Hence if you store the shallow copy it will be stored under a different idx, but the content (e.g. Configuration object) will not.
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
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
-
reversed
¶ Get the reversed copy.
Returns: openpathsampling.snapshots.AbstractSnapshot
– the reversed partner of the current snapshot- Snapshots exist in pairs and this returns the reversed counter part.
- The actual implementation takes care the the reversed version have
- reversed momenta, etc. Usually these will not be stored separately but
- flipped when requested.
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
engines.
DynamicsEngine
(options=None, descriptor=None)[source]¶ Bases:
openpathsampling.netcdfplus.base.StorableNamedObject
Wraps simulation tool (parameters, storage, etc.)
-
on_nan
¶ str – set the behaviour of the engine when NaN is detected. Possible is
- fail will raise an exception EngineNaNError
- retry will rerun the trajectory in engine.generate, these moves do not satisfy detailed balance
-
on_error
¶ str – set the behaviour of the engine when an exception happens. Possible is
- fail will raise an exception EngineError
- retry will rerun the trajectory in engine.generate, these moves do not satisfy detailed balance
-
on_max_length
¶ str – set the behaviour if the trajectory length is n_frames_max. If n_frames_max == 0 this will be ignored and nothing happens. Possible is
- fail will raise an exception EngineMaxLengthError
- stop will stop and return the max length trajectory (default)
- retry will rerun the trajectory in engine.generate, these moves do not satisfy detailed balance
-
retries_when_nan
¶ int, default: 2 – the number of retries (if chosen) before an exception is raised
-
retries_when_error
¶ int, default: 2 – the number of retries (if chosen) before an exception is raised
-
retries_when_max_length
¶ int, default: 0 – the number of retries (if chosen) before an exception is raised
-
on_retry
¶ str or callable – the behaviour when a try is started. Since you have already generated some trajectory you might not restart completely. Possibilities are 1. full will restart completely and use the initial frames (default) 2. 50% will cut the existing in half but keeping at least the initial 3. remove_interval will remove as many frames as the interval 4. a callable will be used as a function to generate the new from the
old trajectories, e.g. lambda t: t[:10] would restart with the first 10 frames
Notes
Should be considered an abstract class: only its subclasses can be instantiated.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
base_snapshot_type
¶ alias of
BaseSnapshot
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
generate
(snapshot, running=None, direction=1)[source]¶ Generate a trajectory consisting of ntau segments of tau_steps in between storage of Snapshots.
Parameters: - snapshot (
openpathsampling.snapshot.Snapshot
) – initial coordinates and velocities in form of a Snapshot object - running ((list of)) –
- :param function(
openpathsampling.trajectory.Trajectory
): callable function of a ‘Trajectory’ that returns True or False. - If one of these returns False the simulation is stopped.
Parameters: direction (-1 or +1 (DynamicsEngine.FORWARD or DynamicsEngine.BACKWARD)) – If +1 then this will integrate forward, if -1 it will reversed the momenta of the given snapshot and then prepending generated snapshots with reversed momenta. This will generate a _reversed_ trajectory that effectively ends in the initial snapshot Returns: trajectory – generated trajectory of initial conditions, including initial coordinate set Return type: openpathsampling.trajectory.Trajectory
Notes
If the returned trajectory has length n_frames_max it can still happen that it stopped because of the stopping criterion. You need to check in that case.
- snapshot (
-
generate_n_frames
(n_frames=1)[source]¶ Generates n_frames, from but not including the current snapshot.
This generates a fixed number of frames at once. If you desire the reversed trajectory, you can reverse the returned trajectory.
Parameters: n_frames (integer) – number of frames to generate Returns: the n_frames of the trajectory following (and not including) the initial current_snapshot Return type: paths.Trajectory()
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
static
is_valid_snapshot
(snapshot)[source]¶ Test the snapshot to be valid. Usually not containing nan
Returns: bool – returns True if the snapshot is okay to be used Return type: True
-
iter_generate
(initial, running=None, direction=1, intervals=10, max_length=0)[source]¶ Return a generator that will generate a trajectory, returning the current trajectory in given intervals
Parameters: initial ( openpathsampling.Snapshot
or) –- :param
openpathsampling.Trajectory
: initial coordinates and velocities in form of a Snapshot object - or a trajectory
Parameters: running ((list of)) – - :param function(
openpathsampling.trajectory.Trajectory
): callable function of a ‘Trajectory’ that returns True or False. - If one of these returns False the simulation is stopped.
Parameters: - direction (-1 or +1 (DynamicsEngine.FORWARD or DynamicsEngine.BACKWARD)) – If +1 then this will integrate forward, if -1 it will reversed the momenta of the given snapshot and then prepending generated snapshots with reversed momenta. This will generate a _reversed_ trajectory that effectively ends in the initial snapshot
- intervals (int) – number steps after which the current status is returned. If 0 it will run until the end or a keyboard interrupt is detected
- max_length (int) – will limit the simulation length to a number of steps. Default is 0 which will run unlimited
Yields: trajectory (
openpathsampling.trajectory.Trajectory
) – generated trajectory of initial conditions, including initial coordinate setNotes
If the returned trajectory has length n_frames_max it can still happen that it stopped because of the stopping criterion. You need to check in that case.
- :param
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
stop
(trajectory)[source]¶ Nothing special needs to be done for direct-control simulations when you hit a stop condition.
-
stop_conditions
(trajectory, continue_conditions=None, trusted=True)[source]¶ Test whether we can continue; called by generate a couple of times, so the logic is separated here.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the trajectory we’ve generated so far - continue_conditions ((list of) function(Trajectory)) – callable function of a ‘Trajectory’ that returns True or False. If one of these returns False the simulation is stopped.
- trusted (bool) – If True (default) the stopping conditions are evaluated as trusted.
Returns: true if the dynamics should be stopped; false otherwise
Return type: bool
- trajectory (
-
-
engines.
SnapshotFactory
(name, features, description=None, use_lazy_reversed=False, base_class=None)[source]¶ Helper to create a new Snapshot class
Parameters: - name (str) – name of the Snapshot class
- features (list of
openpathsampling.features
) – the features used to build the snapshot - description (str) – the string to be used as basis for the docstring of the new class it will be merged with the docs for the features
- use_lazy_reversed (bool) – still in there for legacy reasons. It will make the .reversed attribute into a descriptor than can treat LoaderProxy objects. This feature is not relly used anymore and can in the best case only save little memory with slowing down construction, etc. Using False is faster
- base_class (
openpathsampling.BaseSnapshot
) – The base class the Snapshot is derived from. Default is the BaseSnapshot class.
Returns: the created Snapshot class
Return type: openpathsampling.Snapshot
-
class
engines.
Topology
(n_atoms, n_spatial=3)[source]¶ Bases:
openpathsampling.netcdfplus.base.StorableNamedObject
Topology is the object that contains all information about the structure of the system to be simulated.
-
n_atoms
¶ int – number of atoms
-
n_spatial
¶ int – number of spatial dimensions, default is 3
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
engines.
Trajectory
(trajectory=None)[source]¶ Bases:
list
,openpathsampling.netcdfplus.base.StorableObject
Simulation trajectory. Essentially a python list of snapshots
-
__contains__
¶ x.__contains__(y) <==> y in x
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__delitem__
¶ x.__delitem__(y) <==> del x[y]
-
__delslice__
¶ x.__delslice__(i, j) <==> del x[i – j]
Use of negative indices is not supported.
-
__eq__
¶ x.__eq__(y) <==> x==y
-
__format__
()¶ default object formatter
-
__ge__
¶ x.__ge__(y) <==> x>=y
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__gt__
¶ x.__gt__(y) <==> x>y
-
__iadd__
¶ x.__iadd__(y) <==> x+=y
-
__imul__
¶ x.__imul__(y) <==> x*=y
-
__iter__
()[source]¶ Return an iterator over all snapshots in the storage
This will always give real
openpathsampling.snapshot.Snapshot
objects and never proxies to snapshots. If you prefer proxies (if available) use .items()Returns: The iterator that iterates the objects in the store Return type: Iterator()
-
__le__
¶ x.__le__(y) <==> x<=y
-
__len__
¶
-
__lt__
¶ x.__lt__(y) <==> x<y
-
__mul__
¶ x.__mul__(n) <==> x*n
-
__ne__
¶ x.__ne__(y) <==> x!=y
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__rmul__
¶ x.__rmul__(n) <==> n*x
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__setitem__
¶ x.__setitem__(i, y) <==> x[i]=y
-
__setslice__
¶ x.__setslice__(i, j, y) <==> x[i – j]=y
Use of negative indices is not supported.
-
__sizeof__
()¶ L.__sizeof__() – size of L in memory, in bytes
-
append
()¶ L.append(object) – append object to end
-
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
-
as_proxies
()[source]¶ Returns all contains all actual elements
This will also return lazy proxy objects and not the references ones as does __iter__, __reversed__ or __getitme__. Useful for faster access to the elements
Returns: Return type: list of Snapshot
oropenpathsampling.netcdfplus.LoaderProxy
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
contains_symmetric
(item)[source]¶ Test whether a snapshot or its reversed is in a trajectory
Returns: Return type: bool
-
count
(value) → integer -- return number of occurrences of value¶
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
get_as_proxy
(item)[source]¶ Get an actual contained element
This will also return lazy proxy objects and not the referenced ones as does __iter__, __reversed__ or __getitem__. Useful for faster access to the elements
This is equal to use list.__getitem__(trajectory, item)
Returns: Return type: Snapshot
oropenpathsampling.netcdfplus.proxy.LoaderProxy
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
insert
()¶ L.insert(index, object) – insert object before index
Checks if two trajectories share a common snapshot
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to check for common snapshotsReturns: returns True if at least one snapshot appears in both trajectories Return type: bool
-
iter_proxies
()[source]¶ Returns an iterator over all actual elements
This will also return lazy proxy objects and not the references ones as does __iter__, __reversed__ or __getitme__. Useful for faster access to the elements
Returns: - Iterator() over list of
openpathsampling.snapshot.Snapshot
- or
openpathsampling.netcdfplus.proxy.LoaderProxy
- Iterator() over list of
-
map
(fnc, allow_fast=True)[source]¶ This runs a function and tries to be fast.
Fast here means that functions that are purely based on CVs can be evaluated without actually loading the real Snapshot object. This functions tries to do that and if it fails it does it the usual way and creates the snapshot object. This bears the possibility that the function uses the fake snapshots and returns a non-sense value. It is up to the user to make sure this will not happen.
-
n_snapshots
¶ Return the number of frames in the trajectory.
Returns: Return type: length (int) - the number of frames in the trajectory Notes
Might be removed in later versions for len(trajectory) is more pythonic
See also
len
-
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
-
pop
([index]) → item -- remove and return item at index (default last).¶ Raises IndexError if list is empty or index is out of range.
-
remove
()¶ L.remove(value) – remove first occurrence of value. Raises ValueError if the value is not present.
-
reverse
()¶ L.reverse() – reverse IN PLACE
-
reversed
¶ Returns a reversed (shallow) copy of the trajectory itself. Effectively creates a new Trajectory object and then fills it with shallow reversed copies of the contained snapshots.
Returns: the reversed trajectory Return type: openpathsampling.trajectory.Trajectory
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
Returns a set of shared snapshots
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to useReturns: the set of common snapshots Return type: set of openpathsampling.snapshot.Snapshot
Returns a subtrajectory which only contains frames present in other
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to useReturns: the shared subtrajectory Return type: openpathsampling.trajectory.Trajectory
-
sort
()¶ L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1
-
subtrajectory_indices
(subtrajectories)[source]¶ Returns a list of lists of indices for frames from subtrajectories.
Parameters: subtrajectories (list of Trajectory
) – input list of subtrajectoriesReturns: the indices within this trajectory of the frames in each subtrajectory Return type: list of list of int
-
summarize_by_volumes
(label_dict)[source]¶ Summarize trajectory based on number of continuous frames in volumes.
This uses a dictionary of disjoint volumes: the volumes must be disjoint so that every frame can be mapped to one volume. If the frame maps to none of the given volumes, it returns the label None.
Parameters: label_dict (dict) – dictionary with labels for keys and volumes for values Returns: format is (label, number_of_frames) Return type: list of tuple
-
summarize_by_volumes_str
(label_dict, delimiter='-')[source]¶ Return string version of the volumes visited by this trajectory.
See Trajectory.summarize_by_volumes for details.
Parameters: - label_dict (dict) – dictionary with labels for keys and volumes for values
- delimiter (string (default "-")) – string used to separate volumes in output
Returns: order in which this trajectory visits the volumes in label_dict, separated by the delimiter
Return type: string
-
to_mdtraj
(topology=None)[source]¶ Construct a mdtraj.Trajectory object from the Trajectory itself
Parameters: topology ( mdtraj.Topology
) – If not None this topology will be used to construct the mdtraj objects otherwise the topology object will be taken from the configurations in the trajectory snapshots.Returns: the trajectory Return type: mdtraj.Trajectory
-
topology
¶ Return a Topology object representing the topology of the current view of the trajectory
Returns: the topology object Return type: openpathsampling.topology.Topology
-
unique_subtrajectory
(other)[source]¶ Returns a subtrajectory which contains frames not present in other
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to useReturns: the unique frames subtrajectory (opposite of shared) Return type: openpathsampling.trajectory.Trajectory
-
Shooting¶
-
class
shooting.
FinalFrameSelector
[source]¶ Bases:
shooting.ShootingPointSelector
Pick final trajectory frame as shooting point.
This is used for “forward” extension in, e.g., the minus move.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sum_bias
(trajectory)¶ Returns the unnormalized probability probability of a trajectory. This is just the sum of all proposal probabilities in a trajectory.
Notes
For a uniform distribution this is proportional to the length of the trajectory. In this case we can estimate the maximal accepted trajectory length for a given acceptance probability.
After we have generated a new trajectory the acceptance probability only for the non-symmetric proposal of different snapshots is given by probability(old_trajectory) / probability(new_trajectory)
-
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
-
-
class
shooting.
FirstFrameSelector
[source]¶ Bases:
shooting.ShootingPointSelector
Pick first trajectory frame as shooting point.
This is used for “backward” extension in, e.g., the minus move.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sum_bias
(trajectory)¶ Returns the unnormalized probability probability of a trajectory. This is just the sum of all proposal probabilities in a trajectory.
Notes
For a uniform distribution this is proportional to the length of the trajectory. In this case we can estimate the maximal accepted trajectory length for a given acceptance probability.
After we have generated a new trajectory the acceptance probability only for the non-symmetric proposal of different snapshots is given by probability(old_trajectory) / probability(new_trajectory)
-
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
-
-
class
shooting.
UniformSelector
(pad_start=1, pad_end=1)[source]¶ Bases:
shooting.ShootingPointSelector
Selects random frame in range pad_start to len(trajectory-pad_end.
-
pad_start
¶ int – number of frames at beginning of trajectory to be excluded from selection
-
pad_end
¶ int – number of frames at end of trajectory to be excluded from selection
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
Ensemble¶
Created on 03.09.2014
@author: Jan-Hendrik Prinz, David W.H. Swenson
-
class
ensemble.
AllInXEnsemble
(volume, trusted=True)[source]¶ Ensemble of trajectories with all frames in the given volume
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
AllOutXEnsemble
(volume, trusted=True)[source]¶ Ensemble of trajectories with all frames outside the given volume
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
AppendedNameEnsemble
(ensemble, label)[source]¶ Add string to ensemble name: allows multiple copies of an ensemble.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
EmptyEnsemble
[source]¶ The empty path ensemble of no trajectories.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
Ensemble
[source]¶ Path ensemble object.
An Ensemble represents a path ensemble, effectively a set of trajectories. Typical set operations are allowed, here: and, or, xor, -(without), ~ (inverse = all - x)
Examples
>>> EnsembleFactory.TISEnsemble( >>> CVDefinedVolume(collectivevariable_A, 0.0, 0.02), >>> CVDefinedVolume(collectivevariable_A, 0.0, 0.02), >>> CVDefinedVolume(collectivevariable_A, 0.0, 0.08), >>> True >>> )
Notes
Maybe replace - by / to get better notation. So far it has not been used
-
__call__
(trajectory, trusted=None, candidate=False)[source]¶ Return True if the trajectory is part of the path ensemble.
Parameters: - trajectory (
Trajectory
) – The trajectory to be checked - trusted (boolean) – For many ensembles, a faster algorithm can be used if we know
some information about the trajectory with one fewer frames.
The trusted flag tells the ensemble to use such an algorithm.
This is usually used in combination with an
EnsembleCache
which makes short-cut calculations possible.
- trajectory (
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
can_append
(trajectory, trusted=False)[source]¶ Returns true, if the trajectory so far can still be in the ensemble if it is appended by a frame. To check, it assumes that the trajectory to length L-1 is okay. This is mainly for interactive usage, when a trajectory is generated.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a forward step (extending the trajectory forward in time at its end) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
can_prepend
(trajectory, trusted=False)[source]¶ Returns true, if the trajectory so far can still be in the ensemble if it is prepended by a frame. To check, it assumes that the trajectory from index 1 is okay. This is mainly for interactive usage, when a trajectory is generated using a backward move.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a backward step (extending the trajectory backwards in time at its beginning) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)[source]¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)[source]¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)[source]¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')[source]¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)[source]¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)[source]¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)[source]¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)[source]¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')[source]¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)[source]¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)[source]¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
-
class
ensemble.
EnsembleCache
(direction=None)[source]¶ Object used by ensembles to enable fast algorithms for basic functions.
The contents stored in the can_append, can_prepend, call, and check_reverse dictionaries will depend on the ensemble. Only two of these dictionaries should be non-None at any time: either the pair call and can_append, or the pair check_reverse and can_prepend.
This object also contains basic functions to manage the cache.
-
start_frame
¶ openpathsampling.snapshot.Snapshot
-
prev_last_frame
¶ openpathsampling.snapshot.Snapshot
-
direction
¶ +1 or -1
-
contents
¶ dictionary
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__hash__
¶
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
check
(trajectory=None, reset=None)[source]¶ Checks and resets (if necessary) the ensemble cache.
The trajectory is considered trustworthy based on checking several factors, compared to the last time the cache was checked. For forward caches (direction > 0), these are * the first frame has not changed * the length is the same, or has changed by 1 * if length unchanged, the final frame is the same; if length
changed by 1, the penultimate frame is the old final frameSimilar rules apply for backward caches (direction < 0), with obvious changes of “final” and “first” frames.
If the trajectory is not trustworthy, we return True (should be reset).
Parameters: - trajectory (
Trajectory
) – the trajectory to test - reset (bool or None) – force a value for reset. If None, the value is determined based on the test criteria.
Returns: the value of reset
Return type: bool
- trajectory (
-
-
class
ensemble.
EnsembleCombination
(ensemble1, ensemble2, fnc, str_fnc)[source]¶ Logical combination of two ensembles
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
EnsembleFactory
[source]¶ Convenience class to construct Ensembles
-
static
A2BEnsemble
(volume_a, volume_b, trusted=True)[source]¶ Construct an ensemble that starts in volume_a, ends in volume_b and is in either volumes in between
Parameters: - volume_a (
openpathsampling.Volume
) – The volume to start in - volume_b (
openpathsampling.Volume
) – The volume to end in
Returns: ensemble – The constructed Ensemble
Return type: openpathsampling.Ensemble
- volume_a (
-
static
EndXEnsemble
(volume)[source]¶ Construct an ensemble that ends (x[-1]) in the specified volume
Parameters: volume ( openpathsampling.volume.Volume
) – The volume to end inReturns: ensemble – The constructed Ensemble Return type: openpathsampling.ensemble.Ensemble
-
static
StartXEnsemble
(volume)[source]¶ Construct an ensemble that starts (x[0]) in the specified volume
Parameters: volume ( openpathsampling.volume.Volume
) – The volume to start inReturns: ensemble – The constructed Ensemble Return type: openpathsampling.ensemble.Ensemble
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__hash__
¶
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
static
-
class
ensemble.
EntersXEnsemble
(volume, trusted=False)[source]¶ Represents an ensemble where two successive frames from the selected frames of the trajectory crossing from outside to inside the given volume.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
can_append
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is appended by a frame. To check, it assumes that the trajectory to length L-1 is okay. This is mainly for interactive usage, when a trajectory is generated.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a forward step (extending the trajectory forward in time at its end) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
can_prepend
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is prepended by a frame. To check, it assumes that the trajectory from index 1 is okay. This is mainly for interactive usage, when a trajectory is generated using a backward move.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a backward step (extending the trajectory backwards in time at its beginning) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
ExitsXEnsemble
(volume, trusted=False)[source]¶ Represents an ensemble where two successive frames from the selected frames of the trajectory crossing from inside to outside the given volume.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
can_append
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is appended by a frame. To check, it assumes that the trajectory to length L-1 is okay. This is mainly for interactive usage, when a trajectory is generated.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a forward step (extending the trajectory forward in time at its end) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
can_prepend
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is prepended by a frame. To check, it assumes that the trajectory from index 1 is okay. This is mainly for interactive usage, when a trajectory is generated using a backward move.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a backward step (extending the trajectory backwards in time at its beginning) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
FullEnsemble
[source]¶ The full path ensemble of all possible trajectories.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
LengthEnsemble
(length)[source]¶ The ensemble of trajectories of a given length
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
MinusInterfaceEnsemble
(state_vol, innermost_vols, n_l=2, greedy=False)[source]¶ This creates an ensemble for the minus interface.
Parameters: - state_vol (
openpathsampling.volume.Volume
) – The Volume which defines the state for this minus interface - innermost_vols (
list of openpathsampling.volume.Volume
) – The Volume defining the innermost interface with which this minus interface does its replica exchange. - n_l (integer (greater than one)) – The number of segments crossing innermost_vol for this interface.
- specific implementation allows us to use the multiple-segment minus (The) –
- described by Swenson and Bolhuis. The minus interface was (ensemble) –
- developed by van Erp. For more details, see the section (originally) –
- of a PathMover ("Anatomy) –
- Documentation. –
References
T.S. van Erp. Phys. Rev. Lett.
D.W.H. Swenson and P.G. Bolhuis. J. Chem. Phys. 141, 044101 (2014). doi:10.1063/1.4890037
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
update_cache
(cache, ens_num, ens_from, subtraj_from)¶ Updates the given cache.
Parameters: - cache (EnsembleCache) – the cache to be updated
- ens_num (integer) – current value of ens_num in the sequential ensemble
- ens_from (integer) – current “start” ensemble index. For forward-direction caches, this is ens_first. For reverse-direction caches, this is ens_final. The “initial” (in the appropriate direction) frame is assigned to this ensemble
- subtraj_from (integer) – index of the “start” frame of the subtrajectory in this subensemble. For forward-direction caches, this is the first frame of the subtrajectory. For reverse-direction caches, this is the final frame of the subtrajectory.
- state_vol (
-
class
ensemble.
NegatedEnsemble
(ensemble)[source]¶ Negates an Ensemble and simulates a not statement
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
OptionalEnsemble
(ensemble)[source]¶ An ensemble which is optional for SequentialEnsembles.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
PartInXEnsemble
(volume, trusted=True)[source]¶ Ensemble of trajectory with at least one frame in the volume
-
__call__
(trajectory, trusted=None, candidate=False)[source]¶ Returns True if the trajectory is part of the PathEnsemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – The trajectory to be checked
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
can_append
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is appended by a frame. To check, it assumes that the trajectory to length L-1 is okay. This is mainly for interactive usage, when a trajectory is generated.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a forward step (extending the trajectory forward in time at its end) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
can_prepend
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is prepended by a frame. To check, it assumes that the trajectory from index 1 is okay. This is mainly for interactive usage, when a trajectory is generated using a backward move.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a backward step (extending the trajectory backwards in time at its beginning) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
PartOutXEnsemble
(volume, trusted=True)[source]¶ Ensemble of trajectories with at least one frame outside the volume
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
can_append
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is appended by a frame. To check, it assumes that the trajectory to length L-1 is okay. This is mainly for interactive usage, when a trajectory is generated.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a forward step (extending the trajectory forward in time at its end) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
can_prepend
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is prepended by a frame. To check, it assumes that the trajectory from index 1 is okay. This is mainly for interactive usage, when a trajectory is generated using a backward move.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a backward step (extending the trajectory backwards in time at its beginning) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
PrefixTrajectoryEnsemble
(ensemble, add_trajectory)[source]¶ Ensemble which appends its trajectory to a given trajectory.
Used in forward shooting.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
ReversedTrajectoryEnsemble
(ensemble)[source]¶ Ensemble based on reversing the trajectory.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
SequentialEnsemble
(ensembles, min_overlap=0, max_overlap=0, greedy=False)[source]¶ Ensemble which satisfies several subensembles in sequence.
-
ensembles
¶ tuple of Ensemble – The ensembles, in time-order of when they should occur in the trajectory.
-
min_overlap
¶ int or tuple of int – The minimum number of frames that overlap between two ensembles in the sequence. A positive number n indicates that at least n frames must be in both ensembles at the transition between them. A negative number -n indicates that at least n frames in neither ensemble at the transition between them. If given as a list, the list should be of length len(ensembles)-1, with one value for each transition. If given as an integer, that value will be used for all transitions.
-
max_overlap
¶ int or list of int – The maximum number of frames that overlap between two ensembles in the sequence. A positive number n indicates that no more than n frames can be in both ensembles at the transition between them. A negative number -n indicates no more than n frames in neither ensemble at the transition between them. If given as a list, the list should be of length len(ensembles)-1, with one value for each transition. If given as an integer, that value will be used for all transitions.
Notes
TODO: Overlap features not implemented because ohmygod this was hard enough already.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
static
update_cache
(cache, ens_num, ens_from, subtraj_from)[source]¶ Updates the given cache.
Parameters: - cache (EnsembleCache) – the cache to be updated
- ens_num (integer) – current value of ens_num in the sequential ensemble
- ens_from (integer) – current “start” ensemble index. For forward-direction caches, this is ens_first. For reverse-direction caches, this is ens_final. The “initial” (in the appropriate direction) frame is assigned to this ensemble
- subtraj_from (integer) – index of the “start” frame of the subtrajectory in this subensemble. For forward-direction caches, this is the first frame of the subtrajectory. For reverse-direction caches, this is the final frame of the subtrajectory.
-
-
class
ensemble.
SingleFrameEnsemble
(ensemble)[source]¶ Convenience ensemble to and a LengthEnsemble(1) with a given ensemble.
Frequently used for SequentialEnsembles.
-
ensemble
¶ openpathsampling.ensemble.Ensemble
– the ensemble which should be represented in the single frame
Notes
We allow the user to choose to be stupid: if, for example, the user tries to make a SingleFrameEnsemble from an ensemble which requires more than one frame to be satisfied (e.g., a SequentialEnsemble with more than one subensemble), it can be created, but no path will ever satisfy it. Since we can’t stop all possible mistakes, we don’t bother here.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
SlicedTrajectoryEnsemble
(ensemble, region)[source]¶ Alters trajectories given as arguments by taking Python slices.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
SuffixTrajectoryEnsemble
(ensemble, add_trajectory)[source]¶ Ensemble which prepends its trajectory to a given trajectory.
Used in backward shooting.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
TISEnsemble
(initial_states, final_states, interface, orderparameter=None, lambda_i=None)[source]¶ An ensemble for TIS (or AMS).
Begin in initial_states, end in either initial_states or final_states, and cross interface.
-
initial_states
¶ openpathsampling.volume.Volume or list of openpathsampling.volume.Volume – Volume(s) that only the first or last frame may be in
-
final_states
¶ openpathsampling.volume.Volume or list of openpathsampling.volume.Volume – Volume(s) that only the last frame may be in
-
interface
¶ openpathsampling.volume.Volume – Volume which the trajectory must exit to be accepted
-
orderparameter
¶ openpathsampling.collectivevariable.CollectiveVariable – CV to be used as order parameter for this
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
update_cache
(cache, ens_num, ens_from, subtraj_from)¶ Updates the given cache.
Parameters: - cache (EnsembleCache) – the cache to be updated
- ens_num (integer) – current value of ens_num in the sequential ensemble
- ens_from (integer) – current “start” ensemble index. For forward-direction caches, this is ens_first. For reverse-direction caches, this is ens_final. The “initial” (in the appropriate direction) frame is assigned to this ensemble
- subtraj_from (integer) – index of the “start” frame of the subtrajectory in this subensemble. For forward-direction caches, this is the first frame of the subtrajectory. For reverse-direction caches, this is the final frame of the subtrajectory.
-
-
class
ensemble.
VolumeEnsemble
(volume, trusted=True)[source]¶ Path ensembles based on the Volume object
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
can_append
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is appended by a frame. To check, it assumes that the trajectory to length L-1 is okay. This is mainly for interactive usage, when a trajectory is generated.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a forward step (extending the trajectory forward in time at its end) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
can_prepend
(trajectory, trusted=False)¶ Returns true, if the trajectory so far can still be in the ensemble if it is prepended by a frame. To check, it assumes that the trajectory from index 1 is okay. This is mainly for interactive usage, when a trajectory is generated using a backward move.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be tested - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: Returns true or false if using a backward step (extending the trajectory backwards in time at its beginning) trajectory could still be in the ensemble and thus makes sense to continue a simulation
Return type: bool
- trajectory (
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
strict_can_append
(trajectory, trusted=False)¶ Returns true if the trajectory can be the beginning of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the beginning of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
strict_can_prepend
(trajectory, trusted=False)¶ Returns true if the trajectory can be the end of a trajectory in the ensemble.
Parameters: - trajectory (
Trajectory
) – trajectory to test - trusted (bool) – If trusted=True, some ensembles can be computed more efficiently (e.g., by checking only one frame)
Returns: True if and only if the given trajectory can be the end of a trajectory in the ensemble.
Return type: bool
- trajectory (
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
-
class
ensemble.
WrappedEnsemble
(ensemble)[source]¶ Wraps an ensemble to alter it or the way it sees a trajectory
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
extend_sample_from_trajectories
(trajectories, engine, replica=0, unique='median', level='complex', on_error='retry', attempts=2)¶ Generate a sample in the ensemble by extending parts of trajectories
This will take an initial trajectory look for useable subparts and try to extend them into a valid sample. This works by taking information from an ensemble what are resonable subparts, this is returned by a function .extendable_sub_ensembles() which is only defined for complex ensembles like Minus or TIS ensemble.
As an example the minus could extend from the segment ensemble or even a segment + parts completely in the inner ensemble. Of course the ensemble itself is always valid.
The function tries to find extendable subparts from largest to smallest ones, starting with the ensemble itself and ending with small subparts
If a list of trajectories is provided it will be attempt to find a valid trajectory using all the trajectory parts.
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - engine (
openpathsampling.dynamicsengine.DynamicsEngine
) – engine to use for MD extension - replica (int) – the replica id for the sample to be created
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- level (str) – there are three levels you chose and not all are implemented for an ensemble. For all ensembles you can use native which will simply try to extend the ensemble itself, the mose simple one, which is always possible. Picking complex will use the largest (most complex) sub-ensemble that makes sense. Like in the case of a Minus move this is the segment ensemble. The other choice is minimal which choses the minimal necessary subtrajectory extending makes sense from. For TIS or Minus Ensembles this will be crossing from the (initial) core to the outside. You should try complex first and then minimal. complex should be much faster.
- on_error (str) – if retry (default) then any error will trigger a retry and eventually no sample will be retured. fail will raise the exception. Typical things to happen are MaxLengthError or NaNError, but also initialisation error can happen. fail should only be used for debugging purposes since you will not get a preliminary sampleset as a result but an exception.
- attempts (int) – the number of attemps on a trajectory to extend
- trajectories ((list of)
-
find_first_subtrajectory
(trajectory)¶ Return the first sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
find_last_subtrajectory
(trajectory)¶ Return the last sub-trajectory that matches the ensemble
Parameters: trajectory ( openpathsampling.trajectory.Trajectory
) – the trajectory in which to look for sub-trajectoriesReturns: the found sub-trajectory or None if no sub-trajectory was found Return type: openpathsampling.Trajectory
or None
-
fix_name
()¶ Set the objects name to be immutable.
Usually called after load and save to fix the stored state.
-
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
-
get_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric')¶ Generate a sample in the ensemble by testing trajectories
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- trajectories ((list of)
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
iter_extendable_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over maxiaml slices of extendable subtrajectories
In comparison to the iter_valid_slices this will return maximal subtrajectories that can potentially be extended into samples of the ensemble. Shorter subparts will also always work. Where we always use strict_can_append. So for forward extentable ensembles you can cut at the end and for backward extendable ones you can cut at the beginning.
Notes
This feature is not yet fully tested and should be used with care!
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
iter_split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return iterator over subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: iterator of
openpathsampling.trajectory.Trajectory
Notes
This uses self.iter_valid_slices and returns the actual sub-trajectories
- trajectory (
-
iter_valid_slices
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False)¶ Return an iterator over slices of subtrajectories matching the ensemble
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0, optional) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0, optional) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0, optional) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectorie can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
Returns: Returns a list of index-slices for sub-trajectories in trajectory that are in the ensemble.
Return type: list of slice
- trajectory (
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
split
(trajectory, max_length=None, min_length=1, overlap=1, reverse=False, n_results=0)¶ Return list of subtrajectories satisfying the given ensemble.
Parameters: - trajectory (
openpathsampling.trajectory.Trajectory
) – the actual trajectory to be splitted into ensemble parts - max_length (int > 0) – if set this determines the maximal size to be tested (is mainly used in the recursion)
- min_length (int > 0) – if set this determines the minimal size to be tested (in lazy mode might no
- overlap (int >= 0) – determines the allowed overlap of all trajectories to be found. A value of x means that two sub-trajectory can share up to x frames at the beginning and x frames at the end. Default is 1
- reverse (bool) – if True this will start searching from the end of the trajectory. Otherwise (default) it will start at the beginning.
- n_results (int) – if 0 this will return all results. If the integer is larger than zero it will stop after the given number of slices has been found
Returns: Returns a list of sub-trajectories in trajectory that are in the ensemble.
Return type: list of
openpathsampling.trajectory.Trajectory
Notes
This uses self.find_valid_slices and returns the actual sub-trajectories
- trajectory (
-
split_sample_from_trajectories
(trajectories, replica=0, used_trajectories=None, reuse_strategy='avoid-symmetric', unique='shortest')¶ Generate a sample in the ensemble by searching for sub-parts
Parameters: - trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – single trajectory of list of trajectories to be used to create a sample in this ensemble - replica (int) – the replica id for the sample to be created
- used_trajectories ((list of)
openpathsampling.trajectory.Trajectory
) – trajectories not taken into account in the first attempt - reuse_strategy (str) – if avoid then in a second attempt the used trajectories are tried
- unique (str) – If first the first found subtrajectory is selected. If shortest then from all subparts the shortest one is used.
- trajectories ((list of)
-
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
-
trajectory_summary
(trajectory)¶ Return dict with info on how this ensemble “sees” the trajectory.
Parameters: trajectory (openpathsampling.Trajectory) –
-
trajectory_summary_str
(trajectory)¶ Returns a string with the results of the trajectory_summary function.
Parameters: trajectory (openpathsampling.Trajectory) –
-
Volume¶
Created on 03.09.2014
@author: Jan-Hendrik Prinz, David W.H. Swenson
-
class
openpathsampling.volume.
CVDefinedVolume
(collectivevariable, lambda_min=0.0, lambda_max=1.0)[source]¶ Volume defined by a range of a collective variable collectivevariable.
Contains all snapshots snap for which lamba_min < collectivevariable(snap) and lambda_max > collectivevariable(snap).
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.volume.
EmptyVolume
[source]¶ Empty volume: no snapshot can satisfy
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.volume.
FullVolume
[source]¶ Volume which all snapshots can satisfy.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.volume.
IntersectionVolume
(volume1, volume2)[source]¶ “And” combination (intersection) of two volumes.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
-
class
openpathsampling.volume.
NegatedVolume
(volume)[source]¶ Negation (logical not) of a volume.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.volume.
PeriodicCVDefinedVolume
(collectivevariable, lambda_min=0.0, lambda_max=1.0, period_min=None, period_max=None)[source]¶ As with CVDefinedVolume, but for a periodic order parameter.
Defines a Volume containing all states where collectivevariable, a periodic function wrapping into the range [period_min, period_max], is in the given range [lambda_min, lambda_max].
-
period_min
¶ float (optional) – minimum of the periodic domain
-
period_max
¶ float (optional) – maximum of the periodic domain
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.volume.
RelativeComplementVolume
(volume1, volume2)[source]¶ “Subtraction” combination (relative complement) of two volumes.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
-
class
openpathsampling.volume.
SymmetricDifferenceVolume
(volume1, volume2)[source]¶ “Xor” combination of two volumes.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
-
class
openpathsampling.volume.
UnionVolume
(volume1, volume2)[source]¶ “Or” combination (union) of two volumes.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
-
class
openpathsampling.volume.
Volume
[source]¶ A Volume describes a set of snapshots
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.volume.
VolumeCombination
(volume1, volume2, fnc, str_fnc)[source]¶ Logical combination of volumes.
This should be treated as an abstract class. For storage purposes, use specific subclasses in practice.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
-
class
openpathsampling.volume.
VoronoiVolume
(collectivevariable, state)[source]¶ Volume given by a Voronoi cell specified by a set of centers
Parameters: - collectivevariable (MultiRMSDCV) – must be an MultiRMSDCV collectivevariable that returns several RMSDs
- state (int) – the index of the center for the chosen voronoi cell
-
collectivevariable
¶ collectivevariable – the collectivevariable object
-
state
¶ int – the index of the center for the chosen voronoi cell
-
__call__
(snapshot, state=None)[source]¶ Returns True if snapshot belongs to voronoi cell in state
Parameters: - snapshot (
opensampling.engines.BaseSnapshot
) – snapshot to be tested - state (int or None) – index of the cell to be tested. If None (Default) then the internal self.state is used
Returns: returns True is snapshot is on the specified voronoi cell
Return type: bool
- snapshot (
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cell
(snapshot)[source]¶ Returns the index of the voronoicell snapshot is in
Parameters: snapshot ( opensampling.engines.BaseSnapshot
) – the snapshot to be testedReturns: index of the voronoi cell Return type: int
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
default_name
¶ Return the default name.
Usually derived from the objects class
Returns: the default name Return type: str
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
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')
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
openpathsampling.volume.
join_volumes
(volume_list)[source]¶ Make the union of a list of volumes. (Useful shortcut.)
Parameters: volume_list (list of openpathsampling.Volume
) – the list to be joined togetherReturns: the union of the elements of the list, or EmptyVolume if list is empty Return type: openpathsampling.UnionVolume
PathMover¶
Created on 19.07.2014
@author: Jan-Hendrik Prinz @author: David W. H. Swenson
-
class
openpathsampling.pathmover.
BackwardExtendMover
(ensemble, target_ensemble, engine=None)[source]¶ A Sample Mover implementing Backward Extension
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
BackwardShootMover
(ensemble, selector, engine=None)[source]¶ A Backward shooting generator
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
ConditionalMover
(if_mover, then_mover, else_mover)[source]¶ An if-then-else structure for PathMovers.
Returns a SequentialMoveChange of the if_move movepath and the then_move movepath (if if_move is accepted) or the else_move movepath (if if_move is rejected).
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
ConditionalSequentialMover
(movers)[source]¶ Performs each move in its movers list until complete or until one is not accepted. If any move in not accepted, all previous samples are updated to have set their acceptance to False.
For example, this would be used to create a minus move, which consists of first a replica exchange and then a shooting (extension) move. If the replica exchange fails, the move is aborted before doing the dynamics.
ConditionalSequentialMover only works if there is a single active sample per replica.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
Details
(**kwargs)[source]¶ Details of an object. Can contain any data
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.pathmover.
EngineMover
(ensemble, target_ensemble, selector, engine=None)[source]¶ Baseclass for Movers that use an engine
Notes
A few comments for developers working with subclasses of
EngineMover
: This class is intended to do most of the grunt work for a wide range of possible engine-based needs. Remember that yourselector
can select first or final points, e.g., to extend a move. In order to help you find your way through theEngineMover
code, here is an overview of what various private methods do:__call__
: Creates the trial. Two steps: (1) make the trajectory; (2) assemble a sample to return_build_sample
: assembles the final sample_make_forward_trajectory
/_make_backward_trajectory
: creates the actual trajectory, usingPrefixTrajectoryEnsemble
orSuffixTrajectoryEnsemble
to ensure reasonable behavior (see below for further discussion)._run
: this is what is called by__call__
, and it in turn calls the functions to make the trajectories (depending on the nature of the mover). Frequently, this is the only thing to override (two-way shooting, shifting).
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
class
openpathsampling.pathmover.
EnsembleFilterMover
(mover, ensembles)[source]¶ Mover that return only samples from specified ensembles
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
FinalSubtrajectorySelectMover
(ensemble, sub_ensemble, n_l=None)[source]¶ Samples the final subtrajectory satifying the given subensemble.
If there are no subtrajectories which satisfy the ensemble, this returns the zero-length trajectory.
-
ensemble
¶ openpathsampling.Ensemble – the set of allows samples to chose from
-
sub_ensemble
¶ openpathsampling.Ensemble – the subensemble to be searched for
-
n_l
¶ int or None – the number of subtrajectories that need to be found. If None every number of subtrajectories > 0 is okay. Otherwise the move is only accepted if exactly n_l subtrajectories are found.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
FirstAllowedMover
(movers)[source]¶ Chooses a first mover that has samples in all required ensembles.
A mover can only safely be run, if all inputs can be satisfied. This will pick the first mover from the list where all ensembles from input_ensembles are found.
-
movers
¶ list of PathMover – the PathMovers to choose from
-
weights
¶ list of floats – the relative weight of each PathMover (does not need to be normalized)
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
FirstSubtrajectorySelectMover
(ensemble, sub_ensemble, n_l=None)[source]¶ Samples the first subtrajectory satifying the given subensemble.
If there are no subtrajectories which satisfy the ensemble, this returns the zero-length trajectory.
-
ensemble
¶ openpathsampling.Ensemble – the set of allows samples to chose from
-
sub_ensemble
¶ openpathsampling.Ensemble – the subensemble to be searched for
-
n_l
¶ int or None – the number of subtrajectories that need to be found. If None every number of subtrajectories > 0 is okay. Otherwise the move is only accepted if exactly n_l subtrajectories are found.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
ForwardExtendMover
(ensemble, target_ensemble, engine=None)[source]¶ A Sample Mover implementing Forward Extension
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
ForwardShootMover
(ensemble, selector, engine=None)[source]¶ A forward shooting sample generator
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
IdentityPathMover
(counts_as_trial=False)[source]¶ The simplest Mover that does nothing !
Notes
Since is does nothing it is considered rejected everytime! It can be used to test function of PathMover
Parameters: counts_as_trial (bool) – Whether this mover should count as a trial or not. If True, the EmptyMoveChange returned includes this mover, which means it gets counted as a trial in analysis of acceptance. If False (default), the mover for the returned move change is None, which does not get counted as a trial. -
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
submovers
¶ Returns a list of submovers
Returns: the list of sub-movers Return type: list of openpathsampling.PathMover
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
LastAllowedMover
(movers)[source]¶ Chooses the last mover that has samples in all required ensembles.
A mover can only safely be run, if all inputs can be satisfied. This will pick the last mover from the list where all ensembles from input_ensembles are found.
-
movers
¶ list of PathMover – the PathMovers to choose from
-
weights
¶ list of floats – the relative weight of each PathMover (does not need to be normalized)
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
MinusMover
(minus_ensemble, innermost_ensembles, engine=None)[source]¶ Instance of a MinusMover.
The minus move combines a replica exchange with path extension to swap paths between the innermost regular TIS interface ensemble and the minus interface ensemble. This is particularly useful for improving sampling of path space.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
MoveDetails
(**kwargs)[source]¶ Details of the move as applied to a given replica
Specific move types may have add several other attributes for each MoveDetails object. For example, shooting moves will also include information about the shooting point selection, etc.
TODO (or at least to put somewhere): rejection_reason : String
explanation of reasons the path was rejected-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.pathmover.
OneWayExtendMover
(ensemble, target_ensemble, engine=None)[source]¶ OneWayShootingMover is a special case of a RandomChoiceMover which gives a 50/50 chance of selecting either a ForwardExtendMover or a BackwardExtendMover. Both submovers use the same same ensembles and replicas.
-
ensemble
¶ openpathsampling.Ensemble
– valid ensemble
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
OneWayShootingMover
(ensemble, selector, engine=None)[source]¶ OneWayShootingMover is a special case of a RandomChoiceMover which combines gives a 50/50 chance of selecting either a ForwardShootMover or a BackwardShootMover. Both submovers use the same shooting point selector, and both apply to the same ensembles and replicas.
-
selector
¶ openpathsampling.ShootingPointSelector
– The shooting point selection scheme
-
ensemble
¶ openpathsampling.Ensemble
– Ensemble for this shooting mover
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
PartialAcceptanceSequentialMover
(movers)[source]¶ Performs each move in its movers list until complete or until one is not accepted. If any move is not accepted, further moves are not attempted, but the previous accepted samples remain accepted.
For example, this would be used to create a bootstrap promotion move, which starts with a shooting move, followed by an EnsembleHop/Replica promotion ConditionalSequentialMover. Even if the EnsembleHop fails, the accepted shooting move should be accepted.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
PathMover
[source]¶ A PathMover is the description of a move in replica space.
Notes
A pathmover takes a SampleSet() and returns MoveChange() that is used to change the old SampleSet() to the new one.
SampleSet1 + MoveChange1 => SampleSet2
A MoveChange is effectively a list of Samples. The change acts upon a SampleSet by replacing existing Samples in the same ensemble sequentially.
- SampleSet({samp1(ens1), samp2(ens2), samp3(ens3)}) +
- MoveChange([samp4(ens2)]) => SampleSet({samp1(ens1), samp4(ens2), samp3(ens3)})
Note, that a SampleSet is an unordered list (or a set). Hence the ordering in the example is arbitrary.
Potential future change: engine is not needed for all PathMovers (replica exchange, ensemble hopping, path reversal, and moves which combine these [state swap] have no need for the engine). Maybe that should be moved into only the ensembles that need it? ~~~DWHS
Also, I agree with the separating trial and acceptance. We might choose to use a different acceptance criterion than Metropolis. For example, the “waste recycling” approach recently re-discovered by Frenkel (see also work by Athenes, Jourdain, and old work by Kalos) might be interesting. I think the best way to do this is to keep the acceptance in the PathMover, but have it be a separate class ~~~DWHS
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
static
legal_sample_set
(sample_set, ensembles=None, replicas='all')[source]¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
move
(sample_set)[source]¶ Run the generation starting with the initial sample_set specified.
Parameters: sample_set (SampleSet) – the initially used sampleset Returns: samples – the MoveChange instance describing the change from the old to the new SampleSet Return type: MoveChange
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
static
select_sample
(sample_set, ensembles=None, replicas=None)[source]¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)[source]¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
submovers
¶ Returns a list of submovers
Returns: the list of sub-movers Return type: list of openpathsampling.PathMover
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
class
openpathsampling.pathmover.
PathSimulatorMover
(mover, pathsimulator)[source]¶ This just wraps a mover and references the used pathsimulator
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
RandomAllowedChoiceMover
(movers, weights=None)[source]¶ Chooses a random mover from its movers which have existing samples.
This is different from random choice moves in that this mover only picks from sub movers that actually can succeed because they have samples in all required input_ensembles
-
movers
¶ list of PathMover – the PathMovers to choose from
-
weights
¶ list of floats – the relative weight of each PathMover (does not need to be normalized)
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
RandomChoiceMover
(movers, weights=None)[source]¶ Chooses a random mover from its movers list, and runs that move. Returns the number of samples the submove return.
For example, this would be used to select a specific replica exchange such that each replica exchange is its own move, and which swap is selected at random.
-
movers
¶ list of PathMover – the PathMovers to choose from
-
weights
¶ list of floats – the relative weight of each PathMover (does not need to be normalized)
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
RandomSubtrajectorySelectMover
(ensemble, sub_ensemble, n_l=None)[source]¶ Samples a random subtrajectory satisfying the given subensemble.
If there are no subtrajectories which satisfy the subensemble, this returns the zero-length trajectory.
-
ensemble
¶ openpathsampling.Ensemble – the set of allows samples to chose from
-
sub_ensemble
¶ openpathsampling.Ensemble – the subensemble to be searched for
-
n_l
¶ int or None – the number of subtrajectories that need to be found. If None every number of subtrajectories > 0 is okay. Otherwise the move is only accepted if exactly n_l subtrajectories are found.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
ReplicaExchangeMover
(ensemble1, ensemble2, bias=None)[source]¶ A Sample Mover implementing a standard Replica Exchange
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
SampleDetails
(**kwargs)[source]¶ Details of a sample
Note
Deprecated in OpenPathSampling 0.9.3 SampleDetails will be removed in OPS 2.0.0
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
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
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
class
openpathsampling.pathmover.
SelectionMover
(movers)[source]¶ A general mover that selects a single mover from a set of possibilities
This is a basic class for all sorts of selectors, like RandomChoice, RandomAllowedChoice. The way it works is to generate a list of weights and pick a random one using the weights. This is as general as possible and is chosen because it also allows to store the possibilities in a general way for better comparison
-
movers
¶ list of openpathsampling.PathMover – the PathMovers to choose from
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
SequentialMover
(movers)[source]¶ Performs each of the moves in its movers list. Returns all samples generated, in the order of the mover list.
For example, this would be used to create a move that does a sequence of replica exchanges in a given order, regardless of whether the moves succeed or fail.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
SingleReplicaMinusMover
(minus_ensemble, innermost_ensembles, bias=None, engine=None)[source]¶ Minus mover for single replica TIS.
In SRTIS, the minus mover doesn’t actually keep an active sample in the minus interface. Instead, it just puts the newly generated segment into the innermost ensemble.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
SubPathMover
(mover)[source]¶ Mover that delegates to a single submover
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
class
openpathsampling.pathmover.
SubtrajectorySelectMover
(ensemble, sub_ensemble, n_l=None)[source]¶ Picks a subtrajectory satisfying the given subensemble.
If there are no subtrajectories which satisfy the subensemble, this returns the zero-length trajectory.
-
ensemble
¶ openpathsampling.Ensemble – the set of allows samples to chose from
-
sub_ensemble
¶ openpathsampling.Ensemble – the subensemble to be searched for
-
n_l
¶ int or None – the number of subtrajectories that need to be found. If None every number of subtrajectories > 0 is okay. Otherwise the move is only accepted if exactly n_l subtrajectories are found.
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
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
-
depth_post_order
(fnc, level=0, **kwargs)¶ Traverse the tree in post-order applying a function with depth
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- level (int) – the initial level
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, func(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
depth_pre_order
(fnc, level=0, only_canonical=False, **kwargs)¶ Traverse the tree of node in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- level (int) – the initial level
- only_canonical (bool, default: False) – if True the recursion stops at canonical movers and will hence be more compact
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of tuples of results of the map. First part of the tuple is the level, second part is the function result.
Return type: list of tuple(level, fnc(node, **kwargs))
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
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.
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
in_out
¶ List the input -> output relation for ensembles
A mover will pick one or more replicas from specific ensembles. Alter them (or not) and place these (or additional ones) in specific ensembles. This relation can be visualized as a mapping of input to output ensembles. Like
ReplicaExchange ens1 -> ens2 ens2 -> ens1
EnsembleHop (A sample in ens1 will disappear and appear in ens2) ens1 -> ens2
DuplicateMover (create a copy with a new replica number) Not used yet! ens1 -> ens1 None -> ens1
Returns: - list of list of tuple ((
openpathsampling.Ensemble
,) openpathsampling.Ensemble
) – a list of possible lists of tuples of ensembles.
Notes
The default implementation will (1) in case of a single input and output connect the two, (2) return nothing if there are no out_ensembles and (3) for more then two require implementation
- list of list of tuple ((
-
input_ensembles
¶ Return a list of possible used ensembles for this mover
This list contains all Ensembles from which this mover might pick samples. This is very useful to determine on which ensembles a mover acts for analysis and sanity checking.
Returns: the list of input ensembles Return type: list of openpathsampling.Ensemble
-
is_named
¶ True if this object has a custom name.
This distinguishes default algorithmic names from assigned names.
-
keylist
()¶ Return a list of key : subtree tuples
Returns: A list of all subtrees with their respective keys Return type: list of tuple(key, subtree)
-
legal_sample_set
(sample_set, ensembles=None, replicas='all')¶ This returns all the samples from sample_set which are in both self.replicas and the parameter ensembles. If ensembles is None, we use self.ensembles. If you want all ensembles allowed, pass ensembles=’all’.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles) – the ensembles to pick from
- replicas (list of int or all) – the replicas to pick or ‘all’ for all
-
map_post_order
(fnc, **kwargs)¶ Traverse the tree in post-order applying a function
This traverses the underlying tree and applies the given function at each node returning a list of the results. Post-order means that subnodes are called BEFORE the node itself is evaluated.
Parameters: - fnc (function(node, kwargs)) – the function run at each node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as reversed()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_pre_order
(fnc, **kwargs)¶ Traverse the tree in pre-order applying a function
This traverses the underlying tree applies the given function at each node returning a list of the results. Pre-order means that subnodes are called AFTER the node itself is evaluated.
Parameters: - fnc (function(node, **kwargs)) – the function run at each node. It is given the node and the optional parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: flattened list of the results of the map
Return type: list (fnc(node, **kwargs))
Notes
This uses the same order as iter()
See also
map_pre_order()
,map_post_order()
,level_pre_order()
,level_post_order()
-
map_tree
(fnc)¶ Apply a function to each node and return a nested tree of results
Parameters: - fnc (function(node, args, kwargs)) – the function run at each node node. It is given the node and the optional (fixed) parameters
- kwargs (named arguments) – optional arguments added to the function
Returns: nested list of the results of the map
Return type: tree (fnc(node, **kwargs))
-
metropolis
(trials)¶ Implements the Metropolis acceptance for a list of trial samples
The Metropolis uses the .bias for each sample and checks of samples are valid - are in the proposed ensemble. This will give an acceptance probability for all samples. If the product is smaller than a random number the change will be accepted.
Parameters: trials (list of openpathsampling.Sample) – the list of all samples to be applied in a change. Returns: - bool – True if the trial is accepted, False otherwise
- details (openpathsampling.MoveDetails) – Returns a MoveDetails object that contains information about the decision, i.e. total acceptance and random number
-
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')
-
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
-
output_ensembles
¶ Return a list of possible returned ensembles for this mover
This list contains all Ensembles for which this mover might return samples. This is very useful to determine on which ensembles a mover affects in later steps for analysis and sanity checking.
Returns: the list of output ensembles Return type: list of Ensemble
-
select_sample
(sample_set, ensembles=None, replicas=None)¶ Returns one of the legal samples given self.replica and the ensemble set in ensembles.
Parameters: - sample_set (openpathsampling.SampleSet) – the sampleset from which to pick specific samples matching certain criteria
- ensembles (list of openpathsampling.Ensembles or None) – the ensembles to pick from or None for all
- replicas (list of int or None) – the replicas to pick or None for all
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
sub_replica_state
(replica_states)¶ Return set of replica states that a submover might be called with
Parameters: replica_states (set of openpathsampling.pathmover_inout.ReplicaState) – Returns: Return type: list of set of ReplicaState
-
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
-
tree
()¶ Return the object as a tree structure of nested lists of nodes
Returns: the tree in nested list format Return type: nested list of nodes
-
-
openpathsampling.pathmover.
make_list_of_pairs
(l)[source]¶ Converts input from several possible formats into a list of pairs: used to clean input for swap-like moves.
Allowed input formats: * flat list of length 2N * list of pairs * None (returns None)
Anything else will lead to a ValueError or AssertionError
Parameters: l (list) – input list, either flat list of length 2N, a list of pairs or None Returns: Return type: list of pairs
Storage¶
Snapshot¶
@author: JD Chodera @author: JH Prinz
-
class
openpathsampling.engines.snapshot.
BaseSnapshot
(topology=None)[source]¶ Simulation snapshot. Contains references to a configuration and momentum
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__neg__
()[source]¶ Access the reversed snapshot using -
Returns: the reversed copy Return type: BaseSnapshot
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
copy
()[source]¶ Returns a shallow copy of the instance itself. The contained configuration and momenta are not copied.
Returns: the shallow copy Return type: openpathsampling.BaseSnapshot
Notes
Shallow here means that content will not be copied but only referenced. Hence if you store the shallow copy it will be stored under a different idx, but the content (e.g. Configuration object) will not.
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
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
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
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
-
reversed
¶ Get the reversed copy.
Returns: openpathsampling.snapshots.AbstractSnapshot
– the reversed partner of the current snapshot- Snapshots exist in pairs and this returns the reversed counter part.
- The actual implementation takes care the the reversed version have
- reversed momenta, etc. Usually these will not be stored separately but
- flipped when requested.
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
-
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
-
-
openpathsampling.engines.snapshot.
SnapshotFactory
(name, features, description=None, use_lazy_reversed=False, base_class=None)[source]¶ Helper to create a new Snapshot class
Parameters: - name (str) – name of the Snapshot class
- features (list of
openpathsampling.features
) – the features used to build the snapshot - description (str) – the string to be used as basis for the docstring of the new class it will be merged with the docs for the features
- use_lazy_reversed (bool) – still in there for legacy reasons. It will make the .reversed attribute into a descriptor than can treat LoaderProxy objects. This feature is not relly used anymore and can in the best case only save little memory with slowing down construction, etc. Using False is faster
- base_class (
openpathsampling.BaseSnapshot
) – The base class the Snapshot is derived from. Default is the BaseSnapshot class.
Returns: the created Snapshot class
Return type: openpathsampling.Snapshot
Trajectory¶
@author: JD Chodera @author: JH Prinz
-
class
openpathsampling.engines.trajectory.
Trajectory
(trajectory=None)[source]¶ Simulation trajectory. Essentially a python list of snapshots
-
__contains__
¶ x.__contains__(y) <==> y in x
-
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__delitem__
¶ x.__delitem__(y) <==> del x[y]
-
__delslice__
¶ x.__delslice__(i, j) <==> del x[i – j]
Use of negative indices is not supported.
-
__eq__
¶ x.__eq__(y) <==> x==y
-
__format__
()¶ default object formatter
-
__ge__
¶ x.__ge__(y) <==> x>=y
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__gt__
¶ x.__gt__(y) <==> x>y
-
__iadd__
¶ x.__iadd__(y) <==> x+=y
-
__imul__
¶ x.__imul__(y) <==> x*=y
-
__iter__
()[source]¶ Return an iterator over all snapshots in the storage
This will always give real
openpathsampling.snapshot.Snapshot
objects and never proxies to snapshots. If you prefer proxies (if available) use .items()Returns: The iterator that iterates the objects in the store Return type: Iterator()
-
__le__
¶ x.__le__(y) <==> x<=y
-
__len__
¶
-
__lt__
¶ x.__lt__(y) <==> x<y
-
__mul__
¶ x.__mul__(n) <==> x*n
-
__ne__
¶ x.__ne__(y) <==> x!=y
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__rmul__
¶ x.__rmul__(n) <==> n*x
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__setitem__
¶ x.__setitem__(i, y) <==> x[i]=y
-
__setslice__
¶ x.__setslice__(i, j, y) <==> x[i – j]=y
Use of negative indices is not supported.
-
__sizeof__
()¶ L.__sizeof__() – size of L in memory, in bytes
-
append
()¶ L.append(object) – append object to end
-
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
-
as_proxies
()[source]¶ Returns all contains all actual elements
This will also return lazy proxy objects and not the references ones as does __iter__, __reversed__ or __getitme__. Useful for faster access to the elements
Returns: Return type: list of Snapshot
oropenpathsampling.netcdfplus.LoaderProxy
-
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
-
base_cls_name
¶ Return the name of the base class
Returns: the string representation of the base class Return type: str
-
cls
¶ Return the class name as a string
Returns: the class name Return type: str
-
contains_symmetric
(item)[source]¶ Test whether a snapshot or its reversed is in a trajectory
Returns: Return type: bool
-
count
(value) → integer -- return number of occurrences of value¶
-
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
-
descendants
()¶ Return a list of all subclassed objects
Returns: list of subclasses of a storable object Return type: list of type
-
get_as_proxy
(item)[source]¶ Get an actual contained element
This will also return lazy proxy objects and not the referenced ones as does __iter__, __reversed__ or __getitem__. Useful for faster access to the elements
This is equal to use list.__getitem__(trajectory, item)
Returns: Return type: Snapshot
oropenpathsampling.netcdfplus.proxy.LoaderProxy
-
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 indexReturns: the integer index for the object of it exists or None else Return type: int or None
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
insert
()¶ L.insert(index, object) – insert object before index
Checks if two trajectories share a common snapshot
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to check for common snapshotsReturns: returns True if at least one snapshot appears in both trajectories Return type: bool
-
iter_proxies
()[source]¶ Returns an iterator over all actual elements
This will also return lazy proxy objects and not the references ones as does __iter__, __reversed__ or __getitme__. Useful for faster access to the elements
Returns: - Iterator() over list of
openpathsampling.snapshot.Snapshot
- or
openpathsampling.netcdfplus.proxy.LoaderProxy
- Iterator() over list of
-
map
(fnc, allow_fast=True)[source]¶ This runs a function and tries to be fast.
Fast here means that functions that are purely based on CVs can be evaluated without actually loading the real Snapshot object. This functions tries to do that and if it fails it does it the usual way and creates the snapshot object. This bears the possibility that the function uses the fake snapshots and returns a non-sense value. It is up to the user to make sure this will not happen.
-
n_snapshots
¶ Return the number of frames in the trajectory.
Returns: Return type: length (int) - the number of frames in the trajectory Notes
Might be removed in later versions for len(trajectory) is more pythonic
See also
len
-
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
-
pop
([index]) → item -- remove and return item at index (default last).¶ Raises IndexError if list is empty or index is out of range.
-
remove
()¶ L.remove(value) – remove first occurrence of value. Raises ValueError if the value is not present.
-
reverse
()¶ L.reverse() – reverse IN PLACE
-
reversed
¶ Returns a reversed (shallow) copy of the trajectory itself. Effectively creates a new Trajectory object and then fills it with shallow reversed copies of the contained snapshots.
Returns: the reversed trajectory Return type: openpathsampling.trajectory.Trajectory
-
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 objectsParameters: active (bool) – if True then observing is enabled. False disables observing. Per default observing is disabled.
Returns a set of shared snapshots
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to useReturns: the set of common snapshots Return type: set of openpathsampling.snapshot.Snapshot
Returns a subtrajectory which only contains frames present in other
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to useReturns: the shared subtrajectory Return type: openpathsampling.trajectory.Trajectory
-
sort
()¶ L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1
-
subtrajectory_indices
(subtrajectories)[source]¶ Returns a list of lists of indices for frames from subtrajectories.
Parameters: subtrajectories (list of Trajectory
) – input list of subtrajectoriesReturns: the indices within this trajectory of the frames in each subtrajectory Return type: list of list of int
-
summarize_by_volumes
(label_dict)[source]¶ Summarize trajectory based on number of continuous frames in volumes.
This uses a dictionary of disjoint volumes: the volumes must be disjoint so that every frame can be mapped to one volume. If the frame maps to none of the given volumes, it returns the label None.
Parameters: label_dict (dict) – dictionary with labels for keys and volumes for values Returns: format is (label, number_of_frames) Return type: list of tuple
-
summarize_by_volumes_str
(label_dict, delimiter='-')[source]¶ Return string version of the volumes visited by this trajectory.
See Trajectory.summarize_by_volumes for details.
Parameters: - label_dict (dict) – dictionary with labels for keys and volumes for values
- delimiter (string (default "-")) – string used to separate volumes in output
Returns: order in which this trajectory visits the volumes in label_dict, separated by the delimiter
Return type: string
-
to_mdtraj
(topology=None)[source]¶ Construct a mdtraj.Trajectory object from the Trajectory itself
Parameters: topology ( mdtraj.Topology
) – If not None this topology will be used to construct the mdtraj objects otherwise the topology object will be taken from the configurations in the trajectory snapshots.Returns: the trajectory Return type: mdtraj.Trajectory
-
topology
¶ Return a Topology object representing the topology of the current view of the trajectory
Returns: the topology object Return type: openpathsampling.topology.Topology
-
unique_subtrajectory
(other)[source]¶ Returns a subtrajectory which contains frames not present in other
Parameters: other ( openpathsampling.trajectory.Trajectory
) – the second trajectory to useReturns: the unique frames subtrajectory (opposite of shared) Return type: openpathsampling.trajectory.Trajectory
-