Skip to content

Commit

Permalink
Merge branch 'main' into Fix-pDOS-issue-959
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresOrtegaGuerrero authored Jan 30, 2025
2 parents bba1692 + bcd5508 commit a88f752
Show file tree
Hide file tree
Showing 35 changed files with 5,182 additions and 482 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'

- name: Validate the tag version against the package version
run: python .github/workflows/validate_release_tag.py $GITHUB_REF
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'

- name: Install Python dependencies
run: pip install -e .[pre-commit,tests]
Expand All @@ -58,7 +58,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

services:
postgres:
Expand Down Expand Up @@ -100,10 +100,10 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'

- name: Install flit
run: pip install flit~=3.4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'

- name: Install Python dependencies
run: pip install -e .[pre-commit,tests]
Expand All @@ -36,7 +36,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

services:
postgres:
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ python:
# Let the build fail if there are any warnings
sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: true
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## v4.8.0

### ✨ New features

* `Hubbard`: add useful utility functions [[41f196b](https://github.com/aiidateam/aiida-quantumespresso/commit/41f196b2b46022c179bdce0dcd44ab338d956551)]
* `PwParser`: Add XML schema for Quantum ESPRESSO v7.4 [[75808a9](https://github.com/aiidateam/aiida-quantumespresso/commit/75808a918075b7ef0ac3b82557b5325330ba0fdc)]

### 👌 Improvements

* `PhParser`: allow for pattern initialization [[74a18bc](https://github.com/aiidateam/aiida-quantumespresso/commit/74a18bc59beafd62082b24f809bfba29a402489d)]
* `PwBaseWorkChain`: Always do full restart for `ERROR_OUT_OF_WALLTIME` [[fcb8da9](https://github.com/aiidateam/aiida-quantumespresso/commit/fcb8da9a165fc4f6e94c29a6e4f1d29305da4548)]

### 📚 Documentation

* `README.md`: Correct `aiida-core` compatibility [[1c8a804](https://github.com/aiidateam/aiida-quantumespresso/commit/1c8a8049c005e791300b7d2ca7c4beae32257dc9)]

### 🔧 Maintenance

* Devops: Add explicit sphinx.configuration key to RTD conf [[733c43f](https://github.com/aiidateam/aiida-quantumespresso/commit/733c43ff6b690c19eacb108154038ca93082d145)]
* Update Python support: drop v3.8 and add v3.12 [[172540b](https://github.com/aiidateam/aiida-quantumespresso/commit/172540be5078e77d58b6a8cc1b28cbae2c6e70b9)]

## v4.7.0

### ✨ New features
Expand Down
10 changes: 8 additions & 2 deletions README.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@

# Setting the intersphinx mapping to other readthedocs
intersphinx_mapping = {
'python': ('https://docs.python.org/3.8', None),
'python': ('https://docs.python.org/3.9', None),
'aiida': ('https://aiida.readthedocs.io/projects/aiida-core/en/latest/', None),
'aiida_pseudo': ('http://aiida-pseudo.readthedocs.io/en/latest/', None),
'pymatgen': ('https://pymatgen.org/', None),
}

# Settings for the `autoapi.extenstion` automatically generating API docs
Expand Down Expand Up @@ -170,6 +171,7 @@
(r'.*', r'Tuple.*'),
]
nitpick_ignore = [
('py:class', 'numpy.typing.ArrayLike'),
('py:class', 'AttributeDict'),
('py:class', 'ExitCode'),
('py:class', 'StructureData'),
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ classifiers = [
'Framework :: AiiDA',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
keywords = ['aiida', 'workflows']
requires-python = '>=3.8'
requires-python = '>=3.9'
dependencies = [
'aiida_core[atomic_tools]~=2.3',
'aiida-pseudo~=1.1',
Expand Down
2 changes: 1 addition & 1 deletion src/aiida_quantumespresso/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""The official AiiDA plugin for Quantum ESPRESSO."""
__version__ = '4.7.0'
__version__ = '4.8.0'
15 changes: 12 additions & 3 deletions src/aiida_quantumespresso/calculations/projwfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ class ProjwfcCalculation(NamelistsCalculation):

xml_path = Path(NamelistsCalculation._default_parent_output_folder
).joinpath(f'{NamelistsCalculation._PREFIX}.save', 'data-file-schema.xml')
_internal_retrieve_list = [
NamelistsCalculation._PREFIX + '.pdos*',
]

# The XML file is added to the temporary retrieve list since it is required for parsing, but already in the
# repository of a an ancestor calculation.
_retrieve_temporary_list = [
NamelistsCalculation._PREFIX + '.pdos*',
xml_path.as_posix(),
]

Expand All @@ -60,8 +59,16 @@ def define(cls, spec):
spec.default_output_node = 'output_parameters'
spec.exit_code(301, 'ERROR_NO_RETRIEVED_TEMPORARY_FOLDER',
message='The retrieved temporary folder could not be accessed.')
spec.exit_code(302, 'ERROR_OUTPUT_STDOUT_MISSING',
message='The retrieved folder did not contain the required stdout output file.')
spec.exit_code(303, 'ERROR_OUTPUT_XML_MISSING',
message='The retrieved folder did not contain the required XML file.')
spec.exit_code(310, 'ERROR_OUTPUT_STDOUT_READ',
message='The stdout output file could not be read.')
spec.exit_code(311, 'ERROR_OUTPUT_STDOUT_PARSE',
message='The stdout output file could not be parsed.')
spec.exit_code(312, 'ERROR_OUTPUT_STDOUT_INCOMPLETE',
message='The stdout output file was incomplete probably because the calculation got interrupted.')
spec.exit_code(320, 'ERROR_OUTPUT_XML_READ',
message='The XML output file could not be read.')
spec.exit_code(321, 'ERROR_OUTPUT_XML_PARSE',
Expand All @@ -72,4 +79,6 @@ def define(cls, spec):
message='The pdos_tot file could not be read from the retrieved folder.')
spec.exit_code(340, 'ERROR_PARSING_PROJECTIONS',
message='An exception was raised parsing bands and projections.')
spec.exit_code(350, 'ERROR_UNEXPECTED_PARSER_EXCEPTION',
message='The parser raised an unexpected exception: {exception}')
# yapf: enable
8 changes: 5 additions & 3 deletions src/aiida_quantumespresso/data/hubbard_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ def append_hubbard_parameter(
parameters = HubbardParameters.from_tuple(hp_tuple)
hubbard = self.hubbard

if parameters not in hubbard.parameters:
hubbard.parameters.append(parameters)
self.hubbard = hubbard
if parameters in hubbard.parameters:
hubbard.parameters.remove(parameters)

hubbard.parameters.append(parameters)
self.hubbard = hubbard

def pop_hubbard_parameters(self, index: int):
"""Pop Hubbard parameters in the list.
Expand Down
46 changes: 46 additions & 0 deletions src/aiida_quantumespresso/parsers/parse_raw/ph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
The function that needs to be called from outside is parse_raw_ph_output(). Ideally, the functions should work even
without aiida and will return a dictionary with parsed keys.
"""
from __future__ import annotations

import numpy
from qe_tools import CONSTANTS

Expand Down Expand Up @@ -438,3 +440,47 @@ def parse_ph_dynmat(data, logs, lattice_parameter=None, also_eigenvectors=False,
parsed_data['eigenvectors'] = eigenvectors

return parsed_data


def parse_initialization_qpoints(stdout: str) -> dict:
"""Return the number of q-points from an initialization run.
Here, the initialization run refers to the one performed by specifying
`start_irr` and `last_irr` to 0 in the inputs.
:return: parsed dictionary
:raise: `RuntimeError` if the number of q-points cannot be parsed or it
differs from the number of q-points in the stdout list.
"""
import re

parameters = {}

# Regular expression to match `N` in `( N q-points)`
pattern = r'\(\s*(\d+)\s*q-points\)'
match = re.search(pattern, stdout)
if match:
parameters.update({'number_of_qpoints': int(match.group(1))})
else:
raise RuntimeError('the number of q-points cannot be parsed')

# Regular expression pattern to match the q-points section
pattern = r'\(\s*\d+\s*q-points\):\s*\n\s*N\s*xq\(1\)\s*xq\(2\)\s*xq\(3\)\s*\n((?:\s*\d+\s*[\d\.\-\s]+\n?)*)'
match = re.search(pattern, stdout)

if match:
q_points_block = match.group(1)

# Regular expression to match each line of coordinates
coord_pattern = r'\s*\d+\s*([\d\.\-]+)\s*([\d\.\-]+)\s*([\d\.\-]+)'

coords = re.findall(coord_pattern, q_points_block) # Find all coordinates in the block
q_points = [list(map(float, coord)) for coord in coords]
else:
raise RuntimeError('the list of q-points cannot be parsed')

if parameters['number_of_qpoints'] != len(q_points):
raise RuntimeError('the number of q-points do not coincde with the number of listed q-points')

return parameters
Loading

0 comments on commit a88f752

Please sign in to comment.