Example #1
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()))
Example #2
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))
Example #3
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)
Example #4
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())
Example #5
0
 def _get_point_group(self, space_group):
     return PointGroupFactory.createPointGroup(space_group[1:].replace('_', '/'))
Example #6
0
    def test_creation(self):
        self.assertRaises(ValueError, PointGroupFactory.createPointGroup, "none")

        PointGroupFactory.createPointGroup("m-3m")
Example #7
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)
Example #8
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))
Example #9
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)