Skip to content

Commit e52b699

Browse files
QE: Support output files without stress (#572)
support qe output files which do not contain stress --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2b8779d commit e52b699

File tree

6 files changed

+409
-3
lines changed

6 files changed

+409
-3
lines changed

dpdata/plugins/qe.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def from_labeled_system(self, file_name, **kwargs):
4646
data["coords"],
4747
data["energies"],
4848
data["forces"],
49-
data["virials"],
49+
tmp_virial,
5050
) = dpdata.qe.scf.get_frame(file_name)
51+
if tmp_virial is not None:
52+
data["virials"] = tmp_virial
5153
return data

dpdata/qe/scf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def get_force(lines, natoms):
120120

121121
def get_stress(lines):
122122
blk = get_block(lines, "total stress")
123+
if len(blk) == 0:
124+
return
123125
ret = []
124126
for ii in blk:
125127
ret.append([float(jj) for jj in ii.split()[3:6]])
@@ -148,7 +150,9 @@ def get_frame(fname):
148150
atom_names, natoms, types, coords = get_coords(inlines, cell)
149151
energy = get_energy(outlines)
150152
force = get_force(outlines, natoms)
151-
stress = get_stress(outlines) * np.linalg.det(cell)
153+
stress = get_stress(outlines)
154+
if stress is not None:
155+
stress = (stress * np.linalg.det(cell))[np.newaxis, :, :]
152156
return (
153157
atom_names,
154158
natoms,
@@ -157,5 +161,5 @@ def get_frame(fname):
157161
coords[np.newaxis, :, :],
158162
np.array(energy)[np.newaxis],
159163
force[np.newaxis, :, :],
160-
stress[np.newaxis, :, :],
164+
stress,
161165
)

tests/qe.scf/03.in

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
&control
2+
calculation='scf'
3+
prefix='water'
4+
pseudo_dir='../pseudo'
5+
outdir='./out'
6+
restart_mode='from_scratch'
7+
nstep=20000
8+
disk_io='none'
9+
max_seconds=10000
10+
tprnfor=.true.
11+
tstress=.false.
12+
/
13+
&system
14+
ibrav=1
15+
a=10
16+
nat=5
17+
ntyp=2,
18+
ecutwfc=110
19+
input_dft='PBE'
20+
/
21+
&electrons
22+
electron_maxstep = 1000
23+
mixing_beta = 0.5
24+
/
25+
&ions
26+
/
27+
&cell
28+
/
29+
ATOMIC_SPECIES
30+
H 1.0 H.pbe-van_ak.UPF
31+
C 1.0 C.pbe-van_ak.UPF
32+
ATOMIC_POSITIONS {angstrom}
33+
H 5.41646 4.01132 3.51118
34+
H 4.13161 4.70677 4.43116
35+
H 5.63096 5.52167 4.45038
36+
H 5.49988 4.00341 5.34265
37+
C 5.19271 4.55775 4.43687

