Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate test files by modules and collect test files csv/cif into folders #3746

Merged
merged 112 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
613396e
collect `csv`
DanielYang59 Apr 11, 2024
ffa466f
move json files
DanielYang59 Apr 11, 2024
f5bd4f2
re replace of json paths
DanielYang59 Apr 11, 2024
19e6fe6
move cif files
DanielYang59 Apr 11, 2024
42b146d
move cif files
DanielYang59 Apr 11, 2024
77a06d4
fix some path
DanielYang59 Apr 11, 2024
e73e604
fix another cif path
DanielYang59 Apr 11, 2024
1930d8b
fix test_cli
DanielYang59 Apr 11, 2024
b406c01
Merge branch 'master' into cleanup-test-files
DanielYang59 Apr 12, 2024
e06eac4
Merge branch 'master' into cleanup-test-files
DanielYang59 Apr 14, 2024
e7beea0
move vasp to io.vasp
DanielYang59 Apr 18, 2024
7ea1e0c
Merge branch master into ruff-typing
DanielYang59 Apr 18, 2024
74d26b3
Merge branch 'master' into cleanup-test-files
DanielYang59 Apr 18, 2024
259d2a3
fix some vasp path
DanielYang59 Apr 18, 2024
e31b4cf
fix some vasp path
DanielYang59 Apr 18, 2024
1b54d0f
Merge branch 'master' into cleanup-test-files
DanielYang59 Apr 18, 2024
506aa13
pre-commit auto-fixes
pre-commit-ci[bot] Apr 18, 2024
a7639af
define global TEST_DIR
DanielYang59 Apr 18, 2024
41f3928
relocate `abinit`
DanielYang59 Apr 18, 2024
a21d960
relocate `cp2k`
DanielYang59 Apr 18, 2024
c5c0987
relocate `exciting`
DanielYang59 Apr 18, 2024
71afc3f
relocate `feff`
DanielYang59 Apr 18, 2024
7266f79
relocate `lammps`
DanielYang59 Apr 18, 2024
452998f
relocate `pwmat`
DanielYang59 Apr 18, 2024
f949a4d
fix vasp path
DanielYang59 Apr 18, 2024
eb040a4
relocae qchem
DanielYang59 Apr 18, 2024
9c651f0
relocate `xtb`
DanielYang59 Apr 18, 2024
d311ab2
relocate `adf`
DanielYang59 Apr 18, 2024
409e889
relocate `atat/mcsqs`
DanielYang59 Apr 18, 2024
b7d4afe
relocate cssr
DanielYang59 Apr 18, 2024
070d707
relocate fiesta
DanielYang59 Apr 18, 2024
84f7068
relocate `nwchem`
DanielYang59 Apr 18, 2024
5d264a5
relocate `packmol`
DanielYang59 Apr 18, 2024
a624b10
relocate `res`
DanielYang59 Apr 18, 2024
1ea3a9a
fix some qchem path
DanielYang59 Apr 18, 2024
70f8060
fix some `qchem` paths
DanielYang59 Apr 18, 2024
cbefbb8
relocate `xyz/shengbte/wannier90`
DanielYang59 Apr 18, 2024
f72271c
fix some paths
DanielYang59 Apr 18, 2024
eca2aa1
Merge branch 'master' into cleanup-test-files
DanielYang59 Apr 18, 2024
90aa83f
relocate bader
DanielYang59 Apr 18, 2024
6e76fe7
relocate chargemol
DanielYang59 Apr 18, 2024
fff4c43
relocate critic2
DanielYang59 Apr 18, 2024
41314e7
Revert "relocate `xyz/shengbte/wannier90`"
DanielYang59 Apr 18, 2024
59f5566
relocate shengbte
DanielYang59 Apr 18, 2024
4109a08
relocate wannier90
DanielYang59 Apr 18, 2024
7e64b5b
fix some paths
DanielYang59 Apr 18, 2024
3a08631
relocate `boltztrap(2)`
DanielYang59 Apr 18, 2024
ade3ad6
fix bader path
DanielYang59 Apr 18, 2024
f420e2e
relocate apps.borg
DanielYang59 Apr 18, 2024
6301f95
relocate cohp
DanielYang59 Apr 18, 2024
2aff0a8
fix path
DanielYang59 Apr 18, 2024
40b4522
fix borg
DanielYang59 Apr 19, 2024
fa416fe
fix cohp
DanielYang59 Apr 19, 2024
01fa580
relocate `chemenv`
DanielYang59 Apr 19, 2024
93f5910
relocate `graphs`
DanielYang59 Apr 19, 2024
50dc67e
relocate openff
DanielYang59 Apr 19, 2024
703e679
relocate `correction_calculator`
DanielYang59 Apr 19, 2024
1181cf0
fix paths
DanielYang59 Apr 19, 2024
ac7d358
relocate `fragmenter_files`
DanielYang59 Apr 19, 2024
deee771
relocate `functional_groups`
DanielYang59 Apr 19, 2024
cd0ec50
relocate `grain_boundary`
DanielYang59 Apr 19, 2024
b8a0140
relocate `magnetic_orderings`
DanielYang59 Apr 19, 2024
f026392
fix paths
DanielYang59 Apr 19, 2024
bcef250
relocate fixture nmr for vasp
DanielYang59 Apr 19, 2024
e94a090
relocate site_symmetries
DanielYang59 Apr 19, 2024
84fc016
relocate space_group_structs
DanielYang59 Apr 19, 2024
a6d3bca
relocate `spectrum_test`
DanielYang59 Apr 19, 2024
5b1d7df
relocate `struct_predictor`
DanielYang59 Apr 19, 2024
eb6b433
relocate `xr` and `core.trajectory`
DanielYang59 Apr 19, 2024
497e093
relocate compatibility
DanielYang59 Apr 19, 2024
255ccbd
relocate pwscf
DanielYang59 Apr 19, 2024
8d74a93
relocate `io`
DanielYang59 Apr 19, 2024
c381d96
relocate `gruneisen`
DanielYang59 Apr 19, 2024
2811b48
relocate `mcif`
DanielYang59 Apr 19, 2024
630a6c5
relocate `phonon`
DanielYang59 Apr 19, 2024
cf5ee18
relocate `thermal_displacement_matrices` under `phonon`
DanielYang59 Apr 19, 2024
b9aa549
relocate `molecule_matcher`
DanielYang59 Apr 19, 2024
65f3c7c
remove seemingly unused `qc_aimd`
DanielYang59 Apr 19, 2024
fb79aad
revert `new_qchem_files` back to `molecules`
DanielYang59 Apr 19, 2024
bb152f5
fix path
DanielYang59 Apr 19, 2024
1abd1a6
relocate `structural_change`
DanielYang59 Apr 19, 2024
549371c
remove unused var
DanielYang59 Apr 19, 2024
968c42e
fix some qchem path
DanielYang59 Apr 19, 2024
bea2135
fix paths
DanielYang59 Apr 19, 2024
eeaf70b
separate `xyz` files by modules
DanielYang59 Apr 19, 2024
48e0d3b
relocate `analysis.cost`
DanielYang59 Apr 19, 2024
4884cfc
move files out of tests
DanielYang59 Apr 19, 2024
8576ffa
remove duplicate cohp test file
DanielYang59 Apr 19, 2024
360c67c
move `qchem` files out of tests
DanielYang59 Apr 19, 2024
b369adb
fix path
DanielYang59 Apr 19, 2024
0236107
move files out of tests
DanielYang59 Apr 19, 2024
3e6010a
fix path
DanielYang59 Apr 19, 2024
6d997b3
relocate json for `structure_matcher`
DanielYang59 Apr 19, 2024
ae293ef
relocate `bandstructure` json
DanielYang59 Apr 19, 2024
4477ac2
relocate json for `apps.battery`
DanielYang59 Apr 19, 2024
6b141fc
relocate json for `dos`
DanielYang59 Apr 19, 2024
f35f230
fix path
DanielYang59 Apr 19, 2024
08e3b99
relocate more json
DanielYang59 Apr 19, 2024
db51b25
fix typo in path
DanielYang59 Apr 19, 2024
22b0ae9
relocate more json files
DanielYang59 Apr 19, 2024
02d69ac
fix path
DanielYang59 Apr 19, 2024
80c0309
fix typo in path
DanielYang59 Apr 19, 2024
6557c36
one last chunk of json
DanielYang59 Apr 19, 2024
8592eb8
recover deleted json file
DanielYang59 Apr 19, 2024
62032ae
fix path
DanielYang59 Apr 19, 2024
5b2cbd1
fix typo in path
DanielYang59 Apr 19, 2024
29cde64
clean up `molecules`
DanielYang59 Apr 19, 2024
aca1b31
fix wrong location
DanielYang59 Apr 19, 2024
d16f937
fix quasirrho
DanielYang59 Apr 19, 2024
dd0c91e
fix qchem path
DanielYang59 Apr 19, 2024
ed5ab95
fix path
DanielYang59 Apr 19, 2024
d32b7d9
remove seemings unused files from qchem
DanielYang59 Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions pymatgen/util/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
MODULE_DIR = Path(__file__).absolute().parent
STRUCTURES_DIR = MODULE_DIR / ".." / "structures"
TEST_FILES_DIR = Path(SETTINGS.get("PMG_TEST_FILES_DIR", f"{ROOT}/tests/files"))
VASP_IN_DIR = f"{TEST_FILES_DIR}/vasp/inputs"
VASP_OUT_DIR = f"{TEST_FILES_DIR}/vasp/outputs"
VASP_IN_DIR = f"{TEST_FILES_DIR}/io/vasp/inputs"
VASP_OUT_DIR = f"{TEST_FILES_DIR}/io/vasp/outputs"
# fake POTCARs have original header information, meaning properties like number of electrons,
# nuclear charge, core radii, etc. are unchanged (important for testing) while values of the and
# pseudopotential kinetic energy corrections are scrambled to avoid VASP copyright infringement
Expand Down
4 changes: 2 additions & 2 deletions tests/alchemy/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_as_from_dict(self):

