From 6929a972246d92572e7f05c68734ae97ae84df75 Mon Sep 17 00:00:00 2001 From: anaik Date: Fri, 26 Jan 2024 18:49:16 +0100 Subject: [PATCH] add test for MLPhononMaker --- tests/auto/test_auto_jobs.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/auto/test_auto_jobs.py b/tests/auto/test_auto_jobs.py index ceccdac09..a2c444c99 100644 --- a/tests/auto/test_auto_jobs.py +++ b/tests/auto/test_auto_jobs.py @@ -2,7 +2,7 @@ import os from unittest import mock from pymatgen.core.structure import Structure -from autoplex.auto.jobs import get_phonon_ml_calculation_jobs, get_iso_atom, dft_phonopy_gen_data, dft_random_gen_data +from autoplex.auto.jobs import get_phonon_ml_calculation_jobs, get_iso_atom, dft_phonopy_gen_data, dft_random_gen_data, MLPhononMaker from atomate2.common.schemas.phonons import PhononBSDOSDoc from jobflow import run_locally @@ -27,6 +27,23 @@ def test_get_phonon_ml_calculation_jobs(test_dir, clean_dir, memory_jobstore): ) assert isinstance(ml_phonon_bs_doc, PhononBSDOSDoc) + +def test_ml_phonon_maker(test_dir, clean_dir, memory_jobstore): + potential_file_dir = test_dir / "fitting" / "ref_files" / "gap.xml" + path_to_struct = test_dir / "fitting" / "ref_files" / "POSCAR" + structure = Structure.from_file(path_to_struct) + + gap_phonon_jobs = MLPhononMaker( + ml_dir=potential_file_dir, min_length=20 + ).make(structure=structure) + + responses = run_locally( + gap_phonon_jobs, create_folders=True, ensure_success=True, store=memory_jobstore + ) + + ml_phonon_bs_doc = responses[gap_phonon_jobs.jobs[-1].output.uuid][1].output + assert isinstance(ml_phonon_bs_doc, PhononBSDOSDoc) + def test_get_iso_atom(vasp_test_dir, mock_vasp, clean_dir, memory_jobstore): structure_list = [ Structure(