Ejemplo n.º 1
0
    def final_state_ligand_degeneracy(self):
        # Now iterate over graph isomorphisms
        from networkx.algorithms.isomorphism import GraphMatcher

        graph_matcher = GraphMatcher(self.final_state_mol_nx,
                                     self.final_state_mol_nx)
        degeneracy = sum([1 for isomorphism in graph_matcher.match()])
        return degeneracy
Ejemplo n.º 2
0
def small_molecule_degeneracy(graph):
    # Now iterate over graph isomorphisms
    def equ_node(n1, n2):
        if (
            int(n1["atomic_num"]) == int(n2["atomic_num"])
            and n1["hybridization"] == n2["hybridization"]
        ):
            return True
        else:
            return False

    def equ_edge(n1, n2):
        if int(n1["bond_type"]) == int(n2["bond_type"]):
            return True
        else:
            return False

    from networkx.algorithms.isomorphism import GraphMatcher

    graph_matcher = GraphMatcher(graph, graph, node_match=equ_node, edge_match=equ_edge)
    degeneracy = sum([1 for isomorphism in graph_matcher.match()])
    return calc_rot_entropy(degeneracy), degeneracy