コード例 #1
0
ファイル: _old_amech.py プロジェクト: sjklipp/mechdriver
    RUN_SPC_LST_DCT = parser.species.build_run_spc_dct(SPC_DCT, RUN_OBJ_DCT)
else:
    ioprinter.error_message('No Proper Run object specified')
    sys.exit()

# Build a dictionary of submission scripts (to finish)
# SUB_SCRIPT_DCT = build_sub_script_dct(JOB_PATH)

# Kill run if just printing mechanism is wanted
if RUN_INP_DCT['print_mech']:
    ioprinter.obj('vspace')
    ioprinter.program_exit('amech')
    sys.exit()

# Initialize the filesystem
prefix_fs(RUN_INP_DCT['run_prefix'], RUN_INP_DCT['save_prefix'])

# Print messages describing drivers and tasks running
ioprinter.info_message(
    'Drivers and tasks user has requested to be run...', newline=1)
RUN_ES = bool('es' in RUN_JOBS_LST)
RUN_PRINT = bool('print' in RUN_JOBS_LST)
WRITE_MESSPF, RUN_MESSPF, RUN_NASA = parser.run.set_thermodriver(RUN_JOBS_LST)
WRITE_MESSRATE, RUN_MESSRATE, RUN_FITS = parser.run.set_ktpdriver(RUN_JOBS_LST)
RUN_TRANS = bool('transport' in RUN_JOBS_LST)
ioprinter.driver_tasks(
    RUN_ES, WRITE_MESSPF, RUN_MESSPF, RUN_NASA,
    WRITE_MESSRATE, RUN_MESSRATE, RUN_FITS, RUN_TRANS)

ioprinter.program_exit('inp')
コード例 #2
0
KMOD_DCT, SMOD_DCT = ioparser.models.models_dictionary(
    INP_STRS['mod'], THY_DCT)
INP_KEY_DCT = ioparser.run.input_dictionary(INP_STRS['run'])
PES_IDX_DCT = ioparser.run.pes_idxs(INP_STRS['run'])
SPC_IDX_DCT = ioparser.run.spc_idxs(INP_STRS['run'])
TSK_LST_DCT = ioparser.run.tasks(INP_STRS['run'], THY_DCT)
SPC_DCT, GLOB_DCT = ioparser.spc.species_dictionary(
    INP_STRS['spc'], INP_STRS['dat'], INP_STRS['geo'], 'csv')
PES_DCT = ioparser.mech.pes_dictionary(
    INP_STRS['mech'], 'chemkin', SPC_DCT)

PES_RLST, SPC_RLST = ioparser.rlst.run_lst(
    PES_DCT, SPC_DCT, PES_IDX_DCT, SPC_IDX_DCT)

# Build the Run-Save Filesystem Directories
prefix_fs(INP_KEY_DCT['run_prefix'], INP_KEY_DCT['save_prefix'])

# Run Drivers Requested by User
ES_TSKS = TSK_LST_DCT.get('es')
if ES_TSKS is not None:
    ioprinter.program_header('es')
    esdriver.run(
        PES_RLST, SPC_RLST,
        ES_TSKS,
        SPC_DCT, GLOB_DCT, THY_DCT,
        INP_KEY_DCT['run_prefix'], INP_KEY_DCT['save_prefix']
    )
    ioprinter.program_exit('es')

THERM_TSKS = TSK_LST_DCT.get('thermo')
if THERM_TSKS is not None:
コード例 #3
0
def _mechdriver_main(tmp_dir):
    """ Copy of MechDriver bin
    """

    # print header message and host name (probably combine into one function)
    ioprinter.program_header('amech')
    ioprinter.random_cute_animal()
    ioprinter.host_name()

    # parse all of the input
    ioprinter.program_header('inp')

    inp_strs = ioparser.read_amech_input(tmp_dir)

    thy_dct = ioparser.thy.theory_dictionary(inp_strs['thy'])
    kmod_dct, smod_dct = ioparser.models.models_dictionary(
        inp_strs['mod'], thy_dct)
    inp_key_dct = ioparser.run.input_dictionary(inp_strs['run'])
    pes_idx_dct, spc_idx_dct = ioparser.run.chem_idxs(inp_strs['run'])
    tsk_lst_dct = ioparser.run.tasks(
        inp_strs['run'], inp_strs['mech'], thy_dct)
    spc_dct, glob_dct = ioparser.spc.species_dictionary(
        inp_strs['spc'], inp_strs['dat'], inp_strs['geo'], 'csv')
    pes_dct = ioparser.mech.pes_dictionary(
        inp_strs['mech'], 'chemkin', spc_dct)

    pes_rlst, spc_rlst = ioparser.rlst.run_lst(
        pes_dct, spc_dct, pes_idx_dct, spc_idx_dct)

    # build the run-save filesystem directories
    prefix_fs(inp_key_dct['run_prefix'], inp_key_dct['save_prefix'])

    # run drivers requested by user
    es_tsks = tsk_lst_dct.get('es')
    if es_tsks is not None:
        ioprinter.program_header('es')
        esdriver.run(
            pes_rlst, spc_rlst,
            es_tsks,
            spc_dct, glob_dct, thy_dct,
            inp_key_dct['run_prefix'], inp_key_dct['save_prefix']
        )
        ioprinter.program_exit('es')

    therm_tsks = tsk_lst_dct.get('thermo')
    if therm_tsks is not None:
        ioprinter.program_header('thermo')
        thermodriver.run(
            pes_rlst, spc_rlst,
            therm_tsks,
            kmod_dct, smod_dct,
            spc_dct, thy_dct,
            inp_key_dct['run_prefix'], inp_key_dct['save_prefix'], tmp_dir
        )
        ioprinter.program_exit('thermo')

    trans_tsks = tsk_lst_dct.get('trans')
    if trans_tsks is not None:
        ioprinter.program_header('trans')
        if pes_dct:
            transdriver.run(
                pes_rlst, spc_rlst,
                trans_tsks,
                smod_dct,
                spc_dct, thy_dct,
                inp_key_dct['run_prefix'], inp_key_dct['save_prefix']
            )
        ioprinter.program_exit('trans')

    ktp_tsks = tsk_lst_dct.get('ktp')
    if ktp_tsks is not None:
        ioprinter.program_header('ktp')
        ktpdriver.run(
            pes_rlst,
            ktp_tsks,
            spc_dct, glob_dct,
            kmod_dct, smod_dct,
            inp_key_dct['run_prefix'], inp_key_dct['save_prefix'], tmp_dir
        )
        ioprinter.program_exit('ktp')

    proc_tsks = tsk_lst_dct.get('proc')
    if proc_tsks is not None:
        ioprinter.program_header('proc')
        procdriver.run(
            pes_rlst, spc_rlst,
            proc_tsks,
            spc_dct, thy_dct,
            kmod_dct, smod_dct,
            inp_key_dct['run_prefix'], inp_key_dct['save_prefix'], tmp_dir
        )
        ioprinter.program_exit('proc')

    # exit program
    ioprinter.obj('vspace')
    ioprinter.program_exit('amech')