本文整理汇总了Python中pymatgen.symmetry.analyzer.SpacegroupAnalyzer.get_ir_reciprocal_mesh方法的典型用法代码示例。如果您正苦于以下问题:Python SpacegroupAnalyzer.get_ir_reciprocal_mesh方法的具体用法?Python SpacegroupAnalyzer.get_ir_reciprocal_mesh怎么用?Python SpacegroupAnalyzer.get_ir_reciprocal_mesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.symmetry.analyzer.SpacegroupAnalyzer
的用法示例。
在下文中一共展示了SpacegroupAnalyzer.get_ir_reciprocal_mesh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_kpoint_weights
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_ir_reciprocal_mesh [as 别名]
def test_get_kpoint_weights(self):
for name in ["SrTiO3", "LiFePO4", "Graphite"]:
s = PymatgenTest.get_structure(name)
a = SpacegroupAnalyzer(s)
ir_mesh = a.get_ir_reciprocal_mesh((4, 4, 4))
weights = [i[1] for i in ir_mesh]
weights = np.array(weights) / sum(weights)
for i, w in zip(weights, a.get_kpoint_weights([i[0] for i in
ir_mesh])):
self.assertAlmostEqual(i, w)
for name in ["SrTiO3", "LiFePO4", "Graphite"]:
s = PymatgenTest.get_structure(name)
a = SpacegroupAnalyzer(s)
ir_mesh = a.get_ir_reciprocal_mesh((1, 2, 3))
weights = [i[1] for i in ir_mesh]
weights = np.array(weights) / sum(weights)
for i, w in zip(weights, a.get_kpoint_weights([i[0] for i in
ir_mesh])):
self.assertAlmostEqual(i, w)
v = Vasprun(os.path.join(test_dir, "vasprun.xml"))
a = SpacegroupAnalyzer(v.final_structure)
wts = a.get_kpoint_weights(v.actual_kpoints)
for w1, w2 in zip(v.actual_kpoints_weights, wts):
self.assertAlmostEqual(w1, w2)
kpts = [[0, 0, 0], [0.15, 0.15, 0.15], [0.2, 0.2, 0.2]]
self.assertRaises(ValueError, a.get_kpoint_weights, kpts)
示例2: SpacegroupAnalyzerTest
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_ir_reciprocal_mesh [as 别名]
#.........这里部分代码省略.........
self.assertEqual(sg.get_refined_structure().num_sites, 4 * s.num_sites)
def test_get_symmetrized_structure(self):
symm_struct = self.sg.get_symmetrized_structure()
for a in symm_struct.lattice.angles:
self.assertEqual(a, 90)
self.assertEqual(len(symm_struct.equivalent_sites), 5)
symm_struct = self.disordered_sg.get_symmetrized_structure()
self.assertEqual(len(symm_struct.equivalent_sites), 8)
self.assertEqual([len(i) for i in symm_struct.equivalent_sites],
[16,4,8,4,2,8,8,8])
s1 = symm_struct.equivalent_sites[1][1]
s2 = symm_struct[symm_struct.equivalent_indices[1][1]]
self.assertEqual(s1, s2)
self.assertEqual(self.sg4.get_symmetrized_structure()[0].magmom, 0.1)
def test_find_primitive(self):
"""
F m -3 m Li2O testing of converting to primitive cell
"""
parser = CifParser(os.path.join(test_dir, 'Li2O.cif'))
structure = parser.get_structures(False)[0]
s = SpacegroupAnalyzer(structure)
primitive_structure = s.find_primitive()
self.assertEqual(primitive_structure.formula, "Li2 O1")
# This isn't what is expected. All the angles should be 60
self.assertAlmostEqual(primitive_structure.lattice.alpha, 60)
self.assertAlmostEqual(primitive_structure.lattice.beta, 60)
self.assertAlmostEqual(primitive_structure.lattice.gamma, 60)
self.assertAlmostEqual(primitive_structure.lattice.volume,
structure.lattice.volume / 4.0)
def test_get_ir_reciprocal_mesh(self):
grid=self.sg.get_ir_reciprocal_mesh()
self.assertEqual(len(grid), 216)
self.assertAlmostEquals(grid[1][0][0], 0.1)
self.assertAlmostEquals(grid[1][0][1], 0.0)
self.assertAlmostEquals(grid[1][0][2], 0.0)
self.assertEqual(grid[1][1], 2)
def test_get_conventional_standard_structure(self):
parser = CifParser(os.path.join(test_dir, 'bcc_1927.cif'))
structure = parser.get_structures(False)[0]
s = SpacegroupAnalyzer(structure, symprec=1e-2)
conv = s.get_conventional_standard_structure()
self.assertAlmostEqual(conv.lattice.alpha, 90)
self.assertAlmostEqual(conv.lattice.beta, 90)
self.assertAlmostEqual(conv.lattice.gamma, 90)
self.assertAlmostEqual(conv.lattice.a, 9.1980270633769461)
self.assertAlmostEqual(conv.lattice.b, 9.1980270633769461)
self.assertAlmostEqual(conv.lattice.c, 9.1980270633769461)
parser = CifParser(os.path.join(test_dir, 'btet_1915.cif'))
structure = parser.get_structures(False)[0]
s = SpacegroupAnalyzer(structure, symprec=1e-2)
conv = s.get_conventional_standard_structure()
self.assertAlmostEqual(conv.lattice.alpha, 90)
self.assertAlmostEqual(conv.lattice.beta, 90)
self.assertAlmostEqual(conv.lattice.gamma, 90)
self.assertAlmostEqual(conv.lattice.a, 5.0615106678044235)
self.assertAlmostEqual(conv.lattice.b, 5.0615106678044235)
self.assertAlmostEqual(conv.lattice.c, 4.2327080177761687)
parser = CifParser(os.path.join(test_dir, 'orci_1010.cif'))
structure = parser.get_structures(False)[0]
示例3: SpacegroupAnalyzerTest
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_ir_reciprocal_mesh [as 别名]
#.........这里部分代码省略.........
def test_get_symmetrized_structure(self):
symm_struct = self.sg.get_symmetrized_structure()
for a in symm_struct.lattice.angles:
self.assertEqual(a, 90)
self.assertEqual(len(symm_struct.equivalent_sites), 5)
symm_struct = self.disordered_sg.get_symmetrized_structure()
self.assertEqual(len(symm_struct.equivalent_sites), 8)
self.assertEqual([len(i) for i in symm_struct.equivalent_sites],
[16,4,8,4,2,8,8,8])
s1 = symm_struct.equivalent_sites[1][1]
s2 = symm_struct[symm_struct.equivalent_indices[1][1]]
self.assertEqual(s1, s2)
self.assertEqual(self.sg4.get_symmetrized_structure()[0].magmom, 0.1)
self.assertEqual(symm_struct.wyckoff_symbols[0], '16h')
# self.assertEqual(symm_struct[0].wyckoff, "16h")
def test_find_primitive(self):
"""
F m -3 m Li2O testing of converting to primitive cell
"""
parser = CifParser(os.path.join(test_dir, 'Li2O.cif'))
structure = parser.get_structures(False)[0]
s = SpacegroupAnalyzer(structure)
primitive_structure = s.find_primitive()
self.assertEqual(primitive_structure.formula, "Li2 O1")
# This isn't what is expected. All the angles should be 60
self.assertAlmostEqual(primitive_structure.lattice.alpha, 60)
self.assertAlmostEqual(primitive_structure.lattice.beta, 60)
self.assertAlmostEqual(primitive_structure.lattice.gamma, 60)
self.assertAlmostEqual(primitive_structure.lattice.volume,
structure.lattice.volume / 4.0)
def test_get_ir_reciprocal_mesh(self):
grid = self.sg.get_ir_reciprocal_mesh()
self.assertEqual(len(grid), 216)
self.assertAlmostEqual(grid[1][0][0], 0.1)
self.assertAlmostEqual(grid[1][0][1], 0.0)
self.assertAlmostEqual(grid[1][0][2], 0.0)
self.assertAlmostEqual(grid[1][1], 2)
def test_get_conventional_standard_structure(self):
parser = CifParser(os.path.join(test_dir, 'bcc_1927.cif'))
structure = parser.get_structures(False)[0]
s = SpacegroupAnalyzer(structure, symprec=1e-2)
conv = s.get_conventional_standard_structure()
self.assertAlmostEqual(conv.lattice.alpha, 90)
self.assertAlmostEqual(conv.lattice.beta, 90)
self.assertAlmostEqual(conv.lattice.gamma, 90)
self.assertAlmostEqual(conv.lattice.a, 9.1980270633769461)
self.assertAlmostEqual(conv.lattice.b, 9.1980270633769461)
self.assertAlmostEqual(conv.lattice.c, 9.1980270633769461)
parser = CifParser(os.path.join(test_dir, 'btet_1915.cif'))
structure = parser.get_structures(False)[0]
s = SpacegroupAnalyzer(structure, symprec=1e-2)
conv = s.get_conventional_standard_structure()
self.assertAlmostEqual(conv.lattice.alpha, 90)
self.assertAlmostEqual(conv.lattice.beta, 90)
self.assertAlmostEqual(conv.lattice.gamma, 90)
self.assertAlmostEqual(conv.lattice.a, 5.0615106678044235)
self.assertAlmostEqual(conv.lattice.b, 5.0615106678044235)
self.assertAlmostEqual(conv.lattice.c, 4.2327080177761687)
parser = CifParser(os.path.join(test_dir, 'orci_1010.cif'))
structure = parser.get_structures(False)[0]