Example #1
0
class ReactionDiagramTest(unittest.TestCase):
    def setUp(self):
        module_dir = os.path.dirname(os.path.abspath(__file__))
        self.entries = list(
            EntrySet.from_csv(
                os.path.join(module_dir, "reaction_entries_test.csv")).entries)
        for e in self.entries:
            if e.composition.reduced_formula == "VPO5":
                entry1 = e
            elif e.composition.reduced_formula == "H4(CO)3":
                entry2 = e
        self.rd = ReactionDiagram(entry1=entry1,
                                  entry2=entry2,
                                  all_entries=self.entries[2:])

    def test_get_compound_pd(self):
        self.rd.get_compound_pd()

    def test_formula(self):
        for e in self.rd.rxn_entries:
            self.assertIn(Element.V, e.composition)
            self.assertIn(Element.O, e.composition)
            self.assertIn(Element.C, e.composition)
            self.assertIn(Element.P, e.composition)
            self.assertIn(Element.H, e.composition)
Example #2
0
 def setUp(self):
     module_dir = os.path.dirname(os.path.abspath(__file__))
     self.entries = list(EntrySet.from_csv(os.path.join(module_dir, "reaction_entries_test.csv")).entries)
     for e in self.entries:
         if e.composition.reduced_formula == "VPO5":
             entry1 = e
         elif e.composition.reduced_formula == "H4(CO)3":
             entry2 = e
     self.rd = ReactionDiagram(entry1=entry1, entry2=entry2, all_entries=self.entries[2:])
Example #3
0
class ReactionDiagramTest(unittest.TestCase):
    def setUp(self):
        module_dir = os.path.dirname(os.path.abspath(__file__))
        self.entries = list(
            EntrySet.from_csv(
                os.path.join(module_dir, "reaction_entries_test.csv")).entries)
        for e in self.entries:
            if e.composition.reduced_formula == "VPO5":
                entry1 = e
            elif e.composition.reduced_formula == "H4(CO)3":
                entry2 = e
        self.rd = ReactionDiagram(entry1=entry1,
                                  entry2=entry2,
                                  all_entries=self.entries[2:])

    def test_get_compound_pd(self):
        self.rd.get_compound_pd()

    def test_formula(self):
        for e in self.rd.rxn_entries:
            self.assertIn(Element.V, e.composition)
            self.assertIn(Element.O, e.composition)
            self.assertIn(Element.C, e.composition)
            self.assertIn(Element.P, e.composition)
            self.assertIn(Element.H, e.composition)
        [e.composition.reduced_formula for e in self.rd.rxn_entries]
        expected_formula = [
            "V0.12707182P0.12707182H0.0441989C0.03314917O0.66850829",
            "V0.125P0.125H0.05C0.0375O0.6625",
            "V0.12230216P0.12230216H0.05755396C0.04316547O0.65467626",
            "V0.11340206P0.11340206H0.08247423C0.06185567O0.62886598",
            "V0.11267606P0.11267606H0.08450704C0.06338028O0.62676056",
            "V0.11229947P0.11229947H0.0855615C0.06417112O0.62566845",
            "V0.09677419P0.09677419H0.12903226C0.09677419O0.58064516",
            "V0.05882353P0.05882353H0.23529412C0.17647059O0.47058824",
            "V0.04225352P0.04225352H0.28169014C0.21126761O0.42253521",
        ]