示例#1
0
def main():
    # Parse the command-line arguments (requires the argparse module)
    # args = parse_command_line_arguments()
    # AJ: change path to intended input file
    # args = parse_command_line_arguments(["/Users/agnes/Documents/Software/RMG/RMG-Py/examples/rmg/superminimal/input.py"])
    args = parse_command_line_arguments(
        ["./examples/rmg/superminimal/input.py"])

    if args.postprocess:
        print "Postprocessing the profiler statistics (will be appended to RMG.log)"
    else:
        # Initialize the logging system (resets the RMG.log file)
        level = logging.INFO
        if args.debug:
            level = 0
        elif args.verbose:
            level = logging.DEBUG
        elif args.quiet:
            level = logging.WARNING
        initializeLog(level, os.path.join(args.output_directory, 'RMG.log'))

    logging.info(rmgpy.settings.report())

    kwargs = {
        'restart': args.restart,
        'walltime': args.walltime,
        'kineticsdatastore': args.kineticsdatastore
    }

    if args.profile:
        import cProfile
        global_vars = {}
        local_vars = {
            'inputFile': args.file,
            'output_dir': args.output_directory,
            'kwargs': kwargs,
            'RMG': RMG
        }

        command = """rmg = RMG(inputFile=inputFile, outputDirectory=output_dir); rmg.execute(**kwargs)"""

        stats_file = os.path.join(args.output_directory, 'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, 'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)

    else:

        rmg = RMG(inputFile=args.file, outputDirectory=args.output_directory)
        rmg.execute(**kwargs)
示例#2
0
def main():
    # Parse the command-line arguments (requires the argparse module)
    args = parse_command_line_arguments()

    if args.postprocess:
        logging.info(
            "Postprocessing the profiler statistics (will be appended to RMG.log)"
        )
    else:
        # Initialize the logging system (resets the RMG.log file)
        level = logging.INFO
        if args.debug:
            level = 0
        elif args.verbose:
            level = logging.DEBUG
        elif args.quiet:
            level = logging.WARNING
        initialize_log(level, os.path.join(args.output_directory, 'RMG.log'))

    logging.info(rmgpy.settings.report())

    kwargs = {
        'restart': args.restart,
        'walltime': args.walltime,
        'maxproc': args.maxproc,
        'kineticsdatastore': args.kineticsdatastore
    }

    if args.profile:
        import cProfile
        global_vars = {}
        local_vars = {
            'inputFile': args.file,
            'output_dir': args.output_directory,
            'kwargs': kwargs,
            'RMG': RMG
        }

        command = """rmg = RMG(input_file=inputFile, output_directory=output_dir); rmg.execute(**kwargs)"""

        stats_file = os.path.join(args.output_directory, 'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, 'RMG.log')
        process_profile_stats(stats_file, log_file)
        make_profile_graph(stats_file)

    else:

        rmg = RMG(input_file=args.file, output_directory=args.output_directory)
        rmg.execute(**kwargs)
示例#3
0
def generate_rmg_model(input_file, output_directory):
    """
    Generate the RMG-Py model NOT containing any non-normal isotopomers.

    Returns created RMG object.
    """
    initialize_log(logging.INFO, os.path.join(output_directory, 'RMG.log'))
    # generate mechanism:
    rmg = RMG(input_file=os.path.abspath(input_file),
              output_directory=os.path.abspath(output_directory))
    rmg.execute()

    return rmg
def generate_RMG_model(inputFile, outputDirectory):
    """
    Generate the RMG-Py model NOT containing any non-normal isotopomers.

    Returns created RMG object.
    """
    initializeLog(logging.INFO, os.path.join(outputDirectory, 'RMG.log'))
    # generate mechanism:
    rmg = RMG(inputFile = os.path.abspath(inputFile),
              outputDirectory = os.path.abspath(outputDirectory))
    rmg.execute()

    return rmg
示例#5
0
文件: rmg.py 项目: cainja/RMG-Py
def main():
    # Parse the command-line arguments (requires the argparse module)
    args = parse_command_line_arguments()

    if args.postprocess:
        print "Postprocessing the profiler statistics (will be appended to RMG.log)"
    else:
        # Initialize the logging system (resets the RMG.log file)
        level = logging.INFO
        if args.debug:
            level = 0
        elif args.verbose:
            level = logging.DEBUG
        elif args.quiet:
            level = logging.WARNING
        initializeLog(level, os.path.join(args.output_directory, 'RMG.log'))

    logging.info(rmgpy.settings.report())

    kwargs = {
        'restart': args.restart,
        'walltime': args.walltime,
        'kineticsdatastore': args.kineticsdatastore
    }

    if args.profile:
        import cProfile
        global_vars = {}
        local_vars = {
            'inputFile': args.file,
            'output_dir': args.output_directory,
            'kwargs': kwargs,
            'RMG': RMG
        }

        command = """rmg = RMG(inputFile=inputFile, outputDirectory=output_dir); rmg.execute(**kwargs)"""

        stats_file = os.path.join(args.output_directory, 'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, 'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)

    else:

        rmg = RMG(inputFile=args.file, outputDirectory=args.output_directory)
        rmg.execute(**kwargs)
示例#6
0
        'walltime': args.walltime,
    }

    if args.profile:
        import cProfile, sys, pstats, os
        global_vars = {}
        local_vars = {
            'inputFile': inputFile,
            'output_dir': output_dir,
            'kwargs': kwargs,
            'RMG': RMG
        }

        command = """rmg = RMG(); rmg.execute(inputFile, output_dir, **kwargs)"""

        stats_file = os.path.join(args.output_directory, 'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, 'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)

    else:

        rmg = RMG()

        rmg.execute(inputFile, output_dir, **kwargs)
