From 470251657915650b2cba1d7c089bb51dcf4e9a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Jan=C3=9Fen?= Date: Sat, 22 Mar 2025 11:12:05 +0100 Subject: [PATCH 1/2] Refactor quantum espresso parser --- .github/workflows/aiida.yml | 4 ++-- .github/workflows/executorlib.yml | 2 +- .github/workflows/jobflow.yml | 4 ++-- .github/workflows/pyiron.yml | 4 ++-- .github/workflows/python.yml | 2 +- adis_tools/pyproject.toml | 20 ------------------- postBuild | 4 ++-- qe_xml_parser/pyproject.toml | 13 ++++++++++++ .../src/qe_xml_parser}/__init__.py | 0 .../src/qe_xml_parser}/parsers.py | 2 +- .../src/qe_xml_parser}/schemas/__init__.py | 0 .../src/qe_xml_parser}/schemas/qes_230310.xsd | 0 quantum_espresso_workflow.py | 4 +--- 13 files changed, 25 insertions(+), 34 deletions(-) delete mode 100644 adis_tools/pyproject.toml create mode 100644 qe_xml_parser/pyproject.toml rename {adis_tools/src/adis_tools => qe_xml_parser/src/qe_xml_parser}/__init__.py (100%) rename {adis_tools/src/adis_tools => qe_xml_parser/src/qe_xml_parser}/parsers.py (97%) rename {adis_tools/src/adis_tools => qe_xml_parser/src/qe_xml_parser}/schemas/__init__.py (100%) rename {adis_tools/src/adis_tools => qe_xml_parser/src/qe_xml_parser}/schemas/qes_230310.xsd (100%) diff --git a/.github/workflows/aiida.yml b/.github/workflows/aiida.yml index 3bf45aa..45e698f 100644 --- a/.github/workflows/aiida.yml +++ b/.github/workflows/aiida.yml @@ -21,10 +21,10 @@ jobs: - name: Installation and setup shell: bash -l {0} run: | - pip install -e adis_tools + pip install -e qe_xml_parser pip install -e python_workflow_definition conda install -c conda-forge jupyter papermill - verdi presto --profile-name adis + verdi presto --profile-name pwd - name: Tests shell: bash -l {0} run: | diff --git a/.github/workflows/executorlib.yml b/.github/workflows/executorlib.yml index b0d06a9..b9eb80a 100644 --- a/.github/workflows/executorlib.yml +++ b/.github/workflows/executorlib.yml @@ -21,7 +21,7 @@ jobs: - name: Tests shell: bash -l {0} run: | - pip install -e adis_tools + pip install -e qe_xml_parser pip install -e python_workflow_definition conda install -c conda-forge jupyter papermill export ESPRESSO_PSEUDO=$(pwd)/espresso/pseudo diff --git a/.github/workflows/jobflow.yml b/.github/workflows/jobflow.yml index ff3c7ab..a5123ed 100644 --- a/.github/workflows/jobflow.yml +++ b/.github/workflows/jobflow.yml @@ -21,10 +21,10 @@ jobs: - name: Installation and setup shell: bash -l {0} run: | - pip install -e adis_tools + pip install -e qe_xml_parser pip install -e python_workflow_definition conda install -c conda-forge jupyter papermill - verdi presto --profile-name adis + verdi presto --profile-name pwd - name: Tests shell: bash -l {0} run: | diff --git a/.github/workflows/pyiron.yml b/.github/workflows/pyiron.yml index 4e0b8cc..79d3805 100644 --- a/.github/workflows/pyiron.yml +++ b/.github/workflows/pyiron.yml @@ -21,10 +21,10 @@ jobs: - name: Installation and setup shell: bash -l {0} run: | - pip install -e adis_tools + pip install -e qe_xml_parser pip install -e python_workflow_definition conda install -c conda-forge jupyter papermill - verdi presto --profile-name adis + verdi presto --profile-name pwd - name: Tests shell: bash -l {0} run: | diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index e651121..9089187 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -21,7 +21,7 @@ jobs: - name: Tests shell: bash -l {0} run: | - pip install -e adis_tools + pip install -e qe_xml_parser pip install -e python_workflow_definition conda install -c conda-forge jupyter papermill export ESPRESSO_PSEUDO=$(pwd)/espresso/pseudo diff --git a/adis_tools/pyproject.toml b/adis_tools/pyproject.toml deleted file mode 100644 index be181ea..0000000 --- a/adis_tools/pyproject.toml +++ /dev/null @@ -1,20 +0,0 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[project] -name = "adis_tools" -version = "0.0.1" -description = "Common functions for the Ab initio Description of Iron and Steel (ADIS2023): Digitalization and Workflows workshop" -authors = [ - { name = "Jan Janssen", email = "janssen@mpie.de" }, - { name = "Janine George", email = "janine.geogre@bam.de" }, - { name = "Marnik Bercx", email = "marnik.bercx@psi.ch" }, - { name = "Christina Ertural", email = "christina.ertural@bam.de" }, - { name = "Joerg Schaarschmidt", email = "joerg.schaarschmidt@kit.edu" }, - { name = "Sam Dareska" }, - { name = "Leopold Talirz", email = "leopold.talirz@gmail.com" }, - { name = "Julian Geiger", email = "julian.geiger@psi.ch" }, -] -license = { text = "MIT" } -dependencies = ["numpy", "xmlschema", "qe_tools", "ase"] \ No newline at end of file diff --git a/postBuild b/postBuild index 687c051..f5441d3 100644 --- a/postBuild +++ b/postBuild @@ -1,3 +1,3 @@ -pip install -e adis_tools +pip install -e qe_xml_parser pip install -e python_workflow_definition -verdi presto --profile-name adis +verdi presto --profile-name pwd diff --git a/qe_xml_parser/pyproject.toml b/qe_xml_parser/pyproject.toml new file mode 100644 index 0000000..9548fe6 --- /dev/null +++ b/qe_xml_parser/pyproject.toml @@ -0,0 +1,13 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "qe_xml_parser" +version = "0.0.1" +description = "Quantum Espresso xml output parser" +authors = [ + { name = "Marnik Bercx", email = "marnik.bercx@psi.ch" }, +] +license = { text = "MIT" } +dependencies = ["numpy", "xmlschema", "qe_tools", "ase"] \ No newline at end of file diff --git a/adis_tools/src/adis_tools/__init__.py b/qe_xml_parser/src/qe_xml_parser/__init__.py similarity index 100% rename from adis_tools/src/adis_tools/__init__.py rename to qe_xml_parser/src/qe_xml_parser/__init__.py diff --git a/adis_tools/src/adis_tools/parsers.py b/qe_xml_parser/src/qe_xml_parser/parsers.py similarity index 97% rename from adis_tools/src/adis_tools/parsers.py rename to qe_xml_parser/src/qe_xml_parser/parsers.py index 1b066bd..a309fb4 100644 --- a/adis_tools/src/adis_tools/parsers.py +++ b/qe_xml_parser/src/qe_xml_parser/parsers.py @@ -6,7 +6,7 @@ from ase import Atoms from importlib.resources import files -from . import schemas +from qe_xml_parser.schemas import schemas def parse_pw(xml_file): diff --git a/adis_tools/src/adis_tools/schemas/__init__.py b/qe_xml_parser/src/qe_xml_parser/schemas/__init__.py similarity index 100% rename from adis_tools/src/adis_tools/schemas/__init__.py rename to qe_xml_parser/src/qe_xml_parser/schemas/__init__.py diff --git a/adis_tools/src/adis_tools/schemas/qes_230310.xsd b/qe_xml_parser/src/qe_xml_parser/schemas/qes_230310.xsd similarity index 100% rename from adis_tools/src/adis_tools/schemas/qes_230310.xsd rename to qe_xml_parser/src/qe_xml_parser/schemas/qes_230310.xsd diff --git a/quantum_espresso_workflow.py b/quantum_espresso_workflow.py index f9b8ff8..dcb6a1d 100644 --- a/quantum_espresso_workflow.py +++ b/quantum_espresso_workflow.py @@ -2,12 +2,10 @@ import os import subprocess -from ase.atoms import Atoms from ase.build import bulk from ase.io import write -from adis_tools.parsers import parse_pw +from qe_xml_parser.parsers import parse_pw import matplotlib.pyplot as plt -import numpy as np from optimade.adapters.structures.ase import from_ase_atoms, get_ase_atoms from optimade.models.structures import StructureResourceAttributes, StructureResource From 579ec878806548f6c281bc09e9af8f44e7cb1f33 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 22 Mar 2025 11:16:22 +0100 Subject: [PATCH 2/2] Update parsers.py --- qe_xml_parser/src/qe_xml_parser/parsers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qe_xml_parser/src/qe_xml_parser/parsers.py b/qe_xml_parser/src/qe_xml_parser/parsers.py index a309fb4..1b066bd 100644 --- a/qe_xml_parser/src/qe_xml_parser/parsers.py +++ b/qe_xml_parser/src/qe_xml_parser/parsers.py @@ -6,7 +6,7 @@ from ase import Atoms from importlib.resources import files -from qe_xml_parser.schemas import schemas +from . import schemas def parse_pw(xml_file):