当前位置: 首页>>代码示例>>Python>>正文


Python compatibility.AqueousCorrection类代码示例

本文整理汇总了Python中pymatgen.entries.compatibility.AqueousCorrection的典型用法代码示例。如果您正苦于以下问题:Python AqueousCorrection类的具体用法?Python AqueousCorrection怎么用?Python AqueousCorrection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AqueousCorrection类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AqueousCorrectionTest

class AqueousCorrectionTest(unittest.TestCase):

    def setUp(self):
        self.corr = AqueousCorrection("MIT")

    def test_compound_energy(self):
        entry = ComputedEntry(Composition("H2O"), -16)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -15.10057, 4)

        entry = ComputedEntry(Composition("H2O"), -24)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -15.10057, 4)

        entry = ComputedEntry(Composition("Cl"), -24)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -24.344373, 4)
开发者ID:akashneo,项目名称:pymatgen,代码行数:17,代码来源:test_compatibility.py

示例2: AqueousCorrectionTest

class AqueousCorrectionTest(unittest.TestCase):

    def setUp(self):
        module_dir = os.path.dirname(os.path.abspath(__file__))
        fp = os.path.join(module_dir, os.path.pardir, "MITCompatibility.yaml")
        self.corr = AqueousCorrection(fp)

    def test_compound_energy(self):

        O2_entry = self.corr.correct_entry(ComputedEntry(Composition("O2"),
                                                          -4.9355 * 2))
        H2_entry = self.corr.correct_entry(ComputedEntry(Composition("H2"), 3))
        H2O_entry = self.corr.correct_entry(ComputedEntry(Composition("H2O"), 3))
        H2O_formation_energy = H2O_entry.energy - (H2_entry.energy +
                                                    O2_entry.energy / 2.0)
        self.assertAlmostEqual(H2O_formation_energy, -2.46, 2)

        entry = ComputedEntry(Composition("H2O"), -16)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -14.916, 4)

        entry = ComputedEntry(Composition("H2O"), -24)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -14.916, 4)

        entry = ComputedEntry(Composition("Cl"), -24)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -24.344373, 4)
开发者ID:image-tester,项目名称:pymatgen,代码行数:28,代码来源:test_compatibility.py

示例3: AqueousCorrectionTest

class AqueousCorrectionTest(unittest.TestCase):

    def setUp(self):
        self.corr = AqueousCorrection("MIT")

    def test_compound_energy(self):

        O2_entry = self.corr.correct_entry(ComputedEntry(Composition("O2"),
                                                          -4.9355 * 2))
        H2_entry = self.corr.correct_entry(ComputedEntry(Composition("H2"), 3))
        H2O_entry = self.corr.correct_entry(ComputedEntry(Composition("H2O"), 3))
        H2O_formation_energy = H2O_entry.energy - (H2_entry.energy +
                                                    O2_entry.energy / 2.0)
        self.assertAlmostEqual(H2O_formation_energy, -2.46, 2)

        entry = ComputedEntry(Composition("H2O"), -16)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -14.916, 4)

        entry = ComputedEntry(Composition("H2O"), -24)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -14.916, 4)

        entry = ComputedEntry(Composition("Cl"), -24)
        entry = self.corr.correct_entry(entry)
        self.assertAlmostEqual(entry.energy, -24.344373, 4)
开发者ID:NadezhdaBzhilyanskaya,项目名称:pymatgen,代码行数:26,代码来源:test_compatibility.py

示例4: setUp

 def setUp(self):
     self.compat = MITCompatibility()
     self.aqcompat = MITAqueousCompatibility()
     module_dir = os.path.dirname(os.path.abspath(__file__))
     fp = os.path.join(module_dir, os.path.pardir, "MITCompatibility.yaml")
     self.aqcorr =  AqueousCorrection(fp)
开发者ID:image-tester,项目名称:pymatgen,代码行数:6,代码来源:test_compatibility.py

示例5: TestMITAqueousCompatibility

