diff --git a/src/nomad_parser_vasp/schema_packages/vasp_package.py b/src/nomad_parser_vasp/schema_packages/vasp_package.py index 185e540..926ec84 100644 --- a/src/nomad_parser_vasp/schema_packages/vasp_package.py +++ b/src/nomad_parser_vasp/schema_packages/vasp_package.py @@ -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, @@ -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' ) @@ -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): @@ -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'])) @@ -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'), diff --git a/tests/parsers/test_parser.py b/tests/parsers/test_parser.py index 1b702bb..f5aa3be 100644 --- a/tests/parsers/test_parser.py +++ b/tests/parsers/test_parser.py @@ -1,6 +1,7 @@ import logging from nomad.datamodel import EntryArchive + from nomad_parser_vasp.parsers.myparser import MyParser