Skip to content

Commit bebae14

Browse files
committed
Bugfix: handle more verbose output from recent QE versions
1 parent d496f8f commit bebae14

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

dfttopif/parsers/pwscf.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,12 @@ def get_output_structure(self):
279279
if "Begin final coordinates" in line:
280280
if 'new unit-cell volume' in next(fp):
281281
# unit cell allowed to change
282-
next(fp) # blank line
282+
cellheader = next(fp)
283+
# skip irrelevant lines (density/blank line/etc)
284+
while 'CELL_PARAMETER' not in cellheader:
285+
cellheader = next(fp)
283286
# get the final unit cell
284287
unit_cell = []
285-
cellheader = next(fp)
286288
if 'bohr' in cellheader.lower():
287289
cell_conv_factor = bohr_to_angstrom
288290
elif 'angstrom' in cellheader.lower():

examples/pwscf/FeO.vc-relax.tar.gz

724 KB
Binary file not shown.

tests/parsers/test_pwscf.py

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import shutil
77

8+
89
class TestPWSCFParser(unittest.TestCase):
910

1011
def get_parser(self,name):
@@ -33,6 +34,8 @@ def test_Au_nscf(self):
3334
self.assertAlmostEqual(fin_volume.scalars[0].value, 16.978781940985)
3435
self.assertEqual(fin_volume.units, 'Angstrom^3/cell')
3536

37+
delete_example('Au.nscf')
38+
3639
def test_NaF(self):
3740
# Parse the results
3841
parser = self.get_parser('NaF.scf')
@@ -158,6 +161,19 @@ def test_TiO2(self):
158161

159162
# Delete the data
160163
delete_example('TiO2.vcrelax')
164+
165+
def test_FeO(self):
166+
# Parse the results
167+
parser = self.get_parser('FeO.vc-relax')
168+
169+
strc = parser.get_output_structure()
170+
self.assertAlmostEqual(strc.cell[0][0], 1.319092613)
171+
self.assertAlmostEqual(strc.cell[2][1], -1.523156949)
172+
self.assertEquals(['Fe', 'O'], strc.get_chemical_symbols())
173+
self.assertEquals('FeO', parser.get_composition())
174+
175+
# Delete the data
176+
delete_example('FeO.vc-relax')
161177

162178
def test_VS2(self):
163179
# Parse the results

0 commit comments

Comments
 (0)