def test_get_sorted_structure(self):
     coords = list()
     coords.append([0, 0, 0])
     coords.append([0.75, 0.5, 0.75])
     s = IStructure(self.lattice, ["O", "Li"], coords, site_properties={"charge": [-2, 1]})
     sorted_s = s.get_sorted_structure()
     self.assertEqual(sorted_s[0].species_and_occu, Composition("Li"))
     self.assertEqual(sorted_s[1].species_and_occu, Composition("O"))
     self.assertEqual(sorted_s[0].charge, 1)
     self.assertEqual(sorted_s[1].charge, -2)
     s = IStructure(self.lattice, ["Se", "C", "Se", "C"], [[0] * 3, [0.5] * 3, [0.25] * 3, [0.75] * 3])
     self.assertEqual([site.specie.symbol for site in s.get_sorted_structure()], ["C", "C", "Se", "Se"])
Exemple #2
0
 def test_get_sorted_structure(self):
     coords = list()
     coords.append([0, 0, 0])
     coords.append([0.75, 0.5, 0.75])
     s = IStructure(self.lattice, ["O", "Li"],
                    coords,
                    site_properties={'charge': [-2, 1]})
     sorted_s = s.get_sorted_structure()
     self.assertEqual(sorted_s[0].species_and_occu, Composition("Li"))
     self.assertEqual(sorted_s[1].species_and_occu, Composition("O"))
     self.assertEqual(sorted_s[0].charge, 1)
     self.assertEqual(sorted_s[1].charge, -2)
     s = IStructure(self.lattice, ["Se", "C", "Se", "C"],
                    [[0] * 3, [0.5] * 3, [0.25] * 3, [0.75] * 3])
     self.assertEqual(
         [site.specie.symbol for site in s.get_sorted_structure()],
         ["C", "C", "Se", "Se"])