From 50ee2fe1a26343b3b7bbdcc392521b856cee10ff Mon Sep 17 00:00:00 2001 From: James Graham <J.A.Graham@soton.ac.uk> Date: Fri, 10 Jun 2016 12:34:48 +0100 Subject: [PATCH] Added command line arg for xtc output --- pycgtool.py | 7 ++++--- pycgtool/interface.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pycgtool.py b/pycgtool.py index 4512c52..b653f04 100755 --- a/pycgtool.py +++ b/pycgtool.py @@ -53,7 +53,7 @@ def main(args, config): if config.dump_measurements: bonds.dump_values(config.dump_n_values) - if args.map and config.output_xtc: + if args.map and (config.output_xtc or args.outputxtc): cgframe.flush_xtc_buffer("out.xtc") @@ -69,7 +69,7 @@ def map_only(args, config): cgframe = mapping.apply(frame, exclude={"SOL"}) cgframe.output("out.gro", format=config.output) - if args.xtc and config.output_xtc: + if args.xtc and (config.output_xtc or args.outputxtc): numframes = frame.numframes - args.begin if args.end == -1 else args.end - args.begin for _ in Progress(numframes, postwhile=frame.next_frame): cgframe = mapping.apply(frame, cgframe=cgframe, exclude={"SOL"}) @@ -87,6 +87,7 @@ if __name__ == "__main__": input_files.add_argument('-i', '--itp', type=str, help="GROMACS ITP file") parser.add_argument('--interactive', default=False, action='store_true') + parser.add_argument('--outputxtc', default=False, action='store_true') # parser.add_argument('-f', '--frames', type=int, default=-1, help="Number of frames to read") input_files.add_argument('--begin', type=int, default=0, help="Frame number to begin") input_files.add_argument('--end', type=int, default=-1, help="Frame number to end") @@ -103,7 +104,7 @@ if __name__ == "__main__": ("angle_default_fc", True), ("generate_angles", True), ("generate_dihedrals", False), - ("output_xtc", False)], + ("output_xtc", args.outputxtc)], args) if not args.bnd: config.set("map_only", True) diff --git a/pycgtool/interface.py b/pycgtool/interface.py index 97ba5a7..2949359 100644 --- a/pycgtool/interface.py +++ b/pycgtool/interface.py @@ -156,8 +156,8 @@ class Options: window.refresh() pos = 0 - move = {"KEY_UP": lambda x: max(x - 1, 0), - "KEY_DOWN": lambda x: min(x + 1, nrows - 1), + move = {"KEY_UP": lambda x: (x - 1) % nrows, + "KEY_DOWN": lambda x: (x + 1) % nrows, "KEY_LEFT": lambda x: x, "KEY_RIGHT": lambda x: x} -- GitLab