def test__stereomers(): """ test graph.stereomers """ assert graph.stereomers(C2H2CL2F2_CGR) == C2H2CL2F2_SGRS assert graph.stereomers(C3H3CL2F3_CGR) == C3H3CL2F3_SGRS assert graph.stereomers(C3H5N3_CGR) == C3H5N3_SGRS assert graph.stereomers(C8H13O_CGR) == C8H13O_SGRS
def test__trans__is_stereo_compatible(): """ test graph.trans.is_stereo_compatible """ cgr1 = ({ 0: ('C', 1, None), 1: ('C', 1, None), 2: ('C', 1, None), 3: ('C', 1, None), 4: ('F', 0, None), 5: ('F', 0, None), 6: ('O', 1, None) }, { frozenset({0, 1}): (1, None), frozenset({0, 2}): (1, None), frozenset({2, 4}): (1, None), frozenset({3, 5}): (1, None), frozenset({1, 3}): (1, None) }) cgr2 = ({ 0: ('C', 1, None), 1: ('C', 1, None), 2: ('C', 1, None), 3: ('C', 1, None), 4: ('F', 0, None), 5: ('F', 0, None), 6: ('O', 1, None) }, { frozenset({0, 1}): (1, None), frozenset({0, 2}): (1, None), frozenset({3, 6}): (1, None), frozenset({2, 4}): (1, None), frozenset({3, 5}): (1, None), frozenset({1, 3}): (1, None) }) cgr1 = graph.explicit(cgr1) cgr2 = graph.explicit(cgr2) ich1 = graph.inchi(cgr1) ich2 = graph.inchi(cgr2) smi1 = automol.inchi.smiles(ich1) smi2 = automol.inchi.smiles(ich2) print(smi1) print(smi2) cgr1s = graph.connected_components(cgr1) cgr2s = graph.connected_components(cgr2) tras, _, _ = graph.reac.addition(cgr1s, cgr2s) for tra in tras: assert graph.backbone_isomorphic(graph.trans.apply(tra, cgr1), cgr2) sgr1 = graph.stereomers(cgr1)[0] print(sgr1) for sgr2 in graph.stereomers(cgr2): print(sgr2) print(graph.trans.is_stereo_compatible(tra, sgr1, sgr2))