本文整理汇总了Python中pymatgen.io.cif.CifParser.get_structures方法的典型用法代码示例。如果您正苦于以下问题:Python CifParser.get_structures方法的具体用法?Python CifParser.get_structures怎么用?Python CifParser.get_structures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.io.cif.CifParser
的用法示例。
在下文中一共展示了CifParser.get_structures方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_jahn_teller_structure_analysis
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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))
示例2: test_CifParserSpringerPauling
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
def test_CifParserSpringerPauling(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# Below are 10 tests for CIFs from the Springer Materials/Pauling file DBs.
# Partial occupancy on sites, incorrect label, previously unparsable
parser = CifParser(os.path.join(test_dir, 'PF_sd_1928405.cif'))
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Er1 Mn3.888 Fe2.112 Sn6")
# Partial occupancy on sites, previously parsed as an ordered structure
parser = CifParser(os.path.join(test_dir, 'PF_sd_1011081.cif'))
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Zr0.2 Nb0.8")
# Partial occupancy on sites, incorrect label, previously unparsable
parser = CifParser(os.path.join(test_dir, 'PF_sd_1615854.cif'))
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Na2 Al2 Si6 O16")
# Partial occupancy on sites, incorrect label, previously unparsable
parser = CifParser(os.path.join(test_dir, 'PF_sd_1622133.cif'))
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Ca0.184 Mg13.016 Fe2.8 Si16 O48")
# Partial occupancy on sites, previously parsed as an ordered structure
parser = CifParser(os.path.join(test_dir, 'PF_sd_1908491.cif'))
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Mn0.48 Zn0.52 Ga2 Se4")
# Partial occupancy on sites, incorrect label, previously unparsable
parser = CifParser(os.path.join(test_dir, 'PF_sd_1811457.cif'))
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Ba2 Mg0.6 Zr0.2 Ta1.2 O6")
# Incomplete powder diffraction data, previously unparsable
# This CIF file contains the molecular species "NH3" which is
# parsed as "N" because the label is "N{x}" (x = 1,2,..) and the
# corresponding symbol is "NH3". Since, the label and symbol are switched
# in CIFs from Springer Materials/Pauling file DBs, CifParser parses the
# element as "N".
parser = CifParser(os.path.join(test_dir, 'PF_sd_1002871.cif'))
self.assertEqual(parser.get_structures(True)[0].formula, "Cu1 Br2 N6")
self.assertEqual(parser.get_structures(True)[1].formula, "Cu1 Br4 N6")
# Incomplete powder diffraction data, previously unparsable
parser = CifParser(os.path.join(test_dir, 'PF_sd_1704003.cif'))
for s in parser.get_structures():
self.assertEqual(s.formula, "Rb4 Mn2 F12")
# Unparsable species 'OH/OH2', previously parsed as "O"
parser = CifParser(os.path.join(test_dir, 'PF_sd_1500382.cif'))
for s in parser.get_structures():
self.assertEqual(s.formula, "Mg6 B2 O6 F1.764")
# Unparsable species 'OH/OH2', previously parsed as "O"
parser = CifParser(os.path.join(test_dir, 'PF_sd_1601634.cif'))
for s in parser.get_structures():
self.assertEqual(s.formula, "Zn1.29 Fe0.69 As2 Pb1.02 O8")
示例3: test_implicit_hydrogen
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
def test_implicit_hydrogen(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
parser = CifParser(self.TEST_FILES_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)
self.assertIn("Structure has implicit hydrogens defined, "
"parsed structure unlikely to be suitable for use "
"in calculations unless hydrogens added.", parser.errors)
parser = CifParser(self.TEST_FILES_DIR / 'cif_implicit_hydrogens_cod_1011130.cif')
s = parser.get_structures()[0]
self.assertIn("Structure has implicit hydrogens defined, "
"parsed structure unlikely to be suitable for use "
"in calculations unless hydrogens added.", parser.errors)
示例4: test_no_symmops
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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")
示例5: test_bad_cif
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)
示例6: test_no_symmops
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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")
示例7: test_one_line_symm
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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")
示例8: test_implicit_hydrogen
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)
示例9: test_CifParserCod
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
def test_CifParserCod(self):
"""
Parsing problematic cif files from the COD database
"""
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# Symbol in capital letters
parser = CifParser(self.TEST_FILES_DIR / 'Cod_2100513.cif')
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Ca4 Nb2.0 Al2 O12")
# Label in capital letters
parser = CifParser(self.TEST_FILES_DIR / 'Cod_4115344.cif')
for s in parser.get_structures(True):
self.assertEqual(s.formula, "Mo4 P2 H60 C60 I4 O4")
示例10: test_one_line_symm
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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")
示例11: test_missing_atom_site_type_with_oxistates
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)
示例12: setUp
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)
示例13: test_replacing_finite_precision_frac_coords
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)
示例14: test_bad_cif
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)
示例15: test_bad_cif
# 需要导入模块: from pymatgen.io.cif import CifParser [as 别名]
# 或者: from pymatgen.io.cif.CifParser import get_structures [as 别名]
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)