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)
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)