File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from .topology import build_topology
22from .core import Builder
33from paths_cli .compiling .core import Parameter
4- from .tools import custom_eval_int
4+ from .tools import custom_eval_int_strict_pos
55from paths_cli .compiling .plugins import EngineCompilerPlugin , CategoryPlugin
66
77def load_openmm_xml (filename ):
@@ -32,9 +32,9 @@ def _openmm_options(dct):
3232 description = "XML file with the OpenMM system" ),
3333 Parameter ('integrator' , load_openmm_xml , json_type = 'string' ,
3434 description = "XML file with the OpenMM integrator" ),
35- Parameter ('n_steps_per_frame' , custom_eval_int ,
35+ Parameter ('n_steps_per_frame' , custom_eval_int_strict_pos ,
3636 description = "number of MD steps per saved frame" ),
37- Parameter ("n_frames_max" , custom_eval_int ,
37+ Parameter ("n_frames_max" , custom_eval_int_strict_pos ,
3838 description = ("maximum number of frames before aborting "
3939 "trajectory" )),
4040]
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ def custom_eval_int(obj, named_objs=None):
2222 val = custom_eval (obj , named_objs )
2323 return int (val )
2424
25+ def custom_eval_int_strict_pos (obj , named_objs = None ):
26+ val = custom_eval_int (obj , named_objs )
27+ if val <= 0 :
28+ raise InputError (f"Positive integer required; found { val } " )
29+ return val
30+
2531
2632class UnknownAtomsError (RuntimeError ):
2733 pass
You can’t perform that action at this time.
0 commit comments