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

Clean up test files: VASP inputs #3674

Merged
merged 26 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c11758a
relocate KPOINTS
DanielYang59 Mar 7, 2024
e560c46
pre-commit auto-fixes
pre-commit-ci[bot] Mar 7, 2024
29d7f5c
define VASP_IN_DIR for vasp inputs test files
DanielYang59 Mar 7, 2024
08f32da
unify naming with underscore
DanielYang59 Mar 7, 2024
073defb
Merge branch 'master' into cleanup_vasp_inputs
janosh Mar 7, 2024
00f1beb
relocate POSCARs
DanielYang59 Mar 7, 2024
627aad4
Merge branch 'cleanup_vasp_inputs' of github.com:DanielYang59/pymatge…
DanielYang59 Mar 7, 2024
090f847
relocate POTCARs
DanielYang59 Mar 7, 2024
2ebe592
relocate INCARs
DanielYang59 Mar 7, 2024
b781b2d
fix some hidden vasp files
DanielYang59 Mar 7, 2024
3263b0e
fix POSCAR relocate error
DanielYang59 Mar 8, 2024
ad354fc
reverse POSCAR_LiO2 to POSCAR.LiO2
DanielYang59 Mar 8, 2024
3f44741
Merge branch 'master' into cleanup_vasp_inputs
DanielYang59 Mar 8, 2024
ddbe353
Revert "reverse POSCAR_LiO2 to POSCAR.LiO2"
DanielYang59 Mar 8, 2024
fc82f9e
Merge branch 'cleanup_vasp_inputs' of github.com:DanielYang59/pymatge…
DanielYang59 Mar 8, 2024
1bf43c5
remove accidental DEBUG info
DanielYang59 Mar 8, 2024
a25828d
remove empty line
DanielYang59 Mar 8, 2024
a16cd7f
fix troublesome POSCAR.LiFePO4
DanielYang59 Mar 8, 2024
1b154e0
unify POTCAR naming
DanielYang59 Mar 8, 2024
831c643
relocate feff test files
DanielYang59 Mar 8, 2024
23dbef2
recover FePO4.vasp and correct name
DanielYang59 Mar 8, 2024
2b8474e
reverse name of wrong potcars
DanielYang59 Mar 8, 2024
d01c5f9
remove duplicate `INCAR_3`
DanielYang59 Mar 8, 2024
454a867
Merge branch 'master' into cleanup_vasp_inputs
DanielYang59 Mar 8, 2024
e668188
move another FEFF file
DanielYang59 Mar 8, 2024
8646bd9
relocate last batch of feff files
DanielYang59 Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pymatgen/util/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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"
# 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
Expand Down
6 changes: 3 additions & 3 deletions tests/alchemy/test_transmuters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RemoveSpeciesTransformation,
SubstitutionTransformation,
)
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, PymatgenTest


class TestCifTransmuter(PymatgenTest):
Expand All @@ -25,15 +25,15 @@ def test_init(self):
class TestPoscarTransmuter(PymatgenTest):
def test_init(self):
trafos = [SubstitutionTransformation({"Fe": "Mn"})]
tsc = PoscarTransmuter.from_filenames([f"{TEST_FILES_DIR}/POSCAR", f"{TEST_FILES_DIR}/POSCAR"], trafos)
tsc = PoscarTransmuter.from_filenames([f"{VASP_IN_DIR}/POSCAR", f"{VASP_IN_DIR}/POSCAR"], trafos)
assert len(tsc) == 2
expected = {"Mn", "O", "P"}
for substitution in tsc:
els = {el.symbol for el in substitution.final_structure.elements}
assert expected == els

def test_transmuter(self):
tsc = PoscarTransmuter.from_filenames([f"{TEST_FILES_DIR}/POSCAR"])
tsc = PoscarTransmuter.from_filenames([f"{VASP_IN_DIR}/POSCAR"])
tsc.append_transformation(RemoveSpeciesTransformation("O"))
assert len(tsc[0].final_structure) == 8

