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


Python computed_entries.ComputedStructureEntry类代码示例

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


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

示例1: test_properties

    def test_properties(self):
        # Test cases for getting adsorption related quantities for a 1/4
        # monolalyer adsorption of O on the low MMI surfaces of Pt, Ni and Rh

        for el in self.metals_O_entry_dict.keys():
            el_ucell = ComputedStructureEntry.from_dict(self.ucell_entries[el])
            for hkl in self.metals_O_entry_dict[el].keys():
                for clean in self.metals_O_entry_dict[el][hkl].keys():
                    for ads in self.metals_O_entry_dict[el][hkl][clean]:
                        ml = ads.get_unit_primitive_area
                        self.assertAlmostEqual(ml, 4, 2)
                        self.assertAlmostEqual(ads.get_monolayer, 1/4, 2)
                        Nads = ads.Nads_in_slab
                        self.assertEqual(Nads, 1)
                        self.assertEqual(ads.Nsurfs_ads_in_slab, 1)

                        # Determine the correct binding energy
                        with open(os.path.join(get_path(""),
                                               'isolated_O_entry.txt')) as isolated_O_entry:
                            isolated_O_entry = json.loads(isolated_O_entry.read())
                        O = ComputedStructureEntry.from_dict(isolated_O_entry)
                        gbind = (ads.energy - ml*clean.energy)/Nads - O.energy_per_atom
                        self.assertEqual(gbind, ads.gibbs_binding_energy())
                        # Determine the correction Gibbs adsorption energy
                        eads = Nads * gbind
                        self.assertEqual(eads, ads.gibbs_binding_energy(eads=True))
                        se = ads.surface_energy(el_ucell)
                        self.assertAlmostEqual(se.as_coefficients_dict()[Symbol("delu_O")],
                                               (-1/2)*ads.surface_area**(-1))
开发者ID:albalu,项目名称:pymatgen,代码行数:29,代码来源:test_surface_analysis.py

示例2: load_O_adsorption

def load_O_adsorption():

    # Loads the dictionary for clean and O adsorbed Rh, Pt, and Ni entries

    # Load the adsorbate as an entry
    with open(os.path.join(get_path(""),
                           'isolated_O_entry.txt')) as isolated_O_entry:
        isolated_O_entry = json.loads(isolated_O_entry.read())
    O = ComputedStructureEntry.from_dict(isolated_O_entry)

    # entry_dict for the adsorption case, O adsorption on Ni, Rh and Pt
    metals_O_entry_dict = {"Ni": {(1, 1, 1): {}, (1, 0, 0): {}},
                           "Pt": {(1, 1, 1): {}},
                           "Rh": {(1, 0, 0): {}}
                           }

    with open(os.path.join(get_path(""), "csentries_slabs.json")) as entries:
        entries = json.loads(entries.read())
    for k in entries.keys():
        entry = ComputedStructureEntry.from_dict(entries[k])
        for el in metals_O_entry_dict.keys():
            if el in k:
                if "111" in k:
                    clean = SlabEntry(entry.structure, entry.energy,
                                      (1,1,1), label=k+"_clean")
                    metals_O_entry_dict[el][(1, 1, 1)][clean] = []
                if "110" in k:
                    clean = SlabEntry(entry.structure, entry.energy,
                                      (1, 1, 0), label=k + "_clean")
                    metals_O_entry_dict[el][(1, 1, 0)][clean] = []
                if "100" in k:
                    clean = SlabEntry(entry.structure, entry.energy,
                                      (1,0,0), label=k+"_clean")
                    metals_O_entry_dict[el][(1, 0, 0)][clean] = []

    with open(os.path.join(get_path(""), "csentries_o_ads.json")) as entries:
        entries = json.loads(entries.read())
    for k in entries.keys():
        entry = ComputedStructureEntry.from_dict(entries[k])
        for el in metals_O_entry_dict.keys():
            if el in k:
                if "111" in k:
                    clean = list(metals_O_entry_dict[el][(1, 1, 1)].keys())[0]
                    ads = SlabEntry(entry.structure, entry.energy, (1,1,1),
                                    label=k+"_O", adsorbates=[O], clean_entry=clean)
                    metals_O_entry_dict[el][(1, 1, 1)][clean] = [ads]
                if "110" in k:
                    clean = list(metals_O_entry_dict[el][(1, 1, 0)].keys())[0]
                    ads = SlabEntry(entry.structure, entry.energy, (1,1,0),
                                    label=k+"_O", adsorbates=[O], clean_entry=clean)
                    metals_O_entry_dict[el][(1, 1, 0)][clean] = [ads]
                if "100" in k:
                    clean = list(metals_O_entry_dict[el][(1, 0, 0)].keys())[0]
                    ads = SlabEntry(entry.structure, entry.energy, (1,0,0),
                                    label=k+"_O", adsorbates=[O], clean_entry=clean)
                    metals_O_entry_dict[el][(1, 0, 0)][clean] = [ads]

    return metals_O_entry_dict
