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()))
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))
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)
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())
def _get_point_group(self, space_group): return PointGroupFactory.createPointGroup(space_group[1:].replace( '_', '/'))
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)
def test_creation(self): self.assertRaises(ValueError, PointGroupFactory.createPointGroup, "none") PointGroupFactory.createPointGroup("m-3m")
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))
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)
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)
peaksFile = '%s%s/peaks_%i_%s.integrate'%(workDir,descriptorTOF, sampleRuns[-1], descriptorTOF) ellipseFile = '/SNS/users/ntv/integrate/corelli_beryl/combined_hexagonal_indexedonly.integrate' pg = PointGroupFactory.createPointGroup("6/mmm") ''' #Beta lactamase mutant sampleRuns = range(5921, 5931 + 1) workDir = '/SNS/users/ntv/dropbox/' descriptorBVG = 'beta_lac_3D_mbvg_mutant_newppl' descriptorTOF = 'beta_lac_lab_highres_mut2' peaksFile = '%s%s/peaks_combined_good.integrate' % (workDir, descriptorTOF) #peaksFile = '%s%s/peaks_%i_%s.integrate'%(workDir,descriptorTOF, sampleRuns[-1], descriptorTOF) #ellipseFile = '/SNS/users/ntv/integrate/mandi_betalactamase/MANDI_betalactamase_2.integrate' #ellipseFile = '/SNS/users/ntv/integrate/mandi_betalactamase/combined_triclinic.integrate' ellipseFile = '/SNS/users/ntv/integrate/mandi_beta_lactamase3/combined.integrate' sg = SpaceGroupFactory.createSpaceGroup("P 32 2 1") pg = PointGroupFactory.createPointGroupFromSpaceGroup(sg) ''' #pth sampleRuns = [870,872,873,874,875,876] workDir = '/SNS/users/ntv/dropbox/' descriptorBVG = 'pth_3d' descriptorTOF = 'pth_tof_secondRun' peaksFile = '%s%s/peaks_combined_good.integrate'%(workDir,descriptorTOF) #peaksFile = '%s%s/peaks_%i_%s.integrate'%(workDir,descriptorTOF, sampleRuns[-1], descriptorTOF) ellipseFile = '/SNS/users/ntv/integrate/mandi_pth/peaks_combined.integrate' sg = SpaceGroupFactory.createSpaceGroup("P 61 2 2") pg = PointGroupFactory.createPointGroupFromSpaceGroup(sg) ''' ''' #gfp sampleRuns = range(599,607+1)
def _get_point_group(self, space_group): return PointGroupFactory.createPointGroup(space_group[1:].replace('_', '/'))