|
15 | 15 | magnetic_deformation,
|
16 | 16 | )
|
17 | 17 | from pymatgen.core import Element, Lattice, Species, Structure
|
18 |
| -from pymatgen.io.cif import CifParser |
19 | 18 | from pymatgen.util.testing import TEST_FILES_DIR
|
20 | 19 |
|
21 | 20 | enum_cmd = which("enum.x") or which("multienum.x")
|
|
25 | 24 |
|
26 | 25 | class TestCollinearMagneticStructureAnalyzer(unittest.TestCase):
|
27 | 26 | def setUp(self):
|
28 |
| - parser = CifParser(f"{TEST_FILES_DIR}/Fe.cif") |
29 |
| - self.Fe = parser.get_structures()[0] |
| 27 | + self.Fe = Structure.from_file(f"{TEST_FILES_DIR}/Fe.cif", primitive=True) |
30 | 28 |
|
31 |
| - parser = CifParser(f"{TEST_FILES_DIR}/LiFePO4.cif") |
32 |
| - self.LiFePO4 = parser.get_structures()[0] |
| 29 | + self.LiFePO4 = Structure.from_file(f"{TEST_FILES_DIR}/LiFePO4.cif", primitive=True) |
33 | 30 |
|
34 |
| - parser = CifParser(f"{TEST_FILES_DIR}/Fe3O4.cif") |
35 |
| - self.Fe3O4 = parser.get_structures()[0] |
| 31 | + self.Fe3O4 = Structure.from_file(f"{TEST_FILES_DIR}/Fe3O4.cif", primitive=True) |
36 | 32 |
|
37 |
| - parser = CifParser(f"{TEST_FILES_DIR}/magnetic.ncl.example.GdB4.mcif") |
38 |
| - self.GdB4 = parser.get_structures()[0] |
| 33 | + self.GdB4 = Structure.from_file(f"{TEST_FILES_DIR}/magnetic.ncl.example.GdB4.mcif", primitive=True) |
39 | 34 |
|
40 |
| - parser = CifParser(f"{TEST_FILES_DIR}/magnetic.example.NiO.mcif") |
41 |
| - self.NiO_expt = parser.get_structures()[0] |
| 35 | + self.NiO_expt = Structure.from_file(f"{TEST_FILES_DIR}/magnetic.example.NiO.mcif", primitive=True) |
42 | 36 |
|
43 |
| - latt = Lattice.cubic(4.17) |
| 37 | + lattice = Lattice.cubic(4.17) |
44 | 38 | species = ["Ni", "O"]
|
45 | 39 | coords = [[0, 0, 0], [0.5, 0.5, 0.5]]
|
46 |
| - self.NiO = Structure.from_spacegroup(225, latt, species, coords) |
| 40 | + self.NiO = Structure.from_spacegroup(225, lattice, species, coords) |
47 | 41 |
|
48 |
| - latt = Lattice([[2.085, 2.085, 0.0], [0.0, -2.085, -2.085], [-2.085, 2.085, -4.17]]) |
| 42 | + lattice = Lattice([[2.085, 2.085, 0.0], [0.0, -2.085, -2.085], [-2.085, 2.085, -4.17]]) |
49 | 43 | species = ["Ni", "Ni", "O", "O"]
|
50 | 44 | coords = [[0.5, 0, 0.5], [0, 0, 0], [0.25, 0.5, 0.25], [0.75, 0.5, 0.75]]
|
51 |
| - self.NiO_AFM_111 = Structure(latt, species, coords, site_properties={"magmom": [-5, 5, 0, 0]}) |
| 45 | + self.NiO_AFM_111 = Structure(lattice, species, coords, site_properties={"magmom": [-5, 5, 0, 0]}) |
52 | 46 |
|
53 |
| - latt = Lattice([[2.085, 2.085, 0], [0, 0, -4.17], [-2.085, 2.085, 0]]) |
| 47 | + lattice = Lattice([[2.085, 2.085, 0], [0, 0, -4.17], [-2.085, 2.085, 0]]) |
54 | 48 | species = ["Ni", "Ni", "O", "O"]
|
55 | 49 | coords = [[0.5, 0.5, 0.5], [0, 0, 0], [0, 0.5, 0], [0.5, 0, 0.5]]
|
56 |
| - self.NiO_AFM_001 = Structure(latt, species, coords, site_properties={"magmom": [-5, 5, 0, 0]}) |
| 50 | + self.NiO_AFM_001 = Structure(lattice, species, coords, site_properties={"magmom": [-5, 5, 0, 0]}) |
57 | 51 |
|
58 |
| - latt = Lattice([[2.085, 2.085, 0], [0, 0, -4.17], [-2.085, 2.085, 0]]) |
| 52 | + lattice = Lattice([[2.085, 2.085, 0], [0, 0, -4.17], [-2.085, 2.085, 0]]) |
59 | 53 | species = ["Ni", "Ni", "O", "O"]
|
60 | 54 | coords = [[0.5, 0.5, 0.5], [0, 0, 0], [0, 0.5, 0], [0.5, 0, 0.5]]
|
61 |
| - self.NiO_AFM_001_opposite = Structure(latt, species, coords, site_properties={"magmom": [5, -5, 0, 0]}) |
| 55 | + self.NiO_AFM_001_opposite = Structure(lattice, species, coords, site_properties={"magmom": [5, -5, 0, 0]}) |
62 | 56 |
|
63 |
| - latt = Lattice([[2.085, 2.085, 0], [0, 0, -4.17], [-2.085, 2.085, 0]]) |
| 57 | + lattice = Lattice([[2.085, 2.085, 0], [0, 0, -4.17], [-2.085, 2.085, 0]]) |
64 | 58 | species = ["Ni", "Ni", "O", "O"]
|
65 | 59 | coords = [[0.5, 0.5, 0.5], [0, 0, 0], [0, 0.5, 0], [0.5, 0, 0.5]]
|
66 |
| - self.NiO_unphysical = Structure(latt, species, coords, site_properties={"magmom": [-3, 0, 0, 0]}) |
| 60 | + self.NiO_unphysical = Structure(lattice, species, coords, site_properties={"magmom": [-3, 0, 0, 0]}) |
67 | 61 |
|
68 | 62 | def test_get_representations(self):
|
69 | 63 | # tests to convert between storing magnetic moment information
|
|
0 commit comments