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


Python EnumerateStructureTransformation.apply_transformation方法代码示例

本文整理汇总了Python中pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation.apply_transformation方法的典型用法代码示例。如果您正苦于以下问题:Python EnumerateStructureTransformation.apply_transformation方法的具体用法?Python EnumerateStructureTransformation.apply_transformation怎么用?Python EnumerateStructureTransformation.apply_transformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation的用法示例。


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

示例1: test_apply_transformation

# 需要导入模块: from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation [as 别名]
# 或者: from pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation import apply_transformation [as 别名]
    def test_apply_transformation(self):
        enum_trans = EnumerateStructureTransformation(refine_structure=True)
        p = Poscar.from_file(os.path.join(test_dir, 'POSCAR.LiFePO4'),
                             check_for_POTCAR=False)
        struct = p.structure
        expected_ans = [1, 3, 1]
        for i, frac in enumerate([0.25, 0.5, 0.75]):
            trans = SubstitutionTransformation({'Fe': {'Fe': frac}})
            s = trans.apply_transformation(struct)
            oxitrans = OxidationStateDecorationTransformation({'Li': 1,
                                                               'Fe': 2,
                                                               'P': 5,
                                                               'O': -2})
            s = oxitrans.apply_transformation(s)
            alls = enum_trans.apply_transformation(s, 100)
            self.assertEquals(len(alls), expected_ans[i])
            self.assertIsInstance(trans.apply_transformation(s), Structure)
            for s in alls:
                self.assertIn("energy", s)

        #make sure it works for non-oxidation state decorated structure
        trans = SubstitutionTransformation({'Fe': {'Fe': 0.5}})
        s = trans.apply_transformation(struct)
        alls = enum_trans.apply_transformation(s, 100)
        self.assertEquals(len(alls), 3)
        self.assertIsInstance(trans.apply_transformation(s), Structure)
        for s in alls:
            self.assertNotIn("energy", s)
开发者ID:artemcpp,项目名称:pymatgen,代码行数:30,代码来源:test_advanced_transformations.py

示例2: test_max_disordered_sites

# 需要导入模块: from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation [as 别名]
# 或者: from pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation import apply_transformation [as 别名]
 def test_max_disordered_sites(self):
     l = Lattice.cubic(4)
     s_orig = Structure(l, [{"Li": 0.2, "Na": 0.2, "K": 0.6}, {"O": 1}],
                   [[0, 0, 0], [0.5, 0.5, 0.5]])
     est = EnumerateStructureTransformation(max_cell_size=None,
                                            max_disordered_sites=5)
     s = est.apply_transformation(s_orig)
     self.assertEqual(len(s), 8)
开发者ID:czhengsci,项目名称:pymatgen,代码行数:10,代码来源:test_advanced_transformations.py

示例3: test_max_disordered_sites

# 需要导入模块: from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation [as 别名]
# 或者: from pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation import apply_transformation [as 别名]
 def test_max_disordered_sites(self):
     l = Lattice.cubic(4)
     s_orig = Structure(l, [{"Li": 0.2, "Na": 0.2, "K": 0.6}, {"O": 1}],
                        [[0, 0, 0], [0.5, 0.5, 0.5]])
     est = EnumerateStructureTransformation(max_cell_size=None,
                                            max_disordered_sites=5)
     dd = est.apply_transformation(s_orig, return_ranked_list=100)
     self.assertEqual(len(dd), 9)
     for d in dd:
         self.assertEqual(len(d["structure"]), 10)
开发者ID:ExpHP,项目名称:pymatgen,代码行数:12,代码来源:test_advanced_transformations.py

示例4: enumerate_ordering

# 需要导入模块: from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation [as 别名]
# 或者: from pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation import apply_transformation [as 别名]
    def enumerate_ordering(self, structure):
        # Generate the disordered structure first.
        s = Structure.from_sites(structure.sites)
        for indices, fraction in zip(self._indices, self._fractions):
            for ind in indices:
                new_sp = {sp: occu * fraction for sp, occu in structure[ind].species_and_occu.items()}
                s[ind] = new_sp
        # Perform enumeration
        from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation

        trans = EnumerateStructureTransformation()
        return trans.apply_transformation(s, 10000)
开发者ID:dcossey014,项目名称:pymatgen,代码行数:14,代码来源:site_transformations.py

示例5: enumerate_ordering

# 需要导入模块: from pymatgen.transformations.advanced_transformations import EnumerateStructureTransformation [as 别名]
# 或者: from pymatgen.transformations.advanced_transformations.EnumerateStructureTransformation import apply_transformation [as 别名]
 def enumerate_ordering(self, structure):
     # Generate the disordered structure first.
     editor = StructureEditor(structure)
     for indices, fraction in zip(self._indices, self._fractions):
         for ind in indices:
             new_sp = {sp: occu * fraction
                       for sp, occu
                       in structure[ind].species_and_occu.items()}
             editor.replace_site(ind, new_sp)
     mod_s = editor.modified_structure
     # Perform enumeration
     from pymatgen.transformations.advanced_transformations import \
         EnumerateStructureTransformation
     trans = EnumerateStructureTransformation()
     return trans.apply_transformation(mod_s, 10000)
开发者ID:materialsgenome,项目名称:pymatgen,代码行数:17,代码来源:site_transformations.py


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