Skip to content

Commit 235edf6

Browse files
committed
🐛 PwOutput: fix StopIteration error when XML is missing
1 parent 3ea6fd6 commit 235edf6

File tree

4 files changed

+181
-1
lines changed

4 files changed

+181
-1
lines changed

src/qe_tools/outputs/pw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def from_dir(cls, directory: str | Path):
8383
raise ValueError(f"Path `{directory}` is not a valid directory.")
8484

8585
stdout_file = None
86-
xml_file = next(directory.rglob("data-file*.xml"))
86+
xml_file = next(directory.rglob("data-file*.xml"), None)
8787

8888
for file in [path for path in directory.iterdir() if path.is_file()]:
8989
with file.open("r") as handle:
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
2+
Program PWSCF v.7.5 starts on 12Oct2025 at 6:10:24
3+
4+
This program is part of the open-source Quantum ESPRESSO suite
5+
for quantum simulation of materials; please cite
6+
"P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
7+
"P. Giannozzi et al., J. Phys.:Condens. Matter 29 465901 (2017);
8+
"P. Giannozzi et al., J. Chem. Phys. 152 154105 (2020);
9+
URL http://www.quantum-espresso.org",
10+
in publications or presentations arising from this work. More details at
11+
http://www.quantum-espresso.org/quote
12+
13+
Parallel version (MPI), running on 1 processors
14+
15+
MPI processes distributed on 1 nodes
16+
0 MiB available memory on the printing compute node when the environment starts
17+
18+
Reading input from aiida.in
19+
20+
Current dimensions of program PWSCF are:
21+
Max number of different atomic species (ntypx) = 10
22+
Max number of k-points (npk) = 40000
23+
Max angular momentum in pseudopotentials (lmaxx) = 4
24+
25+
Subspace diagonalization in iterative solution of the eigenvalue problem:
26+
a serial algorithm will be used
27+
28+
29+
G-vector sticks info
30+
--------------------
31+
sticks: dense smooth PW G-vecs: dense smooth PW
32+
Sum 1649 829 241 50733 17941 2721
33+
34+
Using Slab Decomposition
35+
36+
37+
38+
bravais-lattice index = 0
39+
lattice parameter (alat) = 7.6156 a.u.
40+
unit-cell volume = 441.6841 (a.u.)^3
41+
number of atoms/cell = 8
42+
number of atomic types = 2
43+
number of electrons = 40.00
44+
number of Kohn-Sham states= 24
45+
kinetic-energy cutoff = 45.0000 Ry
46+
charge density cutoff = 360.0000 Ry
47+
scf convergence threshold = 3.2E-09
48+
mixing beta = 0.4000
49+
number of iterations used = 8 plain mixing
50+
Exchange-correlation= SLA PW PSX PSC
51+
( 1 4 10 8 0 0 0)
52+
53+
celldm(1)= 7.615596 celldm(2)= 0.000000 celldm(3)= 0.000000
54+
celldm(4)= 0.000000 celldm(5)= 0.000000 celldm(6)= 0.000000
55+
56+
crystal axes: (cart. coord. in units of alat)
57+
a(1) = ( 1.000000 0.000000 0.000000 )
58+
a(2) = ( 0.000000 1.000000 0.000000 )
59+
a(3) = ( 0.000000 0.000000 1.000000 )
60+
61+
reciprocal axes: (cart. coord. in units 2 pi/alat)
62+
b(1) = ( 1.000000 0.000000 0.000000 )
63+
b(2) = ( 0.000000 1.000000 0.000000 )
64+
b(3) = ( 0.000000 0.000000 1.000000 )
65+
66+
67+
PseudoPot. # 1 for F read from file:
68+
./pseudo/f_pbesol_v1.4.uspp.F.UPF
69+
MD5 check sum: d2815ecb49b17b99c5724ffd2f9bbd8d
70+
Pseudo is Ultrasoft, Zval = 7.0
71+
Generated by new atomic code, or converted to UPF format
72+
Using radial grid of 799 points, 4 beta functions with:
73+
l(1) = 0
74+
l(2) = 0
75+
l(3) = 1
76+
l(4) = 1
77+
Q(r) pseudized with 8 coefficients, rinner = 0.950 0.950 0.950
78+
79+
80+
PseudoPot. # 2 for Li read from file:
81+
./pseudo/li_pbesol_v1.4.uspp.F.UPF
82+
MD5 check sum: aa28d9aeea6a965f2dc95ee9517b3536
83+
Pseudo is Ultrasoft, Zval = 3.0
84+
Generated by new atomic code, or converted to UPF format
85+
Using radial grid of 751 points, 5 beta functions with:
86+
l(1) = 0
87+
l(2) = 0
88+
l(3) = 0
89+
l(4) = 1
90+
l(5) = 1
91+
Q(r) pseudized with 10 coefficients, rinner = 1.150 1.150 1.150
92+
93+
94+
atomic species valence mass pseudopotential
95+
F 7.00 18.99840 F ( 1.00)
96+
Li 3.00 6.94100 Li( 1.00)
97+
98+
Dense grid: 50733 G-vectors FFT dimensions: ( 45, 45, 45)
99+
100+
Smooth grid: 17941 G-vectors FFT dimensions: ( 36, 36, 36)
101+
102+
Estimated static dynamical RAM per process > 22.38 MB
103+
104+
Estimated max dynamical RAM per process > 83.15 MB
105+
106+
Initial potential from superposition of free atoms
107+
108+
starting charge 38.1968, renormalised to 40.0000
109+
Starting wfcs are 36 randomized atomic wfcs
110+
111+
total cpu time spent up to now is 0.3 secs
112+
113+
Self-consistent Calculation
114+
115+
iteration # 1 ecut= 45.00 Ry beta= 0.40
116+
Davidson diagonalization with overlap
117+
118+
---- Real-time Memory Report at c_bands before calling an iterative solver
119+
0 MiB given to the printing process from OS
120+
0 MiB allocation reported by mallinfo(arena+hblkhd)
121+
0 MiB available memory on the node where the printing process lives
122+
------------------
123+
ethr = 1.00E-02, avg # of iterations = 2.0
124+
125+
Threshold (ethr) on eigenvalues was too large:
126+
Diagonalizing with lowered threshold
127+
128+
Davidson diagonalization with overlap
129+
130+
---- Real-time Memory Report at c_bands before calling an iterative solver
131+
0 MiB given to the printing process from OS
132+
0 MiB allocation reported by mallinfo(arena+hblkhd)
133+
0 MiB available memory on the node where the printing process lives
134+
------------------
135+
ethr = 3.58E-04, avg # of iterations = 4.5
136+
137+
total cpu time spent up to now is 0.5 secs
138+
139+
total energy = -252.68390504 Ry
140+
estimated scf accuracy < 0.14911372 Ry
141+
142+
iteration # 2 ecut= 45.00 Ry beta= 0.40
143+
Davidson diagonalization with overlap
144+
145+
---- Real-time Memory Report at c_bands before calling an iterative solver
146+
0 MiB given to the printing process from OS
147+
0 MiB allocation reported by mallinfo(arena+hblkhd)
148+
0 MiB available memory on the node where the printing process lives
149+
------------------
150+
ethr = 3.73E-04, avg # of iterations = 2.0
151+
152+
total cpu time spent up to now is 0.7 secs
153+
154+
total energy = -252.68775082 Ry
155+
estimated scf accuracy < 0.02466882 Ry

tests/outputs/test_pw_output.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@ def test_default_xml(data_regression, xml_format):
3232
)
3333

3434

35+
@pytest.mark.parametrize(
36+
"fixture_directory",
37+
[
38+
"failed_no_xml",
39+
],
40+
)
41+
def test_failed(data_regression, fixture_directory):
42+
"""Test failed calculations of pw.x."""
43+
44+
pw_directory = Path(__file__).parent / "fixtures" / "pw" / fixture_directory
45+
46+
pw_out = PwOutput.from_dir(pw_directory)
47+
48+
data_regression.check(
49+
{
50+
"base_outputs": pw_out.get_output_dict(),
51+
"raw_outputs": pw_out.raw_outputs,
52+
}
53+
)
54+
55+
3556
def test_ase_outputs(robust_data_regression_check):
3657
pw_directory = Path(__file__).parent / "fixtures" / "pw" / "default_xml_240411"
3758

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
base_outputs: {}
2+
raw_outputs:
3+
stdout:
4+
code_version: '7.5'

0 commit comments

Comments
 (0)