Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix m3gnet issue #76

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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