Skip to content

Commit

Permalink
Merge branch 'main' into fix_627_scaling_spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Mar 26, 2024
2 parents 7bac041 + 15abd2b commit 30c4988
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 180 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 38 additions & 7 deletions tests/test_submit_qe_workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
203 changes: 32 additions & 171 deletions tests/test_submit_qe_workchain/test_create_builder_default.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 30c4988

Please sign in to comment.