当前位置: 首页>>代码示例>>Python>>正文


Python SpaceGroupFactory.createSpaceGroup方法代码示例

本文整理汇总了Python中mantid.geometry.SpaceGroupFactory.createSpaceGroup方法的典型用法代码示例。如果您正苦于以下问题:Python SpaceGroupFactory.createSpaceGroup方法的具体用法?Python SpaceGroupFactory.createSpaceGroup怎么用?Python SpaceGroupFactory.createSpaceGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mantid.geometry.SpaceGroupFactory的用法示例。


在下文中一共展示了SpaceGroupFactory.createSpaceGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _generate_UBList

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def _generate_UBList(self):
        CreateSingleValuedWorkspace(OutputWorkspace='__ub')
        LoadIsawUB('__ub',self.getProperty("UBMatrix").value)
        ub=mtd['__ub'].sample().getOrientedLattice().getUB().copy()
        DeleteWorkspace(Workspace='__ub')

        symOps = self.getProperty("SymmetryOps").value
        if symOps:
            try:
                symOps = SpaceGroupFactory.subscribedSpaceGroupSymbols(int(symOps))[0]
            except ValueError:
                pass
            if SpaceGroupFactory.isSubscribedSymbol(symOps):
                symOps = SpaceGroupFactory.createSpaceGroup(symOps).getSymmetryOperations()
            else:
                symOps = SymmetryOperationFactory.createSymOps(symOps)
            logger.information('Using symmetries: '+str([sym.getIdentifier() for sym in symOps]))

            ub_list=[]
            for sym in symOps:
                UBtrans = np.zeros((3,3))
                UBtrans[0] = sym.transformHKL([1,0,0])
                UBtrans[1] = sym.transformHKL([0,1,0])
                UBtrans[2] = sym.transformHKL([0,0,1])
                UBtrans=np.matrix(UBtrans.T)
                ub_list.append(ub*UBtrans)
            return ub_list
        else:
            return [ub]
开发者ID:stuartcampbell,项目名称:mantid,代码行数:31,代码来源:SingleCrystalDiffuseReduction.py

示例2: test_isAllowedUnitCell_cubic

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_isAllowedUnitCell_cubic(self):
        cubic = UnitCell(6, 6, 6)
        tetragonal = UnitCell(6, 6, 6.01)
        sg = SpaceGroupFactory.createSpaceGroup('P m -3')

        self.assertTrue(sg.isAllowedUnitCell(cubic))
        self.assertFalse(sg.isAllowedUnitCell(tetragonal))
开发者ID:rosswhitfield,项目名称:mantid,代码行数:9,代码来源:SpaceGroupTest.py

示例3: test_isAllowedUnitCell_trigonal

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_isAllowedUnitCell_trigonal(self):
        rhombohedral = UnitCell(5, 5, 5, 80, 80, 80)
        hexagonal = UnitCell(5, 5, 4, 90, 90, 120)

        sgRh = SpaceGroupFactory.createSpaceGroup('R -3 c :r')
        sgHex = SpaceGroupFactory.createSpaceGroup('R -3 c')

        sgP6m = SpaceGroupFactory.createSpaceGroup('P 6/m')

        self.assertTrue(sgRh.isAllowedUnitCell(rhombohedral))
        self.assertFalse(sgRh.isAllowedUnitCell(hexagonal))

        self.assertTrue(sgHex.isAllowedUnitCell(hexagonal))
        self.assertFalse(sgHex.isAllowedUnitCell(rhombohedral))

        self.assertTrue(sgP6m.isAllowedUnitCell(hexagonal))
        self.assertFalse(sgP6m.isAllowedUnitCell(rhombohedral))
开发者ID:rosswhitfield,项目名称:mantid,代码行数:19,代码来源:SpaceGroupTest.py

