Beispiel #1
0
    def test_getLatticeSystem(self):
        pg_rhombohedral = PointGroupFactory.createPointGroup("3m r")
        pg_hexagonal = PointGroupFactory.createPointGroup("3m")

        self.assertEqual(pg_rhombohedral.getLatticeSystem(),
                         PointGroup.LatticeSystem.Rhombohedral)
        self.assertEqual(pg_hexagonal.getLatticeSystem(),
                         PointGroup.LatticeSystem.Hexagonal)
Beispiel #2
0
    def test_isInvariant_tolerance(self):
        pg3barHex = PointGroupFactory.createPointGroup('-3')
        pg3barRh = PointGroupFactory.createPointGroup('-3 r')

        cellHex = UnitCell(3, 3, 6, 90, 90, 120)
        cellRh = UnitCell(3, 3, 3, 75, 75, 75)

        self.assertTrue(pg3barHex.isInvariant(cellHex.getG()))
        self.assertFalse(pg3barHex.isInvariant(cellRh.getG()))

        self.assertTrue(pg3barRh.isInvariant(cellRh.getG()))
        self.assertFalse(pg3barRh.isInvariant(cellHex.getG()))
Beispiel #3
0
    def test_isInvariant_tolerance(self):
        pg3barHex = PointGroupFactory.createPointGroup('-3')
        pg3barRh = PointGroupFactory.createPointGroup('-3 r')

        cellHex = UnitCell(3, 3, 6, 90, 90, 120)
        cellRh = UnitCell(3, 3, 3, 75, 75, 75)

        self.assertTrue(pg3barHex.isInvariant(cellHex.getG()))
        self.assertFalse(pg3barHex.isInvariant(cellRh.getG()))

        self.assertTrue(pg3barRh.isInvariant(cellRh.getG()))
        self.assertFalse(pg3barRh.isInvariant(cellHex.getG()))
Beispiel #4
0
    def test_getReflectionFamily(self):
        hkl1 = V3D(0, 0, 1)
        hkl2 = V3D(-1, 0, 0)

        pg = PointGroupFactory.createPointGroup("m-3m")
        self.assertEqual(pg.getReflectionFamily(hkl1),
                         pg.getReflectionFamily(hkl2))
Beispiel #5
0
    def test_isEquivalent(self):
        hkl1 = V3D(1, 1, 1)
        hkl2 = V3D(-1, -1, -1)
        hkl3 = V3D(-1, -1, 2)

        pg = PointGroupFactory.createPointGroup("m-3m")
        self.assertTrue(pg.isEquivalent(hkl1, hkl2))
        self.assertFalse(pg.isEquivalent(hkl1, hkl3))
Beispiel #6
0
    def test_isEquivalent(self):
        hkl1 = V3D(1, 1, 1)
        hkl2 = V3D(-1, -1, -1)
        hkl3 = V3D(-1, -1, 2)

        pg = PointGroupFactory.createPointGroup("m-3m")
        self.assertTrue(pg.isEquivalent(hkl1, hkl2))
        self.assertFalse(pg.isEquivalent(hkl1, hkl3))
Beispiel #7
0
    def test_getEquivalents(self):
        hkl1 = V3D(1, 0, 0)
        hkl2 = V3D(-1, 0, 0)

        pg = PointGroupFactory.createPointGroup("-1")
        equivalents = pg.getEquivalents(hkl1)

        self.assertTrue(hkl1 in equivalents)
        self.assertTrue(hkl2 in equivalents)

        self.assertEqual(len(equivalents), 2)
Beispiel #8
0
    def test_getEquivalents(self):
        hkl1 = V3D(1, 0, 0)
        hkl2 = V3D(-1, 0, 0)

        pg = PointGroupFactory.createPointGroup("-1")
        equivalents = pg.getEquivalents(hkl1)

        self.assertTrue(hkl1 in equivalents)
        self.assertTrue(hkl2 in equivalents)

        self.assertEquals(len(equivalents), 2)
Beispiel #9
0
    def test_to_string(self):
        pg = PointGroupFactory.createPointGroup("m-3m")

        expected_str = "Point group with:\nLattice system: Cubic"\
                       "\nCrystal system: Cubic\nSymbol: m-3m"

        expected_repr = "PointGroupFactory.createPointGroup(\"m-3m\")"

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

        newPg = eval(pg.__repr__())
        self.assertEqual(pg.getHMSymbol(), newPg.getHMSymbol())
Beispiel #10
0
    def test_to_string(self):
        pg = PointGroupFactory.createPointGroup("m-3m")

        expected_str = "Point group with:\nLattice system: Cubic"\
                       "\nCrystal system: Cubic\nSymbol: m-3m"

        expected_repr = "PointGroupFactory.createPointGroup(\"m-3m\")"

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

        newPg = eval(pg.__repr__())
        self.assertEqual(pg.getHMSymbol(), newPg.getHMSymbol())
Beispiel #11
0
 def test_getInfo(self):
     pg = PointGroupFactory.createPointGroup("m-3m")
     self.assertEqual(pg.getName(), "m-3m (Cubic)")
     self.assertEqual(pg.getHMSymbol(), "m-3m")
     self.assertEqual(pg.getCrystalSystem(), PointGroup.CrystalSystem.Cubic)
Beispiel #12
0
 def _get_point_group(self, space_group):
     return PointGroupFactory.createPointGroup(space_group[1:].replace('_', '/'))
Beispiel #13
0
 def _get_point_group(self, space_group):
     return PointGroupFactory.createPointGroup(space_group[1:].replace(
         '_', '/'))
Beispiel #14
0
 def test_getInfo(self):
     pg = PointGroupFactory.createPointGroup("m-3m")
     self.assertEquals(pg.getName(), "m-3m (Cubic)")
     self.assertEquals(pg.getHMSymbol(), "m-3m")
     self.assertEquals(pg.getCrystalSystem(), PointGroup.CrystalSystem.Cubic)
Beispiel #15
0
    def test_creation(self):
        self.assertRaises(ValueError, PointGroupFactory.createPointGroup,
                          "none")

        PointGroupFactory.createPointGroup("m-3m")
Beispiel #16
0
    def test_creation(self):
        self.assertRaises(ValueError, PointGroupFactory.createPointGroup, "none")

        PointGroupFactory.createPointGroup("m-3m")
Beispiel #17
0
    def test_getLatticeSystem(self):
        pg_rhombohedral = PointGroupFactory.createPointGroup("3m r")
        pg_hexagonal = PointGroupFactory.createPointGroup("3m")

        self.assertEquals(pg_rhombohedral.getLatticeSystem(), PointGroup.LatticeSystem.Rhombohedral)
        self.assertEquals(pg_hexagonal.getLatticeSystem(), PointGroup.LatticeSystem.Hexagonal)
Beispiel #18
0
    def test_getReflectionFamily(self):
        hkl1 = V3D(0, 0, 1)
        hkl2 = V3D(-1, 0, 0)

        pg = PointGroupFactory.createPointGroup("m-3m")
        self.assertEquals(pg.getReflectionFamily(hkl1), pg.getReflectionFamily(hkl2))