diff --git a/pymatgen/io/pwscf.py b/pymatgen/io/pwscf.py index 88c06fda48e..d2f2d627aa3 100644 --- a/pymatgen/io/pwscf.py +++ b/pymatgen/io/pwscf.py @@ -371,7 +371,7 @@ def proc_val(key, val): "conv_thr", "Hubbard_U", "Hubbard_J0", - "defauss", + "degauss", "starting_magnetization", ) @@ -482,8 +482,7 @@ def smart_int_or_float(numstr): pass try: - val = val.replace("d", "e") - return smart_int_or_float(val) + return smart_int_or_float(val.replace("d", "e")) except ValueError: pass diff --git a/pymatgen/io/tests/test_pwscf.py b/pymatgen/io/tests/test_pwscf.py index 0406076f8fc..ed07e2ccd84 100644 --- a/pymatgen/io/tests/test_pwscf.py +++ b/pymatgen/io/tests/test_pwscf.py @@ -208,6 +208,17 @@ def test_write_str_with_kpoints(self): """ assert str(pw).strip() == expected.strip() + def test_proc_val(self): + inputs = { + "degauss": ("7.3498618000d-03", 7.3498618000e-03), + "nat": ("2", 2), + "nosym": (".TRUE.", True), + "smearing": ("'cold'", "cold"), + } + for key, (input_str, expected) in inputs.items(): + value = PWInput.proc_val(key, input_str) + assert value == expected + def test_read_str(self): string = """ &CONTROL @@ -223,6 +234,7 @@ def test_read_str(self): ecutwfc = 80 nspin = 1 nbnd = 280 + smearing = 'cold' / &ELECTRONS / @@ -364,6 +376,7 @@ def test_read_str(self): np.testing.assert_allclose(sites, pw_sites) np.testing.assert_allclose(lattice, pwin.structure.lattice.matrix) + assert pwin.sections["system"]["smearing"] == "cold" class PWOuputTest(PymatgenTest):