Expand Down
6 changes: 3 additions & 3 deletions tests/analysis/test_ewald.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

from pymatgen.analysis.ewald import EwaldMinimizer, EwaldSummation
from pymatgen.core.structure import Structure
from pymatgen.util.testing import TEST_FILES_DIR
from pymatgen.util.testing import VASP_IN_DIR


class TestEwaldSummation(unittest.TestCase):
def setUp(self):
filepath = f"{TEST_FILES_DIR}/POSCAR"
filepath = f"{VASP_IN_DIR}/POSCAR"
self.original_struct = Structure.from_file(filepath)
self.struct = self.original_struct.copy()
self.struct.add_oxidation_state_by_element({"Li": 1, "Fe": 2, "P": 5, "O": -2})
Expand Down Expand Up @@ -107,7 +107,7 @@ def test_init(self):

def test_site(self):
"""Test that uses an uncharged structure."""
filepath = f"{TEST_FILES_DIR}/POSCAR"
filepath = f"{VASP_IN_DIR}/POSCAR"
struct = Structure.from_file(filepath)
s = struct.copy()
s.add_oxidation_state_by_element({"Li": 1, "Fe": 3, "P": 5, "O": -2})
Expand Down
6 changes: 3 additions & 3 deletions tests/analysis/test_structure_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from pymatgen.core import Element, Lattice, Structure
from pymatgen.io.vasp.outputs import Xdatcar
from pymatgen.util.testing import TEST_FILES_DIR, VASP_OUT_DIR, PymatgenTest
from pymatgen.util.testing import VASP_IN_DIR, VASP_OUT_DIR, PymatgenTest


class TestVoronoiAnalyzer(PymatgenTest):
Expand All @@ -39,8 +39,8 @@ def test_analyze(self):

class TestRelaxationAnalyzer(unittest.TestCase):
def setUp(self):
s1 = Structure.from_file(f"{TEST_FILES_DIR}/POSCAR.Li2O")
s2 = Structure.from_file(f"{VASP_OUT_DIR}/CONTCAR.Li2O")
s1 = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_Li2O")
s2 = Structure.from_file(f"{VASP_OUT_DIR}/CONTCAR_Li2O")
self.analyzer = RelaxationAnalyzer(s1, s2)

def test_vol_and_para_changes(self):
Expand Down
14 changes: 7 additions & 7 deletions tests/analysis/test_structure_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from pymatgen.core import Element, Lattice, Structure, SymmOp
from pymatgen.util.coord import find_in_coord_list_pbc
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, PymatgenTest


class TestStructureMatcher(PymatgenTest):
Expand All @@ -27,12 +27,12 @@ def setUp(self):
self.struct_list = [ent.structure for ent in entries]
self.oxi_structs = [
self.get_structure("Li2O"),
Structure.from_file(f"{TEST_FILES_DIR}/POSCAR.Li2O"),
Structure.from_file(f"{VASP_IN_DIR}/POSCAR_Li2O"),
]

def test_ignore_species(self):
s1 = Structure.from_file(f"{TEST_FILES_DIR}/LiFePO4.cif")
s2 = Structure.from_file(f"{TEST_FILES_DIR}/POSCAR")
s2 = Structure.from_file(f"{VASP_IN_DIR}/POSCAR")
matcher = StructureMatcher(ignored_species=["Li"], primitive_cell=False, attempt_supercell=True)
assert matcher.fit(s1, s2)
assert matcher.fit_anonymous(s1, s2)
Expand Down Expand Up @@ -283,8 +283,8 @@ def test_fit(self):
# test symmetric
sm_coarse = sm = StructureMatcher(comparator=ElementComparator(), ltol=0.6, stol=0.6, angle_tol=6)

