Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Sep 27, 2024
1 parent 0eca54e commit 8a5f431
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
37 changes: 15 additions & 22 deletions src/nomad_parser_wannier90/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,13 @@

# New schema
from nomad_simulations.schema_packages.general import Program, Simulation
from nomad_simulations.schema_packages.model_method import (
ModelMethod,
)
from nomad_simulations.schema_packages.model_method import (
Wannier as ModelWannier,
)
from nomad_simulations.schema_packages.model_method import ModelMethod, Wannier
from nomad_simulations.schema_packages.model_system import AtomicCell, ModelSystem
from nomad_simulations.schema_packages.numerical_settings import (
KLinePath,
KMesh,
KSpace,
)
from nomad_simulations.schema_packages.numerical_settings import (
KMesh as ModelKMesh,
)
from nomad_simulations.schema_packages.outputs import Outputs
from nomad_simulations.schema_packages.workflow import SinglePoint

Expand Down Expand Up @@ -209,7 +202,7 @@ def parse_atoms_state(self, labels: Optional[list[str]]) -> list[AtomsState]:
labels (Optional[list[str]]): List of chemical element labels.
Returns:
(list[AtomsState]): List of `AtomsState` sections.
list[AtomsState]: List of `AtomsState` sections.
"""
if labels is None:
return []
Expand All @@ -223,7 +216,7 @@ def parse_atomic_cell(self) -> AtomicCell:
Parse the `AtomicCell` from the `lattice_vectors` and `structure` regex quantities in `WOutParser`.
Returns:
(AtomicCell): The parsed `AtomicCell` section.
AtomicCell: The parsed `AtomicCell` section.
"""
atomic_cell = AtomicCell()

Expand Down Expand Up @@ -259,7 +252,7 @@ def parse_model_system(self, logger: 'BoundLogger') -> Optional[ModelSystem]:
logger (BoundLogger): The logger to log messages.
Returns:
(Optional[ModelSystem]): The parsed `ModelSystem` section.
Optional[ModelSystem]: The parsed `ModelSystem` section.
"""
model_system = ModelSystem()
model_system.is_representative = True
Expand All @@ -273,14 +266,14 @@ def parse_model_system(self, logger: 'BoundLogger') -> Optional[ModelSystem]:
model_system.cell.append(atomic_cell)
return model_system

def parse_wannier(self) -> ModelWannier:
def parse_wannier(self) -> Wannier:
"""
Parse the `ModelWannier` section from the `WOutParser` quantities.
Parse the `Wannier` section from the `WOutParser` quantities.
Returns:
(ModelWannier): The parsed `ModelWannier` section.
Wannier: The parsed `Wannier` section.
"""
model_wannier = ModelWannier()
model_wannier = Wannier()
for key in self._input_projection_mapping.keys():
setattr(
model_wannier,
Expand All @@ -297,18 +290,18 @@ def parse_wannier(self) -> ModelWannier:
).get('inner')
return model_wannier

def parse_k_mesh(self) -> Optional[ModelKMesh]:
def parse_k_mesh(self) -> Optional[KMesh]:
"""
Parse the `ModelKMesh` section from the `WOutParser` quantities.
Parse the `KMesh` section from the `WOutParser` quantities.
Returns:
(Optional[ModelKMesh]): The parsed `ModelKMesh` section.
Optional[KMesh]: The parsed `KMesh` section.
"""
sec_k_mesh = None
k_mesh = self.wout_parser.get('k_mesh')
if k_mesh is None:
return sec_k_mesh
sec_k_mesh = ModelKMesh()
sec_k_mesh = KMesh()
sec_k_mesh.n_points = k_mesh.get('n_points')
sec_k_mesh.grid = k_mesh.get('grid', [])
if k_mesh.get('k_points') is not None:
Expand All @@ -320,7 +313,7 @@ def parse_k_line_path(self) -> Optional[KLinePath]:
Parse the `KLinePath` section from the `WOutParser` quantities.
Returns:
(Optional[KLinePath]): The parsed `KLinePath` section.
Optional[KLinePath]: The parsed `KLinePath` section.
"""
sec_k_line_path = None
k_line_path = self.wout_parser.get('k_line_path')
Expand Down Expand Up @@ -350,7 +343,7 @@ def parse_model_method(self) -> ModelMethod:
Parse the `ModelWannier(ModelMethod)` section from the `WOutParser` quantities.
Returns:
(ModelMethod): The parsed `ModelWannier(ModelMethod)` section.
ModelMethod: The parsed `ModelWannier(ModelMethod)` section.
"""
# `ModelMethod` section
model_wannier = self.parse_wannier()
Expand Down
6 changes: 4 additions & 2 deletions src/nomad_parser_wannier90/parsers/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def parse_dft_plus_tb_workflow(
dft_task = dft_archive.workflow2
tb_task = tb_archive.workflow2

# Check if main input and output of the `DFTPlusTB` workflow exist
if not dft_task.m_xpath('inputs[0]') or not tb_task.m_xpath('outputs[-1]'):
return dft_plus_tb
dft_plus_tb.inputs = dft_task.inputs[0]
dft_plus_tb.outputs = tb_task.outputs[-1]
dft_plus_tb.inputs = [dft_task.inputs[0]]
dft_plus_tb.outputs = [tb_task.outputs[-1]]

dft_plus_tb.tasks = [
TaskReference(task=dft_task),
TaskReference(task=tb_task),
Expand Down

1 comment on commit 8a5f431

@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__.py10280%24–26
   band_parser.py511571%4, 24, 50–51, 73–74, 77–78, 85–89, 98–99, 104–105
   dos_parser.py18194%13
   hr_parser.py48981%4, 28, 46–47, 59–60, 94–96
   parser.py2153086%8–9, 208, 262–263, 303, 360–361, 378, 395, 412, 468–471, 501, 533–581
   win_parser.py1082081%5, 35–36, 65, 162, 169–171, 210, 221–222, 252–255, 262, 264–265, 269, 286–290
src/nomad_parser_wannier90/parsers/utils
   utils.py311552%4, 35–37, 56–75
src/nomad_parser_wannier90/schema_packages
   __init__.py8275%9–11
   package.py550%1–11
TOTAL51010380% 

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

Please sign in to comment.