Skip to content

Commit 8bb4047

Browse files
authored
Merge pull request #86 from hegdevinayi/bugfix/parse_cell_param
Bugfix: handle more verbose output from recent QE versions
2 parents d496f8f + ac6e95d commit 8bb4047

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ from dfttopif import directory_to_pif
3535
data = directory_to_pif('/path/to/calculation/')
3636
```
3737

38+
Currently supported DFT codes
39+
-----------------------------
40+
41+
- VASP (versions tested: 5.2.11, 5.3.2, 5.3.5)
42+
- PWSCF (Quantum Espresso) (versions tested: 4.3.2, 5.0, 5.4.0, 6.0, 6.4.1)
43+
3844
Development
3945
-----------
4046

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.

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ flask
55
flask-cors
66
gunicorn
77
pypif==2.0.1
8-
dftparse==0.3.0
8+
git+git://github.com/CitrineInformatics/dftparse@develop#egg=dftparse
99
pypif-sdk==2.1.0

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)