Exemplo n.º 1
0
 def test_xsf_back_forth(self):
     c1 = self.cell
     cells = structure.xsf(xsf_structure(c1)).cells()
     assert len(cells) == 1
     c2 = cells[0]
     assert c1.size == c2.size
     testing.assert_allclose(c1.vectors / angstrom, c2.vectors / angstrom, atol=1e-6)
     testing.assert_allclose(c1.coordinates, c2.coordinates)
     testing.assert_equal(c1.values, c2.values)
Exemplo n.º 2
0
 def test_xsf_back_forth(self):
     c1 = self.cell
     cells = structure.xsf(xsf_structure(c1)).unitCells()
     assert len(cells) == 1
     c2 = cells[0]
     assert c1.size() == c2.size()
     testing.assert_allclose(c1.vectors/angstrom, c2.vectors/angstrom, atol = 1e-6)
     testing.assert_allclose(c1.coordinates, c2.coordinates)
     testing.assert_equal(c1.values, c2.values)
Exemplo n.º 3
0
    def test_xsf_back_forth_multi(self):
        c1 = []
        for i in range(10):
            c = self.cell.copy(coordinates=self.cell.coordinates + (numpy.random.rand(*self.cell.coordinates.shape) - .5) / 10)
            c1.append(c)
        c2 = structure.xsf(xsf_structure(*c1)).cells()

        for i, j in zip(c1, c2):
            assert i.size == j.size
            testing.assert_allclose(i.vectors / angstrom, j.vectors / angstrom, atol=1e-6)
            testing.assert_allclose(i.coordinates, j.coordinates)
            testing.assert_equal(i.values, j.values)
Exemplo n.º 4
0
 def test_xsf_back_forth_multi(self):
     c1 = []
     for i in range(10):
         c = self.cell.copy()
         c.coordinates += (numpy.random.rand(*c.coordinates.shape)-.5)/10
         c1.append(c)
     c2 = structure.xsf(xsf_structure(*c1)).unitCells()
     
     for i,j in zip(c1,c2):
         assert i.size() == j.size()
         testing.assert_allclose(i.vectors/angstrom, j.vectors/angstrom, atol = 1e-6)
         testing.assert_allclose(i.coordinates, j.coordinates)
         testing.assert_equal(i.values, j.values)
Exemplo n.º 5
0
 def setUp(self):
     with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"cases/structure.xsf.2.testcase"),'r') as f:
         self.parser = xsf(f.read())
Exemplo n.º 6
0
 def test_xsf_grid_back_forth(self):
     data = xsf_grid(self.grid, self.cell)
     g = structure.xsf(data).grids()[0]
     testing.assert_allclose(self.grid.values, g.values, atol=1e-7)
Exemplo n.º 7
0
 def setUp(self):
     with open(
             os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          "cases/structure.xsf.2.testcase"), 'r') as f:
         self.parser = xsf(f.read())
Exemplo n.º 8
0
 def test_xsf_grid_back_forth(self):
     data = xsf_grid(self.grid, self.cell)
     g = structure.xsf(data).grids()[0]
     testing.assert_allclose(self.grid.values, g.values, atol = 1e-7)