def test_to_from_dict(self): json_str = json.dumps(ReplaceSiteSpeciesTransformation({0:"Na"}).to_dict) t = transformation_from_json(json_str) s = t.apply_transformation(self.struct) self.assertEqual(s.formula, "Na1 Li3 O4")
def test_to_from_dict(self): json_str = json.dumps(PartialRemoveSitesTransformation([tuple(range(4))], [0.5]).to_dict) t = transformation_from_json(json_str) s = t.apply_transformation(self.struct) self.assertEqual(s.formula, "Li2 O4")
def test_to_from_dict(self): json_str = json.dumps(TranslateSitesTransformation([0], [0.1, 0.2, 0.3]).to_dict) t = transformation_from_json(json_str) s = t.apply_transformation(self.struct) self.assertTrue(np.allclose(s[0].frac_coords, [0.1, 0.2, 0.3]))
def test_to_from_dict(self): json_str = json.dumps(RemoveSitesTransformation(range(2)).to_dict) t = transformation_from_json(json_str) s = t.apply_transformation(self.struct) self.assertEqual(s.formula, "Li2 O4")