本文整理汇总了Python中pymatgen.symmetry.analyzer.SpacegroupAnalyzer.get_kpoint_weights方法的典型用法代码示例。如果您正苦于以下问题:Python SpacegroupAnalyzer.get_kpoint_weights方法的具体用法?Python SpacegroupAnalyzer.get_kpoint_weights怎么用?Python SpacegroupAnalyzer.get_kpoint_weights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.symmetry.analyzer.SpacegroupAnalyzer
的用法示例。
在下文中一共展示了SpacegroupAnalyzer.get_kpoint_weights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_kpoint_weights
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import get_kpoint_weights [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)