class TestRemoveDuplicatesFilter(TestCase):
def setUp(self):
with open(f"{TEST_FILES_DIR}/TiO2_entries.json") as file:
with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json") as file:
entries = json.load(file, cls=MontyDecoder)
self._struct_list = [entry.structure for entry in entries]
self._sm = StructureMatcher()
Expand All @@ -91,7 +91,7 @@ def test_as_from_dict(self):

class TestRemoveExistingFilter(TestCase):
def setUp(self):
with open(f"{TEST_FILES_DIR}/TiO2_entries.json") as file:
with open(f"{TEST_FILES_DIR}/entries/TiO2_entries.json") as file:
entries = json.load(file, cls=MontyDecoder)
self._struct_list = [entry.structure for entry in entries]
self._sm = StructureMatcher()
Expand Down
4 changes: 3 additions & 1 deletion tests/alchemy/test_materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from pymatgen.util.provenance import StructureNL
from pymatgen.util.testing import FAKE_POTCAR_DIR, TEST_FILES_DIR, PymatgenTest

TEST_DIR = f"{TEST_FILES_DIR}/alchemy"


class TestTransformedStructure(PymatgenTest):
def setUp(self):
Expand Down Expand Up @@ -61,7 +63,7 @@ def test_final_structure(self):
assert isinstance(deepcopy(self.trans), TransformedStructure)