struct1 = Structure.from_file(f"{TEST_FILES_DIR}/fit_symm_s1.vasp")
struct2 = Structure.from_file(f"{TEST_FILES_DIR}/fit_symm_s2.vasp")
struct1 = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_fit_symm_s1")
struct2 = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_fit_symm_s2")
assert sm_coarse.fit(struct1, struct2)
assert sm_coarse.fit(struct2, struct1) is False
assert sm_coarse.fit(struct1, struct2, symmetric=True) is False
Expand Down Expand Up @@ -317,12 +317,12 @@ def test_class(self):

def test_mix(self):
structures = list(map(self.get_structure, ["Li2O", "Li2O2", "LiFePO4"]))
structures += [Structure.from_file(f"{TEST_FILES_DIR}/{fname}") for fname in ["POSCAR.Li2O", "POSCAR.LiFePO4"]]
structures += [Structure.from_file(f"{VASP_IN_DIR}/{fname}") for fname in ["POSCAR_Li2O", "POSCAR_LiFePO4"]]
sm = StructureMatcher(comparator=ElementComparator())
groups = sm.group_structures(structures)
for group in groups:
formula = group[0].reduced_formula
assert len(group) == (2 if formula in ["Li2O", "LiFePO4"] else 1)
assert len(group) == (2 if formula in {"Li2O", "LiFePO4"} else 1)

def test_left_handed_lattice(self):
"""Ensure Left handed lattices are accepted."""
Expand Down
6 changes: 3 additions & 3 deletions tests/command_line/test_bader_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pytest import approx

from pymatgen.command_line.bader_caller import BaderAnalysis, bader_analysis_from_path
from pymatgen.util.testing import TEST_FILES_DIR, VASP_OUT_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, VASP_OUT_DIR, PymatgenTest


@unittest.skipIf(not which("bader"), "bader executable not present")
Expand All @@ -24,7 +24,7 @@ def test_init(self):
# test with reference file
analysis = BaderAnalysis(
chgcar_filename=f"{VASP_OUT_DIR}/CHGCAR.Fe3O4.gz",
potcar_filename=f"{TEST_FILES_DIR}/POTCAR.Fe3O4",
potcar_filename=f"{VASP_IN_DIR}/POTCAR_Fe3O4.gz",
chgref_filename=f"{VASP_OUT_DIR}/CHGCAR.Fe3O4_ref.gz",
)
assert len(analysis.data) == 14
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_atom_parsing(self):
# test with reference file
analysis = BaderAnalysis(
chgcar_filename=f"{VASP_OUT_DIR}/CHGCAR.Fe3O4.gz",
potcar_filename=f"{TEST_FILES_DIR}/POTCAR.Fe3O4",
potcar_filename=f"{VASP_IN_DIR}/POTCAR_Fe3O4.gz",
chgref_filename=f"{VASP_OUT_DIR}/CHGCAR.Fe3O4_ref.gz",
parse_atomic_densities=True,
)
Expand Down
6 changes: 3 additions & 3 deletions tests/command_line/test_gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
get_energy_tersoff,
)
from pymatgen.core.structure import Structure
from pymatgen.util.testing import TEST_FILES_DIR
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR

gulp_present = which("gulp") and os.getenv("GULP_LIB") and ("win" not in sys.platform)
# disable gulp tests for now. Right now, it is compiled against libgfortran3, which is no longer supported in the new
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_decimal(self):
@unittest.skipIf(not gulp_present, "gulp not present.")
class TestGulpIO(unittest.TestCase):
def setUp(self):
self.structure = Structure.from_file(f"{TEST_FILES_DIR}/POSCAR.Al12O18")
self.structure = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_Al12O18")
self.gio = GulpIO()

def test_keyword_line_with_correct_keywords(self):
Expand Down Expand Up @@ -280,7 +280,7 @@ def setUp(self):
self.val_dict = dict(zip(el, val))

def test_get_energy_tersoff(self):
structure = Structure.from_file(f"{TEST_FILES_DIR}/POSCAR.Al12O18")
structure = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_Al12O18")
energy = get_energy_tersoff(structure)
assert isinstance(energy, float)

Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.io.cif import CifParser
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, PymatgenTest

