Skip to content

Commit

Permalink
Adapt changes to mapping parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ladinesa committed Sep 27, 2024
1 parent 78f154d commit 9b71e4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/nomad_parser_vasp/schema_packages/vasp_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if TYPE_CHECKING:
pass

from nomad.metainfo import SchemaPackage, SubSection
from nomad.metainfo import SchemaPackage
from nomad.parsing.file_parser.mapping_parser import MappingAnnotationModel
from nomad_simulations.schema_packages import (
general,
Expand Down Expand Up @@ -80,8 +80,7 @@ class DFT(model_method.DFT):
)
) # TODO convert vasp bool

numerical_settings = SubSection(sub_section=KSpace.m_def, repeats=True)
numerical_settings.m_annotations['xml'] = MappingAnnotationModel(
numerical_settings.KSpace.m_def.m_annotations['xml'] = MappingAnnotationModel(
path='modeling.kpoints'
)

Expand All @@ -99,8 +98,9 @@ class AtomicCell(model_system.AtomicCell):


class ModelSystem(general.ModelSystem):
cell = SubSection(sub_section=AtomicCell.m_def, repeats=True)
cell.m_annotations['xml'] = MappingAnnotationModel(path='.structure')
model_system.AtomicCell.m_def.m_annotations['xml'] = MappingAnnotationModel(
path='.structure'
)


class TotalEnergy(outputs.TotalEnergy):
Expand All @@ -113,6 +113,9 @@ class ElectronicEigenvalues(outputs.ElectronicEigenvalues):
outputs.ElectronicEigenvalues.n_bands.m_annotations['xml'] = MappingAnnotationModel(
path='length(.array.set.set.set[0].r)'
)
outputs.ElectronicEigenvalues.n_bands.m_annotations['xml2'] = (
MappingAnnotationModel(path='length(.array.set.set.set[0].r)')
)
# TODO This only works for non-spin pol
outputs.ElectronicEigenvalues.occupation.m_annotations['xml2'] = (
MappingAnnotationModel(operator=('get_eigenvalues', ['.array.set.set.set[].r']))
Expand All @@ -134,13 +137,13 @@ class Simulation(general.Simulation):
path='.generator'
)

model_method = SubSection(sub_section=DFT.m_def, repeats=True)
model_method.m_annotations['xml'] = MappingAnnotationModel(
model_method.DFT.m_def.m_annotations['xml'] = MappingAnnotationModel(
path='.parameters.separator[?"@name"==\'electronic\']'
)

model_system = SubSection(sub_section=ModelSystem.m_def, repeats=True)
model_system.m_annotations['xml'] = MappingAnnotationModel(path='.calculation')
general.Simulation.model_system.m_annotations['xml'] = MappingAnnotationModel(
path='.calculation'
)

general.Simulation.outputs.m_annotations = dict(
xml=MappingAnnotationModel(path='.calculation'),
Expand Down
1 change: 1 addition & 0 deletions tests/parsers/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

from nomad.datamodel import EntryArchive

from nomad_parser_vasp.parsers.myparser import MyParser


Expand Down

0 comments on commit 9b71e4a

Please sign in to comment.