def objs(keys, prechars=()): """ Print a set of standard objects """ obj_str = '' for key, prechar in zip(keys, prechars): obj_str += obj(key, prechar=prechar) message(obj_str)
def output_keyword_list(es_keyword_dct, thy_dct=None): """ a """ message('Electronic structure level for property:', newline=1) for key, val in es_keyword_dct.items(): method_str = '' if key in ('inplvl', 'runlvl'): method_dct = thy_dct.get(es_keyword_dct[key]) method_str = f'({method_dct["method"]}/{method_dct["basis"]})' message(f'{key}: {val} ' + method_str) obj('vspace')
def obj(key, prechar=None): """ Print some standard object """ assert key in LIB_DCT, (f'Object {key} not in library') obj_str = LIB_DCT[key] if prechar is not None: obj_str = addchar(obj_str, prechar, side='pre') message(obj_str)
def output_keyword_list(es_keyword_dct, thy_dct=None): """ a """ message('Electronic structure level for property:', newline=1) for key, val in es_keyword_dct.items(): method_str = '' if key in ('inplvl', 'runlvl'): method_dct = thy_dct.get(es_keyword_dct[key]) method_str = '({}/{})'.format(method_dct['method'], method_dct['basis']) message('{}: {} '.format(key, val) + method_str) obj('vspace')
def status_message(print_str, label=None, path=None, newline=False, indent=False): """ Print a general status message. """ if label: print_str += label if path: print_str += ' at {}'.format(path) message(print_str, newline=newline, indent=indent)
def program_exit(driver): """ print the header for a program """ header_dct = { 'amech': AMECH_EXIT_MSG, 'inp': INP_EXIT_MSG, 'ktp': KTP_EXIT_MSG, 'thermo': THM_EXIT_MSG, 'trans': TRANS_EXIT_MSG, 'es': ES_EXIT_MSG, 'proc': PRINT_EXIT_MSG } message(header_dct[driver] + '\n')
def program_header(driver): """ print the header for a program """ header_dct = { 'amech': AMECH_MSG, 'inp': INP_MSG, 'ktp': KTP_MSG, 'thermo': THM_MSG, 'trans': TRANS_MSG, 'es': ES_MSG, 'print': PRINT_MSG } message(header_dct[driver])
def runlst(run_inf, run_lst): """ checks if run lst is a species lst """ message('=========================================') formula, pes_idx, sub_pes_idx = run_inf if formula != 'SPC': print_pes(pes_idx+1, formula, sub_pes_idx+1) for chnl in run_lst: cidx, rxn = chnl print_channel(cidx+1, rxn[0], rxn[1]) else: for i, spc in enumerate(run_lst): message('Running SPC {}: {}'.format(i+1, spc))
def runlst(run_inf, run_lst): """ checks if run lst is a species lst """ message('=========================================') formula, pes_idx, sub_pes_idx = run_inf if formula != 'SPC': print_pes(pes_idx + 1, formula, sub_pes_idx + 1) for chnl in run_lst: cidx, rxn = chnl print_channel(cidx + 1, rxn[0], rxn[1]) else: for idx, spc in zip(sub_pes_idx, run_lst): message(f'Running SPC {idx+1}: {spc}')
def random_cute_animal(): """ Print a picture of a fun, cute animal at random """ msg = random.choice([ r""" _,--._ ,' `. |\ / \ /| )o),/ ( ,--, ,--, ) \.(o( /o/// /| |\ \\ \\o\\ / / |\ \( .----, )/ /| \ \\ | | \o`-/ `--' \-'o/ | | \ \ `,' `.' / / \. \ `-' ,'| /\ |`. `-' / ,/ \`. `.__,' / / \ \ `.__,' ,'/ \o\ ,' ,' `. `. /o/ \o`---' ,' `. `---'o/ `.____,' `.____,' """, r""" ,,, ,,, ;" ^; ;' ", ; s$$$$$$$s ; , ss$$$$$$$$$$s ,' ;s$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$ $$$$P""Y$$$Y""W$$$$$ $$$$ 0"$$$"0 $$$$$ $$$$ .$$$$$. $$$$ $$$$$$$$$$$$$$$$$ "Y$$$"'*'"$$$Y" "$$b.d$$" """, r""" _.---~-~-~~-.. .. __. .-~ ~-. ((\ / `}.~ `. \\\\\ { } / \ \\ (\ \\\\~~ } | } \\ \`.-~-^~ } ,-,. | ) \\ (___, ) _} ( : | / / `. `----._-~. _\ \ |_ \ / /- _ -. ~~----~~ \ \| ~~--~~~( + / ~-. '--~. / / \ \ `~-..__ `~__ __/ / _\ ) `~~---' .<___.' .<___/ """]) message(msg) obj('vspace')
def nasa(statement, spc_name=None, path=None): """ a """ obj('vspace') if statement == 'header': obj('line_dash') message('Running Thermochemistry calculations for all species', newline=1) elif statement == 'calculate': message(f'Starting NASA polynomials calculation for {spc_name}') elif statement == 'fit': message('Attempting to fit NASA polynomials from', '200-1000 and 1000-3000 K ranges using\n', f'temps from MESSPF file:\n {path}.')
def driver_tasks( run_es, write_messpf, run_messpf, run_nasa, write_messrate, run_messrate, run_fits, run_trans): """ a """ if run_es: message(' - ESDriver') # Add the tasks for the ESDriver if write_messpf or run_messpf or run_nasa: message(' - ThermoDriver') if write_messpf: message(' - write_messpf') if run_messpf: message(' - run_messpf') if run_nasa: message(' - run_nasa') if write_messrate or run_messrate or run_fits: message(' - kTPDriver') if write_messrate: message(' - write_messrate') if run_messrate: message(' - run_messrate') if run_fits: message(' - run_fits') if run_trans: message(' - TransportDriver')
def pes(pes_idx, formula, sub_pes_idx): """ a """ message('Running PES {}: {}, SUB PES {}'.format(pes_idx, formula, sub_pes_idx), newline=1)
def host_name(): """ print the host the calculation is running on """ host_node = autorun.host_node() pid = autorun.process_id() message(HOST_MSG.format(host_node, pid))
def channel(chn_idx, reacs, prods): """ a """ message('Running Channel {}: {} = {}'.format(chn_idx, '+'.join(reacs), '+'.join(prods)), indent=1)
def channel(chn_idx, reacs, prods): """ a """ rct_str, prd_str = '+'.join(reacs), '+'.join(prods) message(f'Running Channel {chn_idx}: {rct_str} = {prd_str}')
def task_footer(): """ a """ message('\n' + '--- END TASK ----------------------------------------' + '--------------------------------------')
def pes(pes_idx, fml, sub_pes_idx): """ a """ message(f'Running PES {pes_idx}: {fml}, SUB PES {sub_pes_idx}', newline=1)
def results(): """ Print static results method. """ message('Results:')
def task_header(tsk, spc_name): """ a """ obj('vspace') obj('line_dash') message('Task:', tsk, spc_name, newline=1)
def host_name(): """ print the host the calculation is running on """ host_node = _get_host_node() pid = _get_pid() message(HOST_MSG.format(host_node, pid))
def output_task_header(tsk): """ a """ obj('vspace') obj('line_dash') message('Print Property:', tsk, newline=1)
def program_run_message(prog, path): """ message for a program """ message(f'Run path for {prog}: {path}')
def messpf(statement, path=None): """ a """ # obj('vspace') if statement == 'write_header': obj('line_dash') message('Preparing MESSPF input files for all species', newline=1) elif statement == 'input_string': message('MESSPF Input String:') obj('vspace') obj('vspace') elif statement == 'run_header': obj('line_dash') message('Running MESSPF calculations for all species', newline=1) elif statement == 'write_file': message('Writing MESS input file...') message(f' - Path: {path}') elif statement == 'write_output': message('Writing MESS Output file...') message(f' - Path: {path}') elif statement == 'run_file': message('Running MESS input file...') message(f' - Path: {path}') elif statement == 'global_header': message('Preparing global keywords section for MESS input...') message(' - Using temperatures and pressures defined by user') message(' - Using internal AutoMech defaults for other MESS keywords:') elif statement == 'transfer_section': message('Preparing energy transfer section for MESS input...') elif statement == 'well_section': message('- Determining reference well species...') elif statement == 'bath_section': message('- Determining information for the bath species...') elif statement == 'channel_section': message('Preparing reaction channel section for MESS input... ')
def program_run_message(prog, path): """ message for a program """ message('Run path for {}:'.format(prog), path)