示例4: test_equivalentPositions_Monoclinic

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Monoclinic(self):
        wyckoffs = [([0.3, 0.4, 0.45], 8),
                    ([0.0, 0.4, 0.25], 4),
                    ([0.25, 0.25, 0.5], 4),
                    ([0.25, 0.25, 0.0], 4),
                    ([0.0, 0.5, 0.0], 4),
                    ([0.0, 0.0, 0.0], 4)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("C 1 2/c 1")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:12,代码来源:SpaceGroupTest.py

示例5: test_interface

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_interface(self):
        spaceGroup = SpaceGroupFactory.createSpaceGroup("P -1")
        self.assertEquals(spaceGroup.getHMSymbol(), "P -1")
        self.assertEquals(spaceGroup.getOrder(), 2)

        symOpStrings = spaceGroup.getSymmetryOperationStrings()

        self.assertEqual(len(symOpStrings), 2)
        self.assertTrue("x,y,z" in symOpStrings)
        self.assertTrue("-x,-y,-z" in symOpStrings)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:12,代码来源:SpaceGroupTest.py

示例6: test_equivalentPositions_Trigonal

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Trigonal(self):
        wyckoffs = [([0.3, 0.4, 0.45], 36),
                    ([0.3, 0.0, 0.25], 18),
                    ([0.5, 0.0, 0.0], 18),
                    ([0.0, 0.0, 0.45], 12),
                    ([0.0, 0.0, 0.0], 6),
                    ([0.0, 0.0, 0.25], 6)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("R -3 c")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:12,代码来源:SpaceGroupTest.py

示例7: test_creationFromPythonList

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_creationFromPythonList(self):
        spaceGroup = SpaceGroupFactory.createSpaceGroup("P 63/m m c")

        # Construct python list of only certain symmetry operations
        symOps = [x for x in spaceGroup.getSymmetryOperations() if x.getOrder() == 6]

        group = Group(symOps)
        self.assertEqual(group.getOrder(), len(symOps))

        # But the constructed group is not actually a group
        self.assertFalse(group.isGroup())
开发者ID:mantidproject,项目名称:mantid,代码行数:13,代码来源:GroupTest.py

示例8: test_equivalentPositions_Tetragonal

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Tetragonal(self):
        wyckoffs = [([0.3, 0.4, 0.45], 32),
                    ([0.3, 0.3, 0.25], 16),
                    ([0.25, 0.4, 0.125], 16),
                    ([0.0, 0.0, 0.45], 16),
                    ([0.0, 0.25, 0.125], 16),
                    ([0.0, 0.0, 0.25], 8),
                    ([0.0, 0.0, 0.0], 8)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("I 41/a c d")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:13,代码来源:SpaceGroupTest.py

示例9: test_equivalentPositions_Cubic

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Cubic(self):
        wyckoffs = [([0.3, 0.4, 0.45], 96),
                    ([0.3, 0.25, 0.25], 48),
                    ([0.3, 0.0, 0.0], 48),
                    ([0.3, 0.3, 0.3], 32),
                    ([0.25, 0.0, 0.0], 24),
                    ([0.0, 0.25, 0.25], 24),
                    ([0.25, 0.25, 0.25], 8),
                    ([0.0, 0.0, 0.0], 8)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("F -4 3 c")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:14,代码来源:SpaceGroupTest.py

示例10: test_to_string

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_to_string(self):
        spaceGroup = SpaceGroupFactory.createSpaceGroup("F -4 3 c")

        expected_str = "Space group with Hermann-Mauguin symbol: "\
                       "F -4 3 c"
        expected_repr = "SpaceGroupFactory.createSpaceGroup(\"F -4 3 c\")"

        self.assertEqual(expected_str, str(spaceGroup))
        self.assertEqual(expected_repr, spaceGroup.__repr__())

        newSpaceGroup = eval(spaceGroup.__repr__())
        self.assertEqual(spaceGroup.getHMSymbol(), newSpaceGroup.getHMSymbol())
开发者ID:DanNixon,项目名称:mantid,代码行数:14,代码来源:SpaceGroupTest.py

示例11: test_equivalentPositions_Triclinic

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Triclinic(self):
        wyckoffs = [([0.3, 0.4, 0.45], 2),
                    ([0.5, 0.5, 0.5], 1),
                    ([0.0, 0.5, 0.5], 1),
                    ([0.5, 0.0, 0.5], 1),
                    ([0.5, 0.5, 0.0], 1),
                    ([0.5, 0.0, 0.0], 1),
                    ([0.0, 0.5, 0.0], 1),
                    ([0.0, 0.0, 0.5], 1),
                    ([0.0, 0.0, 0.0], 1)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("P -1")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:15,代码来源:SpaceGroupTest.py

示例12: _getSpaceGroupFromString

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def _getSpaceGroupFromString(self, cifData):
        # Try two possibilities for space group symbol. If neither is present, throw a RuntimeError.
        rawSpaceGroupSymbol = [str(cifData[x]) for x in
                               [u'_space_group_name_h-m_alt', u'_symmetry_space_group_name_h-m'] if
                               x in cifData.keys()]

        if len(rawSpaceGroupSymbol) == 0:
            raise RuntimeError('No space group symbol in CIF.')

        cleanSpaceGroupSymbol = self._getCleanSpaceGroupSymbol(rawSpaceGroupSymbol[0])

        # If the symbol is not registered, throw as well.
        return SpaceGroupFactory.createSpaceGroup(cleanSpaceGroupSymbol).getHMSymbol()
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:15,代码来源:LoadCIF.py

示例13: test_equivalentPositions_Orthorhombic

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Orthorhombic(self):
        wyckoffs = [([0.3, 0.4, 0.45], 16),
                    ([0.3, 0.25, 0.45], 8),
                    ([0.0, 0.4, 0.45], 8),
                    ([0.25, 0.4, 0.25], 8),
                    ([0.3, 0.0, 0.0], 8),
                    ([0.0, 0.25, 0.45], 4),
                    ([0.25, 0.25, 0.75], 4),
                    ([0.25, 0.25, 0.25], 4),
                    ([0.0, 0.0, 0.5], 4),
                    ([0.0, 0.0, 0.0], 4)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("I m m a")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:16,代码来源:SpaceGroupTest.py

示例14: _getSpaceGroupFromNumber

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def _getSpaceGroupFromNumber(self, cifData):
        spaceGroupNumber = [int(cifData[x]) for x in
                            [u'_space_group_it_number', u'_symmetry_int_tables_number'] if
                            x in cifData.keys()]

        if len(spaceGroupNumber) == 0:
            raise RuntimeError('No space group symbol in CIF.')

        possibleSpaceGroupSymbols = SpaceGroupFactory.subscribedSpaceGroupSymbols(spaceGroupNumber[0])

        if len(possibleSpaceGroupSymbols) != 1:
            raise RuntimeError(
                'Can not use space group number to determine space group for no. {0}'.format(spaceGroupNumber))

        return SpaceGroupFactory.createSpaceGroup(possibleSpaceGroupSymbols[0]).getHMSymbol()
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:17,代码来源:LoadCIF.py

示例15: test_equivalentPositions_Hexagonal

# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import createSpaceGroup [as 别名]
    def test_equivalentPositions_Hexagonal(self):
        wyckoffs = [([0.3, 0.4, 0.45], 24),
                    ([0.3, 0.6, 0.45], 12),
                    ([0.3, 0.4, 0.25], 12),
                    ([0.3, 0.0, 0.0], 12),
                    ([0.3, 0.6, 0.25], 6),
                    ([0.5, 0.0, 0.0], 6),
                    ([1. / 3., 2. / 3., 0.45], 4),
                    ([0.0, 0.0, 0.45], 4),
                    ([1. / 3, 2. / 3., 0.75], 2),
                    ([1. / 3, 2. / 3., 0.25], 2),
                    ([0.0, 0.0, 0.25], 2),
                    ([0.0, 0.0, 0.0], 2)]

        spaceGroup = SpaceGroupFactory.createSpaceGroup("P 63/m m c")
        self.checkWyckoffPositions(spaceGroup, wyckoffs)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:18,代码来源:SpaceGroupTest.py


注:本文中的mantid.geometry.SpaceGroupFactory.createSpaceGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。