|
12 | 12 | from nomad.parsing.file_parser.mapping_parser import MetainfoParser, TextParser |
13 | 13 | from nomad.parsing.file_parser.text_parser import DataTextParser |
14 | 14 | from nomad.parsing.parser import MatchingParser |
| 15 | +from nomad.utils import get_logger |
15 | 16 | from nomad_simulations.schema_packages.general import Simulation |
16 | 17 | from nomad_simulations.schema_packages.workflow import SinglePoint |
17 | 18 | from nomad_simulations.schema_packages.workflow.beyond_dft import DFTTBWorkflow |
|
25 | 26 | configuration = config.get_plugin_entry_point( |
26 | 27 | 'nomad_simulation_parsers.parsers:wannier90_parser_entry_point' |
27 | 28 | ) |
| 29 | +LOGGER = get_logger(__name__) |
| 30 | + |
| 31 | + |
| 32 | +# TODO temporary fix for structlog unable to propagate logger |
| 33 | +class Wannier90MetainfoParser(MetainfoParser): |
| 34 | + @property |
| 35 | + def logger(self): |
| 36 | + return LOGGER |
| 37 | + |
28 | 38 |
|
29 | 39 |
|
30 | 40 | class WHrTextParser(TextParser): |
| 41 | + # TODO temporary fix for structlog unable to propagate logger |
| 42 | + @property |
| 43 | + def logger(self): |
| 44 | + return LOGGER |
| 45 | + |
31 | 46 | def get_hoppings(self, source: dict[str, Any], **kwargs) -> dict[str, Any]: |
32 | 47 | degeneracy_factors = source.get('degeneracy_factors')[2:] |
33 | 48 | full_hoppings = source.get('hoppings', []) |
@@ -63,17 +78,32 @@ def get_hoppings(self, source: dict[str, Any], **kwargs) -> dict[str, Any]: |
63 | 78 |
|
64 | 79 |
|
65 | 80 | class WDosTextParser(TextParser): |
| 81 | + # TODO temporary fix for structlog unable to propagate logger |
| 82 | + @property |
| 83 | + def logger(self): |
| 84 | + return LOGGER |
| 85 | + |
66 | 86 | def get_dos(self, source: np.ndarray) -> dict[str, Any]: |
67 | 87 | data = np.transpose(source) |
68 | 88 | return dict(energies=data[0], value=data[1]) |
69 | 89 |
|
70 | 90 |
|
71 | 91 | class WBandTextParser(TextParser): |
| 92 | + # TODO temporary fix for structlog unable to propagate logger |
| 93 | + @property |
| 94 | + def logger(self): |
| 95 | + return LOGGER |
| 96 | + |
72 | 97 | def get_data(self, data: np.ndarray) -> np.ndarray: |
73 | 98 | return np.transpose(data)[1:].transpose() |
74 | 99 |
|
75 | 100 |
|
76 | 101 | class WOutTextParser(TextParser): |
| 102 | + # TODO temporary fix for structlog unable to propagate logger |
| 103 | + @property |
| 104 | + def logger(self): |
| 105 | + return LOGGER |
| 106 | + |
77 | 107 | def get_lattice_vectors(self, vectors: list[Any]) -> np.ndarray: |
78 | 108 | return np.vstack(vectors[-3:]) |
79 | 109 |
|
@@ -142,6 +172,11 @@ class WInTextParser(TextParser): |
142 | 172 | 'fy(3x2-y2)', |
143 | 173 | ] |
144 | 174 |
|
| 175 | + # TODO temporary fix for structlog unable to propagate logger |
| 176 | + @property |
| 177 | + def logger(self): |
| 178 | + return LOGGER |
| 179 | + |
145 | 180 | def get_projections(self, source: list[Any]) -> list[dict[str, Any]]: |
146 | 181 | return [dict(projection=val) for val in source] |
147 | 182 |
|
@@ -325,7 +360,7 @@ def write_to_archive(self) -> None: |
325 | 360 |
|
326 | 361 | # construct metainfo parser |
327 | 362 | data = Simulation() |
328 | | - self.data_parser = MetainfoParser() |
| 363 | + self.data_parser = Wannier90MetainfoParser() |
329 | 364 | self.data_parser.annotation_key = 'wout' |
330 | 365 | self.data_parser.data_object = data |
331 | 366 | self.archive.data = data |
|
0 commit comments