本文整理汇总了Python中pymatgen.analysis.structure_matcher.StructureMatcher._get_supercell_size方法的典型用法代码示例。如果您正苦于以下问题:Python StructureMatcher._get_supercell_size方法的具体用法?Python StructureMatcher._get_supercell_size怎么用?Python StructureMatcher._get_supercell_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.analysis.structure_matcher.StructureMatcher
的用法示例。
在下文中一共展示了StructureMatcher._get_supercell_size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_supercell_size
# 需要导入模块: from pymatgen.analysis.structure_matcher import StructureMatcher [as 别名]
# 或者: from pymatgen.analysis.structure_matcher.StructureMatcher import _get_supercell_size [as 别名]
def test_get_supercell_size(self):
l = Lattice.cubic(1)
l2 = Lattice.cubic(0.9)
s1 = Structure(l, ["Mg", "Cu", "Ag", "Cu", "Ag"], [[0] * 3] * 5)
s2 = Structure(l2, ["Cu", "Cu", "Ag"], [[0] * 3] * 3)
sm = StructureMatcher(supercell_size="volume")
self.assertEqual(sm._get_supercell_size(s1, s2), (1, True))
self.assertEqual(sm._get_supercell_size(s2, s1), (1, True))
sm = StructureMatcher(supercell_size="num_sites")
self.assertEqual(sm._get_supercell_size(s1, s2), (2, False))
self.assertEqual(sm._get_supercell_size(s2, s1), (2, True))
sm = StructureMatcher(supercell_size="Ag")
self.assertEqual(sm._get_supercell_size(s1, s2), (2, False))
self.assertEqual(sm._get_supercell_size(s2, s1), (2, True))
sm = StructureMatcher(supercell_size="wfieoh")
self.assertRaises(ValueError, sm._get_supercell_size, s1, s2)
示例2: test_get_supercell_size
# 需要导入模块: from pymatgen.analysis.structure_matcher import StructureMatcher [as 别名]
# 或者: from pymatgen.analysis.structure_matcher.StructureMatcher import _get_supercell_size [as 别名]
def test_get_supercell_size(self):
l = Lattice.cubic(1)
l2 = Lattice.cubic(0.9)
s1 = Structure(l, ['Mg', 'Cu', 'Ag', 'Cu', 'Ag'], [[0] * 3] * 5)
s2 = Structure(l2, ['Cu', 'Cu', 'Ag'], [[0] * 3] * 3)
sm = StructureMatcher(supercell_size='volume')
self.assertEqual(sm._get_supercell_size(s1, s2),
(1, True))
self.assertEqual(sm._get_supercell_size(s2, s1),
(1, True))
sm = StructureMatcher(supercell_size='num_sites')
self.assertEqual(sm._get_supercell_size(s1, s2),
(2, False))
self.assertEqual(sm._get_supercell_size(s2, s1),
(2, True))
sm = StructureMatcher(supercell_size='Ag')
self.assertEqual(sm._get_supercell_size(s1, s2),
(2, False))
self.assertEqual(sm._get_supercell_size(s2, s1),
(2, True))
sm = StructureMatcher(supercell_size='wfieoh')
self.assertRaises(ValueError, sm._get_supercell_size, s1, s2)
示例3: test_get_supercell_size
# 需要导入模块: from pymatgen.analysis.structure_matcher import StructureMatcher [as 别名]
# 或者: from pymatgen.analysis.structure_matcher.StructureMatcher import _get_supercell_size [as 别名]
def test_get_supercell_size(self):
l = Lattice.cubic(1)
l2 = Lattice.cubic(0.9)
s1 = Structure(l, ['Mg', 'Cu', 'Ag', 'Cu', 'Ag'], [[0]*3]*5)
s2 = Structure(l2, ['Cu', 'Cu', 'Ag'], [[0]*3]*3)
sm = StructureMatcher(supercell_size='volume')
result = sm._get_supercell_size(s1, s2)
self.assertEqual(result[0], 1)
self.assertEqual(result[1], True)
result = sm._get_supercell_size(s2, s1)
self.assertEqual(result[0], 1)
self.assertEqual(result[1], True)
sm = StructureMatcher(supercell_size='num_sites')
result = sm._get_supercell_size(s1, s2)
self.assertEqual(result[0], 2)
self.assertEqual(result[1], False)
result = sm._get_supercell_size(s2, s1)
self.assertEqual(result[0], 2)
self.assertEqual(result[1], True)