class TestMITAqueousCompatibility(unittest.TestCase):

    def setUp(self):
        self.compat = MITCompatibility(check_potcar_hash=True)
        self.aqcompat = MITAqueousCompatibility(check_potcar_hash=True)
        module_dir = os.path.dirname(os.path.abspath(__file__))
        fp = os.path.join(module_dir, os.path.pardir, "MITCompatibility.yaml")
        self.aqcorr =  AqueousCorrection(fp)

    def test_aqueous_compat(self):

        el_li = Element("Li")
        el_o = Element("O")
        el_h = Element("H")
        latt = Lattice.from_parameters(3.565276, 3.565276, 4.384277, 90.000000, 90.000000, 90.000000)
        elts = [el_h, el_h, el_li, el_li, el_o, el_o]
        coords = [[0.000000, 0.500000, 0.413969],
                  [0.500000, 0.000000, 0.586031],
                  [0.000000, 0.000000, 0.000000],
                  [0.500000, 0.500000, 0.000000],
                  [0.000000, 0.500000, 0.192672],
                  [0.500000, 0.000000, 0.807328]]
        struct = Structure(latt, elts, coords)
        lioh_entry = ComputedStructureEntry(struct, -3,
                                            parameters={'is_hubbard': False,
                                          'hubbards': None,
                                          'run_type': 'GGA',
                                          'potcar_spec': [{'titel':'PAW_PBE Li 17Jan2003',
                                                           'hash': '65e83282d1707ec078c1012afbd05be8'},
                                                          {'titel': 'PAW_PBE O 08Apr2002',
                                                           'hash': '7a25bc5b9a5393f46600a4939d357982'},
                                                          {"titel": 'PAW_PBE H 15Jun2001',
                                                           'hash': "bb43c666e3d36577264afe07669e9582"}]})
        lioh_entry_compat = self.compat.process_entry(lioh_entry)
        lioh_entry_compat_aqcorr = self.aqcorr.correct_entry(lioh_entry_compat)
        lioh_entry_aqcompat = self.aqcompat.process_entry(lioh_entry)
        self.assertAlmostEqual(lioh_entry_compat_aqcorr.energy, lioh_entry_aqcompat.energy, 4)

    def test_potcar_doenst_match_structure(self):
        compat = MITCompatibility()
        el_li = Element("Li")
        el_o = Element("O")
        el_h = Element("H")
        latt = Lattice.from_parameters(3.565276, 3.565276, 4.384277, 90.000000, 90.000000, 90.000000)
        elts = [el_h, el_h, el_li, el_li, el_o, el_o]
        coords = [[0.000000, 0.500000, 0.413969],
                  [0.500000, 0.000000, 0.586031],
                  [0.000000, 0.000000, 0.000000],
                  [0.500000, 0.500000, 0.000000],
                  [0.000000, 0.500000, 0.192672],
                  [0.500000, 0.000000, 0.807328]]
        struct = Structure(latt, elts, coords)

        lioh_entry = ComputedStructureEntry(struct, -3,
                                            parameters={'is_hubbard': False,
                                          'hubbards': None,
                                          'run_type': 'GGA',
                                          'potcar_symbols':
        ['PAW_PBE Fe 17Jan2003', 'PAW_PBE O 08Apr2002', 'PAW_PBE H 15Jun2001']})

        self.assertIsNone(compat.process_entry(lioh_entry))
开发者ID:georgeyumnam,项目名称:pymatgen,代码行数:61,代码来源:test_compatibility.py

示例6: setUp

 def setUp(self):
     self.corr = AqueousCorrection("MIT")
开发者ID:akashneo,项目名称:pymatgen,代码行数:2,代码来源:test_compatibility.py

示例7: TestMITAqueousCompatibility

