parser.add_option('-g', dest='gasphase_directory', action='store', default = 'gasphase', help='path to directory containing gasphase speces - default: rootdir/%default') parser.add_option('-o', dest='outputfile', action='store', default='output', help='Name of outputfile - default: %default') opts, args = parser.parse_args() if len(args) == 0: parser.error("The directory (rootdir) must be given") elif len(args) >1: parser.error("Too many arguments. Only the directory (rootdir) must be given") rootdir = args[0] if rootdir[-1] == '/': rootdir = rootdir[:-1] print "\nExtracting VASP data from: " + str(rootdir) if opts.gasphase_directory == 'gasphase': gasphase_dir = os.path.join(rootdir, 'gasphase') else: gasphase_dir = opts.gasphase_directory OA = VASP_DATA(rootdir, gasphase_dir) OA.write_outputdata(opts.outputfile)
help='Output driver; can be any driver supported by SOFT ' '(hdf5, json, mongo...) in addition to txt ' '- default: %default') parser.add_option('--options', help='Additional options passed to the driver.') opts, args = parser.parse_args() if len(args) == 0: parser.error("The directory (rootdir) must be given") elif len(args) > 1: parser.error('Too many arguments. Only the directory (rootdir) must ' 'be given') # Append output file extension if it is missing if opts.driver in ('hdf5', 'json') and not '.' in os.path.basename(opts.output): opts.output += '.' + opts.driver rootdir = args[0] if rootdir[-1] == '/': rootdir = rootdir[:-1] print("\nExtracting VASP data from: " + str(rootdir)) if opts.gasphase_directory == 'gasphase': gasphase_dir = os.path.join(rootdir, 'gasphase') else: gasphase_dir = opts.gasphase_directory OA = VASP_DATA(rootdir, gasphase_dir) OA.write_outputdata(uri=opts.output, driver=opts.driver, options=opts.options)
parser.add_option('--options', help='Additional options passed to the driver.') opts, args = parser.parse_args() if len(args) == 0: parser.error("The directory (rootdir) must be given") elif len(args) >1: parser.error('Too many arguments. Only the directory (rootdir) must ' 'be given') # Append output file extension if it is missing if opts.driver in ('hdf5', 'json') and not '.' in os.path.basename(opts.output): opts.output += '.' + opts.driver rootdir = args[0] if rootdir[-1] == '/': rootdir = rootdir[:-1] print("\nExtracting VASP data from: " + str(rootdir)) if opts.gasphase_directory == 'gasphase': gasphase_dir = os.path.join(rootdir, 'gasphase') else: gasphase_dir = opts.gasphase_directory OA = VASP_DATA(rootdir, gasphase_dir) OA.write_outputdata(uri=opts.output, driver=opts.driver, options=opts.options)