Skip to content

Commit

Permalink
Fix entry point to MatchingParserInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Sep 23, 2024
1 parent 1c6d488 commit 14e0d38
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ maintainers = [
license = { file = "LICENSE" }
dependencies = [
"nomad-lab@git+https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR.git@ea0e5cbc632a514ea4d7e0bca1fab105d452f94c",
"nomad-simulations@git+https://github.com/nomad-coe/nomad-simulations.git@64ae0efb323cf17b20651f9a9a50864832db9a71",
"nomad-simulations@git+https://github.com/nomad-coe/nomad-simulations.git@7c101b80f14d500d6c8bc266a001444b4ba35ea9",
]

[project.urls]
Expand Down
28 changes: 21 additions & 7 deletions src/nomad_parser_wannier90/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@
from pydantic import Field


class Wannier90ParserEntryPoint(ParserEntryPoint):
parameter: int = Field(0, description='Custom configuration parameter')
class SimulationParserEntryPoint(ParserEntryPoint):
parser_class_name: str = Field(
description="""
The fully qualified name of the Python class that implements the parser.
This class must have a function `def parse(self, mainfile, archive, logger)`.
"""
)
level: int = Field(
0,
description="""
Order of execution of parser with respect to other parsers.
""",
)

def load(self):
from nomad_parser_wannier90.parsers.parser import Wannier90Parser
from nomad.parsing import MatchingParserInterface

return Wannier90Parser(**self.dict())
return MatchingParserInterface(**self.dict())


nomad_parser_wannier90_plugin = Wannier90ParserEntryPoint(
name='Wannier90ParserEntryPoint',
nomad_parser_wannier90_plugin = SimulationParserEntryPoint(
name='parsers/wannier90',
aliases=['parsers/wannier90'],
description='Entry point for the Wannier90 parser.',
parser_as_interface=False, # in order to use `child_archives` and auto workflows
python_package='nomad_parser_wannier90.parsers',
parser_class_name='nomad_parser_wannier90.parsers.parser.Wannier90Parser',
# parser_as_interface=False, # in order to use `child_archives` and auto workflows
level=1,
mainfile_contents_re=r'\|\s*WANNIER90\s*\|',
)
3 changes: 1 addition & 2 deletions src/nomad_parser_wannier90/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from nomad.datamodel import EntryArchive
from nomad.parsing.file_parser import Quantity, TextParser
from nomad.parsing.parser import MatchingParser
from nomad.units import ureg
from nomad_simulations.schema_packages.atoms_state import AtomsState

Expand Down Expand Up @@ -169,7 +168,7 @@ def init_quantities(self):
]


class Wannier90Parser(MatchingParser):
class Wannier90Parser:
def __init__(self, *args, **kwargs):
super().__init__()
self.wout_parser = WOutParser()
Expand Down

0 comments on commit 14e0d38

Please sign in to comment.