def test_from_dict(self):
with open(f"{TEST_FILES_DIR}/transformations.json") as file:
with open(f"{TEST_DIR}/transformations.json") as file:
dct = json.load(file)
dct["other_parameters"] = {"tags": ["test"]}
ts = TransformedStructure.from_dict(dct)
Expand Down
2 changes: 1 addition & 1 deletion tests/alchemy/test_transmuters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestCifTransmuter(PymatgenTest):
def test_init(self):
trafos = [SubstitutionTransformation({"Fe": "Mn", "Fe2+": "Mn2+"})]
tsc = CifTransmuter.from_filenames([f"{TEST_FILES_DIR}/MultiStructure.cif"], trafos)
tsc = CifTransmuter.from_filenames([f"{TEST_FILES_DIR}/cif/MultiStructure.cif"], trafos)
assert len(tsc) == 2
expected = {"Mn", "O", "Li", "P"}
for s in tsc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def test_real_systems(self):
assert cc.periodicity == "2D"

# Connectivity of Li4Fe3Mn1(PO4)4
struct = Structure.from_file(f"{TEST_FILES_DIR}/Li4Fe3Mn1(PO4)4.cif")
struct = Structure.from_file(f"{TEST_FILES_DIR}/cif/Li4Fe3Mn1(PO4)4.cif")
lgf.setup_structure(structure=struct)
se = lgf.compute_structure_environments(only_atoms=["Li", "Fe", "Mn", "P"], maximum_distance_factor=1.2)
lse = LightStructureEnvironments.from_structure_environments(strategy=strategy, structure_environments=se)
Expand Down Expand Up @@ -837,7 +837,7 @@ def test_real_systems(self):
assert ccs_periodicities == {"0D", "2D"}

