8000 Support aiida-quantumespresso v5 by edan-bainglass · Pull Request #16 · aiidalab/aiidalab-qe-hp · GitHub
[go: up one dir, main page]

Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
cache: pip
cache-dependency-path: pyproject.toml

Expand All @@ -39,12 +39,12 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
cache: pip
cache-dependency-path: pyproject.toml

- name: Install Python package and dependencies
run: pip install aiidalab-qe && pip install -e .[dev]
run: pip install aiidalab-qe@git+https://github.com/aiidalab/aiidalab-qe@main && pip install -e .[dev]

- name: Run tests
run: pytest
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sphinx:
build:
os: ubuntu-22.04
tools:
python: '3.11'
python: '3.12'
jobs:
post_create_environment:
- python -m pip install --no-cache-dir .[docs]
21 changes: 9 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = ['flit_core>=3.4,<4']

[project]
authors = [
{name = 'Xing Wang', email = 'xingwang1991@gmail.com'}
{ name = 'Xing Wang', email = 'xingwang1991@gmail.com' }
]
classifiers = [
'Development Status :: 4 - Beta',
Expand All @@ -13,25 +13,22 @@ classifiers = [
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: Python',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering'
]
dependencies = [
"aiida-core>=2.3",
"aiida-quantumespresso>=4.10,<4.13",
"aiida-hubbard==0.3.0",
"aiida-core~=2.8",
"aiida-quantumespresso~=5.0",
"aiida-hubbard~=0.7.0",
"weas-widget>=0.2.6",
"table-widget>=0.0.3"
]
dynamic = ['description', 'version']
keywords = ['aiida', 'workflows', 'core-level', 'spectroscopy']
license = {file = 'LICENSE'}
license = { file = 'LICENSE' }
name = 'aiidalab-qe-hp'
readme = 'README.md'
requires-python = '>=3.9'
requires-python = '>=3.12'

[project.entry-points."aiidalab_qe.properties"]
"hp" = "aiidalab_qe_hp:hp"
Expand All @@ -51,9 +48,9 @@ docs = [

[project.urls]
documentation = 'https://aiidalab-qe-hp.readthedocs.io/'
homepage = 'https://github.com/superstar54/aiidalab-qe-hp'
source = 'https://github.com/superstar54/aiidalab-qe-hp'
tracker = 'https://github.com/superstar54/aiidalab-qe-hp/issues'
homepage = 'https://github.com/aiidalab/aiidalab-qe-hp'
source = 'https://github.com/aiidalab/aiidalab-qe-hp'
tracker = 'https://github.com/aiidalab/aiidalab-qe-hp/issues'

[tool.flit.module]
name = 'aiidalab_qe_hp'
Expand Down
8 changes: 5 additions & 3 deletions src/aiidalab_qe_hp/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def check_codes(pw_code, hp_code):


def update_resources(builder, codes):
set_component_resources(builder.relax.base.pw, codes.get('pw'))
for namespace in ('base_init_relax', 'base_relax'):
if namespace in builder.relax:
set_component_resources(builder.relax[namespace].pw, codes.get('pw'))
set_component_resources(builder.scf.pw, codes.get('pw'))
set_component_resources(builder.hubbard.hp, codes.get('hp'))

Expand All @@ -66,8 +68,8 @@ def get_builder(codes, structure, parameters, **kwargs):

scf_overrides = parameters['advanced']
relax_overrides = {
'base': parameters['advanced'],
'base_final_scf': parameters['advanced'],
'base_init_relax': parameters['advanced'],
'base_relax': parameters['advanced'],
}
overrides = {
'tolerance_onsite': orm.Float(PROTOCOL_MAP_U[protocol]),
Expand Down
36 changes: 28 additions & 8 deletions tests/test_workchain.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
import pytest

from aiidalab_qe_hp.model import HpSettingsModel
from aiidalab_qe_hp.workchain import get_builder


def test_workchain(test_structure, pw_code, hp_code):
@pytest.mark.parametrize('method', ['one-shot', 'self-consistent'])
def test_workchain(test_structure, pw_code, hp_code, method):
model = HpSettingsModel()
model.structure_uuid = test_structure.uuid
model.calculation_type = 'DFT+U+V'
model.hubbard_u = [['Co', '3d', 3.0]]
model.hubbard_v = [['Co', '3d', 'O', '2p', 1.0]]
model.protocol = 'fast'
model.method = method

codes = {
'pw': {
'code': pw_code,
'nodes': 1,
'ntasks_per_node': 1,
'cpus_per_task': 1,
'nodes': 2,
'ntasks_per_node': 3,
'cpus_per_task': 4,
'max_wallclock_seconds': 3600,
},
'hp': {
'code': hp_code,
'nodes': 1,
'ntasks_per_node': 1,
'cpus_per_task': 1,
'nodes': 5,
'ntasks_per_node': 7,
'cpus_per_task': 8,
'max_wallclock_seconds': 3600,
},
}
Expand All @@ -39,4 +43,20 @@ def test_workchain(test_structure, pw_code, hp_code):
}

builder = get_builder(codes, test_structure, parameters, **{})
print(builder)

pw_resources = builder.scf.pw.metadata.options.resources
assert pw_resources['num_machines'] == codes['pw']['nodes']
assert pw_resources['num_mpiprocs_per_machine'] == codes['pw']['ntasks_per_node']
assert pw_resources['num_cores_per_mpiproc'] == codes['pw']['cpus_per_task']

hp_resources = builder.hubbard.hp.metadata.options.resources
assert hp_resources['num_machines'] == codes['hp']['nodes']
assert hp_resources['num_mpiprocs_per_machine'] == codes['hp']['ntasks_per_node']
assert hp_resources['num_cores_per_mpiproc'] == codes['hp']['cpus_per_task']

if method == 'self-consistent':
for namespace in ('base_init_relax', 'base_relax'):
resources = builder.relax[namespace].pw.metadata.options.resources
assert resources['num_machines'] == codes['pw']['nodes']
assert resources['num_mpiprocs_per_machine'] == codes['pw']['ntasks_per_node']
assert resources['num_cores_per_mpiproc'] == codes['pw']['cpus_per_task']
Loading
0