tests/qe.scf/03.out

Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
2+
Program PWSCF v.7.1 starts on 5Nov2023 at 13:51:57
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 28 processors
14+
15+
MPI processes distributed on 1 nodes
16+
59927 MiB available memory on the printing compute node when the environment starts
17+
18+
Waiting for input...
19+
Reading input from standard input
20+
Warning: card &CELL ignored
21+
Warning: card / ignored
22+
23+
Current dimensions of program PWSCF are:
24+
Max number of different atomic species (ntypx) = 10
25+
Max number of k-points (npk) = 40000
26+
Max angular momentum in pseudopotentials (lmaxx) = 4
27+
28+
IMPORTANT: XC functional enforced from input :
29+
Exchange-correlation= PBE
30+
( 1 4 3 4 0 0 0)
31+
Any further DFT definition will be discarded
32+
Please, verify this is what you really want
33+
34+
35+
gamma-point specific algorithms are used
36+
37+
R & G space division: proc/nbgrp/npool/nimage = 28
38+
Subspace diagonalization in iterative solution of the eigenvalue problem:
39+
a serial algorithm will be used
40+
41+
42+
Parallelization info
43+
--------------------
44+
sticks: dense smooth PW G-vecs: dense smooth PW
45+
Min 446 446 110 37558 37558 4694
46+
Max 448 448 112 37564 37564 4708
47+
Sum 12517 12517 3125 1051747 1051747 131683
48+
49+
Using Slab Decomposition
50+
51+
52+
53+
bravais-lattice index = 1
54+
lattice parameter (alat) = 18.8973 a.u.
55+
unit-cell volume = 6748.3345 (a.u.)^3
56+
number of atoms/cell = 5
57+
number of atomic types = 2
58+
number of electrons = 8.00
59+
number of Kohn-Sham states= 4
60+
kinetic-energy cutoff = 110.0000 Ry
61+
charge density cutoff = 440.0000 Ry
62+
scf convergence threshold = 1.0E-06
63+
mixing beta = 0.5000
64+
number of iterations used = 8 plain mixing
65+
Exchange-correlation= PBE
66+
( 1 4 3 4 0 0 0)
67+
68+
celldm(1)= 18.897261 celldm(2)= 0.000000 celldm(3)= 0.000000
69+
celldm(4)= 0.000000 celldm(5)= 0.000000 celldm(6)= 0.000000
70+
71+
crystal axes: (cart. coord. in units of alat)
72+
a(1) = ( 1.000000 0.000000 0.000000 )
73+
a(2) = ( 0.000000 1.000000 0.000000 )
74+
a(3) = ( 0.000000 0.000000 1.000000 )
75+
76+
reciprocal axes: (cart. coord. in units 2 pi/alat)
77+
b(1) = ( 1.000000 0.000000 0.000000 )
78+
b(2) = ( 0.000000 1.000000 0.000000 )
79+
b(3) = ( 0.000000 0.000000 1.000000 )
80+
81+
82+
PseudoPot. # 1 for H read from file:
83+
../pseudo/H.pbe-van_ak.UPF
84+
MD5 check sum: a537b41238c433fb4068aaff04c6fb4a
85+
Pseudo is Ultrasoft, Zval = 1.0
86+
Generated by new atomic code, or converted to UPF format
87+
Using radial grid of 615 points, 1 beta functions with:
88+
l(1) = 0
89+
Q(r) pseudized with 8 coefficients, rinner = 0.800
90+
91+
PseudoPot. # 2 for C read from file:
92+
../pseudo/C.pbe-van_ak.UPF
93+
MD5 check sum: ecc3b1e1c1ebe006fc976faab44e17a8
94+
Pseudo is Ultrasoft, Zval = 4.0
95+
Generated by new atomic code, or converted to UPF format
96+
Using radial grid of 721 points, 4 beta functions with:
97+
l(1) = 0
98+
l(2) = 0
99+
l(3) = 1
100+
l(4) = 1
101+
Q(r) pseudized with 8 coefficients, rinner = 0.800 0.800 0.800
102+
103+
104+
atomic species valence mass pseudopotential
105+
H 1.00 1.00000 H ( 1.00)
106+
C 4.00 1.00000 C ( 1.00)
107+
108+
No symmetry found
109+
110+
111+
112+
Cartesian axes
113+
114+
site n. atom positions (alat units)
115+
1 H tau( 1) = ( 0.5416460 0.4011320 0.3511180 )
116+
2 H tau( 2) = ( 0.4131610 0.4706770 0.4431160 )
117+
3 H tau( 3) = ( 0.5630960 0.5521670 0.4450380 )
118+
4 H tau( 4) = ( 0.5499880 0.4003410 0.5342650 )
119+
5 C tau( 5) = ( 0.5192710 0.4557750 0.4436870 )
120+
121+
number of k points= 1
122+
cart. coord. in units 2pi/alat
123+
k( 1) = ( 0.0000000 0.0000000 0.0000000), wk = 2.0000000
124+
125+
Dense grid: 525874 G-vectors FFT dimensions: ( 128, 128, 128)
126+
127+
Estimated max dynamical RAM per process > 30.88 MB
128+
129+
Estimated total dynamical RAM > 864.60 MB
130+
131+
Initial potential from superposition of free atoms
132+
133+
starting charge 7.9999, renormalised to 8.0000
134+
135+
negative rho (up, down): 1.567E-03 0.000E+00
136+
Starting wfcs are 8 randomized atomic wfcs
137+
138+
total cpu time spent up to now is 0.7 secs
139+
140+
Self-consistent Calculation
141+
142+
iteration # 1 ecut= 110.00 Ry beta= 0.50
143+
Davidson diagonalization with overlap
144+
ethr = 1.00E-02, avg # of iterations = 2.0
145+
146+
negative rho (up, down): 3.779E-03 0.000E+00
147+
148+
total cpu time spent up to now is 0.9 secs
149+
150+
total energy = -16.02157560 Ry
151+
estimated scf accuracy < 0.70040947 Ry
152+
153+
iteration # 2 ecut= 110.00 Ry beta= 0.50
154+
Davidson diagonalization with overlap
155+
ethr = 8.76E-03, avg # of iterations = 2.0
156+
157+
negative rho (up, down): 4.476E-03 0.000E+00
158+
159+
total cpu time spent up to now is 1.1 secs
160+
161+
total energy = -16.15192549 Ry
162+
estimated scf accuracy < 0.04051988 Ry
163+
164+
iteration # 3 ecut= 110.00 Ry beta= 0.50
165+
Davidson diagonalization with overlap
166+
ethr = 5.06E-04, avg # of iterations = 1.0
167+
168+
negative rho (up, down): 5.628E-03 0.000E+00
169+
170+
total cpu time spent up to now is 1.2 secs
171+
172+
total energy = -16.14738168 Ry
173+
estimated scf accuracy < 0.01107922 Ry
174+
175+
iteration # 4 ecut= 110.00 Ry beta= 0.50
176+
Davidson diagonalization with overlap
177+
ethr = 1.38E-04, avg # of iterations = 2.0
178+
179+
negative rho (up, down): 5.562E-03 0.000E+00
180+
181+
total cpu time spent up to now is 1.4 secs
182+
183+
total energy = -16.14875721 Ry
184+
estimated scf accuracy < 0.00199039 Ry
185+
186+
iteration # 5 ecut= 110.00 Ry beta= 0.50
187+
Davidson diagonalization with overlap
188+
ethr = 2.49E-05, avg # of iterations = 2.0
189+
190+
negative rho (up, down): 5.643E-03 0.000E+00
191+
192+
total cpu time spent up to now is 1.5 secs
193+
194+
total energy = -16.14865735 Ry
195+
estimated scf accuracy < 0.00032165 Ry
196+
197+
iteration # 6 ecut= 110.00 Ry beta= 0.50
198+
Davidson diagonalization with overlap
199+
ethr = 4.02E-06, avg # of iterations = 3.0
200+
201+
negative rho (up, down): 5.623E-03 0.000E+00
202+
203+
total cpu time spent up to now is 1.7 secs
204+
205+
total energy = -16.14878943 Ry
206+
estimated scf accuracy < 0.00003385 Ry
207+
208+
iteration # 7 ecut= 110.00 Ry beta= 0.50
209+
Davidson diagonalization with overlap
210+
ethr = 4.23E-07, avg # of iterations = 2.0
211+
212+
negative rho (up, down): 5.612E-03 0.000E+00
213+
214+
total cpu time spent up to now is 1.9 secs
215+
216+
total energy = -16.14877906 Ry
217+
estimated scf accuracy < 0.00003129 Ry
218+
219+
iteration # 8 ecut= 110.00 Ry beta= 0.50
220+
Davidson diagonalization with overlap
221+
ethr = 3.91E-07, avg # of iterations = 2.0
222+
223+
negative rho (up, down): 5.611E-03 0.000E+00
224+
225+
total cpu time spent up to now is 2.0 secs
226+
227+
total energy = -16.14878120 Ry
228+
estimated scf accuracy < 0.00000208 Ry
229+
230+
iteration # 9 ecut= 110.00 Ry beta= 0.50
231+
Davidson diagonalization with overlap
232+
ethr = 2.61E-08, avg # of iterations = 3.0
233+
234+
negative rho (up, down): 5.614E-03 0.000E+00
235+
236+
total cpu time spent up to now is 2.2 secs
237+
238+
End of self-consistent calculation
239+
240+
k = 0.0000 0.0000 0.0000 ( 65842 PWs) bands (ev):
241+
242+
-16.9477 -9.4968 -9.3276 -9.0865
243+
244+
highest occupied level (ev): -9.0865
245+
246+
! total energy = -16.14878191 Ry
247+
estimated scf accuracy < 0.00000062 Ry
248+
249+
The total energy is the sum of the following terms:
250+
one-electron contribution = -40.61130475 Ry
251+
hartree contribution = 21.13447342 Ry
252+
xc contribution = -6.37239920 Ry
253+
ewald contribution = 9.70044862 Ry
254+
255+
convergence has been achieved in 9 iterations
256+
257+
Forces acting on atoms (cartesian axes, Ry/au):
258+
259+
atom 1 type 1 force = 0.01321833 0.00035039 0.00596821
260+
atom 2 type 1 force = -0.03792494 0.00068257 0.00934494
261+
atom 3 type 1 force = 0.03068281 0.04387976 -0.00506668
262+
atom 4 type 1 force = -0.00384202 0.00079975 -0.01397316
263+
atom 5 type 2 force = -0.00213417 -0.04571247 0.00372669
264+
265+
Total force = 0.083354 Total SCF correction = 0.000416
266+
267+
init_run : 0.39s CPU 0.59s WALL ( 1 calls)
268+
electrons : 1.44s CPU 1.49s WALL ( 1 calls)
269+
forces : 0.09s CPU 0.09s WALL ( 1 calls)
270+
271+
Called by init_run:
272+
wfcinit : 0.02s CPU 0.05s WALL ( 1 calls)
273+
potinit : 0.09s CPU 0.13s WALL ( 1 calls)
274+
hinit0 : 0.05s CPU 0.10s WALL ( 1 calls)
275+
276+
Called by electrons:
277+
c_bands : 0.22s CPU 0.24s WALL ( 9 calls)
278+
sum_band : 0.30s CPU 0.32s WALL ( 9 calls)
279+
v_of_rho : 0.60s CPU 0.65s WALL ( 10 calls)
280+
newd : 0.24s CPU 0.29s WALL ( 10 calls)
281+
mix_rho : 0.12s CPU 0.12s WALL ( 9 calls)
282+
283+
Called by c_bands:
284+
init_us_2 : 0.01s CPU 0.01s WALL ( 19 calls)
285+
init_us_2:cp : 0.01s CPU 0.01s WALL ( 19 calls)
286+
regterg : 0.21s CPU 0.22s WALL ( 9 calls)
287+
288+
Called by *egterg:
289+
rdiaghg : 0.00s CPU 0.02s WALL ( 28 calls)
290+
h_psi : 0.20s CPU 0.22s WALL ( 29 calls)
291+
s_psi : 0.00s CPU 0.00s WALL ( 29 calls)
292+
g_psi : 0.00s CPU 0.00s WALL ( 19 calls)
293+
294+
Called by h_psi:
295+
h_psi:calbec : 0.01s CPU 0.02s WALL ( 29 calls)
296+
vloc_psi : 0.19s CPU 0.19s WALL ( 29 calls)
297+
add_vuspsi : 0.00s CPU 0.01s WALL ( 29 calls)
298+
299+
General routines
300+
calbec : 0.01s CPU 0.02s WALL ( 42 calls)
301+
fft : 0.38s CPU 0.45s WALL ( 92 calls)
302+
ffts : 0.03s CPU 0.03s WALL ( 9 calls)
303+
fftw : 0.17s CPU 0.18s WALL ( 128 calls)
304+
305+
Parallel routines
306+
307+
PWSCF : 1.98s CPU 2.31s WALL
308+
309+
310+
This run was terminated on: 13:52: 0 5Nov2023
311+
312+
=------------------------------------------------------------------------------=
313+
JOB DONE.
314+
=------------------------------------------------------------------------------=

tests/qe.scf/ch4_force_2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
3.398569258943536786e-01 9.008889040001466508e-03 1.534488474483494125e-01
2+
-9.750894041174495985e-01 1.754958015934758586e-02 2.402680657138368536e-01
3+
7.888867568293825849e-01 1.128193980826777798e+00 -1.302695793863826723e-01
4+
-9.878230505855312149e-02 2.056239906886946772e-02 -3.592643853368728823e-01
5+
-5.487171643739811866e-02 -1.175314849094996283e+00 9.581705156106927468e-02

0 commit comments

Comments
 (0)