wepy.runners.runner module¶
Abstract Base classes implementing the Runner interface.
Runner Interface¶
All a runner needs to implement is the ‘run_segment’ method which should accept a walker and a spec for the length of the segment to run (e.g. number of dynamics steps).
Additionally, any number of optional key word arguments should be given.
As a matter of convention, classes accessory to a runner (such as State, Walker, Worker, etc.) should also be put in the same module as the runner.
See the openmm.py module for an example.
- class wepy.runners.runner.Runner[source]¶
Bases:
object
Abstract base class for the Runner interface.
- pre_cycle(**kwargs)[source]¶
Perform pre-cycle behavior. run_segment will be called for each walker so this allows you to perform changes of state on a per-cycle basis.
- Parameters:
kwargs (key-word arguments) – Key-value pairs to be interpreted by each runner implementation.
- post_cycle(**kwargs)[source]¶
Perform post-cycle behavior. run_segment will be called for each walker so this allows you to perform changes of state on a per-cycle basis.
- Parameters:
kwargs (key-word arguments) – Key-value pairs to be interpreted by each runner implementation.
- class wepy.runners.runner.NoRunner[source]¶
Bases:
Runner
Stub Runner that just returns the walkers back with the same state.
May be useful for testing.
- run_segment(walker, segment_length, **kwargs)[source]¶
Run dynamics for the walker.
- Parameters:
- Returns:
new_walker – Walker after dynamics was run, only the state should be modified.
- Return type:
object implementing the Walker interface
- post_cycle(**kwargs)¶
Perform post-cycle behavior. run_segment will be called for each walker so this allows you to perform changes of state on a per-cycle basis.
- Parameters:
kwargs (key-word arguments) – Key-value pairs to be interpreted by each runner implementation.
- pre_cycle(**kwargs)¶
Perform pre-cycle behavior. run_segment will be called for each walker so this allows you to perform changes of state on a per-cycle basis.
- Parameters:
kwargs (key-word arguments) – Key-value pairs to be interpreted by each runner implementation.