예제 #1
0
def create_kinetics_entry(label, rxn, index, k_data, settings):
    """
    Create a kinetic library entry given its label, corresponding reaction,
    kinetic parameters, settings, and the library instance

    Args:
        label (str): The reaction label
        rxn (RMG Reaction): The corresponding RMG reaction instance
        index (int): The index of the new entry
        k_data (dict): A dictionary contains the information about
                        A factor, n, Ea, T0 and multiplier
        settings (dict): A dictionary contains the information about
                         variable units, T and P range, description
    Returns:
        entry (RMG Entry): The created RMG kinetic entry
    """
    entry = Entry()
    entry.index = index
    entry.label = label
    entry.item = rxn
    data = get_kinetic_data(k_data, settings)
    entry.data = data
    short_desc = ''
    if 'level_of_theory' in settings and settings['level_of_theory']:
        short_desc += 'calculated at {}'.format(settings['level_of_theory'])
    if 'experiment' in settings and settings['experiment']:
        short_desc += settings['experiment']
    if 'literature_index' in settings and settings['literature_index']:
        short_desc += ' from [{}]'.format(settings['literature_index'])
    if 'compute_by' in settings and settings['compute_by']:
        short_desc += ' by {}'.format(settings['compute_by'])
    entry.short_desc = short_desc
    return entry
def get_children(top, item):

    entry0 = Entry(label=top)
    new_entries[top] = entry0

    children = []
    for key, value in item.iteritems():
        if isinstance(value, Group):
            entry = Entry(label=key, item=value)
            children.append(entry)
            new_entries[key] = entry
        elif isinstance(value, OrderedDict):
            children.append(get_children(key, value))

    entry0.item = LogicOr([child.label for child in children], invert=False)
    entry0.children = children

    for child in children:
        child.parent = entry0

    return entry0