#!/usr/bin/env python
# encoding: utf-8

name = "Birad_recombination/groups"
shortDesc = ""
longDesc = """

"""

template(reactants=["Root"], products=["Rncycle"], ownReverse=False)

reverse = "Ring_Open"
reversible = True
reactantNum = 1
productNum = 1
autoGenerated = True

recipe(actions=[
    ['FORM_BOND', '*1', 1, '*2'],
    ['LOSE_RADICAL', '*1', '1'],
    ['LOSE_RADICAL', '*2', '1'],
])

boundaryAtoms = ["*1", "*2"]

entry(
    index = 0,
    label = "Root",
    group = 
"""
1 *2 R!H u1
2 *1 R!H u1
""",
    kinetics = None,
)

entry(
    index = 1,
    label = "Root_1R!H->C",
    group = 
"""
1 *2 C u1
2 *1 C u1
""",
    kinetics = None,
)

entry(
    index = 2,
    label = "Root_1R!H->C_Ext-2R!H-R_Ext-2R!H-R",
    group = 
"""
1 *2 C   u1 r0
2 *1 C   u1 r0 {3,[S,D,T,B]} {4,[S,D,T,B]}
3    R!H ux {2,[S,D,T,B]}
4    R!H ux {2,[S,D,T,B]}
""",
    kinetics = None,
)

entry(
    index = 3,
    label = "Root_1R!H->C_Ext-2R!H-R_Ext-3R!H-R_Ext-3R!H-R_Ext-2R!H-R",
    group = 
"""
1 *2 C u1 {3,S}
2 *1 C u1 {5,S}
3    C u0 {1,S} {4,[S,D,T,B]}
4    C ux {3,[S,D,T,B]}
5    C u0 {2,S}
""",
    kinetics = None,
)

entry(
    index = 4,
    label = "Root_1R!H->C_Ext-2R!H-R_Ext-3R!H-R_Ext-3R!H-R_Ext-2R!H-R_Ext-4R!H-R",
    group = 
"""
1 *2 C   u1 r0 {3,S}
2 *1 C   u1 r0 {5,S}
3    C   u0 r0 {1,S} {4,[S,D,T,B]}
4    C   ux {3,[S,D,T,B]} {6,[S,D,T,B]}
5    C   u0 r0 {2,S}
6    R!H ux {4,[S,D,T,B]}
""",
    kinetics = None,
)

entry(
    index = 5,
    label = "Root_N-1R!H->C",
    group = 
"""
1 *2 [O,Cl,N,S,Si] u1 r0
2 *1 R!H           u1 r0
""",
    kinetics = None,
)

tree(
"""
L1: Root
    L2: Root_1R!H->C
        L3: Root_1R!H->C_Ext-2R!H-R_Ext-2R!H-R
        L3: Root_1R!H->C_Ext-2R!H-R_Ext-3R!H-R_Ext-3R!H-R_Ext-2R!H-R
            L4: Root_1R!H->C_Ext-2R!H-R_Ext-3R!H-R_Ext-3R!H-R_Ext-2R!H-R_Ext-4R!H-R
    L2: Root_N-1R!H->C
"""
)

forbidden(
    label = "RR_d",
    group = 
"""
1 *1 R!H u1 {2,D}
2 *2 R!H u1 {1,D}
""",
    shortDesc = """""",
    longDesc = 
"""

""",
)

forbidden(
    label = "RR_s",
    group = 
"""
1 *1 R!H u1 {2,S}
2 *2 R!H u1 {1,S}
""",
    shortDesc = """""",
    longDesc = 
"""

""",
)

forbidden(
    label = "RR_t",
    group = 
"""
1 *1 R!H u1 {2,T}
2 *2 R!H u1 {1,T}
""",
    shortDesc = """""",
    longDesc = 
"""

""",
)

