Example #1
0
def prod_beta_scission(gra):
    """ products of beta scission
    """

    prod_gras = tuple()

    rad_idxs = resonance_dominant_radical_atom_keys(gra)
    single_bonds = bonds_of_order(gra, mbond=1)

    for rad_idx in rad_idxs:
        rad_neighs = atoms_neighbor_atom_keys(gra)[rad_idx]
        for single_bond in single_bonds:
            bond = frozenset(single_bond)
            if rad_neighs & bond and rad_idx not in bond:
                gra2 = remove_bonds(gra, [bond])
                disconn_gras = automol.graph.connected_components(gra2)
                prod_gras += (disconn_gras, )

    return _unique_gras(prod_gras)
Example #2
0
def rot_permutated_geoms(geo, frm_bnd_keys=(), brk_bnd_keys=()):
    """ Convert an input geometry to a list of geometries
        corresponding to the rotational permuations of all the terminal groups.
        :param geo: molecular geometry
        :type geo: automol molecular geometry data structure
        :param frm_bnd_keys: keys denoting atoms forming bond in TS
        :type frm_bnd_keys: frozenset(int)
        :param brk_bnd_keys: keys denoting atoms breaking bond in TS
        :type brk_bnd_keys: frozenset(int)
        :rtype: tuple(automol geom data structure)
    """

    # Set saddle based on frm and brk keys existing
    saddle = bool(frm_bnd_keys or brk_bnd_keys)

    gra = automol.convert.geom.graph(geo, stereo=False)
    term_atms = {}
    all_hyds = []
    neighbor_dct = atoms_neighbor_atom_keys(gra)
    ts_atms = []
    for bnd in frm_bnd_keys:
        ts_atms.extend(list(bnd))
    for bnd in brk_bnd_keys:
        ts_atms.extend(list(bnd))

    # determine if atom is a part of a double bond
    unsat_atms = unsaturated_atom_keys(gra)
    if not saddle:
        rad_atms = sing_res_dom_radical_atom_keys(gra)
        res_rad_atms = resonance_dominant_radical_atom_keys(gra)
        rad_atms = [atm for atm in rad_atms if atm not in res_rad_atms]
    else:
        rad_atms = []

    gra = gra[0]
    for atm in gra:
        if gra[atm][0] == 'H':
            all_hyds.append(atm)
    for atm in gra:
        if atm in unsat_atms and atm not in rad_atms:
            pass
        else:
            if atm not in ts_atms:
                nonh_neighs = []
                h_neighs = []
                neighs = neighbor_dct[atm]
                for nei in neighs:
                    if nei in all_hyds:
                        h_neighs.append(nei)
                    else:
                        nonh_neighs.append(nei)
                if len(nonh_neighs) < 2 and len(h_neighs) > 1:
                    term_atms[atm] = h_neighs
    geo_final_lst = [geo]
    for atm in term_atms:
        hyds = term_atms[atm]
        geo_lst = []
        for geom in geo_final_lst:
            geo_lst.extend(_swap_for_one(geom, hyds))
        geo_final_lst = geo_lst

    return geo_final_lst
Example #3
0
def end_group_symmetry_factor(geo, frm_bnd_keys=(), brk_bnd_keys=()):
    """ Determine sym factor for terminal groups in a geometry
        :param geo: molecular geometry
        :type geo: automol molecular geometry data structure
        :param frm_bnd_keys: keys denoting atoms forming bond in TS
        :type frm_bnd_keys: frozenset(int)
        :param brk_bnd_keys: keys denoting atoms breaking bond in TS
        :type brk_bnd_keys: frozenset(int)
        :rtype: (automol geom data structure, float)
    """

    # Set saddle based on frm and brk keys existing
    saddle = bool(frm_bnd_keys or brk_bnd_keys)

    gra = automol.convert.geom.graph(geo, stereo=False)
    term_atms = {}
    all_hyds = []
    neighbor_dct = atoms_neighbor_atom_keys(gra)

    ts_atms = []
    for bnd in frm_bnd_keys:
        ts_atms.extend(list(bnd))
    for bnd in brk_bnd_keys:
        ts_atms.extend(list(bnd))
    # determine if atom is a part of a double bond
    unsat_atms = unsaturated_atom_keys(gra)
    if not saddle:
        rad_atms = sing_res_dom_radical_atom_keys(gra)
        res_rad_atms = resonance_dominant_radical_atom_keys(gra)
        rad_atms = [atm for atm in rad_atms if atm not in res_rad_atms]
    else:
        rad_atms = []

    gra = gra[0]
    for atm in gra:
        if gra[atm][0] == 'H':
            all_hyds.append(atm)
    for atm in gra:
        if atm in unsat_atms and atm not in rad_atms:
            pass
        else:
            if atm not in ts_atms:
                nonh_neighs = []
                h_neighs = []
                neighs = neighbor_dct[atm]
                for nei in neighs:
                    if nei in all_hyds:
                        h_neighs.append(nei)
                    else:
                        nonh_neighs.append(nei)
                if len(nonh_neighs) == 1 and len(h_neighs) > 1:
                    term_atms[atm] = h_neighs
    factor = 1.
    remove_atms = []
    for atm in term_atms:
        hyds = term_atms[atm]
        if len(hyds) > 1:
            factor *= len(hyds)
            remove_atms.extend(hyds)
    geo = trans.remove_coordinates(geo, remove_atms)

    return geo, factor, remove_atms