Skip to content

Commit

Permalink
Using libxc with FHI-aims requires an additional keyword (#4254)
Browse files Browse the repository at this point in the history
automatically add the override warning when using libxc
  • Loading branch information
tpurcell90 authored Jan 17, 2025
1 parent 7c0b65b commit 663876f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/pymatgen/io/aims/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ def get_content(
content += self.get_aims_control_parameter_str(key, output_type, "%s")
elif key == "vdw_correction_hirshfeld" and value:
content += self.get_aims_control_parameter_str(key, "", "%s")
elif key == "xc":
if "libxc" in value:
content += self.get_aims_control_parameter_str("override_warning_libxc", ".true.", "%s")
content += self.get_aims_control_parameter_str(key, value, "%s")
elif isinstance(value, bool):
content += self.get_aims_control_parameter_str(key, str(value).lower(), ".%s.")
elif isinstance(value, tuple | list):
Expand Down
Binary file modified tests/files/io/aims/input_files/control.in.si.gz
Binary file not shown.
Binary file modified tests/files/io/aims/input_files/control.in.si.no_sd.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/io/aims/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def test_aims_control_in(tmp_path: Path):
with pytest.raises(ValueError, match="k-grid must be defined for periodic systems"):
aims_control.write_file(si, directory=tmp_path, overwrite=True)
aims_control["k_grid"] = [1, 1, 1]
aims_control["xc"] = "libxc LDA_X+LDA_C_PW"

with pytest.raises(ValueError, match="control.in file already in "):
aims_control.write_file(si, directory=tmp_path, overwrite=False)
Expand All @@ -276,7 +277,6 @@ def test_aims_control_in(tmp_path: Path):

aims_control_from_dict = json.loads(json.dumps(aims_control.as_dict(), cls=MontyEncoder), cls=MontyDecoder)
for key, val in aims_control.parameters.items():
print("\n\n", key, "\n", val, "\n", aims_control_from_dict[key], "\n\n")
if key in ["output", "cubes"]:
np.all(aims_control_from_dict[key] == val)
assert aims_control_from_dict[key] == val
Expand Down

0 comments on commit 663876f

Please sign in to comment.