Skip to content

Commit 7770265

Browse files
Merge pull request #148 from Exabyte-io/chore/drop-qe-old-xml-support
chore: drop old xml support for QE (pre 6.4)
2 parents 801cda7 + 99b267b commit 7770265

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+87
-689
lines changed
Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import re
2-
from abc import abstractmethod
32

43
import numpy as np
54

@@ -61,38 +60,7 @@ def fermi_energy(self):
6160
bs_tag = self.root.find(self.band_structure_tag)
6261
return self._get_xml_tag_value(bs_tag.find(self.fermi_energy_tag)) * Constant.HARTREE
6362

64-
@abstractmethod
65-
def nspins(self) -> int:
66-
"""
67-
Extracts the number of number of spin components.
6863

69-
Returns:
70-
int
71-
"""
72-
pass
73-
74-
@abstractmethod
75-
def final_lattice_vectors(self, reciprocal=False) -> dict:
76-
"""
77-
Extracts lattice.
78-
79-
Args:
80-
reciprocal (bool): whether to extract reciprocal lattice.
81-
82-
Returns:
83-
dict
84-
85-
Examples:
86-
{
87-
'vectors': {
88-
'a': [-0.561154473, -0.000000000, 0.561154473],
89-
'b': [-0.000000000, 0.561154473, 0.561154473],
90-
'c': [-0.561154473, 0.561154473, 0.000000000],
91-
'alat': 9.44858082
92-
}
93-
}
94-
"""
95-
pass
9664

9765
def get_inverse_reciprocal_lattice_vectors(self):
9866
"""
@@ -102,45 +70,4 @@ def get_inverse_reciprocal_lattice_vectors(self):
10270
lattice_array = [reciprocal_lattice["vectors"][i] for i in ["a", "b", "c"]]
10371
return np.linalg.inv(np.array(lattice_array))
10472

105-
@abstractmethod
106-
def eigenvalues_at_kpoints(self):
107-
"""
108-
Returns eigenvalues for all kpoints.
109-
110-
Returns:
111-
list
112-
113-
Example:
114-
[
115-
{
116-
'kpoint': [-0.5, 0.5, 0.5],
117-
'weight': 9.5238095E-002,
118-
'eigenvalues': [
119-
{
120-
'energies': [-1.4498446E-001, ..., 4.6507387E-001],
121-
'occupations': [1, ... , 0],
122-
'spin': 0.5
123-
}
124-
]
125-
},
126-
...
127-
]
128-
"""
129-
pass
13073

131-
@abstractmethod
132-
def final_basis(self):
133-
"""
134-
Extracts basis.
135-
136-
Returns:
137-
dict
138-
139-
Example:
140-
{
141-
'units': 'angstrom',
142-
'elements': [{'id': 0, 'value': 'Si'}, {'id': 1, 'value': 'Si'}],
143-
'coordinates': [{'id': 0, 'value': [0.0, 0.0, 0.0]}, {'id': 1, 'value': [0.0, 0.0, 0.0]}]
144-
}
145-
"""
146-
pass

express/parsers/apps/espresso/formats/xml/xml_factory.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
11
import os
22
from typing import Optional, Union
33

4-
from packaging import version
5-
64
from express.parsers.apps.espresso import settings
75
from express.parsers.apps.espresso.formats.xml.xml_base import EspressoXMLParserBase
86
from express.parsers.apps.espresso.formats.xml.xml_post64 import EspressoXMLParserPostV6_4
9-
from express.parsers.apps.espresso.formats.xml.xml_pre64 import EspressoXMLParserPreV6_4
10-
11-
VERSIONS = {
12-
"Pre6_4": {
13-
"parser": EspressoXMLParserPreV6_4,
14-
"default_xml_file": settings.XML_DATA_FILE_PREv6_4,
15-
},
16-
"Post6_4": {
17-
"parser": EspressoXMLParserPostV6_4,
18-
"default_xml_file": settings.XML_DATA_FILE_POSTv6_4,
19-
},
20-
}
217

228

239
def get_xml_parser(
2410
parser_version: Union[str, None], work_dir: str, is_sternheimer_gw: bool = False
2511
) -> EspressoXMLParserBase:
26-
parser_version = "6.4" if not parser_version else parser_version
27-
if version.parse(parser_version) <= version.parse("6.4"):
28-
version_key = "Pre6_4"
29-
else:
30-
version_key = "Post6_4"
31-
12+
"""
13+
Get XML parser for espresso. Only supports post-6.4 versions.
14+
15+
Args:
16+
parser_version: Version string (unused, kept for compatibility)
17+
work_dir: Working directory
18+
is_sternheimer_gw: Whether this is a Sternheimer GW calculation
19+
20+
Returns:
21+
EspressoXMLParserPostV6_4 instance
22+
"""
3223
xml_file = find_xml_file(
3324
work_dir,
34-
VERSIONS[version_key]["default_xml_file"],
25+
settings.XML_DATA_FILE,
3526
is_sternheimer_gw,
3627
)
37-
return VERSIONS[version_key]["parser"](xml_file)
28+
return EspressoXMLParserPostV6_4(xml_file)
3829

3930

4031
def find_xml_file(work_dir: str, default_xml_filename: str, is_sternheimer_gw: bool) -> Optional[str]:

express/parsers/apps/espresso/formats/xml/xml_pre64.py

Lines changed: 0 additions & 184 deletions
This file was deleted.

express/parsers/apps/espresso/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
PDOS_TOT_FILE = "pdos_tot"
44
NEB_PATH_FILE_SUFFIX = ".path"
5-
XML_DATA_FILE_PREv6_4 = "data-file.xml"
6-
XML_DATA_FILE_POSTv6_4 = "__prefix__.xml"
5+
XML_DATA_FILE = "__prefix__.xml"
76
PHONON_DOS_FILE = "phonon_dos.out"
87
PHONON_MODES_FILE = "normal_modes.out"
98
AVERAGE_FILE = "avg.dat"

tests/fixtures/espresso/v5_4/__init__.py

Whitespace-only changes.

tests/fixtures/espresso/v5_4/references.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/fixtures/espresso/v5_4/test-001/outdir/__prefix__.save/K00001/eigenval.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/fixtures/espresso/v5_4/test-001/outdir/__prefix__.save/K00001/evc.dat

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/fixtures/espresso/v5_4/test-001/outdir/__prefix__.save/K00001/gkvectors.dat

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/fixtures/espresso/v5_4/test-001/outdir/__prefix__.save/K00002/eigenval.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)