Ejemplo n.º 1
0
 def test_in_database_through_build_new_FWs(self):
     ft = FragmentMolecule(molecule=self.pc_frag1,
                           edges=self.pc_frag1_edges,
                           depth=0)
     ft.mol = ft.get("molecule")
     ft.depth = ft.get("depth")
     ft.charges = [-1, 0, 1]
     ft.do_triplets = False
     ft.linked = False
     ft.qchem_input_params = {}
     pc_frag1_edges = {(e[0], e[1]): None for e in self.pc_frag1_edges}
     mol_graph = MoleculeGraph.with_edges(self.pc_frag1, pc_frag1_edges)
     unique_frag_dict = mol_graph.build_unique_fragments()
     unique_frag_list = []
     for key in unique_frag_dict:
         for frag in unique_frag_dict[key]:
             unique_frag_list.append(frag)
     ft.unique_fragments = unique_frag_list
     ft._build_unique_relevant_molecules()
     docs = loadfn(os.path.join(module_dir, "doc.json"))
     for doc in docs:
         doc["input"]["initial_molecule"] = doc["input"][
             "initial_molecule"].as_dict()
     ft.all_relevant_docs = docs
     new_FWs = ft._build_new_FWs()
     self.assertEqual(len(new_FWs), 29)
Ejemplo n.º 2
0
 def test_build_new_FWs(self):
     ft = FragmentMolecule(molecule=self.pc_frag1, edges=self.pc_frag1_edges, depth=0)
     ft.mol = ft.get("molecule")
     ft.depth = ft.get("depth")
     ft.charges = [-1, 0, 1]
     ft.do_triplets = False
     ft.linked = False
     ft.qchem_input_params = {}
     pc_frag1_edges = {(e[0], e[1]): None for e in self.pc_frag1_edges}
     mol_graph = MoleculeGraph.with_edges(self.pc_frag1, pc_frag1_edges)
     unique_frag_dict = mol_graph.build_unique_fragments()
     unique_frag_list = []
     for key in unique_frag_dict:
         for frag in unique_frag_dict[key]:
             unique_frag_list.append(frag)
     ft.unique_fragments = unique_frag_list
     ft._build_unique_relevant_molecules()
     ft.all_relevant_docs = list()
     new_FWs = ft._build_new_FWs()
     self.assertEqual(len(new_FWs), 36)