示例#7
0
文件: rmg.py 项目: PengZhang13/RMG-Py
        'restart': args.restart,
        'walltime': args.walltime,
        }

    if args.profile:
        import cProfile, sys, pstats, os
        global_vars = {}
        local_vars = {
            'inputFile': inputFile, 
            'output_dir': output_dir, 
            'kwargs': kwargs,
            'RMG': RMG
            }

        command = """rmg = RMG(inputFile=inputFile, outputDirectory=output_dir); rmg.execute(**kwargs)"""

        stats_file = os.path.join(args.output_directory,'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory,'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)
        
    else:

        rmg = RMG(inputFile=inputFile, outputDirectory=output_dir)
        rmg.execute(**kwargs)
示例#8
0
文件: rmg.py 项目: canh-thu/RMG-Py
        'walltime': args.walltime,
        'kineticsdatastore': args.kineticsdatastore
    }

    if args.profile:
        import cProfile, sys, pstats, os
        global_vars = {}
        local_vars = {
            'inputFile': inputFile,
            'output_dir': output_dir,
            'kwargs': kwargs,
            'RMG': RMG
        }

        command = """rmg = RMG(inputFile=inputFile, outputDirectory=output_dir); rmg.execute(**kwargs)"""

        stats_file = os.path.join(args.output_directory, 'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, 'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)

    else:

        rmg = RMG(inputFile=inputFile, outputDirectory=output_dir)
        rmg.execute(**kwargs)
示例#9
0
文件: rmg.py 项目: thackray/RMG-Py
        print "Postprocessing the profiler statistics (will be appended to RMG.log)"
        args.profile = True
    else:
        # Initialize the logging system (resets the RMG.log file)
        level = logging.INFO
        if args.debug: level = 0
        elif args.verbose: level = logging.DEBUG
        elif args.quiet: level = logging.WARNING
        initializeLog(level, os.path.join(args.output_directory, 'RMG.log'))

    logging.info(rmgpy.settings.report())

    if args.profile:
        import cProfile, sys, pstats, os
        global_vars = {}
        local_vars = {'args': args, 'RMG': RMG}
        command = """rmg = RMG(); rmg.execute(args)"""
        stats_file = os.path.join(args.output_directory, 'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, 'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)

    else:
        rmg = RMG()
        rmg.execute(args)
示例#10
0
文件: rmg.py 项目: jwallen/RMG-Py
    else:
        # Initialize the logging system (resets the RMG.log file)
        level = logging.INFO
        if args.debug:
            level = 0
        elif args.verbose:
            level = logging.DEBUG
        elif args.quiet:
            level = logging.WARNING
        initializeLog(level, os.path.join(args.output_directory, "RMG.log"))

    if args.profile:
        import cProfile, sys, pstats, os

        global_vars = {}
        local_vars = {"args": args, "RMG": RMG}
        command = """rmg = RMG(); rmg.execute(args)"""
        stats_file = os.path.join(args.output_directory, "RMG.profile")
        print ("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory, "RMG.log")
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)

    else:
        rmg = RMG()
        rmg.execute(args)
示例#11
0
文件: rmg.py 项目: Alborzi/RMG-Py
        'walltime': args.walltime,
        }

    if args.profile:
        import cProfile, sys, pstats, os
        global_vars = {}
        local_vars = {
            'inputFile': inputFile, 
            'output_dir': output_dir, 
            'kwargs': kwargs,
            'RMG': RMG
            }

        command = """rmg = RMG(); rmg.execute(inputFile, output_dir, **kwargs)"""

        stats_file = os.path.join(args.output_directory,'RMG.profile')
        print("Running under cProfile")
        if not args.postprocess:
            # actually run the program!
            cProfile.runctx(command, global_vars, local_vars, stats_file)
        # postprocess the stats
        log_file = os.path.join(args.output_directory,'RMG.log')
        processProfileStats(stats_file, log_file)
        makeProfileGraph(stats_file)
        
    else:

        rmg = RMG()

        rmg.execute(inputFile, output_dir, **kwargs)