Skip to content

SOF-5353 - Add application version reporting to espresso units #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: epic/SOF-4864
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions express/parsers/apps/espresso/formats/espresso_640xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ def steps(self):
self._steps = sorted(self.root.findall("step"), key=lambda node: int(node.get("n_step")))
return self._steps

def application_version(self) -> str:
"""
Returns the version of Espresso found in the XML file.
Returns:
str: The version of the application
"""
creator_node = self.traverse_xml(self.root, ("general_info", "creator"))
creator_version = creator_node.get("VERSION", default="VERSION_NOT_FOUND")
return creator_version

def fermi_energy(self) -> float:
"""
Extracts fermi energy.
Expand Down
10 changes: 10 additions & 0 deletions express/parsers/apps/espresso/formats/espresso_legacyxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ def _get_xml_tag_value(self, tag):
result = TAG_VALUE_CAST_MAP[type](tag.text, size, columns)
return result[0][0] if size == 1 and type not in ['logical', 'character'] else result

def application_version(self) -> str:
"""
Returns the version of Espresso found in the XML file.
Returns:
str: The version of the application
"""
creator_node = self.traverse_xml(self.root, ("HEADER", "CREATOR"))
creator_version = creator_node.get("VERSION", default="VERSION_NOT_FOUND")
return creator_version

def fermi_energy(self):
"""
Extracts fermi energy.
Expand Down
22 changes: 22 additions & 0 deletions express/parsers/apps/espresso/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@ def find_xml_file(self):
is_sternheimer_gw and settings.STERNHEIMER_GW0_DIR_PATTERN in file_path):
return file_path

def application_version(self) -> str:
"""
Returns the version of Espresso found in the XML file.
Returns:
str: The version of the application
"""
# This dict maps the version reported by the XML parser to the full version number, for use in the rest of
# our platform
versions_map = {
"6.5": "6.5.0",
"6.6": "6.6.0",
"6.7MaX": "6.7.0",
"6.7": "6.7.0",
"6.8": "6.8.0"

}
parsed_version = self.xml_parser.application_version()
version = versions_map.get(parsed_version, parsed_version)
return version


def total_energy(self) -> float:
"""
Returns total energy.
Expand Down Expand Up @@ -360,3 +381,4 @@ def final_structure_strings(self) -> List[str]:
print(f"exception finalizing structures: {repr(e)}")
pass
return structures

4 changes: 2 additions & 2 deletions tests/fixtures/espresso/references.py
Git LFS file not shown
13 changes: 13 additions & 0 deletions tests/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ tests:
comparison: assertDeepAlmostEqual
final_lattice_vectors:
comparison: assertDeepAlmostEqual
application_version:
comparison: assertDeepAlmostEqual

test_config_schema:
- name: name
Expand Down Expand Up @@ -77,6 +79,7 @@ applications: # fixtures/
- atomic_forces
- total_energy_contributions
- final_lattice_vectors
- application_version
- subdir: projwfc.x/dos
filename: projwfc.out
tests:
Expand All @@ -101,6 +104,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
- subdir: pw.x/pw_vc_relax
filename: pw.out
tests:
Expand All @@ -112,6 +116,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
6.5.0:
- subdir: pw.x/pw_scf
filename: pw.out
Expand All @@ -124,6 +129,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
- subdir: pw.x/pw_vc_relax
filename: pw.out
tests:
Expand All @@ -135,6 +141,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
6.6.0:
- subdir: pw.x/pw_scf
filename: pw.out
Expand All @@ -147,6 +154,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
- subdir: pw.x/pw_vc_relax
filename: pw.out
tests:
Expand All @@ -158,6 +166,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
6.7.0:
- subdir: pw.x/pw_scf
filename: pw.out
Expand All @@ -170,6 +179,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
- subdir: pw.x/pw_vc_relax
filename: pw.out
tests:
Expand All @@ -181,6 +191,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
6.8.0:
- subdir: pw.x/pw_scf
filename: pw.out
Expand All @@ -193,6 +204,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version
- subdir: pw.x/pw_vc_relax
filename: pw.out
tests:
Expand All @@ -204,6 +216,7 @@ applications: # fixtures/
- final_lattice_vectors
- name: eigenvalues_at_kpoints
actual_index: 0
- application_version

vasp:
5.3.5:
Expand Down