Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
the final frame (`padding=[0, -1]`) so that it doesn't include
the frame in `to_vol`.
Returns
-------
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]
Returns
-------
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]
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)
])
try:
innermost_vols = list(innermost_vols)
except TypeError:
innermost_vols = [innermost_vols]
if forbidden is None:
forbidden = [paths.EmptyVolume()]
else:
try:
forbidden = list(forbidden)
except TypeError:
forbidden = [forbidden]
self.forbidden = forbidden
forbidden_volume = paths.join_volumes(forbidden)
forbidden_ensemble = paths.AllOutXEnsemble(forbidden_volume)
self.innermost_vols = innermost_vols
self.innermost_vol = paths.FullVolume()
for vol in self.innermost_vols:
self.innermost_vol = self.innermost_vol & vol
self.greedy = greedy
in_A = AllInXEnsemble(state_vol)
out_A = AllOutXEnsemble(state_vol)
in_X = AllInXEnsemble(self.innermost_vol)
leave_X = PartOutXEnsemble(self.innermost_vol)
# interstitial = out_A & in_X
interstitial = self.innermost_vol - state_vol
in_interstitial = AllInXEnsemble(interstitial)
segment_ensembles = [paths.TISEnsemble(state_vol, state_vol, inner)
for inner in self.innermost_vols]
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()