Skip to content

Commit 8edbe89

Browse files
committed
🧪 EpwParser: reintroduce tests from AiiDA-QE
Add the parser tests that were previously in the EPW support branch of `aiida-quantumespresso`. For setting up a `localhost` computer, we rely on the `aiida_localhost` test fixture provided in the `aiida.tools.pytest_fixtures` module, made available via the `pytest_plugins` variable. Originally the idea was to make the `aiida-quantumespresso` fixtures similarly importable, but closer inspection revealed improvements can still be made, and the fixtures were currently not general enough to work for other plugin packages. Instead, we add two fixtures here: - `files_path`: this simply returns the path to the test files directory. For the tests added here, the files correspond to the output files for which we want to test the `EpwParser`. - `parse_from_files`: a simplified version of the fixtures defined in `aiida-quantumespresso`. Parses the output files in the corresponding `test_name` directory. The tests that we had in the EPW support branch have also been adapted to rely on these fixtures.
1 parent 2a227a1 commit 8edbe89

File tree

15 files changed

+2423
-9
lines changed

15 files changed

+2423
-9
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ docs = [
4646
"mystmd"
4747
]
4848
tests = [
49-
"pytest"
49+
"pytest",
50+
"pytest-regressions"
5051
]
5152
pre-commit = [
5253
"pre-commit"

tests/conftest.py

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,55 @@
1-
"""Project-wide pytest fixtures & hooks.
2-
3-
Docs: https://docs.pytest.org/en/stable/how-to/fixtures.html#conftest-py-sharing-fixtures-across-multiple-files
4-
"""
1+
"""Fixtures and configuration for the `aiida-epw` package."""
52

63
import pytest
74

5+
from pathlib import Path
6+
7+
from aiida import orm
8+
from aiida.common import LinkType
9+
from aiida.plugins.entry_point import format_entry_point_string, get_entry_point_string_from_class
10+
from aiida.parsers.parser import Parser
11+
12+
13+
pytest_plugins = 'aiida.tools.pytest_fixtures'
14+
15+
16+
@pytest.fixture
17+
def files_path():
18+
"""Path to the data files used for the tests."""
19+
return Path(__file__).parent / "files"
20+
821

922
@pytest.fixture
10-
def readability_counts() -> bool:
11-
return True
23+
def parse_from_files(aiida_localhost, files_path):
24+
"""Return a function that parses the files from a corresponding test name."""
25+
26+
def factory(parser_class: Parser, test_name: str):
27+
"""Parse the files from the corresponding test name using the parser class.
28+
29+
:param parser_class: parser class used for the parsing.
30+
:param test_name: name of the directory in which the test files are stored.
31+
Resolves to `tests/files/parsers/<parser_entry_point.split('.')[-1]>/test_name`
32+
:return: Tuple of parsed results and the `CalcFunctionNode` representing the process of parsing
33+
"""
34+
parser_entry_point = get_entry_point_string_from_class(
35+
class_module=parser_class.__module__, class_name=parser_class.__name__
36+
)
37+
calc_entry_point = format_entry_point_string(
38+
group='aiida.calculations', name=parser_entry_point.split(':')[1]
39+
)
40+
node = orm.CalcJobNode(computer=aiida_localhost, process_type=calc_entry_point)
41+
node.base.attributes.set('output_filename', 'aiida.out')
42+
43+
directory_path = files_path / 'parsers' / parser_entry_point.split('.')[-1] / test_name
44+
45+
node.store()
46+
47+
retrieved = orm.FolderData()
48+
retrieved.base.repository.put_object_from_tree(directory_path.as_posix())
49+
50+
retrieved.base.links.add_incoming(node, link_type=LinkType.CREATE, link_label='retrieved')
51+
retrieved.store()
52+
53+
return parser_class.parse_from_node(node, store_provenance=False)
54+
55+
return factory
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
2+
``:oss/
3+
`.+s+. .+ys--yh+ `./ss+.
4+
-sh//yy+` +yy +yy -+h+-oyy
5+
-yh- .oyy/.-sh. .syo-.:sy- /yh
6+
`.-.` `yh+ -oyyyo. `/syys: oys `.`
7+
`/+ssys+-` `sh+ ` oys` .:osyo`
8+
-yh- ./syyooyo` .sys+/oyo--yh/
9+
`yy+ .-:-. `-/+/:` -sh-
10+
/yh. oys
11+
``..---hho---------` .---------..` `.-----.` -hd+---.
12+
`./osmNMMMMMMMMMMMMMMMs. +NNMMMMMMMMNNmh+. yNMMMMMNm- oNMMMMMNmo++:`
13+
+sy--/sdMMMhyyyyyyyNMMh- .oyNMMmyyyyyhNMMm+` -yMMMdyyo:` .oyyNMMNhs+syy`
14+
-yy/ /MMM+.`-+/``mMMy- `mMMh:`````.dMMN:` `MMMy-`-dhhy```mMMy:``+hs
15+
-yy+` /MMMo:-mMM+`-oo/. mMMh: `dMMN/` dMMm:`dMMMMy..MMMo-.+yo`
16+
.sys`/MMMMNNMMMs- mMMmyooooymMMNo: oMMM/sMMMMMM++MMN//oh:
17+
`sh+/MMMhyyMMMs- `-` mMMMMMMMMMNmy+-` -MMMhMMMsmMMmdMMd/yy+
18+
`-/+++oyy-/MMM+.`/hh/.`mNm:` mMMd+/////:-.` NMMMMMd/:NMMMMMy:/yyo/:.`
19+
+os+//:-..-oMMMo:--:::-/MMMo. .-mMMd+---` hMMMMN+. oMMMMMo. `-+osyso:`
20+
syo `mNMMMMMNNNNNNNNMMMo.oNNMMMMMNNNN:` +MMMMs:` dMMMN/` ``:syo
21+
/yh` :syyyyyyyyyyyyyyyy+.`+syyyyyyyyo:` .oyys:` .oyys:` +yh
22+
-yh- ```````````````` ````````` `` `` oys
23+
-+h/------------------------::::::::://////++++++++++++++++++++++///////::::/yd:
24+
shdddddddddddddddddddddddddddddhhhhhhhhyyyyyssssssssssssssssyyyyyyyhhhhhhhddddh`
25+
26+
S. Ponce, E. R. Margine, C. Verdi, and F. Giustino,
27+
Comput. Phys. Commun. 209, 116 (2016)
28+
29+
30+
Program EPW v.5.7 starts on 25Jul2023 at 0:11:31
31+
32+
This program is part of the open-source Quantum ESPRESSO suite
33+
for quantum simulation of materials; please cite
34+
"P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
35+
"P. Giannozzi et al., J. Phys.:Condens. Matter 29 465901 (2017);
36+
"P. Giannozzi et al., J. Chem. Phys. 152 154105 (2020);
37+
URL http://www.quantum-espresso.org",
38+
in publications or presentations arising from this work. More details at
39+
http://www.quantum-espresso.org/quote
40+
41+
Parallel version (MPI), running on 128 processors
42+
43+
MPI processes distributed on 1 nodes
44+
K-points division: npool = 128
45+
236845 MiB available memory on the printing compute node when the environment starts
46+
47+
Reading input from aiida.in
48+
Title line not specified: using 'default'.
49+
50+
No temperature supplied. Setting temps(:) to 300 K.
51+
52+
------------------------------------------------------------------------
53+
RESTART - RESTART - RESTART - RESTART
54+
Restart is done without reading PWSCF save file.
55+
Be aware that some consistency checks are therefore not done.
56+
------------------------------------------------------------------------
57+
58+
59+
default
60+
61+
bravais-lattice index = 0
62+
lattice parameter (a_0) = 0.0000 a.u.
63+
unit-cell volume = 0.0000 (a.u.)^3
64+
number of atoms/cell = 0
65+
number of atomic types = 0
66+
kinetic-energy cut-off = 0.0000 Ry
67+
charge density cut-off = 0.0000 Ry
68+
Exchange-correlation= not set
69+
( -1 -1 -1 -1 -1 -1 -1)
70+
71+
72+
celldm(1)= 0.00000 celldm(2)= 0.00000 celldm(3)= 0.00000
73+
celldm(4)= 0.00000 celldm(5)= 0.00000 celldm(6)= 0.00000
74+
75+
crystal axes: (cart. coord. in units of a_0)
76+
a(1) = ( 0.0000 0.0000 0.0000 )
77+
a(2) = ( 0.0000 0.0000 0.0000 )
78+
a(3) = ( 0.0000 0.0000 0.0000 )
79+
80+
reciprocal axes: (cart. coord. in units 2 pi/a_0)
81+
b(1) = ( 0.0000 0.0000 0.0000 )
82+
b(2) = ( 0.0000 0.0000 0.0000 )
83+
b(3) = ( 0.0000 0.0000 0.0000 )
84+
85+
86+
Atoms inside the unit cell:
87+
88+
Cartesian axes
89+
90+
site n. atom mass positions (a_0 units)
91+
92+
93+
No symmetry!
94+
95+
G cutoff = 0.0000 ( 0 G-vectors) FFT grid: ( 0, 0, 0)
96+
number of k points= 0
97+
cart. coord. in units 2pi/a_0
98+
EPW : 0.01s CPU 0.03s WALL
99+
100+
EPW : 0.01s CPU 0.03s WALL
101+
102+
103+
-------------------------------------------------------------------
104+
Using aiida.ukk from disk
105+
-------------------------------------------------------------------
106+
107+
Symmetries of Bravais lattice: 24
108+
Symmetries of crystal: 24
109+
110+
Do not need to read .epb files; read .fmt files
111+
112+
113+
Band disentanglement is used: nbndsub = 20
114+
Use zone-centred Wigner-Seitz cells
115+
Number of WS vectors for electrons 511
116+
Number of WS vectors for phonons 57
117+
Number of WS vectors for electron-phonon 57
118+
Maximum number of cores for efficient parallelization 684
119+
Results may improve by using use_ws == .TRUE.
120+
121+
Reading Hamiltonian, Dynamical matrix and EP vertex in Wann rep from file
122+
123+
124+
Finished reading Wann rep data from file
125+
126+
===================================================================
127+
Memory usage: VmHWM = 44Mb
128+
VmPeak = 887Mb
129+
===================================================================
130+
131+
Using q-mesh file: qfpoints.kpt
132+
WARNING: q-point weigths do not add up to 1 [loadqmesh_serial]
133+
Size of q point mesh for interpolation: 283
134+
Using k-mesh file: kfpoints.kpt
135+
WARNING: k-point weigths do not add up to 1 [loadkmesh_para]
136+
Size of k point mesh for interpolation: 566
137+
Max number of k points per pool: 6
138+
139+
Fermi energy coarse grid = 14.700566 eV
140+
141+
===================================================================
142+
143+
Fermi energy corresponds to the coarse k-mesh
144+
145+
===================================================================
146+
147+
ibndmin = 1 ebndmin = -1.062 eV
148+
ibndmax = 20 ebndmax = 25.007 eV
149+
150+
151+
Number of ep-matrix elements per pool : 14400 ~= 112.50 Kb (@ 8 bytes/ DP)
152+
153+
A selecq.fmt file was found but re-created because selecqread == .FALSE.
154+
Number selected, total 100 100
155+
Number selected, total 200 200
156+
We only need to compute 283 q-points
157+
158+
Progression iq (fine) = 100/ 283
159+
Progression iq (fine) = 200/ 283
160+
===================================================================
161+
Memory usage: VmHWM = 132Mb
162+
VmPeak = 982Mb
163+
===================================================================
164+
165+
166+
Unfolding on the coarse grid
167+
elphon_wrap : 0.00s CPU 0.04s WALL ( 1 calls)
168+
169+
INITIALIZATION:
170+
171+
172+
173+
174+
Electron-Phonon interpolation
175+
ephwann : 69.44s CPU 91.31s WALL ( 1 calls)
176+
ep-interp : 68.11s CPU 87.66s WALL ( 283 calls)
177+
178+
DynW2B : 0.02s CPU 0.02s WALL ( 283 calls)
179+
HamW2B : 2.00s CPU 2.21s WALL ( 1990 calls)
180+
ephW2Bp : 47.20s CPU 66.36s WALL ( 283 calls)
181+
ephW2B : 11.62s CPU 11.66s WALL ( 849 calls)
182+
183+
184+
Total program execution
185+
EPW : 1m 9.45s CPU 1m31.40s WALL
186+
187+
===============================================================================
188+
The functionality-dependent EPW.bib file was created with suggested citations.
189+
Please consider citing the papers listed in EPW.bib.
190+
===============================================================================
191+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
&plot nbnd= 20, nks= 8 /
2+
0.000000 0.000000 0.000000
3+
-1.062274538219 -0.674223523464 9.316575269770 9.316575298301 9.563195491658 9.563195515517 10.570669366941 12.163213074534 14.372576245065 14.372576322299 14.649212759774 16.842182825602 17.688780223265 17.688785004869 19.233517222189 20.468845874559 20.470945827274 21.318365096650 21.331875260807 21.878595849966
4+
0.013514 0.007802 0.000000
5+
-1.060700111600 -0.673082447313 9.313676744493 9.319166840883 9.563522147944 9.565195447614 10.569881802457 12.158776438589 14.369843064473 14.376568039570 14.658465342101 16.842980282697 17.688129059980 17.692128477291 19.237066765258 20.457631479305 20.464748379303 21.312729637039 21.327913355597 21.884031262761
6+
0.027027 0.015604 0.000000
7+
-1.055981468429 -0.669673988945 9.305172786881 9.326898254325 9.564499474675 9.571163915259 10.567577955958 12.145619279203 14.361706307445 14.388399391907 14.685882432680 16.845295567082 17.686158854684 17.702170788442 19.247630879984 20.423116946200 20.447490177484 21.294975645661 21.316685929206 21.900616643792
8+
0.040541 0.023406 0.000000
9+
-1.048138292418 -0.664036944837 9.291582155529 9.339660349482 9.566016632458 9.581123481016 10.563915874723 12.124178389587 14.348318426603 14.407637064933 14.730575497852 16.848913372504 17.682857746521 17.718923919246 19.264968843659 20.366813062917 20.418983412653 21.264108313455 21.298679962854 21.929061032314
10+
0.054054 0.031208 0.000000
11+
-1.037215663213 -0.656226088351 9.273637178757 9.357290058651 9.567958266772 9.595084263669 10.559118707843 12.095120538030 14.329906770864 14.433533089824 14.791365726991 16.853524284933 17.678288309289 17.742364495067 19.288706021275 20.290599534022 20.379361209917 21.219836420034 21.273531889252 21.970183003235
12+
0.067568 0.039010 0.000000
13+
-1.023295754665 -0.646302725321 9.252150487839 9.379595319383 9.570238228212 9.613044973847 10.553425389669 12.059266979482 14.306784354307 14.465052521196 14.867032069818 16.858781806521 17.672685739827 17.772380580301 19.318359732532 20.196696535829 20.328886601192 21.162048113097 21.240771289310 22.024484785188
14+
0.081081 0.046812 0.000000
15+
-1.006503965775 -0.634329626443 9.227915138946 9.406378569241 9.572831933653 9.634982338134 10.547040591715 12.017513107021 14.279365985862 14.500956348915 14.956479012134 16.864355215486 17.666541597535 17.808720604114 19.353355320111 20.087502286405 20.267903604796 21.090727851889 21.200111318687 22.091763857946
16+
0.094595 0.054614 0.000000
17+
-0.987005148772 -0.620373743611 9.201656523514 9.437454826246 9.575794847283 9.660843689396 10.540097056419 11.970756596255 14.248157488649 14.539919439683 15.058811492745 16.869963738068 17.660633285951 17.850958747752 19.393025704508 19.965441203106 20.196824709829 21.006045221431 21.151512852070 22.170894974497
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
&plot nbnd= 12, nks= 8 /
2+
0.000000 0.000000 0.000000
3+
-0.0000 -0.0000 -0.0000 21.6834 21.6834 28.1903 53.8871 53.8871 56.6914 60.2970 60.2970 67.7687
4+
0.013514 0.007802 0.000000
5+
0.3788 0.7404 1.1784 21.7065 21.7127 28.1916 53.8625 53.8670 56.6870 60.2817 60.2965 67.7404
6+
0.027027 0.015604 0.000000
7+
0.7578 1.4801 2.3531 21.7753 21.7998 28.1957 53.7893 53.8066 56.6743 60.2362 60.2947 67.6558
8+
0.040541 0.023406 0.000000
9+
1.1370 2.2183 3.5205 21.8884 21.9427 28.2023 53.6687 53.7053 56.6535 60.1618 60.2901 67.5158
10+
0.054054 0.031208 0.000000
11+
1.5165 2.9543 4.6771 22.0432 22.1379 28.2112 53.5029 53.5624 56.6254 60.0609 60.2809 67.3221
12+
0.067568 0.039010 0.000000
13+
1.8960 3.6872 5.8196 22.2366 22.3810 28.2221 53.2947 53.3773 56.5911 59.9360 60.2647 67.0767
14+
0.081081 0.046812 0.000000
15+
2.2752 4.4163 6.9449 22.4647 22.6663 28.2346 53.0468 53.1497 56.5516 59.7901 60.2387 66.7825
16+
0.094595 0.054614 0.000000
17+
2.6538 5.1408 8.0501 22.7231 22.9872 28.2482 52.7624 52.8804 56.5084 59.6262 60.2002 66.4425

0 commit comments

Comments
 (0)