本文整理汇总了Python中pymatgen.analysis.structure_matcher.StructureMatcher._match方法的典型用法代码示例。如果您正苦于以下问题:Python StructureMatcher._match方法的具体用法?Python StructureMatcher._match怎么用?Python StructureMatcher._match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.analysis.structure_matcher.StructureMatcher
的用法示例。
在下文中一共展示了StructureMatcher._match方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_match2
# 需要导入模块: from pymatgen.analysis.structure_matcher import StructureMatcher [as 别名]
# 或者: from pymatgen.analysis.structure_matcher.StructureMatcher import _match [as 别名]
def test_find_match2(self):
sm = StructureMatcher(ltol=0.2, stol=0.3, angle_tol=5,
primitive_cell=True, scale=True,
attempt_supercell=False)
l = Lattice.orthorhombic(1, 2, 3)
s1 = Structure(l, ['Si', 'Si'], [[0,0,0.1],[0,0,0.2]])
s2 = Structure(l, ['Si', 'Si'], [[0,0.1,0],[0,0.1,-0.95]])
s1, s2, fu, s1_supercell = sm._preprocess(s1, s2, False)
match = sm._match(s1, s2, fu, s1_supercell = False,
use_rms = True, break_on_match = False)
scale_matrix = match[2]
s2.make_supercell(scale_matrix)
s2.translate_sites(range(len(s2)), match[3])
self.assertAlmostEqual(np.sum(s2.frac_coords), 0.3)
self.assertAlmostEqual(np.sum(s2.frac_coords[:,:2]), 0)
示例2: test_find_match1
# 需要导入模块: from pymatgen.analysis.structure_matcher import StructureMatcher [as 别名]
# 或者: from pymatgen.analysis.structure_matcher.StructureMatcher import _match [as 别名]
def test_find_match1(self):
sm = StructureMatcher(ltol=0.2, stol=0.3, angle_tol=5,
primitive_cell=True, scale=True,
attempt_supercell=False)
l = Lattice.orthorhombic(1, 2, 3)
s1 = Structure(l, ['Si', 'Si', 'Ag'],
[[0,0,0.1],[0,0,0.2],[.7,.4,.5]])
s2 = Structure(l, ['Si', 'Si', 'Ag'],
[[0,0.1,0],[0,0.1,-0.95],[.7,.5,.375]])
s1, s2, fu, s1_supercell = sm._preprocess(s1, s2, False)
match = sm._match(s1, s2, fu, s1_supercell = True, use_rms = True, break_on_match = False)
scale_matrix = match[2]
s2.make_supercell(scale_matrix)
fc = s2.frac_coords + match[3]
fc -= np.round(fc)
self.assertAlmostEqual(np.sum(fc), 0.9)
self.assertAlmostEqual(np.sum(fc[:,:2]), 0.1)
cart_dist = np.sum(match[1] * (l.volume/3) ** (1/3))
self.assertAlmostEqual(cart_dist, 0.15)