Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
71044ec
update
jhprinz Aug 13, 2016
c85fc53
fix
jhprinz Aug 13, 2016
c4c8724
fix
jhprinz Aug 13, 2016
67534f1
add tests
jhprinz Aug 14, 2016
044aa82
Merge branch 'ala' into enginefail
jhprinz Aug 19, 2016
88cd009
Merge branch 'ala' into enginefail
jhprinz Aug 19, 2016
ee8590f
update
jhprinz Aug 19, 2016
5e0f6e6
add tests
jhprinz Aug 19, 2016
6051a80
udpate
jhprinz Aug 19, 2016
c499aa5
more tests
jhprinz Aug 19, 2016
a0bf940
added correct errors
jhprinz Aug 19, 2016
f81394d
fix
jhprinz Aug 19, 2016
3895254
updates
jhprinz Aug 19, 2016
6e830cf
Merge branch 'ala' into enginefail
jhprinz Aug 19, 2016
d2cdd58
little updates
jhprinz Aug 20, 2016
50aed24
Merge branch 'ala' into enginefail
jhprinz Aug 21, 2016
61411d8
fix a special case in a test
jhprinz Aug 21, 2016
d8d696f
Merge branch 'master' of github.com:choderalab/openpathsampling into …
jhprinz Aug 22, 2016
3daf330
add tests
jhprinz Aug 23, 2016
207546d
fix test using nan template
jhprinz Aug 23, 2016
150f464
update test
jhprinz Aug 23, 2016
3acb843
fix default options
jhprinz Aug 23, 2016
0f81a6e
fix test
jhprinz Aug 23, 2016
f8061b5
fixes
jhprinz Aug 23, 2016
8bf1568
cleanup
jhprinz Aug 23, 2016
f7113aa
add example notebook
jhprinz Aug 23, 2016
5643ecf
little cleanup
jhprinz Aug 23, 2016
9810676
little cleanup
jhprinz Aug 23, 2016
c2eff38
little fix in generate
jhprinz Aug 23, 2016
25cfb40
docstring
jhprinz Aug 23, 2016
454749e
from default `stop` to `fail`
jhprinz Aug 23, 2016
f275912
revert notebook
jhprinz Aug 23, 2016
873a892
revert
jhprinz Aug 23, 2016
76009a1
revert
jhprinz Aug 23, 2016
003758a
revert
jhprinz Aug 23, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests
  • Loading branch information
jhprinz committed Aug 19, 2016
commit 5e0f6e6d7287df67d58a3e8cffef70b3d70cf959
11 changes: 11 additions & 0 deletions openpathsampling/engines/dynamics_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def iter_generate(self, initial, running=None, direction=+1,
valid = False
attempt_nan = 0
attempt_error = 0
attempt_max_length = 0
trajectory = initial

final_error = None
Expand Down Expand Up @@ -528,13 +529,23 @@ def iter_generate(self, initial, running=None, direction=+1,
'Hit maximal length of %d frames.' %
self.options['n_frames_max']
)
break
elif on == 'ignore':
# keep on going
pass
elif on == 'stop':
logger.info('Trajectory hit max length. Stopping.')
# fail gracefully
stop = True
elif on == 'retry':
attempt_max_length += 1
if attempt_max_length > self.retries_when_max_length:
if self.on_nan == 'fail':
final_error = RuntimeError(
'Failed to generate trajectory without '
'hitting max length after %d attempts' %
attempt_max_length)
break

if has_nan:
attempt_nan += 1
Expand Down
4 changes: 1 addition & 3 deletions openpathsampling/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ class CalvinistDynamics(DynamicsEngine):
def __init__(self, predestination):
topology = Topology(n_atoms=1, n_spatial=1)
engine = peng.tools.TopologyEngine(topology)
template = toys.Snapshot(engine=engine)

super(CalvinistDynamics, self).__init__(options={'n_frames_max' : 12},
template=template)
super(CalvinistDynamics, self).__init__(options={'n_frames_max': 12})
self.predestination = make_1d_traj(coordinates=predestination,
velocities=[1.0]*len(predestination),
engine=engine
Expand Down
11 changes: 10 additions & 1 deletion openpathsampling/tests/testopenmmengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,16 @@ def test_fail_length(self):
self.engine.options['n_max_length'] = 2
_ = self.engine.generate(self.engine.current_snapshot, [true_func])

# @raises_with_message_like(RuntimeError,
@raises_with_message_like(RuntimeError,
'Failed to generate trajectory without hitting '
'max length')
def test_retry_length(self):
self.engine.on_max_length = 'retry'
self.engine.options['n_max_length'] = 2
self.engine.retries_when_max_length = 2
_ = self.engine.generate(self.engine.current_snapshot, [true_func])

# @raises_with_message_like(RuntimeError,
# "Failed to generate trajectory without error")
# def test_fail_length(self):
# self.engine.on_nan = 'fail'
Expand Down