class TestMITAqueousCompatibility(unittest.TestCase):

    def setUp(self):
        self.compat = MITCompatibility(check_potcar_hash=True)
        self.aqcompat = MITAqueousCompatibility(check_potcar_hash=True)
        module_dir = os.path.dirname(os.path.abspath(__file__))
        fp = os.path.join(module_dir, os.path.pardir, "MITCompatibility.yaml")
        self.aqcorr =  AqueousCorrection(fp)

    def test_aqueous_compat(self):

        el_li = Element("Li")
        el_o = Element("O")
        el_h = Element("H")
        latt = Lattice.from_parameters(3.565276, 3.565276, 4.384277, 90.000000, 90.000000, 90.000000)
        elts = [el_h, el_h, el_li, el_li, el_o, el_o]
        coords = [[0.000000, 0.500000, 0.413969],
                  [0.500000, 0.000000, 0.586031],
                  [0.000000, 0.000000, 0.000000],
                  [0.500000, 0.500000, 0.000000],
                  [0.000000, 0.500000, 0.192672],
                  [0.500000, 0.000000, 0.807328]]
        struct = Structure(latt, elts, coords)
        lioh_entry = ComputedStructureEntry(struct, -3,
                                            parameters={'is_hubbard': False,
                                          'hubbards': None,
                                          'run_type': 'GGA',
                                          'potcar_spec': [{'titel':'PAW_PBE Li 17Jan2003',
                                                           'hash': '65e83282d1707ec078c1012afbd05be8'},
                                                          {'titel': 'PAW_PBE O 08Apr2002',
                                                           'hash': '7a25bc5b9a5393f46600a4939d357982'},
                                                          {"titel": 'PAW_PBE H 15Jun2001',
                                                           'hash': "bb43c666e3d36577264afe07669e9582"}]})
        lioh_entry_compat = self.compat.process_entry(lioh_entry)
        lioh_entry_compat_aqcorr = self.aqcorr.correct_entry(lioh_entry_compat)
        lioh_entry_aqcompat = self.aqcompat.process_entry(lioh_entry)
        self.assertAlmostEqual(lioh_entry_compat_aqcorr.energy, lioh_entry_aqcompat.energy, 4)

    def test_potcar_doenst_match_structure(self):
        compat = MITCompatibility()
        el_li = Element("Li")
        el_o = Element("O")
        el_h = Element("H")
        latt = Lattice.from_parameters(3.565276, 3.565276, 4.384277, 90.000000, 90.000000, 90.000000)
        elts = [el_h, el_h, el_li, el_li, el_o, el_o]
        coords = [[0.000000, 0.500000, 0.413969],
                  [0.500000, 0.000000, 0.586031],
                  [0.000000, 0.000000, 0.000000],
                  [0.500000, 0.500000, 0.000000],
                  [0.000000, 0.500000, 0.192672],
                  [0.500000, 0.000000, 0.807328]]
        struct = Structure(latt, elts, coords)

        lioh_entry = ComputedStructureEntry(struct, -3,
                                            parameters={'is_hubbard': False,
                                          'hubbards': None,
                                          'run_type': 'GGA',
                                          'potcar_symbols':
        ['PAW_PBE Fe 17Jan2003', 'PAW_PBE O 08Apr2002', 'PAW_PBE H 15Jun2001']})

        self.assertIsNone(compat.process_entry(lioh_entry))

    def test_msonable(self):

        compat_dict = self.aqcompat.as_dict()
        decoder = MontyDecoder()
        temp_compat = decoder.process_decoded(compat_dict)
        self.assertIsInstance(temp_compat,MITAqueousCompatibility)

    def test_dont_error_on_weird_elements(self):
        entry = ComputedEntry('AmSi',-1, 0.0,
            parameters={
                "potcar_spec": [{
                    "titel": "PAW_PBE Am 08May2007",
                    "hash": "ed5eebd8a143e35a0c19e9f8a2c42a93"
                }, {
                    "titel": "PAW_PBE Si 05Jan2001",
                    "hash": "b2b0ea6feb62e7cde209616683b8f7f5"
                }]
            })
        self.assertIsNone(self.compat.process_entry(entry))
开发者ID:ExpHP,项目名称:pymatgen,代码行数:81,代码来源:test_compatibility.py


注:本文中的pymatgen.entries.compatibility.AqueousCorrection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。