diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1645e17..10ee2f6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: matrix: tag: [latest] python-version: ['3.9', '3.10'] + aiida-core-version: [2.3, 2.5] fail-fast: false runs-on: ubuntu-latest @@ -46,7 +47,7 @@ jobs: **/pyproject.toml **/requirements*.txt - name: Install package - run: pip install -e .[dev] + run: pip install -e .[dev] aiida-core==${{ matrix.aiida-core-version }} - name: Run pytest run: pytest -v tests --cov diff --git a/setup.cfg b/setup.cfg index 4f8936a7..d9e6a107 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,7 +26,7 @@ packages = find: install_requires = aiida-core~=2.2,<3 Jinja2~=3.0 - aiida-quantumespresso~=4.4.0 + aiida-quantumespresso~=4.4 aiidalab-widgets-base[optimade]~=2.2.0a0 aiida-pseudo~=1.4 filelock~=3.8 diff --git a/tests/test_submit_qe_workchain.py b/tests/test_submit_qe_workchain.py index 5bde299c..51d3a4a1 100644 --- a/tests/test_submit_qe_workchain.py +++ b/tests/test_submit_qe_workchain.py @@ -14,13 +14,12 @@ def test_create_builder_default( app = submit_app_generator(properties=["bands", "pdos"]) submit_step = app.submit_step - builder = submit_step._create_builder() - - # check and validate the builder - got = builder_to_readable_dict(builder) - - # regression test - data_regression.check(got) + submit_step._create_builder() + # since uuid is specific to each run, we remove it from the output + ui_parameters = remove_uuid_fields(submit_step.ui_parameters) + # regression test for the parameters generated by the app + # this parameters are passed to the workchain + data_regression.check(ui_parameters) @pytest.mark.usefixtures("sssp") @@ -121,3 +120,35 @@ def builder_to_readable_dict(builder): readable_dict[k] = v return readable_dict + + +def remove_uuid_fields(data): + """ + Recursively remove fields that contain UUID values from a dictionary. + + :param data: The dictionary to process. + :return: The dictionary with UUID fields removed. + """ + import re + + # Define a UUID pattern + uuid_pattern = re.compile( + r"[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}", re.I + ) + + if isinstance(data, dict): + new_dict = {} + for key, value in data.items(): + # If the value matches the UUID pattern, skip adding it to the new dictionary + if isinstance(value, str) and uuid_pattern.match(value): + continue + # Otherwise, process the value recursively and add it to the new dictionary + else: + new_dict[key] = remove_uuid_fields(value) + return new_dict + elif isinstance(data, list): + # Process each item in the list recursively + return [remove_uuid_fields(item) for item in data] + else: + # Return the value unchanged if it's not a dictionary or list + return data diff --git a/tests/test_submit_qe_workchain/test_create_builder_default.yml b/tests/test_submit_qe_workchain/test_create_builder_default.yml index 868198e3..2f9f2357 100644 --- a/tests/test_submit_qe_workchain/test_create_builder_default.yml +++ b/tests/test_submit_qe_workchain/test_create_builder_default.yml @@ -1,173 +1,34 @@ +advanced: + clean_workdir: false + initial_magnetic_moments: null + kpoints_distance: 0.12 + pseudo_family: SSSP/1.3/PBEsol/efficiency + pw: + parameters: + SYSTEM: + degauss: 0.015 + ecutrho: 240.0 + ecutwfc: 30.0 + smearing: methfessel-paxton + tot_charge: 0.0 + vdw_corr: none + pseudos: {} bands: - bands: - pw: - parallelization: - npool: 1 - parameters: - CONTROL: - calculation: bands - etot_conv_thr: 2.0e-05 - forc_conv_thr: 0.0001 - restart_mode: from_scratch - tprnfor: true - tstress: true - ELECTRONS: - conv_thr: 4.0e-10 - diago_full_acc: true - diagonalization: paro - electron_maxstep: 80 - mixing_beta: 0.4 - startingpot: file - SYSTEM: - degauss: 0.01 - ecutrho: 240.0 - ecutwfc: 30.0 - nosym: false - occupations: smearing - smearing: cold - tot_charge: 0.0 - vdw_corr: none - pseudos: - Si: Si.upf - bands_kpoints_distance: 0.025 - nbands_factor: 3.0 - scf: - kpoints_distance: 0.12 - kpoints_force_parity: false - pw: - parallelization: - npool: 1 - parameters: - CONTROL: - calculation: scf - etot_conv_thr: 2.0e-05 - forc_conv_thr: 0.0001 - tprnfor: true - tstress: true - ELECTRONS: - conv_thr: 4.0e-10 - electron_maxstep: 80 - mixing_beta: 0.4 - SYSTEM: - degauss: 0.015 - ecutrho: 240.0 - ecutwfc: 30.0 - nosym: false - occupations: smearing - smearing: methfessel-paxton - tot_charge: 0.0 - vdw_corr: none - pseudos: - Si: Si.upf -clean_workdir: false + kpath_2d: hexagonal +codes: + xspectra: null pdos: - dos: - parameters: - DOS: - DeltaE: 0.02 - nscf: - kpoints_distance: 0.1 - kpoints_force_parity: false - pw: - parallelization: - npool: 1 - parameters: - CONTROL: - calculation: nscf - etot_conv_thr: 2.0e-05 - forc_conv_thr: 0.0001 - restart_mode: from_scratch - tprnfor: true - tstress: true - ELECTRONS: - conv_thr: 4.0e-10 - electron_maxstep: 80 - mixing_beta: 0.4 - SYSTEM: - ecutrho: 240.0 - ecutwfc: 30.0 - nosym: true - occupations: tetrahedra - tot_charge: 0.0 - vdw_corr: none - pseudos: - Si: Si.upf - projwfc: - parameters: - PROJWFC: - DeltaE: 0.02 - settings: - cmdline: - - -nk - - '1' - scf: - kpoints_distance: 0.12 - kpoints_force_parity: false - pw: - parallelization: - npool: 1 - parameters: - CONTROL: - calculation: scf - etot_conv_thr: 2.0e-05 - forc_conv_thr: 0.0001 - restart_mode: from_scratch - tprnfor: true - tstress: true - ELECTRONS: - conv_thr: 4.0e-10 - electron_maxstep: 80 - mixing_beta: 0.4 - SYSTEM: - degauss: 0.015 - ecutrho: 240.0 - ecutwfc: 30.0 - nosym: false - occupations: smearing - smearing: methfessel-paxton - tot_charge: 0.0 - vdw_corr: none - pseudos: - Si: Si.upf -properties: -- bands -- pdos -- relax -relax: - base: - kpoints_distance: 0.12 - kpoints_force_parity: false - pw: - parallelization: - npool: 1 - parameters: - CELL: - cell_dofree: all - press_conv_thr: 0.5 - CONTROL: - calculation: vc-relax - etot_conv_thr: 2.0e-05 - forc_conv_thr: 0.0001 - tprnfor: true - tstress: true - ELECTRONS: - conv_thr: 4.0e-10 - electron_maxstep: 80 - mixing_beta: 0.4 - SYSTEM: - degauss: 0.015 - ecutrho: 240.0 - ecutwfc: 30.0 - nosym: false - occupations: smearing - smearing: methfessel-paxton - tot_charge: 0.0 - vdw_corr: none - pseudos: - Si: Si.upf - base_final_scf: - pw: - pseudos: {} - max_meta_convergence_iterations: 5 - meta_convergence: true - volume_convergence: 0.02 + nscf_kpoints_distance: 0.1 +resources: + npools: 1 + num_machines: 1 + num_mpiprocs_per_machine: 2 +workchain: + electronic_type: metal + properties: + - bands + - pdos + - relax + protocol: moderate + relax_type: positions_cell + spin_type: none