Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from ase.neb import NEBTools
2from ase.gui.images import Images
5class CLICommand:
6 """Analyze NEB trajectories by making band plots.
8 One file:
10 ase nebplot neb.traj
12 Multiple files:
14 ase nebplot neb1.traj neb2.traj
16 Specify output:
18 ase nebplot neb1.traj neb2.traj myfile.pdf
19 """
21 @staticmethod
22 def add_arguments(parser):
23 add = parser.add_argument
24 add('filenames', nargs='+',
25 help='one or more trajectory files to analyze')
26 add('output', nargs='?',
27 help='optional name of output file, default=nebplots.pdf')
28 add('--nimages', dest='n_images', type=int, default=None,
29 help='number of images per band, guessed if not supplied')
30 add('--share-x', dest='constant_x', action='store_true',
31 help='use a single x axis scale for all plots')
32 add('--share-y', dest='constant_y', action='store_true',
33 help='use a single y axis scale for all plots')
35 @staticmethod
36 def run(args, parser):
37 # Nothing will ever be stored in args.output; need to manually find
38 # if its supplied by checking extensions.
39 if args.filenames[-1].endswith('.pdf'):
40 args.output = args.filenames.pop(-1)
41 else:
42 args.output = 'nebplots.pdf'
44 images = Images()
45 images.read(args.filenames)
46 nebtools = NEBTools(images=images)
47 nebtools.plot_bands(constant_x=args.constant_x,
48 constant_y=args.constant_y,
49 nimages=args.n_images,
50 label=args.output[:-4])