-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1521 from pyiron/tests
Add usecases to the tests
- Loading branch information
Showing
23 changed files
with
20,516 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Usecase ADIS | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Merge Notebook environment | ||
run: | | ||
cp .ci_support/environment.yml environment.yml | ||
tail --lines=+4 tests/usecases/ADIS/environment.yml >> environment.yml | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
python-version: "3.11" | ||
miniforge-variant: Mambaforge | ||
channels: conda-forge | ||
channel-priority: strict | ||
activate-environment: my-env | ||
environment-file: environment.yml | ||
use-mamba: true | ||
- name: Tests | ||
shell: bash -l {0} | ||
run: | | ||
bash .ci_support/pip_install.sh | ||
conda install -c conda-forge jupyter papermill | ||
cd tests/usecases/ADIS | ||
export ESPRESSO_PSEUDO=$(pwd)/espresso/pseudo | ||
papermill notebook.ipynb notebook-out.ipynb -k "python3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Usecase NFDI4Ing | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Merge Notebook environment | ||
run: | | ||
cp .ci_support/environment.yml environment.yml | ||
tail --lines=+4 tests/usecases/NFDI4ING/environment.yml >> environment.yml | ||
- name: Setup Mambaforge | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
python-version: '3.11' | ||
miniforge-variant: Mambaforge | ||
channels: conda-forge | ||
channel-priority: strict | ||
activate-environment: my-env | ||
environment-file: environment.yml | ||
use-mamba: true | ||
- name: Test | ||
shell: bash -l {0} | ||
timeout-minutes: 60 | ||
run: | | ||
bash .ci_support/pip_install.sh | ||
conda install -y papermill jupyter | ||
sudo apt-get install -y $(cat tests/usecases/NFDI4ING/apt.txt) | ||
cd tests/usecases/NFDI4ING | ||
papermill notebook.ipynb notebook.ipynb -k "python3" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import numpy | ||
|
||
from xmlschema import XMLSchema | ||
from qe_tools import CONSTANTS | ||
|
||
from ase import Atoms | ||
from importlib.resources import files | ||
|
||
from . import schemas | ||
|
||
|
||
def parse_pw(xml_file): | ||
"""Parse a Quantum Espresso XML output file.""" | ||
|
||
xml_dict = XMLSchema(str(files(schemas) / "qes_230310.xsd")).to_dict(xml_file) | ||
|
||
parsed_results = {} | ||
|
||
try: | ||
cell = ( | ||
numpy.array( | ||
[v for v in xml_dict["output"]["atomic_structure"]["cell"].values()] | ||
) | ||
* CONSTANTS.bohr_to_ang | ||
) | ||
symbols = [ | ||
el["@name"] | ||
for el in xml_dict["output"]["atomic_structure"]["atomic_positions"]["atom"] | ||
] | ||
positions = ( | ||
numpy.array( | ||
[ | ||
el["$"] | ||
for el in xml_dict["output"]["atomic_structure"][ | ||
"atomic_positions" | ||
]["atom"] | ||
] | ||
) | ||
* CONSTANTS.bohr_to_ang | ||
) | ||
|
||
parsed_results["ase_structure"] = Atoms( | ||
cell=cell, | ||
positions=positions, | ||
symbols=symbols, | ||
pbc=True, | ||
) | ||
except KeyError: | ||
pass | ||
|
||
try: | ||
parsed_results["energy"] = ( | ||
xml_dict["output"]["total_energy"]["etot"] * CONSTANTS.ry_to_ev | ||
) | ||
except KeyError: | ||
pass | ||
|
||
try: | ||
parsed_results["forces"] = ( | ||
numpy.array(xml_dict["output"]["forces"]["$"]).reshape( | ||
xml_dict["output"]["forces"]["@dims"] | ||
) | ||
* 2 | ||
* CONSTANTS.ry_to_ev | ||
/ CONSTANTS.bohr_to_ang | ||
) | ||
except KeyError: | ||
pass | ||
|
||
return parsed_results |
Empty file.
Oops, something went wrong.