From 3c4d7eca94e560ccc3025d1bdd453688c15d8984 Mon Sep 17 00:00:00 2001 From: Federica Zanca <93498393+federicazanca@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:03:29 +0100 Subject: [PATCH] fix result dictionary (#136) * Fix results dictionary * Set read format to extxyz for singlepoint output --------- Co-authored-by: alin elena --- aiida_mlip/parsers/sp_parser.py | 4 +++- pyproject.toml | 4 ++-- tests/calculations/configs/config_janus.yaml | 1 - tests/calculations/test_geomopt.py | 2 +- tests/calculations/test_singlepoint.py | 5 ++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/aiida_mlip/parsers/sp_parser.py b/aiida_mlip/parsers/sp_parser.py index 3caf3f38..01830b03 100644 --- a/aiida_mlip/parsers/sp_parser.py +++ b/aiida_mlip/parsers/sp_parser.py @@ -98,7 +98,9 @@ def parse(self, **kwargs) -> int: with self.retrieved.open(xyz_output, "rb") as handle: self.out("xyz_output", SinglefileData(file=handle, filename=xyz_output)) - content = read(Path(self.node.get_remote_workdir(), xyz_output)) + content = read( + Path(self.node.get_remote_workdir(), xyz_output), format="extxyz" + ) results = convert_numpy(content.todict()) results_node = Dict(results) self.out("results_dict", results_node) diff --git a/pyproject.toml b/pyproject.toml index cba58bdc..16397048 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,9 +28,9 @@ documentation = "https://stfc.github.io/aiida-mlip/" [tool.poetry.dependencies] python = "^3.9" aiida-core = "^2.5" -ase = "^3.22.1" +ase = "^3.23.0" voluptuous = "^0.14" -janus-core = "^v0.5.0b0" +janus-core = "^v0.6.0b0" [tool.poetry.group.dev.dependencies] coverage = {extras = ["toml"], version = "^7.4.1"} diff --git a/tests/calculations/configs/config_janus.yaml b/tests/calculations/configs/config_janus.yaml index c12574b5..119715b8 100644 --- a/tests/calculations/configs/config_janus.yaml +++ b/tests/calculations/configs/config_janus.yaml @@ -1,4 +1,3 @@ properties: - "energy" -out: "results.xyz" arch: mace_mp diff --git a/tests/calculations/test_geomopt.py b/tests/calculations/test_geomopt.py index dbcec76e..457516b4 100644 --- a/tests/calculations/test_geomopt.py +++ b/tests/calculations/test_geomopt.py @@ -91,7 +91,7 @@ def test_run_opt(model_folder, janus_code): assert "traj_output" in result assert "traj_file" in result assert result["traj_output"].numsteps == 3 - assert result["final_structure"].cell[0][1] == pytest.approx(2.8442048309822) + assert result["final_structure"].cell[0][1] == pytest.approx(2.8438848145858) assert result["xyz_output"].filename == "aiida-results.xyz" diff --git a/tests/calculations/test_singlepoint.py b/tests/calculations/test_singlepoint.py index afa8b9dd..e5359159 100644 --- a/tests/calculations/test_singlepoint.py +++ b/tests/calculations/test_singlepoint.py @@ -122,12 +122,11 @@ def test_run_sp(model_folder, janus_code): singlePointCalculation = CalculationFactory("mlip.sp") result = run(singlePointCalculation, **inputs) - assert "results_dict" in result obtained_res = result["results_dict"].get_dict() assert "xyz_output" in result - assert obtained_res["info"]["energy"] == pytest.approx(-6.7575203839729) - assert obtained_res["info"]["stress"][0][0] == pytest.approx(-0.005816546985101) + assert obtained_res["info"]["mace_energy"] == pytest.approx(-6.7575203839729) + assert obtained_res["info"]["mace_stress"][0] == pytest.approx(-0.005816546985101) def test_example(example_path):