def test_classmethods(self): c = Cell.cubic(1) self.assertAlmostEqual(c.volume, 1.0, msg="Volume of cubic 1 == 1.0, got %s" % c.volume) c = Cell.tetragonal(2, 3) self.assertAlmostEqual(c.volume, 12.0, msg="Volume of tetragonal 2,3 == 12.0, got %s" % c.volume) c = Cell.orthorhombic(1, 2, 3) self.assertAlmostEqual(c.volume, 6.0, msg="Volume of orthorhombic 1,2,3 == 6.0, got %s" % c.volume)
def test_dspacing(self): c = Cell.cubic(1) cd = c.d_spacing(0.1) cds = list(cd.keys()) cds.sort() t = Cell() td = t.d_spacing(0.1) tds = list(td.keys()) tds.sort() self.assertEquals(cds, tds, msg="d-spacings are the same") for k in cds: self.assertEquals(cd[k], td[k], msg="plans are the same for d=%s" % k)
def test_dspacing(self): c = Cell.cubic(1) cd = c.d_spacing(0.1) cds = cd.keys() cds.sort() t = Cell() td = t.d_spacing(0.1) tds = td.keys() tds.sort() self.assertEquals(cds, tds, msg="d-spacings are the same") for k in cds: self.assertEquals(cd[k], td[k], msg="plans are the same for d=%s" % k)
def test_helium(self): a = 4.242 href = "A.F. Schuch and R.L. Mills, Phys. Rev. Lett., 1961, 6, 596." he = Cell.cubic(a) self.assert_(len(he.d_spacing(1)) == 15, msg="got 15 lines for He") he.save("He", "Helium", href, 1.0, UtilsTest.tempdir)