當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。