Skip to content

Commit

Permalink
Move tests to end of function
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-S-Rosen committed Nov 28, 2021
1 parent b502e57 commit 741680e
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions pymatgen/io/vasp/tests/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,26 +520,6 @@ def test_init(self):
self.assertEqual(vis.incar["ENCUT"], 600)
self.assertEqual(vis.kpoints.style, Kpoints.supported_modes.Monkhorst)

# Check warning if LASPH is set to False for meta-GGAs/hybrids/+U/vdW
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
vis = MPStaticSet(vis.structure, user_incar_settings={"METAGGA": "M06L", "LASPH": False})
vis.incar.items()
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
vis = MPStaticSet(vis.structure, user_incar_settings={"LHFCALC": True, "LASPH": False})
vis.incar.items()
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
vis = MPStaticSet(vis.structure, user_incar_settings={"LUSE_VDW": True, "LASPH": False})
vis.incar.items()
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
dummy_struc = Structure(
lattice=[[0, 2, 2], [2, 0, 2], [2, 2, 0]],
species=["Fe", "O"],
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
)
vis = MPStaticSet(dummy_struc, user_incar_settings={"LDAU": True, "LASPH": False})
vis.incar.items()

vis = MPStaticSet.from_dict(vis.as_dict())
non_prev_vis = MPStaticSet(vis.structure, user_incar_settings={"LORBIT": 12, "LWAVE": True})
self.assertEqual(non_prev_vis.incar["NSW"], 0)
# Check that the ENCUT and Kpoints style has NOT been inherited.
Expand All @@ -566,6 +546,25 @@ def test_init(self):
lcalcpol_vis = MPStaticSet.from_prev_calc(prev_calc_dir=prev_run, lcalcpol=True)
self.assertTrue(lcalcpol_vis.incar["LCALCPOL"])

# Check warning if LASPH is set to False for meta-GGAs/hybrids/+U/vdW
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
vis = MPStaticSet(vis.structure, user_incar_settings={"METAGGA": "M06L", "LASPH": False})
vis.incar.items()
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
vis = MPStaticSet(vis.structure, user_incar_settings={"LHFCALC": True, "LASPH": False})
vis.incar.items()
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
vis = MPStaticSet(vis.structure, user_incar_settings={"LUSE_VDW": True, "LASPH": False})
vis.incar.items()
with pytest.warns(BadInputSetWarning, match=r"LASPH"):
dummy_struc = Structure(
lattice=[[0, 2, 2], [2, 0, 2], [2, 2, 0]],
species=["Fe", "O"],
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
)
vis = MPStaticSet(dummy_struc, user_incar_settings={"LDAU": True, "LASPH": False})
vis.incar.items()

def test_user_incar_kspacing(self):
# Make sure user KSPACING settings properly overrides KPOINTS.
si = self.get_structure("Si")
Expand Down

0 comments on commit 741680e

Please sign in to comment.