def test_coordination_sequences(self):
BaTiO3_se_fpath = f"{TEST_FILES_DIR}/chemenv/structure_environments/se_mp-5020.json"
BaTiO3_se_fpath = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments/se_mp-5020.json"
with open(BaTiO3_se_fpath) as file:
dct = json.load(file)
struct_envs = StructureEnvironments.from_dict(dct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class TestStructureConnectivity(PymatgenTest):
def test_serialization(self):
BaTiO3_se_fpath = f"{TEST_FILES_DIR}/chemenv/structure_environments/se_mp-5020.json"
BaTiO3_se_fpath = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments/se_mp-5020.json"
with open(BaTiO3_se_fpath) as file:
dd = json.load(file)
struct_envs = StructureEnvironments.from_dict(dd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

__author__ = "waroquiers"

json_dir = f"{TEST_FILES_DIR}/chemenv/json"
json_dir = f"{TEST_FILES_DIR}/analysis/chemenv/json"


class TestCoordinationGeometryFinder(PymatgenTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

__author__ = "waroquiers"

json_dir = f"{TEST_FILES_DIR}/chemenv/json"
struct_env_dir = f"{TEST_FILES_DIR}/chemenv/structure_environments"
json_dir = f"{TEST_FILES_DIR}/analysis/chemenv/json"
struct_env_dir = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments"


class TestReadWriteChemenv(PymatgenTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

__author__ = "waroquiers"

struct_env_dir = f"{TEST_FILES_DIR}/chemenv/structure_environments"
TEST_DIR = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments"


class TestStructureEnvironments(PymatgenTest):
def test_structure_environments(self):
with open(f"{struct_env_dir}/se_mp-7000.json") as file:
with open(f"{TEST_DIR}/se_mp-7000.json") as file:
dct = json.load(file)

struct_envs = StructureEnvironments.from_dict(dct)
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_structure_environments(self):
assert ce != ce2

def test_light_structure_environments(self):
with open(f"{struct_env_dir}/se_mp-7000.json") as file:
with open(f"{TEST_DIR}/se_mp-7000.json") as file:
dct = json.load(file)

struct_envs = StructureEnvironments.from_dict(dct)
Expand Down Expand Up @@ -220,8 +220,7 @@ def test_light_structure_environments(self):

def test_from_structure_environments(self):
# https://github.com/materialsproject/pymatgen/issues/2756
mp_id = "mp-554015"
struct = Structure.from_file(f"{TEST_FILES_DIR}/{mp_id}.json.gz")
struct = Structure.from_file(f"{TEST_DIR}/mp-554015.json.gz")
strategy = SimplestChemenvStrategy(distance_cutoff=1.4, angle_cutoff=0.3)
local_geom_finder = LocalGeometryFinder()
local_geom_finder.setup_structure(structure=struct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

__author__ = "waroquiers"

img_files_dir = f"{TEST_FILES_DIR}/chemenv/images"
img_files_dir = f"{TEST_FILES_DIR}/analysis/chemenv/images"


class TestVoronoiContainer(PymatgenTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

__author__ = "waroquiers"

struct_env_dir = f"{TEST_FILES_DIR}/chemenv/structure_environments"
struct_env_dir = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments"


class FakeNbSet:
Expand Down
2 changes: 1 addition & 1 deletion tests/analysis/chemenv/utils/test_chemenv_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

__author__ = "waroquiers"

config_file_dir = f"{TEST_FILES_DIR}/chemenv/config"
config_file_dir = f"{TEST_FILES_DIR}/analysis/chemenv/config"


class TestChemenvConfig(PymatgenTest):
Expand Down
12 changes: 7 additions & 5 deletions tests/analysis/elasticity/test_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from pymatgen.core.units import FloatWithUnit
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest

TEST_DIR = f"{TEST_FILES_DIR}/analysis/elasticity"


class TestElasticTensor(PymatgenTest):
def setUp(self):
Expand Down Expand Up @@ -65,10 +67,10 @@ def setUp(self):
)

self.elastic_tensor_1 = ElasticTensor(self.ft)
filepath = f"{TEST_FILES_DIR}/Sn_def_stress.json"
filepath = f"{TEST_DIR}/Sn_def_stress.json"
with open(filepath) as file:
self.def_stress_dict = json.load(file)
with open(f"{TEST_FILES_DIR}/test_toec_data.json") as file:
with open(f"{TEST_DIR}/test_toec_data.json") as file:
self.toec_dict = json.load(file)
self.structure = self.get_structure("Sn")

Expand Down Expand Up @@ -256,7 +258,7 @@ def test_energy_density(self):

class TestElasticTensorExpansion(PymatgenTest):
def setUp(self):
with open(f"{TEST_FILES_DIR}/test_toec_data.json") as file:
with open(f"{TEST_DIR}/test_toec_data.json") as file:
self.data_dict = json.load(file)
self.strains = [Strain(sm) for sm in self.data_dict["strains"]]
self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]]
Expand Down Expand Up @@ -357,7 +359,7 @@ def test_get_yield_stress(self):

class TestNthOrderElasticTensor(PymatgenTest):
def setUp(self):
with open(f"{TEST_FILES_DIR}/test_toec_data.json") as file:
with open(f"{TEST_DIR}/test_toec_data.json") as file:
self.data_dict = json.load(file)
self.strains = [Strain(sm) for sm in self.data_dict["strains"]]
self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]]
Expand Down Expand Up @@ -396,7 +398,7 @@ class TestDiffFit(PymatgenTest):
"""Tests various functions related to diff fitting."""

def setUp(self):
with open(f"{TEST_FILES_DIR}/test_toec_data.json") as file:
with open(f"{TEST_DIR}/test_toec_data.json") as file:
self.data_dict = json.load(file)
self.strains = [Strain(sm) for sm in self.data_dict["strains"]]
self.pk_stresses = [Stress(d) for d in self.data_dict["pk_stresses"]]
Expand Down
2 changes: 1 addition & 1 deletion tests/analysis/ferroelectricity/test_polarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from pymatgen.io.vasp.outputs import Outcar
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest

TEST_DIR = f"{TEST_FILES_DIR}/vasp/fixtures/BTO_221_99_polarization"
TEST_DIR = f"{TEST_FILES_DIR}/io/vasp/fixtures/BTO_221_99_polarization"
bto_folders = ["nonpolar_polarization"]
bto_folders += [f"interpolation_{idx}_polarization" for idx in range(8, 0, -1)]
bto_folders += ["polar_polarization"]
Expand Down
26 changes: 15 additions & 11 deletions tests/analysis/magnetism/test_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,30 @@
from pymatgen.core import Element, Lattice, Species, Structure
from pymatgen.util.testing import TEST_FILES_DIR

TEST_DIR = f"{TEST_FILES_DIR}/analysis/magnetic_orderings"

enum_cmd = which("enum.x") or which("multienum.x")
makestr_cmd = which("makestr.x") or which("makeStr.x") or which("makeStr.py")
enumlib_present = enum_cmd and makestr_cmd


class TestCollinearMagneticStructureAnalyzer(TestCase):
def setUp(self):
self.Fe = Structure.from_file(f"{TEST_FILES_DIR}/Fe.cif", primitive=True)
self.Fe = Structure.from_file(f"{TEST_FILES_DIR}/cif/Fe.cif", primitive=True)

self.LiFePO4 = Structure.from_file(f"{TEST_FILES_DIR}/LiFePO4.cif", primitive=True)
self.LiFePO4 = Structure.from_file(f"{TEST_FILES_DIR}/cif/LiFePO4.cif", primitive=True)

self.Fe3O4 = Structure.from_file(f"{TEST_FILES_DIR}/Fe3O4.cif", primitive=True)
self.Fe3O4 = Structure.from_file(f"{TEST_FILES_DIR}/cif/Fe3O4.cif", primitive=True)

self.GdB4 = Structure.from_file(f"{TEST_FILES_DIR}/mcif/magnetic.ncl.example.GdB4.mcif", primitive=True)
self.GdB4 = Structure.from_file(f"{TEST_FILES_DIR}/io/cif/mcif/magnetic.ncl.example.GdB4.mcif", primitive=True)

self.NiO_expt = Structure.from_file(f"{TEST_FILES_DIR}/mcif/magnetic.example.NiO.mcif", primitive=True)
self.NiO_expt = Structure.from_file(f"{TEST_FILES_DIR}/io/cif/mcif/magnetic.example.NiO.mcif", primitive=True)

# CuO.mcif sourced from https://www.cryst.ehu.es/magndata/index.php?index=1.62
# doi: 10.1088/0022-3719/21/15/023
self.CuO_expt = Structure.from_file(f"{TEST_FILES_DIR}/mcif/magnetic.example.CuO.mcif.gz", primitive=True)
self.CuO_expt = Structure.from_file(
f"{TEST_FILES_DIR}/io/cif/mcif/magnetic.example.CuO.mcif.gz", primitive=True
)

lattice = Lattice.cubic(4.17)
species = ["Ni", "O"]
Expand Down Expand Up @@ -251,17 +255,17 @@ class TestMagneticStructureEnumerator:
@pytest.mark.skipif(not enumlib_present, reason="enumlib not present")
def test_ordering_enumeration(self):
# simple afm
structure = Structure.from_file(f"{TEST_FILES_DIR}/magnetic_orderings/LaMnO3.json")
structure = Structure.from_file(f"{TEST_DIR}/LaMnO3.json")
enumerator = MagneticStructureEnumerator(structure)
assert enumerator.input_origin == "afm"

# ferrimagnetic (Cr produces net spin)
structure = Structure.from_file(f"{TEST_FILES_DIR}/magnetic_orderings/Cr2NiO4.json")
structure = Structure.from_file(f"{TEST_DIR}/Cr2NiO4.json")
enumerator = MagneticStructureEnumerator(structure)
assert enumerator.input_origin == "ferri_by_Cr"

# antiferromagnetic on single magnetic site
structure = Structure.from_file(f"{TEST_FILES_DIR}/magnetic_orderings/Cr2WO6.json")
structure = Structure.from_file(f"{TEST_DIR}/Cr2WO6.json")
enumerator = MagneticStructureEnumerator(structure)
assert enumerator.input_origin == "afm_by_Cr"

Expand All @@ -275,7 +279,7 @@ def test_ordering_enumeration(self):
# assert enumerator.input_origin == "afm"

# antiferromagnetic by structural motif
structure = Structure.from_file(f"{TEST_FILES_DIR}/magnetic_orderings/Ca3Co2O6.json")
structure = Structure.from_file(f"{TEST_DIR}/Ca3Co2O6.json")
enumerator = MagneticStructureEnumerator(
structure,
strategies=("antiferromagnetic_by_motif",),
Expand All @@ -288,7 +292,7 @@ def test_ordering_enumeration(self):

class TestMagneticDeformation:
def test_magnetic_deformation(self):
test_structs = loadfn(f"{TEST_FILES_DIR}/magnetic_deformation.json")
test_structs = loadfn(f"{TEST_FILES_DIR}/analysis/magnetism/magnetic_deformation.json")
mag_def = magnetic_deformation(test_structs[0], test_structs[1])

assert mag_def.type == "NM-FM"
Expand Down
2 changes: 1 addition & 1 deletion tests/analysis/magnetism/test_heisenberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pymatgen.core.structure import Structure
from pymatgen.util.testing import TEST_FILES_DIR

TEST_DIR = f"{TEST_FILES_DIR}/magnetic_orderings"
TEST_DIR = f"{TEST_FILES_DIR}/analysis/magnetic_orderings"


class TestHeisenbergMapper(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/analysis/magnetism/test_jahnteller.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def test_jahn_teller_species_analysis(self):
assert magnitude == "none"

def test_jahn_teller_structure_analysis(self):
LiFePO4 = Structure.from_file(f"{TEST_FILES_DIR}/LiFePO4.cif", primitive=True)
LiFePO4 = Structure.from_file(f"{TEST_FILES_DIR}/cif/LiFePO4.cif", primitive=True)

Fe3O4 = Structure.from_file(f"{TEST_FILES_DIR}/Fe3O4.cif", primitive=True)
Fe3O4 = Structure.from_file(f"{TEST_FILES_DIR}/cif/Fe3O4.cif", primitive=True)

assert self.jt.is_jahn_teller_active(LiFePO4)
assert self.jt.is_jahn_teller_active(Fe3O4)
Expand Down
8 changes: 4 additions & 4 deletions tests/analysis/solar/test_slme.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from __future__ import annotations

import os

from pytest import approx

from pymatgen.analysis.solar.slme import optics, slme
from pymatgen.util.testing import PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest

TEST_DIR = f"{TEST_FILES_DIR}/analysis/solar"


class TestSolar(PymatgenTest):
def test_slme_from_vasprun(self):
en, abz, dir_gap, indir_gap = optics(f"{os.path.dirname(__file__)}/vasprun.xml")
en, abz, dir_gap, indir_gap = optics(f"{TEST_DIR}/vasprun.xml")
abz = abz * 100.0
eff = slme(en, abz, indir_gap, indir_gap, plot_current_voltage=False)
assert eff == approx(27.729, abs=1e-2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
from pymatgen.core import Composition, Species
from pymatgen.util.testing import TEST_FILES_DIR

TEST_DIR = f"{TEST_FILES_DIR}/analysis/struct_predictor"


def get_table():
"""
Loads a lightweight lambda table for use in unit tests to reduce
initialization time, and make unit tests insensitive to changes in the
default lambda table.
"""
json_path = f"{TEST_FILES_DIR}/struct_predictor/test_lambda.json"
json_path = f"{TEST_DIR}/test_lambda.json"
with open(json_path) as file:
return json.load(file)

Expand Down
4 changes: 3 additions & 1 deletion tests/analysis/structure_prediction/test_substitutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
from pymatgen.core import Composition, Species
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest

TEST_DIR = f"{TEST_FILES_DIR}/analysis/struct_predictor"


def get_table():
"""
Loads a lightweight lambda table for use in unit tests to reduce
initialization time, and make unit tests insensitive to changes in the
default lambda table.
"""
json_path = f"{TEST_FILES_DIR}/struct_predictor/test_lambda.json"
json_path = f"{TEST_DIR}/test_lambda.json"
with open(json_path) as file:
return json.load(file)

Expand Down
Loading