开发者ID:albalu,项目名称:pymatgen,代码行数:58,代码来源:test_surface_analysis.py

示例3: get_entry_dict

def get_entry_dict(filename):
    # helper to generate an entry_dict

    entry_dict = {}
    with open(filename) as entries:
        entries = json.loads(entries.read())
    for k in entries.keys():
        n = k[25:]
        miller_index = []
        for i, s in enumerate(n):
            if s == "_":
                break
            if s == "-":
                continue
            t = int(s)
            if n[i - 1] == "-":
                t *= -1
            miller_index.append(t)
        hkl = tuple(miller_index)
        if hkl not in entry_dict.keys():
            entry_dict[hkl] = {}
        entry = ComputedStructureEntry.from_dict(entries[k])
        entry_dict[hkl][SlabEntry(entry.structure, entry.energy, hkl, label=k)] = []

    return entry_dict
开发者ID:albalu,项目名称:pymatgen,代码行数:25,代码来源:test_surface_analysis.py

示例4: setUp

    def setUp(self):

        # Load all entries
        La_hcp_entry_dict = get_entry_dict(os.path.join(get_path(""),
                                                        "La_hcp_entries.txt"))
        La_fcc_entry_dict = get_entry_dict(os.path.join(get_path(""),
                                                        "La_fcc_entries.txt"))
        with open(os.path.join(get_path(""), 'ucell_entries.txt')) as ucell_entries:
            ucell_entries = json.loads(ucell_entries.read())
        La_hcp_ucell_entry = ComputedStructureEntry.from_dict(ucell_entries["La_hcp"])
        La_fcc_ucell_entry = ComputedStructureEntry.from_dict(ucell_entries["La_fcc"])

        # Set up the NanoscaleStabilityClass
        self.La_hcp_analyzer = SurfaceEnergyPlotter(La_hcp_entry_dict,
                                                    La_hcp_ucell_entry)
        self.La_fcc_analyzer = SurfaceEnergyPlotter(La_fcc_entry_dict,
                                                    La_fcc_ucell_entry)
        self.nanoscale_stability = NanoscaleStability([self.La_fcc_analyzer,
                                                       self.La_hcp_analyzer])
开发者ID:albalu,项目名称:pymatgen,代码行数:19,代码来源:test_surface_analysis.py

示例5: ComputedStructureEntryTest

class ComputedStructureEntryTest(unittest.TestCase):
    def setUp(self):
        self.entry = ComputedStructureEntry(vasprun.final_structure, vasprun.final_energy, parameters=vasprun.incar)

    def test_energy(self):
        self.assertAlmostEqual(self.entry.energy, -269.38319884)
        self.entry.correction = 1.0
        self.assertAlmostEqual(self.entry.energy, -268.38319884)

    def test_composition(self):
        self.assertEqual(self.entry.composition.reduced_formula, "LiFe4(PO4)4")

    def test_to_from_dict(self):
        d = self.entry.as_dict()
        e = ComputedStructureEntry.from_dict(d)
        self.assertAlmostEqual(e.energy, -269.38319884)

    def test_str(self):
        self.assertIsNotNone(str(self.entry))
开发者ID:georgeyumnam,项目名称:pymatgen,代码行数:19,代码来源:test_computed_entries.py

示例6: test_to_from_dict

 def test_to_from_dict(self):
     d = self.entry.to_dict
     e = ComputedStructureEntry.from_dict(d)
     self.assertAlmostEqual(e.energy, -269.38319884)
开发者ID:qimin,项目名称:pymatgen,代码行数:4,代码来源:test_computed_entries.py

示例7: setUp

 def setUp(self):
     self.entry = ComputedStructureEntry(vasprun.final_structure,
                                vasprun.final_energy,
                                parameters=vasprun.incar)
开发者ID:albalu,项目名称:pymatgen,代码行数:4,代码来源:test_computed_entries.py

示例8: convert

 def convert(self, d):
     if 'structure' in d:
         return ComputedStructureEntry.from_dict(d)
     else:
         return ComputedEntry.from_dict(d)
开发者ID:chenweis,项目名称:pymatgen,代码行数:5,代码来源:hive.py


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