Skip to content

Commit

Permalink
Deleted legacy Run schema parsing and dependency
Browse files Browse the repository at this point in the history
Fix TYPE_CHECKING
  • Loading branch information
JosePizarro3 committed Jul 15, 2024
1 parent a9b593a commit 763cf57
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 728 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ license = { file = "LICENSE" }
dependencies = [
"nomad-lab>=1.3.0",
"nomad-schema-plugin-simulation-workflow@git+https://github.com/nomad-coe/nomad-schema-plugin-simulation-workflow.git@develop",
"nomad-schema-plugin-run@git+https://github.com/nomad-coe/nomad-schema-plugin-run.git@develop",
"nomad-simulations>=0.0.2",
]

Expand Down
10 changes: 6 additions & 4 deletions src/nomad_parser_wannier90/parsers/band_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# limitations under the License.
#

from typing import Optional
from typing import TYPE_CHECKING, Optional

if TYPE_CHECKING:
from structlog.stdlib import BoundLogger

import numpy as np
from nomad.parsing.file_parser import DataTextParser
Expand All @@ -31,7 +34,6 @@
)
from nomad_simulations.schema_packages.properties import ElectronicBandStructure
from nomad_simulations.schema_packages.variables import KLinePath
from structlog.stdlib import BoundLogger


class Wannier90BandParser:
Expand All @@ -44,7 +46,7 @@ def parse_k_line_path_settings(
self,
reciprocal_lattice_vectors: Optional[np.ndarray],
k_line_path: KLinePathSettings,
logger: BoundLogger,
logger: 'BoundLogger',
) -> None:
"""
Parse the `KLinePath` settings from the `*band.dat` file using the `KLinePath.resolve_points` method. The
Expand All @@ -71,7 +73,7 @@ def parse_band_structure(
wannier_method: Optional[Wannier],
k_space: Optional[KSpace],
model_systems: list[ModelSystem],
logger: BoundLogger,
logger: 'BoundLogger',
) -> Optional[ElectronicBandStructure]:
"""
Parse the `ElectronicBandStructure` section from the `*band.dat` file.
Expand Down
4 changes: 2 additions & 2 deletions src/nomad_parser_wannier90/parsers/dos_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from nomad.parsing.file_parser import DataTextParser
from nomad.units import ureg
from nomad_simulations.schema_packages.properties import ElectronicDensityOfStates
from nomad_simulations.schema_packages.variables import Energy2
from nomad_simulations.schema_packages.variables import Energy2 as Energy


class Wannier90DosParser:
Expand All @@ -42,7 +42,7 @@ def parse_dos(self) -> Optional[ElectronicDensityOfStates]:
# TODO add spin polarized case
data = np.transpose(self.dos_parser.data)
sec_dos = ElectronicDensityOfStates()
energies = Energy2(points=data[0] * ureg.eV)
energies = Energy(points=data[0] * ureg.eV)
sec_dos.variables.append(energies)
sec_dos.value = data[1] / ureg.eV
return sec_dos
8 changes: 5 additions & 3 deletions src/nomad_parser_wannier90/parsers/hr_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# limitations under the License.
#

from typing import Optional
from typing import TYPE_CHECKING, Optional

if TYPE_CHECKING:
from structlog.stdlib import BoundLogger

import numpy as np
from nomad.parsing.file_parser import Quantity, TextParser
Expand All @@ -28,7 +31,6 @@
HoppingMatrix,
)
from nomad_simulations.schema_packages.variables import WignerSeitz
from structlog.stdlib import BoundLogger


class HrParser(TextParser):
Expand All @@ -46,7 +48,7 @@ def __init__(self, hr_file: str = ''):
self.hr_parser = HrParser(mainfile=hr_file)

def parse_hoppings(
self, wannier_method: Optional[Wannier], logger: BoundLogger
self, wannier_method: Optional[Wannier], logger: 'BoundLogger'
) -> tuple[Optional[HoppingMatrix], Optional[CrystalFieldSplitting]]:
"""
Parse the `HoppingMatrix` and `CrystalFieldSplitting` sections from the `*hr.dat` file.
Expand Down
Loading

1 comment on commit 763cf57

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_parser_wannier90
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_parser_wannier90/parsers
   __init__.py8275%9–11
   band_parser.py461274%23, 42, 68–69, 91–92, 95–96, 108–109, 114–115
   dos_parser.py18194%32
   hr_parser.py48981%23, 47, 65–66, 78–79, 113–115
   parser.py1751194%27, 275–276, 316, 334, 373–374, 387, 402, 417, 461
   win_parser.py973168%23, 54, 111–117, 138, 140–142, 144–145, 175–178, 183, 192–194, 204–206, 227–230, 237, 239–240, 244, 261–265
src/nomad_parser_wannier90/parsers/utils
   utils.py14379%46–48
src/nomad_parser_wannier90/schema_packages
   __init__.py8275%9–11
   package.py13130%1–24
TOTAL4438880% 

Tests Skipped Failures Errors Time
2 0 💤 0 ❌ 0 🔥 17.654s ⏱️

Please sign in to comment.