One-Way Shooting Converters

class ops_piggybacker.TPSConverterOptions[source]
Parameters:
  • trim (bool) – whether to trim the file trajectories to minimum acceptable length (default True)
  • retrim_shooting (bool) – whether the shooting point index given is based on an untrimmed trajectory, and therefore needs to be shifted (default False).
  • auto_reverse (bool) – whether to reverse backward trajectories (if the file version is forward, instead of backward, default False)
  • includes_shooting_point (bool) – whether the one-way trial trajectory includes the shooting point, and therefore must have it trimmed off (default True)
  • full_trajectory (bool) – whether the input trajectories are the full trajectories, instead of the partial one-way trajectories (default False). Note that if you use full_trajectory=True, you should also use auto_reverse=False.
__add__

x.__add__(y) <==> x+y

__contains__

x.__contains__(y) <==> y in x

__delattr__

x.__delattr__(‘name’) <==> del x.name

__eq__

x.__eq__(y) <==> x==y

__format__()

default object formatter

__ge__

x.__ge__(y) <==> x>=y

__getattribute__

x.__getattribute__(‘name’) <==> x.name

__getitem__

x.__getitem__(y) <==> x[y]

__getslice__

x.__getslice__(i, j) <==> x[i:j]

Use of negative indices is not supported.

__gt__

x.__gt__(y) <==> x>y

__hash__
__iter__
__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

__sizeof__() → int

size of object in memory, in bytes

__str__
auto_reverse

Alias for field number 2

count(value) → integer -- return number of occurrences of value
full_trajectory

Alias for field number 4

includes_shooting_point

Alias for field number 3

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

retrim_shooting

Alias for field number 1

trim

Alias for field number 0

class ops_piggybacker.OneWayTPSConverter(storage, initial_file, mover, network, options=None, options_rejected=None)[source]

Bases: ops_piggybacker.simulation_stubs.ShootingPseudoSimulator

Single-ensemble network shooting pseudo-simulator from external trajectories.

This object handles a wide variety of external simulators. The idea is that the user must create a “simulation summary” file, which contains the information we need to perform the pseudo-simulation, where the trajectories are loaded via mdtraj.

__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__
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

Return the base class

Returns:the base class
Return type:type

See also

base()

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.objects.ObjectStore) – the store in which to ask for the index
Returns:the integer index for the object of it exists or None else
Return type:int or None
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
parse_summary_line(line)[source]

Parse a line from the summary file.

To control the parsing, set the OneWayTPSConverter.options (see TPSConverterOptions).

Parameters:line (str) – the input line
Returns:
  • replica (0) – always zero for now
  • trial_trajectory (openpathsampling.Trajectory) – one-way trial segments
  • shooting_point_index (int) – index of the shooting point based on the previous trajectory (None if no previous trajectory)
  • accepted (bool) – whether the trial was accepted
  • direction (1 or -1) – positive if forward shooting, negative if backward
save(store)

Save the object in the given store (or storage)

Parameters:store (openpathsampling.netcdfplus.ObjectStore or openpathsampling.netcdfplus.netcdfplus.NetCDFPlus) – the store or storage to be saved in. if a storage is given then the default store for the given object base type is determined and the appropriate store is used.
Returns:the integer index used to save the object or None if the object has already been saved.
Return type:int or None
save_initial_step()

Save the initial state as an MCStep to the storage

set_observer(active)

(De-)Activate observing creation of storable objects

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

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

See also

openpathsampling.netcdfplus.base.StorableObject.count_weaks()

sync_storage()

Will sync all collective variables and the storage to disk

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 ops_piggybacker.GromacsOneWayTPSConverter(storage, network, initial_file, topology_file, options=None, options_rejected=None)[source]

Bases: ops_piggybacker.one_way_tps_converters.OneWayTPSConverter

__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__
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

Return the base class

Returns:the base class
Return type:type

See also

base()

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.objects.ObjectStore) – the store in which to ask for the index
Returns:the integer index for the object of it exists or None else
Return type:int or None
is_named

True if this object has a custom name.

This distinguishes default algorithmic names from assigned names.

load_trajectory(file_name)[source]

Creates an OPS trajectory from the given file

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
parse_summary_line(line)

Parse a line from the summary file.

To control the parsing, set the OneWayTPSConverter.options (see TPSConverterOptions).

Parameters:line (str) – the input line
Returns:
  • replica (0) – always zero for now
  • trial_trajectory (openpathsampling.Trajectory) – one-way trial segments
  • shooting_point_index (int) – index of the shooting point based on the previous trajectory (None if no previous trajectory)
  • accepted (bool) – whether the trial was accepted
  • direction (1 or -1) – positive if forward shooting, negative if backward
save(store)

Save the object in the given store (or storage)

Parameters:store (openpathsampling.netcdfplus.ObjectStore or openpathsampling.netcdfplus.netcdfplus.NetCDFPlus) – the store or storage to be saved in. if a storage is given then the default store for the given object base type is determined and the appropriate store is used.
Returns:the integer index used to save the object or None if the object has already been saved.
Return type:int or None
save_initial_step()

Save the initial state as an MCStep to the storage

set_observer(active)

(De-)Activate observing creation of storable objects

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

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

See also

openpathsampling.netcdfplus.base.StorableObject.count_weaks()

sync_storage()

Will sync all collective variables and the storage to disk

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