本文整理汇总了Python中pymatgen.symmetry.analyzer.SpacegroupAnalyzer.apply_operation方法的典型用法代码示例。如果您正苦于以下问题:Python SpacegroupAnalyzer.apply_operation方法的具体用法?Python SpacegroupAnalyzer.apply_operation怎么用?Python SpacegroupAnalyzer.apply_operation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.symmetry.analyzer.SpacegroupAnalyzer
的用法示例。
在下文中一共展示了SpacegroupAnalyzer.apply_operation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_structure_transform
# 需要导入模块: from pymatgen.symmetry.analyzer import SpacegroupAnalyzer [as 别名]
# 或者: from pymatgen.symmetry.analyzer.SpacegroupAnalyzer import apply_operation [as 别名]
def test_structure_transform(self):
# Test trivial case
trivial = self.fit_r4.structure_transform(self.structure,
self.structure.copy())
self.assertArrayAlmostEqual(trivial, self.fit_r4)
# Test simple rotation
rot_symm_op = SymmOp.from_axis_angle_and_translation([1, 1, 1], 55.5)
rot_struct = self.structure.copy()
rot_struct.apply_operation(rot_symm_op)
rot_tensor = self.fit_r4.rotate(rot_symm_op.rotation_matrix)
trans_tensor = self.fit_r4.structure_transform(self.structure, rot_struct)
self.assertArrayAlmostEqual(rot_tensor, trans_tensor)
# Test supercell
bigcell = self.structure.copy()
bigcell.make_supercell([2, 2, 3])
trans_tensor = self.fit_r4.structure_transform(self.structure, bigcell)
self.assertArrayAlmostEqual(self.fit_r4, trans_tensor)
# Test rotated primitive to conventional for fcc structure
sn = self.get_structure("Sn")
sn_prim = SpacegroupAnalyzer(sn).get_primitive_standard_structure()
sn_prim.apply_operation(rot_symm_op)
rotated = self.fit_r4.rotate(rot_symm_op.rotation_matrix)
transformed = self.fit_r4.structure_transform(sn, sn_prim)
self.assertArrayAlmostEqual(rotated, transformed)