Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
-------
list of :class:`.Trajectory`
the frames from (and including) each first entry from `to_vol`
into `from_vol` until (and including) the next entry into
`to_vol`, with no frames in `forbidden`, and with frames removed
from the ends according to `padding`
"""
if forbidden is None:
forbidden = paths.EmptyVolume()
ensemble_BAB = paths.SequentialEnsemble([
paths.LengthEnsemble(1) & paths.AllInXEnsemble(to_vol),
paths.AllOutXEnsemble(to_vol) & paths.PartInXEnsemble(from_vol),
paths.LengthEnsemble(1) & paths.AllInXEnsemble(to_vol)
]) & paths.AllOutXEnsemble(forbidden)
ensemble_AB = paths.SequentialEnsemble([
paths.LengthEnsemble(1) & paths.AllInXEnsemble(from_vol),
paths.OptionalEnsemble(paths.AllOutXEnsemble(to_vol)),
paths.LengthEnsemble(1) & paths.AllInXEnsemble(to_vol)
])
BAB_split = ensemble_BAB.split(trajectory)
AB_split = [ensemble_AB.split(part)[0] for part in BAB_split]
return [subtraj[padding[0]:padding[1]] for subtraj in AB_split]
trajectory : :class:`.Trajectory`
trajectory to analyze
stateA : :class:`.Volume`
initial state volume for the transition
stateB : :class:`.Volume`
final state volume for the transition
Returns
-------
:class:`.TrajectorySegmentContainer`
transitions from `stateA` to `stateB` within `trajectory`
"""
# we define the transitions ensemble just in case the transition is,
# e.g., fixed path length TPS. We want flexible path length ensemble
transition_ensemble = paths.SequentialEnsemble([
paths.AllInXEnsemble(stateA) & paths.LengthEnsemble(1),
paths.OptionalEnsemble( # optional to allow instantaneous hops
paths.AllOutXEnsemble(stateA) & paths.AllOutXEnsemble(stateB)
),
paths.AllInXEnsemble(stateB) & paths.LengthEnsemble(1)
])
segments = [seg[1:-1] for seg in transition_ensemble.split(trajectory)]
return TrajectorySegmentContainer(segments, self.dt)
stateB : :class:`.Volume`
final state volume for the transition
Returns
-------
:class:`.TrajectorySegmentContainer`
transitions from `stateA` to `stateB` within `trajectory`
"""
# we define the transitions ensemble just in case the transition is,
# e.g., fixed path length TPS. We want flexible path length ensemble
transition_ensemble = paths.SequentialEnsemble([
paths.AllInXEnsemble(stateA) & paths.LengthEnsemble(1),
paths.OptionalEnsemble( # optional to allow instantaneous hops
paths.AllOutXEnsemble(stateA) & paths.AllOutXEnsemble(stateB)
),
paths.AllInXEnsemble(stateB) & paths.LengthEnsemble(1)
])
segments = [seg[1:-1] for seg in transition_ensemble.split(trajectory)]
return TrajectorySegmentContainer(segments, self.dt)
def _tps_ensemble(self, stateA, stateB):
return paths.SequentialEnsemble([
paths.AllInXEnsemble(stateA) & paths.LengthEnsemble(1),
paths.AllOutXEnsemble(stateA | stateB),
paths.AllInXEnsemble(stateB) & paths.LengthEnsemble(1)
])
def __init__(self, states, progress='default', timestep=None):
self.states = states
self.all_states = paths.join_volumes(states)
all_states_ens = paths.join_ensembles([paths.AllOutXEnsemble(s)
for s in states])
ensemble = paths.SequentialEnsemble([
all_states_ens,
paths.AllInXEnsemble(self.all_states) & paths.LengthEnsemble(1)
])
super(VisitAllStatesEnsemble, self).__init__(ensemble)
self.timestep = timestep
self.report_frequency = 10
self.progress_formatter, self.progress_emitter = \
self._progress_indicator(progress)
self.cache = EnsembleCache(direction=+1)
self._reset_cache_contents()