Skip to content

Commit

Permalink
Fix and add tests for dir_name (#1736)
Browse files Browse the repository at this point in the history
Closes #1734.
  • Loading branch information
Andrew-S-Rosen authored Feb 21, 2024
1 parent 74eae85 commit 85a45a5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/quacc/schemas/ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def summarize_run(
inputs = {
"parameters": final_atoms.calc.parameters,
"nid": uri.split(":")[0],
"dir_name": ":".join(uri.split(":")[1:]),
"dir_name": directory,
"input_atoms": input_atoms_metadata,
"quacc_version": __version__,
}
Expand Down Expand Up @@ -286,7 +286,7 @@ def summarize_vib_run(
"nfree": vib.nfree,
},
"nid": uri.split(":")[0],
"dir_name": ":".join(uri.split(":")[1:]),
"dir_name": directory,
}

atoms_metadata = atoms_to_metadata(
Expand Down
1 change: 1 addition & 0 deletions src/quacc/schemas/vasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def vasp_summarize_run(
# Fetch all tabulated results from VASP outputs files. Fortunately, emmet
# already has a handy function for this
vasp_task_doc = TaskDoc.from_directory(dir_path).model_dump()
vasp_task_doc["dir_name"] = dir_path

# Check for calculation convergence
if check_convergence and vasp_task_doc["state"] != "successful":
Expand Down
1 change: 1 addition & 0 deletions tests/core/schemas/test_ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_summarize_run():
assert results["results"]["energy"] == atoms.get_potential_energy()
assert "pymatgen_version" in results["builder_meta"]
assert results["input_atoms"]["atoms"] == initial_atoms
assert Path(results["dir_name"]).is_dir()


def test_summarize_run2():
Expand Down
2 changes: 2 additions & 0 deletions tests/core/schemas/test_vasp_schema.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
from pathlib import Path
from shutil import copytree, move

import pytest
Expand Down Expand Up @@ -58,6 +59,7 @@ def test_vasp_summarize_run(run1, monkeypatch):
assert results["nsites"] == len(atoms)
assert results["atoms"] == atoms
assert results["output"]["energy"] == -33.15807349
assert Path(results["dir_name"]).is_dir()

# Make sure default dir works
cwd = os.getcwd()
Expand Down

0 comments on commit 85a45a5

Please sign in to comment.