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


Python cif.CifParser类代码示例

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


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

示例1: test_implicit_hydrogen

 def test_implicit_hydrogen(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         parser = CifParser(os.path.join(test_dir, 'Senegalite_implicit_hydrogen.cif'))
         for s in parser.get_structures():
             self.assertEqual(s.formula, "Al8 P4 O32")
             self.assertEqual(sum(s.site_properties['implicit_hydrogens']), 20)
开发者ID:czhengsci,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例2: test_one_line_symm

 def test_one_line_symm(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         f = os.path.join(test_dir, "OneLineSymmP1.cif")
         p = CifParser(f)
         s = p.get_structures()[0]
         self.assertEqual(s.formula, "Ga4 Pb2 O8")
开发者ID:dongsenfo,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例3: test_bad_cif

 def test_bad_cif(self):
     f = os.path.join(test_dir, "bad_occu.cif")
     p = CifParser(f)
     self.assertRaises(ValueError, p.get_structures)
     p = CifParser(f, occupancy_tolerance=2)
     s = p.get_structures()[0]
     self.assertAlmostEqual(s[0].species_and_occu["Al3+"], 0.5)
开发者ID:montoyjh,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例4: test_no_symmops

 def test_no_symmops(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         f = self.TEST_FILES_DIR / "nosymm.cif"
         p = CifParser(f)
         s = p.get_structures()[0]
         self.assertEqual(s.formula, "H96 C60 O8")
开发者ID:materialsproject,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例5: test_one_line_symm

 def test_one_line_symm(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         f = self.TEST_FILES_DIR / "OneLineSymmP1.cif"
         p = CifParser(f)
         s = p.get_structures()[0]
         self.assertEqual(s.formula, "Ga4 Pb2 O8")
开发者ID:materialsproject,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例6: setUp

 def setUp(self):
     warnings.filterwarnings("ignore")
     self.mcif = CifParser(self.TEST_FILES_DIR / "magnetic.example.NiO.mcif")
     self.mcif_ncl = CifParser(self.TEST_FILES_DIR / "magnetic.ncl.example.GdB4.mcif")
     self.mcif_incom = CifParser(self.TEST_FILES_DIR / "magnetic.incommensurate.example.Cr.mcif")
     self.mcif_disord = CifParser(self.TEST_FILES_DIR / "magnetic.disordered.example.CuMnO2.mcif")
     self.mcif_ncl2 = CifParser(self.TEST_FILES_DIR / "Mn3Ge_IR2.mcif")
开发者ID:materialsproject,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例7: test_jahn_teller_structure_analysis

    def test_jahn_teller_structure_analysis(self):
        parser = CifParser(os.path.join(test_dir, 'LiFePO4.cif'))
        LiFePO4 = parser.get_structures()[0]

        parser = CifParser(os.path.join(test_dir, 'Fe3O4.cif'))
        Fe3O4 = parser.get_structures()[0]

        self.assertTrue(self.jt.is_jahn_teller_active(LiFePO4))
        self.assertTrue(self.jt.is_jahn_teller_active(Fe3O4))

        LiFePO4_analysis = {
            'active': True,
            'strength': 'weak',
            'sites': [
                {
                    'ligand': 'O2-',
                    'ligand_bond_length_spread': 0.2111,
                    'ligand_bond_lengths': [2.1382,
                                            2.0840,
                                            2.0863,
                                            2.2383,
                                            2.2951,
                                            2.2215],
                    'strength': 'weak',
                    'motif': 'oct',
                    'motif_order_parameter': 0.1441,
                    'site_indices': [4, 5, 6, 7],
                    'species': 'Fe2+',
                    'spin_state': 'unknown'
                }
            ]
        }

        self.assertDictEqual(LiFePO4_analysis, self.jt.get_analysis(LiFePO4))
开发者ID:albalu,项目名称:pymatgen,代码行数:34,代码来源:test_jahnteller.py

示例8: test_no_symmops

 def test_no_symmops(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         f = os.path.join(test_dir, "nosymm.cif")
         p = CifParser(f)
         s = p.get_structures()[0]
         self.assertEqual(s.formula, "H96 C60 O8")
开发者ID:dongsenfo,项目名称:pymatgen,代码行数:7,代码来源:test_cif.py

示例9: setUp

 def setUp(self):
     """
     Setup Fe3O4  structure for testing multiple oxidation states
     """
     cif_ob = CifParser(os.path.join(test_dir, "Fe3O4.cif"))
     self._struct = cif_ob.get_structures()[0]
     self._valrad_evaluator = ValenceIonicRadiusEvaluator(self._struct)
     self._length = len(self._struct.sites)
开发者ID:Lightslayer,项目名称:pymatgen,代码行数:8,代码来源:test_point_defects.py

示例10: test_missing_atom_site_type_with_oxistates

 def test_missing_atom_site_type_with_oxistates(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         parser = CifParser(self.TEST_FILES_DIR / 'P24Ru4H252C296S24N16.cif')
         c = Composition({'S0+': 24, 'Ru0+': 4, 'H0+': 252, 'C0+': 296,
                          'N0+': 16, 'P0+': 24})
         for s in parser.get_structures(False):
             self.assertEqual(s.composition, c)
开发者ID:materialsproject,项目名称:pymatgen,代码行数:8,代码来源:test_cif.py

示例11: test_replacing_finite_precision_frac_coords

 def test_replacing_finite_precision_frac_coords(self):
     f = self.TEST_FILES_DIR / "cif_finite_precision_frac_coord_error.cif"
     with warnings.catch_warnings():
         p = CifParser(f)
         s = p.get_structures()[0]
         self.assertEqual(str(s.composition), "N5+24")
         self.assertIn("Some fractional co-ordinates rounded to ideal values to "
                       "avoid finite precision errors.", p.errors)
开发者ID:materialsproject,项目名称:pymatgen,代码行数:8,代码来源:test_cif.py

示例12: test_bad_cif

 def test_bad_cif(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         f = self.TEST_FILES_DIR / "bad_occu.cif"
         p = CifParser(f)
         self.assertRaises(ValueError, p.get_structures)
         p = CifParser(f, occupancy_tolerance=2)
         s = p.get_structures()[0]
         self.assertAlmostEqual(s[0].species["Al3+"], 0.5)
开发者ID:materialsproject,项目名称:pymatgen,代码行数:9,代码来源:test_cif.py

示例13: test_bad_cif

 def test_bad_cif(self):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         f = os.path.join(test_dir, "bad_occu.cif")
         p = CifParser(f)
         self.assertRaises(ValueError, p.get_structures)
         p = CifParser(f, occupancy_tolerance=2)
         s = p.get_structures()[0]
         self.assertAlmostEqual(s[0].species_and_occu["Al3+"], 0.5)
开发者ID:dongsenfo,项目名称:pymatgen,代码行数:9,代码来源:test_cif.py

示例14: test_cluster_from_file

 def test_cluster_from_file(self):
     r = CifParser(os.path.join(test_dir, "CoO19128.cif"))
     structure = r.get_structures()[0]
     atoms = Atoms(structure, "O", 10.0)
     atoms.write_file("ATOMS_test")
     mol_1 = Atoms.cluster_from_file("ATOMS_test")
     mol_2 = Atoms.cluster_from_file(os.path.join(test_dir, "ATOMS"))
     self.assertEqual(mol_1.formula, mol_2.formula)
     self.assertEqual(len(mol_1), len(mol_2))
     os.remove("ATOMS_test")
开发者ID:adozier,项目名称:pymatgen,代码行数:10,代码来源:test_inputs.py

示例15: setUp

 def setUp(self):
     self.mcif = CifParser(os.path.join(test_dir,
                                        "magnetic.example.NiO.mcif"))
     self.mcif_ncl = CifParser(os.path.join(test_dir,
                                            "magnetic.ncl.example.GdB4.mcif"))
     self.mcif_incom = CifParser(os.path.join(test_dir,
                                              "magnetic.incommensurate.example.Cr.mcif"))
     self.mcif_disord = CifParser(os.path.join(test_dir,
                                               "magnetic.disordered.example.CuMnO2.mcif"))
     self.mcif_ncl2 = CifParser(os.path.join(test_dir,
                                               "Mn3Ge_IR2.mcif"))
开发者ID:czhengsci,项目名称:pymatgen,代码行数:11,代码来源:test_cif.py


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