Skip to content

Commit

Permalink
Merge pull request #76 from naik-aakash/fix_m3gnet_issue
Browse files Browse the repository at this point in the history
fix m3gnet issue
  • Loading branch information
JaGeo authored Jul 3, 2024
2 parents 57b2404 + 08ad7e0 commit 0b8105c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
7 changes: 4 additions & 3 deletions autoplex/auto/phonons/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ def complete_benchmark( # this function was put here to prevent circular import
elif ml_model == "J-ACE":
raise UserWarning("No atomate2 ACE.jl PhononMaker implemented.")
elif ml_model in ["M3GNET"]:
ml_potential = Path(ml_path.join(suffix)) / "training"
# M3GNet requires path
# also need to find a different solution for separated fit then
ml_potential = (
Path(ml_path) / suffix
) # M3GNet requires path and fit already returns the path
# also need to find a different solution for separated fit then (name to path could be modified)
elif ml_model in ["NEQUIP"]:
ml_potential = Path(ml_path) / f"deployed_nequip_model{suffix}.pth"
else: # MACE
Expand Down
18 changes: 8 additions & 10 deletions tests/auto/test_auto_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def test_complete_dft_vs_ml_benchmark_workflow_gap(
)


@pytest.mark.skip(reason="This test will work only when atomate2 "
"PR #911 for m3gnet is merged. Thus don't forget to enable it after that")
def test_complete_dft_vs_ml_benchmark_workflow_m3gnet(
vasp_test_dir, mock_vasp, test_dir, memory_jobstore, ref_paths4, fake_run_vasp_kwargs4, clean_dir
):
Expand Down Expand Up @@ -217,21 +219,17 @@ def test_complete_dft_vs_ml_benchmark_workflow_m3gnet(
mock_vasp(ref_paths4, fake_run_vasp_kwargs4)

# run the flow or job and ensure that it finished running successfully
try:
responses = run_locally(
responses = run_locally(
complete_workflow_m3gnet,
create_folders=True,
ensure_success=False,
ensure_success=True,
store=memory_jobstore,
)
except ValueError:
print("\nWe need to fix some jobflow error.")

assert complete_workflow_m3gnet.jobs[4].name == "complete_benchmark"
#assert responses[complete_workflow_m3gnet.jobs[-1].output.uuid][1].output[0][0][
# "benchmark_phonon_rmse"] == pytest.approx(
# 1.162641337594289, abs=1.0 # it's kinda fluctuating because of the little data
#)
assert responses[complete_workflow_m3gnet.jobs[-1].output.uuid][1].output[0][0][
"benchmark_phonon_rmse"] == pytest.approx(
5.2622804443539355, abs=1.0 # bad fit data
)


def test_complete_dft_vs_ml_benchmark_workflow_mace(
Expand Down

0 comments on commit 0b8105c

Please sign in to comment.