try:
from ase.atoms import Atoms
Expand Down Expand Up @@ -1807,7 +1807,7 @@ def test_to_ase_atoms(self):
assert AseAtomsAdaptor.get_structure(atoms) == self.struct

def test_struct_with_isotope(self):
struct = Structure.from_file(f"{TEST_FILES_DIR}/POSCAR.LiFePO4")
struct = Structure.from_file(f"{VASP_IN_DIR}/POSCAR_LiFePO4")
struct = struct.replace_species({"Li": "H"})

struct_deuter = struct.copy()
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pymatgen.core.trajectory import Trajectory
from pymatgen.io.qchem.outputs import QCOutput
from pymatgen.io.vasp.outputs import Xdatcar
from pymatgen.util.testing import TEST_FILES_DIR, VASP_OUT_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, VASP_OUT_DIR, PymatgenTest


class TestTrajectory(PymatgenTest):
Expand Down Expand Up @@ -418,7 +418,7 @@ def test_length(self):
assert len(self.traj_mols) == len(self.molecules)

def test_displacements(self):
structures = [Structure.from_file(f"{TEST_FILES_DIR}/POSCAR")]
structures = [Structure.from_file(f"{VASP_IN_DIR}/POSCAR")]
displacements = np.zeros((11, *np.shape(structures[-1].frac_coords)))

for i in range(10):
Expand Down
4 changes: 2 additions & 2 deletions tests/electronic_structure/test_bandstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pymatgen.electronic_structure.core import Orbital, Spin
from pymatgen.electronic_structure.plotter import BSPlotterProjected
from pymatgen.io.vasp import BSVasprun
from pymatgen.util.testing import TEST_FILES_DIR, VASP_OUT_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, VASP_OUT_DIR, PymatgenTest


class TestKpoint(unittest.TestCase):
Expand Down Expand Up @@ -268,7 +268,7 @@ def test_vasprun_bs(self):
parse_projected_eigen=True,
parse_potcar_file=True,
)
bs = bsv.get_band_structure(kpoints_filename=f"{TEST_FILES_DIR}/KPOINTS.band", line_mode=True)
bs = bsv.get_band_structure(kpoints_filename=f"{VASP_IN_DIR}/KPOINTS_band", line_mode=True)
bs.get_projection_on_elements()


Expand Down
4 changes: 2 additions & 2 deletions tests/electronic_structure/test_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
plot_ellipsoid,
)
from pymatgen.io.vasp import Vasprun
from pymatgen.util.testing import TEST_FILES_DIR, VASP_OUT_DIR, PymatgenTest
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, VASP_OUT_DIR, PymatgenTest

rc("text", usetex=False) # Disabling latex is needed for this test to work.

Expand Down Expand Up @@ -214,7 +214,7 @@ class TestBSDOSPlotter(unittest.TestCase):
def test_methods(self):
vasp_run = Vasprun(f"{VASP_OUT_DIR}/vasprun_Si_bands.xml.gz")
plotter = BSDOSPlotter()
band_struct = vasp_run.get_band_structure(kpoints_filename=f"{TEST_FILES_DIR}/KPOINTS_Si_bands")
band_struct = vasp_run.get_band_structure(kpoints_filename=f"{VASP_IN_DIR}/KPOINTS_Si_bands")
ax = plotter.get_plot(band_struct)
assert isinstance(ax, plt.Axes)
plt.close()
Expand Down
19 changes: 0 additions & 19 deletions tests/files/INCAR.3

This file was deleted.

Binary file removed tests/files/INCAR.C2.gz
Binary file not shown.
Binary file removed tests/files/POSCAR.C2.gz
Binary file not shown.
12 changes: 0 additions & 12 deletions tests/files/POSCAR.CdS_HSE

This file was deleted.

Loading