diff --git a/tests/data_dir/kkr_imp_dos_wc-nodes-05066f1f4c9bc35ea08a631b005688fa.tar.gz b/tests/data_dir/kkr_imp_dos_wc-nodes-05066f1f4c9bc35ea08a631b005688fa.tar.gz deleted file mode 100644 index 1a966af9..00000000 Binary files a/tests/data_dir/kkr_imp_dos_wc-nodes-05066f1f4c9bc35ea08a631b005688fa.tar.gz and /dev/null differ diff --git a/tests/data_dir/kkr_imp_sub_wc-nodes-6227d9003b63b76d1fd41bd5322771b5.tar.gz b/tests/data_dir/kkr_imp_sub_wc-nodes-6227d9003b63b76d1fd41bd5322771b5.tar.gz deleted file mode 100644 index 6553f649..00000000 Binary files a/tests/data_dir/kkr_imp_sub_wc-nodes-6227d9003b63b76d1fd41bd5322771b5.tar.gz and /dev/null differ diff --git a/tests/data_dir/kkr_imp_wc-nodes-767eddfa3c34e0942d764a7e986aed8d.tar.gz b/tests/data_dir/kkr_imp_wc-nodes-767eddfa3c34e0942d764a7e986aed8d.tar.gz deleted file mode 100644 index 7ccc993a..00000000 Binary files a/tests/data_dir/kkr_imp_wc-nodes-767eddfa3c34e0942d764a7e986aed8d.tar.gz and /dev/null differ diff --git a/tests/data_dir/kkrimp_dos.aiida b/tests/data_dir/kkrimp_dos.aiida new file mode 100644 index 00000000..26b1a88f Binary files /dev/null and b/tests/data_dir/kkrimp_dos.aiida differ diff --git a/tests/data_dir/kkrimp_full_wc.aiida b/tests/data_dir/kkrimp_full_wc.aiida new file mode 100644 index 00000000..a759de47 Binary files /dev/null and b/tests/data_dir/kkrimp_full_wc.aiida differ diff --git a/tests/data_dir/kkrimp_sub_wc.aiida b/tests/data_dir/kkrimp_sub_wc.aiida new file mode 100644 index 00000000..3bd9785b Binary files /dev/null and b/tests/data_dir/kkrimp_sub_wc.aiida differ diff --git a/tests/workflows/test_kkrimp_dos_wc.py b/tests/workflows/test_kkrimp_dos_wc.py index 93272f3e..3405dad6 100755 --- a/tests/workflows/test_kkrimp_dos_wc.py +++ b/tests/workflows/test_kkrimp_dos_wc.py @@ -3,18 +3,17 @@ import pytest from ..dbsetup import * from ..conftest import voronoi_local_code, kkrhost_local_code, data_dir, import_with_migration -from aiida.manage.tests.pytest_fixtures import aiida_local_code_factory, aiida_localhost, temp_dir, aiida_profile -from aiida.manage.tests.pytest_fixtures import clear_database, clear_database_after_test, clear_database_before_test +from aiida.engine import run_get_node @pytest.mark.timeout(300, method='thread') -def test_dos_startpot_wc(clear_database_before_test, kkrimp_local_code, kkrhost_local_code, run_with_cache): +def test_dos_startpot_wc(clear_database_before_test, kkrimp_local_code, kkrhost_local_code, enable_archive_cache): """ simple Cu noSOC, FP, lmax2 full example using scf workflow for impurity host-in-host """ from numpy import array, loadtxt from masci_tools.io.kkr_params import kkrparams - from aiida.orm import Code, load_node, Dict, StructureData, load_group + from aiida.orm import Code, load_node, Dict, StructureData, load_group, WorkChainNode from aiida.orm.querybuilder import QueryBuilder from aiida.manage.caching import enable_caching from aiida_kkr.tools import neworder_potential_wf @@ -22,7 +21,7 @@ def test_dos_startpot_wc(clear_database_before_test, kkrimp_local_code, kkrhost_ from aiida_kkr.calculations import KkrCalculation # import precomputed GF host writeout - o = import_with_migration('data_dir/kkr_flex_wc-nodes-94b44d25a7af0e584343419207f3a7e1.tar.gz') + o = import_with_migration('data_dir/kkrflex_writeout_wc.aiida') print('import', o) # gf_workflow = load_node('0adfe62d-05aa-4c79-90ca-86b1753612a2') gf_workflow = [i for i in load_group(o).nodes if i.label == 'GF_writeout Cu bulk'][0] @@ -78,10 +77,10 @@ def test_dos_startpot_wc(clear_database_before_test, kkrimp_local_code, kkrhost_ builder.host_remote = GF_host_calc.outputs.remote_folder # now run calculation - out, node = run_with_cache(builder, data_dir=data_dir) + with enable_archive_cache(data_dir / 'kkrimp_dos.aiida'): + out, node = run_get_node(builder) print(node) print(out) - from aiida.orm import WorkChainNode for i in node.get_outgoing(node_class=WorkChainNode).all(): print(i.node, list(i.node.outputs)) @@ -95,27 +94,8 @@ def test_dos_startpot_wc(clear_database_before_test, kkrimp_local_code, kkrhost_ assert len(out['dos_data_interpol'].get_y()[0][0]) == 20 -""" -@pytest.mark.timeout(300, method='thread') -def test_dos_reuse_gf_writeout(self): - pass - - -@pytest.mark.timeout(300, method='thread') -def test_dos_from_kkrimp_sub(self): - pass - - -@pytest.mark.timeout(300, method='thread') -def test_dos_from_kkrimp_full(self): - pass -""" - #run test manually if __name__ == '__main__': from aiida import load_profile load_profile() test_dos_startpot_wc() - #test_dos_reuse_gf_writeout() - #test_dos_from_kkrimp_sub() - #test_dos_from_kkrimp_full() diff --git a/tests/workflows/test_kkrimp_full_wc.py b/tests/workflows/test_kkrimp_full_wc.py index c69a9a4b..eb30458c 100755 --- a/tests/workflows/test_kkrimp_full_wc.py +++ b/tests/workflows/test_kkrimp_full_wc.py @@ -3,15 +3,13 @@ import pytest from ..dbsetup import * if __name__ != '__main__': - from aiida_testing.export_cache._fixtures import run_with_cache, export_cache, load_cache, hash_code_by_entrypoint + from aiida.engine import run_get_node from ..conftest import voronoi_local_code, kkrhost_local_code, test_dir, data_dir, import_with_migration - from aiida.manage.tests.pytest_fixtures import aiida_local_code_factory, aiida_localhost, temp_dir, aiida_profile - from aiida.manage.tests.pytest_fixtures import clear_database, clear_database_after_test, clear_database_before_test @pytest.mark.timeout(900, method='thread') def test_kkrimp_full_wc( - clear_database_before_test, voronoi_local_code, kkrhost_local_code, kkrimp_local_code, run_with_cache + clear_database_before_test, voronoi_local_code, kkrhost_local_code, kkrimp_local_code, enable_archive_cache ): """ simple Cu noSOC, FP, lmax2 full example using scf workflow for impurity host-in-host @@ -71,16 +69,10 @@ def test_kkrimp_full_wc( builder.scf.params_overwrite = Dict({'TOL_ALAT_CHECK': 1e-8}) # now run calculation - out, node = run_with_cache(builder, data_dir=data_dir) + with enable_archive_cache(data_dir / 'kkrimp_full_wc.aiida'): + out, node = run_get_node(builder) print(out) print(list(node.called)) - # c = node.called[-1].called[-1] - # print(c, c.exit_status, c.exit_message) - # print(c.outputs.retrieved.list_object_names()) - # for fname in ['out_kkrimp', 'config.cfg']: - # with c.outputs.retrieved.open(fname) as _f: - # txt = _f.readlines() - # print(fname, txt) # check outcome n = out['workflow_info'] @@ -101,7 +93,7 @@ def test_kkrimp_full_wc( # @pytest.mark.timeout(900, method='thread') # def test_kkrimp_full_Ag_Cu_onsite( -# clear_database_before_test, voronoi_local_code, kkrhost_local_code, kkrimp_local_code, run_with_cache +# clear_database_before_test, voronoi_local_code, kkrhost_local_code, kkrimp_local_code, enable_archive_cache # ): # """ # Simple Ag_Cu (bulk) noSOC, FP, lmax2 example where impurity cluster contains only the impurity atom @@ -166,7 +158,8 @@ def test_kkrimp_full_wc( # builder.scf.params_overwrite = Dict({'TOL_ALAT_CHECK': 1e-8}) # # now run calculation -# out, node = run_with_cache(builder, data_dir=data_dir) +# with enable_archive_cache(data_dir / 'kkrimp_full_Ag_Cu_onsite.aiida'): +# out, node = run_get_node(builder) # print(out) # # check outcome diff --git a/tests/workflows/test_kkrimp_sub_wc.py b/tests/workflows/test_kkrimp_sub_wc.py index b64f165e..451c6c69 100755 --- a/tests/workflows/test_kkrimp_sub_wc.py +++ b/tests/workflows/test_kkrimp_sub_wc.py @@ -3,13 +3,11 @@ import pytest from ..dbsetup import * from ..conftest import kkrimp_local_code, data_dir, import_with_migration -from aiida_testing.export_cache._fixtures import run_with_cache, export_cache, load_cache, hash_code_by_entrypoint, with_export_cache -from aiida.manage.tests.pytest_fixtures import aiida_local_code_factory, aiida_localhost, temp_dir, aiida_profile -from aiida.manage.tests.pytest_fixtures import clear_database, clear_database_after_test, clear_database_before_test +from aiida.engine import run_get_node @pytest.mark.timeout(1200, method='thread') -def test_kkrimp_sub_wc(clear_database_before_test, kkrimp_local_code, run_with_cache): +def test_kkrimp_sub_wc(clear_database_before_test, kkrimp_local_code, enable_archive_cache): """ simple Cu noSOC, FP, lmax2 full example using scf workflow for impurity host-in-host """ @@ -18,6 +16,9 @@ def test_kkrimp_sub_wc(clear_database_before_test, kkrimp_local_code, run_with_c from masci_tools.io.kkr_params import kkrparams from aiida_kkr.workflows.kkr_imp_sub import kkr_imp_sub_wc from numpy import array + from aiida_kkr.tools import neworder_potential_wf + from numpy import loadtxt + from aiida.manage.caching import enable_caching wfd = kkr_imp_sub_wc.get_wf_defaults() @@ -42,13 +43,10 @@ def test_kkrimp_sub_wc(clear_database_before_test, kkrimp_local_code, run_with_c GF_host_calc = load_node('baabef05-f418-4475-bba5-ef0ee3fd5ca6') # now create a SingleFileData node containing the impurity starting potential - from aiida_kkr.tools import neworder_potential_wf - from numpy import loadtxt with GF_host_calc.outputs.retrieved.open('scoef') as _f: neworder_pot1 = [int(i) for i in loadtxt(_f, skiprows=1)[:, 3] - 1] settings_dict = {'pot1': 'out_potential', 'out_pot': 'potential_imp', 'neworder': neworder_pot1} settings = Dict(settings_dict) - from aiida.manage.caching import enable_caching with enable_caching(): startpot_imp_sfd = neworder_potential_wf( settings_node=settings, parent_calc_folder=GF_host_calc.outputs.remote_folder @@ -70,7 +68,8 @@ def test_kkrimp_sub_wc(clear_database_before_test, kkrimp_local_code, run_with_c print('builder', builder) # now run calculation - out, node = run_with_cache(builder, data_dir=data_dir) + with enable_archive_cache(data_dir / 'kkrimp_sub_wc.aiida'): + out, node = run_get_node(builder) print('out', out) print('node', node) print(node.process_status)